diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index 47a713e..94a4246 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -17,6 +17,16 @@ data, }) } + +// 设备借用取消审批 +export function cancelApproval(data: { processInstanceId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} + // 设备借用申请详情 export function detailApply(data: object) { return request({ diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index 47a713e..94a4246 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -17,6 +17,16 @@ data, }) } + +// 设备借用取消审批 +export function cancelApproval(data: { processInstanceId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} + // 设备借用申请详情 export function detailApply(data: object) { return request({ diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 6dc9628..1c13501 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -56,7 +56,7 @@ - + diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index 47a713e..94a4246 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -17,6 +17,16 @@ data, }) } + +// 设备借用取消审批 +export function cancelApproval(data: { processInstanceId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} + // 设备借用申请详情 export function detailApply(data: object) { return request({ diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 6dc9628..1c13501 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -56,7 +56,7 @@ - + diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index b863728..c17034c 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -2,7 +2,10 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { borrowDeviceType } from '../borrow-interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' -import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { cancelApproval, deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { + submitReceiveApplyList, +} from '@/api/device/receive' import type{ searchType } from '@/views/device/borrow/borrow-interface' import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' @@ -36,7 +39,7 @@ ids: [] as string[], limit: 20, offset: 1, - formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, + formId: SCHEDULE.DEVICE_BORROW_APPROVAL, }) // 查询参数 watch(() => time.value, (newVal) => { if (newVal) { @@ -252,6 +255,7 @@ query: { title: '新建', name: '设备借用申请', + applyType: props.applyType, }, }) } @@ -277,7 +281,6 @@ exportApply({ ...searchQuery, limit: undefined, offset: undefined }).then((res) => { exportFile(res.data, '设备借用申请') loading.close() - // searchQuery.ids = [] }).catch((_) => { loading.close() }) @@ -333,7 +336,17 @@ cancelButtonText: '取消', type: 'warning', }, - ) + ).then((res) => { + cancelApproval({ processInstanceId: row.processId, comments: '' }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + getList() + } + }) + }) } // 提交 const submit = (row: any) => { @@ -346,11 +359,11 @@ type: 'warning', }, ).then((res) => { - submitApply({ id: row.id }).then((res) => { + submitReceiveApplyList({ formId: SCHEDULE.DEVICE_BORROW_APPROVAL, id: row.id }).then((res) => { if (res.code === 200) { ElMessage({ type: 'success', - message: '提交', + message: '提交成功', }) getList() } @@ -468,7 +481,7 @@ 拒绝 - + 取消 diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index 47a713e..94a4246 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -17,6 +17,16 @@ data, }) } + +// 设备借用取消审批 +export function cancelApproval(data: { processInstanceId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} + // 设备借用申请详情 export function detailApply(data: object) { return request({ diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 6dc9628..1c13501 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -56,7 +56,7 @@ - + diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index b863728..c17034c 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -2,7 +2,10 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { borrowDeviceType } from '../borrow-interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' -import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { cancelApproval, deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { + submitReceiveApplyList, +} from '@/api/device/receive' import type{ searchType } from '@/views/device/borrow/borrow-interface' import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' @@ -36,7 +39,7 @@ ids: [] as string[], limit: 20, offset: 1, - formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, + formId: SCHEDULE.DEVICE_BORROW_APPROVAL, }) // 查询参数 watch(() => time.value, (newVal) => { if (newVal) { @@ -252,6 +255,7 @@ query: { title: '新建', name: '设备借用申请', + applyType: props.applyType, }, }) } @@ -277,7 +281,6 @@ exportApply({ ...searchQuery, limit: undefined, offset: undefined }).then((res) => { exportFile(res.data, '设备借用申请') loading.close() - // searchQuery.ids = [] }).catch((_) => { loading.close() }) @@ -333,7 +336,17 @@ cancelButtonText: '取消', type: 'warning', }, - ) + ).then((res) => { + cancelApproval({ processInstanceId: row.processId, comments: '' }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + getList() + } + }) + }) } // 提交 const submit = (row: any) => { @@ -346,11 +359,11 @@ type: 'warning', }, ).then((res) => { - submitApply({ id: row.id }).then((res) => { + submitReceiveApplyList({ formId: SCHEDULE.DEVICE_BORROW_APPROVAL, id: row.id }).then((res) => { if (res.code === 200) { ElMessage({ type: 'success', - message: '提交', + message: '提交成功', }) getList() } @@ -468,7 +481,7 @@ 拒绝 - + 取消 diff --git a/src/views/device/borrow/components/handleList.vue b/src/views/device/borrow/components/handleList.vue index 293be0c..b277758 100644 --- a/src/views/device/borrow/components/handleList.vue +++ b/src/views/device/borrow/components/handleList.vue @@ -23,9 +23,9 @@ applyNo: '', // 申请编号 applyPerson: '', // 申请人 applyUnit: '', // 申请单位 - approvalStatus: '0', // 审批状态 + approvalStatus: '4', // 审批状态 createUser: '', // 创建人 - processResult: '', // 处置结果 + processResult: '0', // 处置结果 applyType: props.applyType, time: '', // 申请日期 ids: [] as string[], diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index 47a713e..94a4246 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -17,6 +17,16 @@ data, }) } + +// 设备借用取消审批 +export function cancelApproval(data: { processInstanceId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} + // 设备借用申请详情 export function detailApply(data: object) { return request({ diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 6dc9628..1c13501 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -56,7 +56,7 @@ - + diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index b863728..c17034c 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -2,7 +2,10 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { borrowDeviceType } from '../borrow-interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' -import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { cancelApproval, deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { + submitReceiveApplyList, +} from '@/api/device/receive' import type{ searchType } from '@/views/device/borrow/borrow-interface' import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' @@ -36,7 +39,7 @@ ids: [] as string[], limit: 20, offset: 1, - formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, + formId: SCHEDULE.DEVICE_BORROW_APPROVAL, }) // 查询参数 watch(() => time.value, (newVal) => { if (newVal) { @@ -252,6 +255,7 @@ query: { title: '新建', name: '设备借用申请', + applyType: props.applyType, }, }) } @@ -277,7 +281,6 @@ exportApply({ ...searchQuery, limit: undefined, offset: undefined }).then((res) => { exportFile(res.data, '设备借用申请') loading.close() - // searchQuery.ids = [] }).catch((_) => { loading.close() }) @@ -333,7 +336,17 @@ cancelButtonText: '取消', type: 'warning', }, - ) + ).then((res) => { + cancelApproval({ processInstanceId: row.processId, comments: '' }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + getList() + } + }) + }) } // 提交 const submit = (row: any) => { @@ -346,11 +359,11 @@ type: 'warning', }, ).then((res) => { - submitApply({ id: row.id }).then((res) => { + submitReceiveApplyList({ formId: SCHEDULE.DEVICE_BORROW_APPROVAL, id: row.id }).then((res) => { if (res.code === 200) { ElMessage({ type: 'success', - message: '提交', + message: '提交成功', }) getList() } @@ -468,7 +481,7 @@ 拒绝 - + 取消 diff --git a/src/views/device/borrow/components/handleList.vue b/src/views/device/borrow/components/handleList.vue index 293be0c..b277758 100644 --- a/src/views/device/borrow/components/handleList.vue +++ b/src/views/device/borrow/components/handleList.vue @@ -23,9 +23,9 @@ applyNo: '', // 申请编号 applyPerson: '', // 申请人 applyUnit: '', // 申请单位 - approvalStatus: '0', // 审批状态 + approvalStatus: '4', // 审批状态 createUser: '', // 创建人 - processResult: '', // 处置结果 + processResult: '0', // 处置结果 applyType: props.applyType, time: '', // 申请日期 ids: [] as string[], diff --git a/src/views/device/stateManage/components/templateAdd.vue b/src/views/device/stateManage/components/templateAdd.vue index 0d33dfb..3c64594 100644 --- a/src/views/device/stateManage/components/templateAdd.vue +++ b/src/views/device/stateManage/components/templateAdd.vue @@ -50,6 +50,7 @@ applyPerson: '', // 申请人 time: '', // 借用时间 applyDesc: '', // 申请说明 + applyType: '', // 申请类型 applyName: '', // 申请名称 createUser: userInfo.$state.id, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), @@ -227,6 +228,36 @@ const close = () => { $router.go(-1) } + +// 保存 +const saveForm = async (formEl: FormInstance | undefined) => { + if (!formEl) { return } + await formEl.validate((valid, fields) => { + if (valid) { + if (borrowList.value.length) { + // 整理数据 + delete ruleForm2.value.equipmentInfoList // 去除显示的列表 + ruleForm2.value.applyType = '2' + const params = { + ...ruleForm2.value, + equipmentList: borrowList.value.map(item => ({ + id: ruleForm2.value.id, + equipmentId: item.id, + })), + // applyType: $route.query.applyType, + } + editApply(params).then((res) => { + if (res.code === 200) { + // 成功 + ElMessage.success('操作成功') + $router.go(-1) + } + }) + } + } + }) +} + // 提交 const submitForm = async (formEl1: FormInstance | undefined, formEl2: FormInstance | undefined) => { if (isDevice.value) { @@ -252,7 +283,7 @@ id: ruleForm2.value.id, equipmentId: item.id, })), - applyType: '1', + applyType: $route.query.applyType || '1', } // title.value === '新建' @@ -604,10 +635,13 @@ diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index b863728..c17034c 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -2,7 +2,10 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { borrowDeviceType } from '../borrow-interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' -import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { cancelApproval, deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { + submitReceiveApplyList, +} from '@/api/device/receive' import type{ searchType } from '@/views/device/borrow/borrow-interface' import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' @@ -36,7 +39,7 @@ ids: [] as string[], limit: 20, offset: 1, - formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, + formId: SCHEDULE.DEVICE_BORROW_APPROVAL, }) // 查询参数 watch(() => time.value, (newVal) => { if (newVal) { @@ -252,6 +255,7 @@ query: { title: '新建', name: '设备借用申请', + applyType: props.applyType, }, }) } @@ -277,7 +281,6 @@ exportApply({ ...searchQuery, limit: undefined, offset: undefined }).then((res) => { exportFile(res.data, '设备借用申请') loading.close() - // searchQuery.ids = [] }).catch((_) => { loading.close() }) @@ -333,7 +336,17 @@ cancelButtonText: '取消', type: 'warning', }, - ) + ).then((res) => { + cancelApproval({ processInstanceId: row.processId, comments: '' }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + getList() + } + }) + }) } // 提交 const submit = (row: any) => { @@ -346,11 +359,11 @@ type: 'warning', }, ).then((res) => { - submitApply({ id: row.id }).then((res) => { + submitReceiveApplyList({ formId: SCHEDULE.DEVICE_BORROW_APPROVAL, id: row.id }).then((res) => { if (res.code === 200) { ElMessage({ type: 'success', - message: '提交', + message: '提交成功', }) getList() } @@ -468,7 +481,7 @@ 拒绝 - + 取消 diff --git a/src/views/device/borrow/components/handleList.vue b/src/views/device/borrow/components/handleList.vue index 293be0c..b277758 100644 --- a/src/views/device/borrow/components/handleList.vue +++ b/src/views/device/borrow/components/handleList.vue @@ -23,9 +23,9 @@ applyNo: '', // 申请编号 applyPerson: '', // 申请人 applyUnit: '', // 申请单位 - approvalStatus: '0', // 审批状态 + approvalStatus: '4', // 审批状态 createUser: '', // 创建人 - processResult: '', // 处置结果 + processResult: '0', // 处置结果 applyType: props.applyType, time: '', // 申请日期 ids: [] as string[], diff --git a/src/views/device/stateManage/components/templateAdd.vue b/src/views/device/stateManage/components/templateAdd.vue index 0d33dfb..3c64594 100644 --- a/src/views/device/stateManage/components/templateAdd.vue +++ b/src/views/device/stateManage/components/templateAdd.vue @@ -50,6 +50,7 @@ applyPerson: '', // 申请人 time: '', // 借用时间 applyDesc: '', // 申请说明 + applyType: '', // 申请类型 applyName: '', // 申请名称 createUser: userInfo.$state.id, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), @@ -227,6 +228,36 @@ const close = () => { $router.go(-1) } + +// 保存 +const saveForm = async (formEl: FormInstance | undefined) => { + if (!formEl) { return } + await formEl.validate((valid, fields) => { + if (valid) { + if (borrowList.value.length) { + // 整理数据 + delete ruleForm2.value.equipmentInfoList // 去除显示的列表 + ruleForm2.value.applyType = '2' + const params = { + ...ruleForm2.value, + equipmentList: borrowList.value.map(item => ({ + id: ruleForm2.value.id, + equipmentId: item.id, + })), + // applyType: $route.query.applyType, + } + editApply(params).then((res) => { + if (res.code === 200) { + // 成功 + ElMessage.success('操作成功') + $router.go(-1) + } + }) + } + } + }) +} + // 提交 const submitForm = async (formEl1: FormInstance | undefined, formEl2: FormInstance | undefined) => { if (isDevice.value) { @@ -252,7 +283,7 @@ id: ruleForm2.value.id, equipmentId: item.id, })), - applyType: '1', + applyType: $route.query.applyType || '1', } // title.value === '新建' @@ -604,10 +635,13 @@ diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index b863728..c17034c 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -2,7 +2,10 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { borrowDeviceType } from '../borrow-interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' -import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { cancelApproval, deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' +import { + submitReceiveApplyList, +} from '@/api/device/receive' import type{ searchType } from '@/views/device/borrow/borrow-interface' import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' @@ -36,7 +39,7 @@ ids: [] as string[], limit: 20, offset: 1, - formId: SCHEDULE.DEVICE_CONSUMING_APPROVAL, + formId: SCHEDULE.DEVICE_BORROW_APPROVAL, }) // 查询参数 watch(() => time.value, (newVal) => { if (newVal) { @@ -252,6 +255,7 @@ query: { title: '新建', name: '设备借用申请', + applyType: props.applyType, }, }) } @@ -277,7 +281,6 @@ exportApply({ ...searchQuery, limit: undefined, offset: undefined }).then((res) => { exportFile(res.data, '设备借用申请') loading.close() - // searchQuery.ids = [] }).catch((_) => { loading.close() }) @@ -333,7 +336,17 @@ cancelButtonText: '取消', type: 'warning', }, - ) + ).then((res) => { + cancelApproval({ processInstanceId: row.processId, comments: '' }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + getList() + } + }) + }) } // 提交 const submit = (row: any) => { @@ -346,11 +359,11 @@ type: 'warning', }, ).then((res) => { - submitApply({ id: row.id }).then((res) => { + submitReceiveApplyList({ formId: SCHEDULE.DEVICE_BORROW_APPROVAL, id: row.id }).then((res) => { if (res.code === 200) { ElMessage({ type: 'success', - message: '提交', + message: '提交成功', }) getList() } @@ -468,7 +481,7 @@ 拒绝 - + 取消 diff --git a/src/views/device/borrow/components/handleList.vue b/src/views/device/borrow/components/handleList.vue index 293be0c..b277758 100644 --- a/src/views/device/borrow/components/handleList.vue +++ b/src/views/device/borrow/components/handleList.vue @@ -23,9 +23,9 @@ applyNo: '', // 申请编号 applyPerson: '', // 申请人 applyUnit: '', // 申请单位 - approvalStatus: '0', // 审批状态 + approvalStatus: '4', // 审批状态 createUser: '', // 创建人 - processResult: '', // 处置结果 + processResult: '0', // 处置结果 applyType: props.applyType, time: '', // 申请日期 ids: [] as string[], diff --git a/src/views/device/stateManage/components/templateAdd.vue b/src/views/device/stateManage/components/templateAdd.vue index 0d33dfb..3c64594 100644 --- a/src/views/device/stateManage/components/templateAdd.vue +++ b/src/views/device/stateManage/components/templateAdd.vue @@ -50,6 +50,7 @@ applyPerson: '', // 申请人 time: '', // 借用时间 applyDesc: '', // 申请说明 + applyType: '', // 申请类型 applyName: '', // 申请名称 createUser: userInfo.$state.id, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), @@ -227,6 +228,36 @@ const close = () => { $router.go(-1) } + +// 保存 +const saveForm = async (formEl: FormInstance | undefined) => { + if (!formEl) { return } + await formEl.validate((valid, fields) => { + if (valid) { + if (borrowList.value.length) { + // 整理数据 + delete ruleForm2.value.equipmentInfoList // 去除显示的列表 + ruleForm2.value.applyType = '2' + const params = { + ...ruleForm2.value, + equipmentList: borrowList.value.map(item => ({ + id: ruleForm2.value.id, + equipmentId: item.id, + })), + // applyType: $route.query.applyType, + } + editApply(params).then((res) => { + if (res.code === 200) { + // 成功 + ElMessage.success('操作成功') + $router.go(-1) + } + }) + } + } + }) +} + // 提交 const submitForm = async (formEl1: FormInstance | undefined, formEl2: FormInstance | undefined) => { if (isDevice.value) { @@ -252,7 +283,7 @@ id: ruleForm2.value.id, equipmentId: item.id, })), - applyType: '1', + applyType: $route.query.applyType || '1', } // title.value === '新建' @@ -604,10 +635,13 @@