diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 2479614..f342066 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -148,18 +148,14 @@ } // 单选选中 const radioChange = () => { - console.log('---------') - - console.log(singleChecked.value) - console.log(props.data) - const checkValue = props.data.find((item: any) => item.id == singleChecked.value) emit('multiSelect', [checkValue]) } -// 清除多选选中 +// 清除选中 const clearMulti = () => { console.log('清理选中') - table.value!.clearSelection() + singleChecked.value = '' // 清除单选选中 + table.value!.clearSelection() // 清除多选选中 } defineExpose({ clearMulti, initColumnsState, diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 2479614..f342066 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -148,18 +148,14 @@ } // 单选选中 const radioChange = () => { - console.log('---------') - - console.log(singleChecked.value) - console.log(props.data) - const checkValue = props.data.find((item: any) => item.id == singleChecked.value) emit('multiSelect', [checkValue]) } -// 清除多选选中 +// 清除选中 const clearMulti = () => { console.log('清理选中') - table.value!.clearSelection() + singleChecked.value = '' // 清除单选选中 + table.value!.clearSelection() // 清除多选选中 } defineExpose({ clearMulti, initColumnsState, diff --git a/src/views/business/fieldTest/approve/approve-interface.ts b/src/views/business/fieldTest/approve/approve-interface.ts index d7ec099..b32bdee 100644 --- a/src/views/business/fieldTest/approve/approve-interface.ts +++ b/src/views/business/fieldTest/approve/approve-interface.ts @@ -23,6 +23,7 @@ approvalStatusName: string // 审批状态 processId: string // 流程实例id taskId: string // 任务id-审批时使用 + decisionItem: number | string // 同意、驳回、拒绝按钮权限 } // 字典 diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 2479614..f342066 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -148,18 +148,14 @@ } // 单选选中 const radioChange = () => { - console.log('---------') - - console.log(singleChecked.value) - console.log(props.data) - const checkValue = props.data.find((item: any) => item.id == singleChecked.value) emit('multiSelect', [checkValue]) } -// 清除多选选中 +// 清除选中 const clearMulti = () => { console.log('清理选中') - table.value!.clearSelection() + singleChecked.value = '' // 清除单选选中 + table.value!.clearSelection() // 清除多选选中 } defineExpose({ clearMulti, initColumnsState, diff --git a/src/views/business/fieldTest/approve/approve-interface.ts b/src/views/business/fieldTest/approve/approve-interface.ts index d7ec099..b32bdee 100644 --- a/src/views/business/fieldTest/approve/approve-interface.ts +++ b/src/views/business/fieldTest/approve/approve-interface.ts @@ -23,6 +23,7 @@ approvalStatusName: string // 审批状态 processId: string // 流程实例id taskId: string // 任务id-审批时使用 + decisionItem: number | string // 同意、驳回、拒绝按钮权限 } // 字典 diff --git a/src/views/business/fieldTest/approve/edit.vue b/src/views/business/fieldTest/approve/edit.vue index 4fff614..3f2062b 100644 --- a/src/views/business/fieldTest/approve/edit.vue +++ b/src/views/business/fieldTest/approve/edit.vue @@ -6,7 +6,8 @@ import dayjs from 'dayjs' import selectStaffList from '../components/selectStaffList.vue' import type { IForm, dictType } from './approve-interface' -import { fetchApproval, submitApproval } from '@/api/approval' +import { cancelApproval, fetchApproval, submitApproval } from '@/api/approval' +import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { IAddress } from '@/components/AddressSelect/address-interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' @@ -15,7 +16,9 @@ import useUserStore from '@/store/modules/user' import { getUserList } from '@/api/system/user' import { SCHEDULE } from '@/utils/scheduleDict' +import { printPdf } from '@/utils/printUtils' import type { userType } from '@/views/system/user/user-interface' +import { getPhotoUrl } from '@/api/system/tool' import SelectDeviceDialog from '@/views/device/receive/selectDeviceDialog.vue' import { addFieldTestApproveList, failUpdateFieldTestApprove, getDetail, submit, updateFieldTestApprove } from '@/api/business/fieldTest/apply' const user = useUserStore() // 用户信息 @@ -35,6 +38,9 @@ const submitId = ref('') // 新建提交时所用的id const $route = useRoute() // 路由参数 const ruleFormRef = ref() // 表单ref +const decisionItem = ref('') // 同意、驳回、拒绝按钮权限 +const taskId = ref('') // 任务id,用于同意、驳回、拒绝审批 +const approvalDialog = ref() // 审批对话ref const form = ref({ siteExecutiveNo: '', // 现场检测编号 siteExecutiveName: '', // 现场检测名字 @@ -70,7 +76,7 @@ // 自定义校验规则--要求预计结束时间大于预计开始时间 const requireOverTimeValid = (rule: any, value: any, callback: any) => { if (!value) { - return callback(new Error('要求预计结束时间不能为空')) + return callback(new Error('预计结束时间必填')) } if (new Date(form.value.preEndTime).getTime() <= new Date(form.value.preStartTime).getTime()) { return callback(new Error('不能小于预计开始时间')) @@ -81,7 +87,8 @@ const formRules = ref({ directorId: [{ required: true, message: '要求负责人不能为空', trigger: ['blur', 'change'] }], taskSource: [{ required: true, message: '要求任务来源不能为空', trigger: ['blur', 'change'] }], - preCost: [{ required: true, message: '要求预计计量费用不能为空', trigger: ['blur', 'change'] }], + preCost: [{ required: true, message: '要求预计计量费用不能为空', trigger: ['blur', 'change'] }, + { pattern: /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/, message: '要求大于0,且最多保留两位小数', trigger: ['blur', 'change'] }], preStartTime: [{ required: true, message: '要求预计开始时间不能为空', trigger: ['blur', 'change'] }], preEndTime: [{ required: true, type: 'date', validator: requireOverTimeValid, trigger: 'change' }], // preEndTime: [{ required: true, message: '要求预计结束时间不能为空', trigger: ['blur', 'change'] }], @@ -445,8 +452,53 @@ } } +// 审批结束回调 +const approvalSuccess = () => { + close() // 返回上一页 +} +// 审批 +const handleApprove = (val: string, title = '') => { + if (val === '取消') { + const params = { + processInstanceId: form.value.processId!, + comments: '', + } + ElMessageBox.confirm( + '确认取消该审批吗?', + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ) + .then(() => { + cancelApproval(params).then((res) => { + ElMessage({ + type: 'success', + message: '取消成功', + }) + close() + }) + }) + } + else if (val === '同意') { + approvalDialog.value.initDialog('agree', taskId.value) + } + else if (val === '驳回') { + approvalDialog.value.initDialog('reject', taskId.value) + } + else if (val === '拒绝') { + approvalDialog.value.initDialog('refuse', taskId.value) + } +} + // 获取详细信息 const getInfo = () => { + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) getDetail({ id: infoId.value }).then((res) => { form.value = res.data form.value.meterStaffList = res.data.meterStaffList.map((item: any) => { @@ -465,6 +517,14 @@ form.value.applyPerson = user.id// 申请人 form.value.applyPersonName = user.name // 申请人名字 }) + loading.close() +} +// 打印 +const print = () => { + // getPhotoUrl(printFileName as string).then((res) => { + // const url = res.data + // printPdf(res.data) + // }) } onMounted(async () => { @@ -472,6 +532,8 @@ await getDict()// 字典 form.value.processId = $route.query.processId as string // 任务id approvalStatusName.value = $route.query.approvalStatusName as string // 审批类型名称 + decisionItem.value = $route.query.decisionItem as string // 同意、驳回、拒绝按钮权限 + taskId.value = $route.query.taskId as string // 流程实例id if (pageType.value !== 'add') { getInfo() // 获取详情 if (approvalStatusName.value !== '草稿箱') { @@ -489,14 +551,27 @@