|
|
@@ -27,10 +27,6 @@
|
|
|
<el-button @click="resetQuery"
|
|
|
><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button
|
|
|
>
|
|
|
-
|
|
|
- <el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
|
- <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
- </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
|
@@ -150,11 +146,28 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-drawer>
|
|
|
+ <el-dialog v-model="rejectDialogVisible" title="填写驳回原因" width="520px">
|
|
|
+ <el-form ref="rejectFormRef" :model="rejectForm" :rules="rejectRules" label-width="90px">
|
|
|
+ <el-form-item label="驳回原因" prop="rejectDesc">
|
|
|
+ <el-input
|
|
|
+ v-model="rejectForm.rejectDesc"
|
|
|
+ type="textarea"
|
|
|
+ :rows="4"
|
|
|
+ maxlength="200"
|
|
|
+ show-word-limit
|
|
|
+ placeholder="请输入驳回原因" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="rejectDialogVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" :loading="auditLoading" @click="submitReject">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
|
-import { QhseMonthReportApi, QhseMonthReportAuditApi } from '@/api/pms/qhse'
|
|
|
+import { QhseMonthReportAuditApi } from '@/api/pms/qhse'
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
import DeptTree from '@/views/system/user/DeptTree2.vue'
|
|
|
import { formatDate } from '@/utils/formatTime'
|
|
|
@@ -180,6 +193,14 @@ const detailLoading = ref(false)
|
|
|
const auditLoading = ref(false)
|
|
|
const reviewReport = ref(null)
|
|
|
const reviewId = ref(null)
|
|
|
+const rejectDialogVisible = ref(false)
|
|
|
+const rejectFormRef = ref(null)
|
|
|
+const rejectForm = reactive({
|
|
|
+ rejectDesc: ''
|
|
|
+})
|
|
|
+const rejectRules = {
|
|
|
+ rejectDesc: [{ required: true, message: '请输入驳回原因', trigger: 'blur' }]
|
|
|
+}
|
|
|
|
|
|
const detailSections = [
|
|
|
{
|
|
|
@@ -286,22 +307,6 @@ const downloadFile = (response) => {
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
}
|
|
|
|
|
|
-const handleExport = async () => {
|
|
|
- try {
|
|
|
- exportLoading.value = true
|
|
|
- // 调用导出接口
|
|
|
- const response = await QhseMonthReportApi.exportQhseMonthReport(queryParams)
|
|
|
-
|
|
|
- // 下载文件
|
|
|
- downloadFile(response)
|
|
|
- exportLoading.value = false
|
|
|
- } catch (error) {
|
|
|
- ElMessage.error('导出失败,请重试')
|
|
|
- console.error('导出错误:', error)
|
|
|
- } finally {
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 重置查询
|
|
|
const resetQuery = () => {
|
|
|
pagination.pageNo = 1 // 重置为第一页
|
|
|
@@ -309,26 +314,6 @@ const resetQuery = () => {
|
|
|
loadTableData()
|
|
|
}
|
|
|
|
|
|
-// 删除确认
|
|
|
-const deleteRow = async (row) => {
|
|
|
- try {
|
|
|
- await ElMessageBox.confirm(`确认删除 ${row.elementDescription} 吗?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
-
|
|
|
- await QhseMonthReportApi.deleteQhseMonthReport(row.id)
|
|
|
- ElMessage.success('删除成功')
|
|
|
- loadTableData() // 重新加载数据
|
|
|
- } catch (error) {
|
|
|
- // 用户取消或删除失败
|
|
|
- if (error !== 'cancel') {
|
|
|
- ElMessage.error('删除失败')
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 每页数量变化
|
|
|
const handleSizeChange = (val) => {
|
|
|
pagination.pageSize = val
|
|
|
@@ -360,10 +345,14 @@ const openReview = async (row) => {
|
|
|
|
|
|
const handleAudit = async (passed) => {
|
|
|
if (!reviewId.value) return
|
|
|
+ if (!passed) {
|
|
|
+ rejectForm.rejectDesc = ''
|
|
|
+ rejectDialogVisible.value = true
|
|
|
+ return
|
|
|
+ }
|
|
|
auditLoading.value = true
|
|
|
try {
|
|
|
- if (passed) await QhseMonthReportAuditApi.auditPass(reviewId.value)
|
|
|
- else await QhseMonthReportAuditApi.auditNotPass(reviewId.value)
|
|
|
+ await QhseMonthReportAuditApi.auditPass(reviewId.value)
|
|
|
ElMessage.success(passed ? '审批通过' : '审批不通过')
|
|
|
reviewVisible.value = false
|
|
|
await loadTableData()
|
|
|
@@ -374,6 +363,26 @@ const handleAudit = async (passed) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const submitReject = async () => {
|
|
|
+ if (!reviewId.value) return
|
|
|
+ await rejectFormRef.value?.validate()
|
|
|
+ auditLoading.value = true
|
|
|
+ try {
|
|
|
+ await QhseMonthReportAuditApi.auditNotPass({
|
|
|
+ id: reviewId.value,
|
|
|
+ rejectDesc: rejectForm.rejectDesc
|
|
|
+ })
|
|
|
+ ElMessage.success('审批不通过')
|
|
|
+ rejectDialogVisible.value = false
|
|
|
+ reviewVisible.value = false
|
|
|
+ await loadTableData()
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('审批不通过失败')
|
|
|
+ } finally {
|
|
|
+ auditLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const displayValue = (value) =>
|
|
|
value === undefined || value === null || value === '' ? '--' : value
|
|
|
|