diff --git a/src/api/device/receive.ts b/src/api/device/receive.ts index da7ac90..8120747 100644 --- a/src/api/device/receive.ts +++ b/src/api/device/receive.ts @@ -46,7 +46,7 @@ }) } // 新建--提交 -export function submitReceiveApplyList(data: { formId: string; id: string }) { +export function submitReceiveApplyList(data: { formId: string; id: string; processId?: string }) { return request({ url: `${prefix}/submitEquipmentApply`, method: 'post', @@ -80,3 +80,12 @@ data, }) } + +// 设备领用、借用-未通过-驳回编辑 +export function failUpdateEquipmentApply(data: object) { + return request({ + url: '/equipmentApply/failUpdate', + method: 'post', + data, + }) +} diff --git a/src/api/device/receive.ts b/src/api/device/receive.ts index da7ac90..8120747 100644 --- a/src/api/device/receive.ts +++ b/src/api/device/receive.ts @@ -46,7 +46,7 @@ }) } // 新建--提交 -export function submitReceiveApplyList(data: { formId: string; id: string }) { +export function submitReceiveApplyList(data: { formId: string; id: string; processId?: string }) { return request({ url: `${prefix}/submitEquipmentApply`, method: 'post', @@ -80,3 +80,12 @@ data, }) } + +// 设备领用、借用-未通过-驳回编辑 +export function failUpdateEquipmentApply(data: object) { + return request({ + url: '/equipmentApply/failUpdate', + method: 'post', + data, + }) +} diff --git a/src/views/device/deviceMaintenance/components/manageAdd.vue b/src/views/device/deviceMaintenance/components/manageAdd.vue index 4f4be24..d92910f 100644 --- a/src/views/device/deviceMaintenance/components/manageAdd.vue +++ b/src/views/device/deviceMaintenance/components/manageAdd.vue @@ -235,7 +235,6 @@ v-model="formInline.createUserName" :placeholder="pageType === 'detail' ? '' : '请输入管理点负责人'" :class="{ 'detail-input': pageType === 'detail' }" - disabled /> diff --git a/src/api/device/receive.ts b/src/api/device/receive.ts index da7ac90..8120747 100644 --- a/src/api/device/receive.ts +++ b/src/api/device/receive.ts @@ -46,7 +46,7 @@ }) } // 新建--提交 -export function submitReceiveApplyList(data: { formId: string; id: string }) { +export function submitReceiveApplyList(data: { formId: string; id: string; processId?: string }) { return request({ url: `${prefix}/submitEquipmentApply`, method: 'post', @@ -80,3 +80,12 @@ data, }) } + +// 设备领用、借用-未通过-驳回编辑 +export function failUpdateEquipmentApply(data: object) { + return request({ + url: '/equipmentApply/failUpdate', + method: 'post', + data, + }) +} diff --git a/src/views/device/deviceMaintenance/components/manageAdd.vue b/src/views/device/deviceMaintenance/components/manageAdd.vue index 4f4be24..d92910f 100644 --- a/src/views/device/deviceMaintenance/components/manageAdd.vue +++ b/src/views/device/deviceMaintenance/components/manageAdd.vue @@ -235,7 +235,6 @@ v-model="formInline.createUserName" :placeholder="pageType === 'detail' ? '' : '请输入管理点负责人'" :class="{ 'detail-input': pageType === 'detail' }" - disabled /> diff --git a/src/views/device/receive/apply/applyEdit.vue b/src/views/device/receive/apply/applyEdit.vue index 5194bdb..5e2b089 100644 --- a/src/views/device/receive/apply/applyEdit.vue +++ b/src/views/device/receive/apply/applyEdit.vue @@ -11,6 +11,7 @@ import { SCHEDULE } from '@/utils/scheduleDict' import type { TableColumn } from '@/components/NormalTable/table_interface' import { + failUpdateEquipmentApply, getReceiveApplyListDetail, saveAddReceiveApplyList, saveEditReceiveApplyList, @@ -20,13 +21,14 @@ import type { deptType } from '@/views/device/standingBook/standingBook-interface' import { getDeptTreeList } from '@/api/system/dept' import { getUserList } from '@/api/system/user' -import { submitApproval } from '@/api/approval' +import { fetchApproval, submitApproval } from '@/api/approval' import ApprovalRecord from '@/components/ApprovalRecord/ApprovalRecord.vue' const $route = useRoute() const approvalDialog = ref() // 审批对话框显隐 const typeValue = ref() // add、edit、detail const approvalStatus = ref() // 审批类型 +const approvalStatusName = ref() // 审批类型名称 const useDeptList = ref([]) // 部门列表 const usePersonList = ref([]) // 申请人列表(用户) const usePersonOptions = ref([]) // 申请人列表(用户)--模糊搜索数据 @@ -54,20 +56,6 @@ }) const ruleFormRef = ref() as any const list = ref([])// 表格数据 - -// 查询条件 -const listQuery: Ref = ref({ - equipmentName: '', // 仪器名称 - equipmentNo: '', // 设备编号 - modelNo: '', // 型号 - mesureRange: '', // 测量范围 - useDeptName: '', // 使用部门 - usePersonName: '', // 使用人 - managerStateName: '', // 管理状态 - validDate: '', // 有效日期 - offset: 1, - limit: 20, -}) // 表头 const columns = ref([ { text: '设备编号', value: 'equipmentNo', align: 'center', width: '230' }, @@ -83,7 +71,7 @@ const rules = reactive({ applyName: [{ required: true, message: '申请名称不能为空', trigger: 'blur' }], applyUnit: [{ required: true, message: '申请单位不能为空', trigger: 'change' }], - applyPerson: [{ required: true, message: '申请人不能为空', trigger: 'blur' }], + applyPerson: [{ required: true, message: '申请人不能为空', trigger: 'change' }], time: [{ type: 'date', required: true, message: '领用时间不能为空', trigger: 'change' }], applyDesc: [{ required: true, message: '申请说明不能为空', trigger: 'blur' }], }) @@ -215,6 +203,10 @@ // 保存 const save = () => { + if (!list.value.length) { + ElMessage.warning('设备领用列表不能为空') + return + } ruleFormRef.value.validate((valid: boolean) => { if (valid) { const loading = ElLoading.service({ @@ -229,6 +221,7 @@ const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 + processId: form.value.processId, applyPerson: form.value.applyPerson, // 申请人 time: form.value.time, // 领用时间 applyDesc: form.value.applyDesc, // 申请说明 @@ -250,11 +243,22 @@ } // 保存 else if (typeValue.value === 'edit') { - saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data - ElMessage.success('保存成功') - loading.close() - }) + if (approvalStatusName.value === '未通过-驳回') { + failUpdateEquipmentApply(params).then((res) => { + form.value.id = res.data + ElMessage.success('保存成功') + loading.close() + close() + }) + } + else { + saveEditReceiveApplyList(params).then((res) => { + form.value.id = res.data + ElMessage.success('保存成功') + loading.close() + close() + }) + } } } else { @@ -265,11 +269,11 @@ // 提交表单 const submit = () => { - const loading = ElLoading.service({ - lock: true, - background: 'rgba(255, 255, 255, 0.8)', - }) if (form.value.id) { + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) const params = { id: form.value.id, formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, // 表单id @@ -281,7 +285,7 @@ }) } else { - ElMessage.info('请先保存再提交!') + ElMessage.warning('请先保存再提交!') } } @@ -340,17 +344,35 @@ } } +const approvalRecordData = ref([]) // 审批流程数据 +// 查询审批记录 +function getApprovalRecord(processId: string) { + if (typeValue.value !== 'add') { + if (processId) { + fetchApproval(processId).then((res) => { + approvalRecordData.value = res.data + }) + } + else { + ElMessage.warning('流程实例id为空') + } + } +} + onMounted(() => { typeValue.value = $route.query.typeValue // 类型add、edit、detail form.value.id = $route.query.id as string // id form.value.taskId = $route.query.taskId as string // 任务id form.value.processId = $route.query.processId as string // 任务id approvalStatus.value = $route.query.approvalStatus // 审批类型 + approvalStatusName.value = $route.query.approvalStatusName // 审批类型名称 // 编辑、详情获取详情页信息 if (typeValue.value === 'edit' || typeValue.value === 'detail') { fetchReceiveApplyListDetail() // 获取详细信息 } - + if (approvalStatusName.value !== '草稿箱') { + getApprovalRecord(form.value.processId) // 查询审批记录 + } // 获取部门信息 fetchDeptTreeList() // 获取人员列表--申请人使用 @@ -498,15 +520,16 @@ - - + + + diff --git a/src/api/device/receive.ts b/src/api/device/receive.ts index da7ac90..8120747 100644 --- a/src/api/device/receive.ts +++ b/src/api/device/receive.ts @@ -46,7 +46,7 @@ }) } // 新建--提交 -export function submitReceiveApplyList(data: { formId: string; id: string }) { +export function submitReceiveApplyList(data: { formId: string; id: string; processId?: string }) { return request({ url: `${prefix}/submitEquipmentApply`, method: 'post', @@ -80,3 +80,12 @@ data, }) } + +// 设备领用、借用-未通过-驳回编辑 +export function failUpdateEquipmentApply(data: object) { + return request({ + url: '/equipmentApply/failUpdate', + method: 'post', + data, + }) +} diff --git a/src/views/device/deviceMaintenance/components/manageAdd.vue b/src/views/device/deviceMaintenance/components/manageAdd.vue index 4f4be24..d92910f 100644 --- a/src/views/device/deviceMaintenance/components/manageAdd.vue +++ b/src/views/device/deviceMaintenance/components/manageAdd.vue @@ -235,7 +235,6 @@ v-model="formInline.createUserName" :placeholder="pageType === 'detail' ? '' : '请输入管理点负责人'" :class="{ 'detail-input': pageType === 'detail' }" - disabled /> diff --git a/src/views/device/receive/apply/applyEdit.vue b/src/views/device/receive/apply/applyEdit.vue index 5194bdb..5e2b089 100644 --- a/src/views/device/receive/apply/applyEdit.vue +++ b/src/views/device/receive/apply/applyEdit.vue @@ -11,6 +11,7 @@ import { SCHEDULE } from '@/utils/scheduleDict' import type { TableColumn } from '@/components/NormalTable/table_interface' import { + failUpdateEquipmentApply, getReceiveApplyListDetail, saveAddReceiveApplyList, saveEditReceiveApplyList, @@ -20,13 +21,14 @@ import type { deptType } from '@/views/device/standingBook/standingBook-interface' import { getDeptTreeList } from '@/api/system/dept' import { getUserList } from '@/api/system/user' -import { submitApproval } from '@/api/approval' +import { fetchApproval, submitApproval } from '@/api/approval' import ApprovalRecord from '@/components/ApprovalRecord/ApprovalRecord.vue' const $route = useRoute() const approvalDialog = ref() // 审批对话框显隐 const typeValue = ref() // add、edit、detail const approvalStatus = ref() // 审批类型 +const approvalStatusName = ref() // 审批类型名称 const useDeptList = ref([]) // 部门列表 const usePersonList = ref([]) // 申请人列表(用户) const usePersonOptions = ref([]) // 申请人列表(用户)--模糊搜索数据 @@ -54,20 +56,6 @@ }) const ruleFormRef = ref() as any const list = ref([])// 表格数据 - -// 查询条件 -const listQuery: Ref = ref({ - equipmentName: '', // 仪器名称 - equipmentNo: '', // 设备编号 - modelNo: '', // 型号 - mesureRange: '', // 测量范围 - useDeptName: '', // 使用部门 - usePersonName: '', // 使用人 - managerStateName: '', // 管理状态 - validDate: '', // 有效日期 - offset: 1, - limit: 20, -}) // 表头 const columns = ref([ { text: '设备编号', value: 'equipmentNo', align: 'center', width: '230' }, @@ -83,7 +71,7 @@ const rules = reactive({ applyName: [{ required: true, message: '申请名称不能为空', trigger: 'blur' }], applyUnit: [{ required: true, message: '申请单位不能为空', trigger: 'change' }], - applyPerson: [{ required: true, message: '申请人不能为空', trigger: 'blur' }], + applyPerson: [{ required: true, message: '申请人不能为空', trigger: 'change' }], time: [{ type: 'date', required: true, message: '领用时间不能为空', trigger: 'change' }], applyDesc: [{ required: true, message: '申请说明不能为空', trigger: 'blur' }], }) @@ -215,6 +203,10 @@ // 保存 const save = () => { + if (!list.value.length) { + ElMessage.warning('设备领用列表不能为空') + return + } ruleFormRef.value.validate((valid: boolean) => { if (valid) { const loading = ElLoading.service({ @@ -229,6 +221,7 @@ const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 + processId: form.value.processId, applyPerson: form.value.applyPerson, // 申请人 time: form.value.time, // 领用时间 applyDesc: form.value.applyDesc, // 申请说明 @@ -250,11 +243,22 @@ } // 保存 else if (typeValue.value === 'edit') { - saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data - ElMessage.success('保存成功') - loading.close() - }) + if (approvalStatusName.value === '未通过-驳回') { + failUpdateEquipmentApply(params).then((res) => { + form.value.id = res.data + ElMessage.success('保存成功') + loading.close() + close() + }) + } + else { + saveEditReceiveApplyList(params).then((res) => { + form.value.id = res.data + ElMessage.success('保存成功') + loading.close() + close() + }) + } } } else { @@ -265,11 +269,11 @@ // 提交表单 const submit = () => { - const loading = ElLoading.service({ - lock: true, - background: 'rgba(255, 255, 255, 0.8)', - }) if (form.value.id) { + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) const params = { id: form.value.id, formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, // 表单id @@ -281,7 +285,7 @@ }) } else { - ElMessage.info('请先保存再提交!') + ElMessage.warning('请先保存再提交!') } } @@ -340,17 +344,35 @@ } } +const approvalRecordData = ref([]) // 审批流程数据 +// 查询审批记录 +function getApprovalRecord(processId: string) { + if (typeValue.value !== 'add') { + if (processId) { + fetchApproval(processId).then((res) => { + approvalRecordData.value = res.data + }) + } + else { + ElMessage.warning('流程实例id为空') + } + } +} + onMounted(() => { typeValue.value = $route.query.typeValue // 类型add、edit、detail form.value.id = $route.query.id as string // id form.value.taskId = $route.query.taskId as string // 任务id form.value.processId = $route.query.processId as string // 任务id approvalStatus.value = $route.query.approvalStatus // 审批类型 + approvalStatusName.value = $route.query.approvalStatusName // 审批类型名称 // 编辑、详情获取详情页信息 if (typeValue.value === 'edit' || typeValue.value === 'detail') { fetchReceiveApplyListDetail() // 获取详细信息 } - + if (approvalStatusName.value !== '草稿箱') { + getApprovalRecord(form.value.processId) // 查询审批记录 + } // 获取部门信息 fetchDeptTreeList() // 获取人员列表--申请人使用 @@ -498,15 +520,16 @@ - - + + + diff --git a/src/views/device/receive/apply/applyList.vue b/src/views/device/receive/apply/applyList.vue index 7bded86..8369c24 100644 --- a/src/views/device/receive/apply/applyList.vue +++ b/src/views/device/receive/apply/applyList.vue @@ -249,8 +249,8 @@ type: 'success', message: '取消成功', }) + fetchData(true) }) - fetchData(true) }) } else if (val === '删除') { @@ -284,13 +284,13 @@ }, ) .then(() => { - submitReceiveApplyList({ id: row.id, formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL }).then((res) => { + submitReceiveApplyList({ id: row.id, formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, processId: row.processId }).then((res) => { ElMessage({ type: 'success', message: '已提交', }) + fetchData(true) }) - fetchData(true) }) } else if (val === '同意') { @@ -311,6 +311,7 @@ id: row.id, taskId: row.taskId, processId: row.processId, // 查询审批记录使用 + approvalStatusName: row.approvalStatusName, }, }) } @@ -365,7 +366,7 @@ onMounted(async () => { // 获取字典-审批状态 getDict().then(() => { - if (window.sessionStorage.getItem('receiveButtonBoxActive') !== 'undefined' && window.sessionStorage.getItem('receiveButtonBoxActive') !== '' && window.sessionStorage.getItem('receiveButtonBoxActive') !== null) { + if (window.sessionStorage.getItem('receiveButtonBoxActive') !== 'undefined' && window.sessionStorage.getItem('receiveButtonBoxActive') !== '' && window.sessionStorage.getItem('receiveButtonBoxActive') !== 'null') { active.value = window.sessionStorage.getItem('receiveButtonBoxActive')! console.log(window.sessionStorage.getItem('receiveButtonBoxActive')) } @@ -380,9 +381,6 @@ }) }) }) -onUnmounted(() => { - window.sessionStorage.setItem('receiveButtonBoxActive', '') // 清除 -})