diff --git a/src/api/approval.ts b/src/api/approval.ts index cb8a9af..88ff0a5 100644 --- a/src/api/approval.ts +++ b/src/api/approval.ts @@ -4,16 +4,24 @@ agree: '/approval/operate/agree', refuse: '/approval/operate/refuse', reject: '/approval/operate/reject', - revoke: '/approval/operate/revoke', } // 审批操作接口 -export function submitApproval(type: string, data: { taskId: string; comments: string }) { +export function submitApproval(type: string, data: { processId?: string; taskId?: string; comments: string }) { return request({ url: approvalType[type], method: 'post', data, }) } + +// 取消审批 +export function cancelApproval(data: { processId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} // 查询审批记录 export function fetchApproval(processId: string) { return request({ diff --git a/src/api/approval.ts b/src/api/approval.ts index cb8a9af..88ff0a5 100644 --- a/src/api/approval.ts +++ b/src/api/approval.ts @@ -4,16 +4,24 @@ agree: '/approval/operate/agree', refuse: '/approval/operate/refuse', reject: '/approval/operate/reject', - revoke: '/approval/operate/revoke', } // 审批操作接口 -export function submitApproval(type: string, data: { taskId: string; comments: string }) { +export function submitApproval(type: string, data: { processId?: string; taskId?: string; comments: string }) { return request({ url: approvalType[type], method: 'post', data, }) } + +// 取消审批 +export function cancelApproval(data: { processId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} // 查询审批记录 export function fetchApproval(processId: string) { return request({ diff --git a/src/views/measure/source/components/listApproval.vue b/src/views/measure/source/components/listApproval.vue index e369399..438f76c 100644 --- a/src/views/measure/source/components/listApproval.vue +++ b/src/views/measure/source/components/listApproval.vue @@ -8,7 +8,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { printJSON } from '@/utils/printUtils' import { SCHEDULE } from '@/utils/scheduleDict' -import { submitApproval } from '@/api/approval' +import { cancelApproval, submitApproval } from '@/api/approval' const props = defineProps({ status: { type: String, @@ -105,7 +105,6 @@ id: string supplierName: string } -const buttonTypeMap = ref('') // 点击删除或者取消 const handleDelete = (row: rowReturn) => { ElMessageBox.confirm( @@ -132,8 +131,8 @@ // 取消 const handleCancel = (row: ISupplier) => { const params = { - taskId: row.taskId!, - comments: '', + processInstanceId: row.processId!, + comments: '取消审批', } ElMessageBox.confirm( '确认取消该审批吗?', @@ -143,16 +142,12 @@ cancelButtonText: '取消', type: 'warning', }, - ) - .then(() => { - submitApproval('revoke', params).then((res) => { - ElMessage({ - type: 'success', - message: '取消成功', - }) - fetchData(true) - }) + ).then(() => { + cancelApproval(params).then((res) => { + ElMessage.success('取消成功') + fetchData(true) }) + }) } const approvalDialog = ref() @@ -161,9 +156,7 @@ const searchList = () => { fetchData(false) } -const cancelEvent = () => { - console.log('cancel!') -} + // 点击重置 const clearList = () => { listQuery.value = { @@ -379,7 +372,7 @@ 取消 - + 删除 diff --git a/src/api/approval.ts b/src/api/approval.ts index cb8a9af..88ff0a5 100644 --- a/src/api/approval.ts +++ b/src/api/approval.ts @@ -4,16 +4,24 @@ agree: '/approval/operate/agree', refuse: '/approval/operate/refuse', reject: '/approval/operate/reject', - revoke: '/approval/operate/revoke', } // 审批操作接口 -export function submitApproval(type: string, data: { taskId: string; comments: string }) { +export function submitApproval(type: string, data: { processId?: string; taskId?: string; comments: string }) { return request({ url: approvalType[type], method: 'post', data, }) } + +// 取消审批 +export function cancelApproval(data: { processId?: string; comments: string }) { + return request({ + url: '/approval/operate/revoke', + method: 'post', + data, + }) +} // 查询审批记录 export function fetchApproval(processId: string) { return request({ diff --git a/src/views/measure/source/components/listApproval.vue b/src/views/measure/source/components/listApproval.vue index e369399..438f76c 100644 --- a/src/views/measure/source/components/listApproval.vue +++ b/src/views/measure/source/components/listApproval.vue @@ -8,7 +8,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { printJSON } from '@/utils/printUtils' import { SCHEDULE } from '@/utils/scheduleDict' -import { submitApproval } from '@/api/approval' +import { cancelApproval, submitApproval } from '@/api/approval' const props = defineProps({ status: { type: String, @@ -105,7 +105,6 @@ id: string supplierName: string } -const buttonTypeMap = ref('') // 点击删除或者取消 const handleDelete = (row: rowReturn) => { ElMessageBox.confirm( @@ -132,8 +131,8 @@ // 取消 const handleCancel = (row: ISupplier) => { const params = { - taskId: row.taskId!, - comments: '', + processInstanceId: row.processId!, + comments: '取消审批', } ElMessageBox.confirm( '确认取消该审批吗?', @@ -143,16 +142,12 @@ cancelButtonText: '取消', type: 'warning', }, - ) - .then(() => { - submitApproval('revoke', params).then((res) => { - ElMessage({ - type: 'success', - message: '取消成功', - }) - fetchData(true) - }) + ).then(() => { + cancelApproval(params).then((res) => { + ElMessage.success('取消成功') + fetchData(true) }) + }) } const approvalDialog = ref() @@ -161,9 +156,7 @@ const searchList = () => { fetchData(false) } -const cancelEvent = () => { - console.log('cancel!') -} + // 点击重置 const clearList = () => { listQuery.value = { @@ -379,7 +372,7 @@ 取消 - + 删除 diff --git a/src/views/measure/source/components/sourceApprovalDetail.vue b/src/views/measure/source/components/sourceApprovalDetail.vue index 17adf39..7b89b15 100644 --- a/src/views/measure/source/components/sourceApprovalDetail.vue +++ b/src/views/measure/source/components/sourceApprovalDetail.vue @@ -6,24 +6,13 @@ import type { IButton, ISupplier, traceSupplierPerson } from '../list_interface' import baseInfoDetail from './baseInfoDetail.vue' import { getSoucreListDetail } from '@/api/measure/source' -import { submitApproval } from '@/api/approval' +import { cancelApproval, submitApproval } from '@/api/approval' const infoId = ref('') // id -const buttonArray = ref([]) - -const buttonsSet: { [key: string]: IButton[] } = { - 2: [{ name: '查看', type: 'primary' }, - { name: '同意', type: 'primary' }, - { name: '驳回', type: 'primary' }, - { name: '拒绝', type: 'danger' }, - ], - 3: [ - { name: '取消', type: 'primary' }, - ], -} +const approvalType = ref('') // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { - const status = $route.params.type + approvalType.value = $route.params.type as string if ($route.params.id) { infoId.value = $route.params.id as string } @@ -44,6 +33,10 @@ companyCity: '', companyCountry: '', companyProvince: '', + companyAreaName: '', + companyCityName: '', + companyCountryName: '', + companyProvinceName: '', createTime: '', director: '', fax: '', @@ -52,6 +45,10 @@ invoiceCity: '', invoiceCountry: '', invoiceProvince: '', + invoiceAreaName: '', + invoiceCityName: '', + invoiceCountryName: '', + invoiceProvinceName: '', mailbox: '', minioFileName: '', mobile: '', @@ -66,16 +63,6 @@ const getInfo = () => { getSoucreListDetail({ id: infoId.value }).then((res) => { dataForm.value = res.data - if (dataForm.value.approvalStatus) { - // 待审批 - if (dataForm.value.approvalStatus == '2') { - buttonArray.value = buttonsSet[dataForm.value.approvalStatus] - } - else if (dataForm.value.approvalStatus == '3') { // 审批中 - // todo:判断当前用户是否为发起人 - buttonArray.value = buttonsSet[dataForm.value.approvalStatus] - } - } }) } getInfo() @@ -122,8 +109,8 @@ // 取消 const handleCancel = () => { const params = { - taskId: dataForm.value.taskId!, - comments: '', + processInstanceId: dataForm.value.processId!, + comments: '取消审批', } ElMessageBox.confirm( '确认取消该审批吗?', @@ -133,15 +120,11 @@ cancelButtonText: '取消', type: 'warning', }, - ) - .then(() => { - submitApproval('revoke', params).then((res) => { - ElMessage({ - type: 'success', - message: '取消成功', - }) - }) + ).then(() => { + cancelApproval(params).then((res) => { + ElMessage.success('取消成功') }) + }) } const approvalDialog = ref() // 点击数据后的操作按钮 @@ -167,9 +150,18 @@ diff --git a/src/views/measure/source/components/sourceApprovalDetail.vue b/src/views/measure/source/components/sourceApprovalDetail.vue index 17adf39..7b89b15 100644 --- a/src/views/measure/source/components/sourceApprovalDetail.vue +++ b/src/views/measure/source/components/sourceApprovalDetail.vue @@ -6,24 +6,13 @@ import type { IButton, ISupplier, traceSupplierPerson } from '../list_interface' import baseInfoDetail from './baseInfoDetail.vue' import { getSoucreListDetail } from '@/api/measure/source' -import { submitApproval } from '@/api/approval' +import { cancelApproval, submitApproval } from '@/api/approval' const infoId = ref('') // id -const buttonArray = ref([]) - -const buttonsSet: { [key: string]: IButton[] } = { - 2: [{ name: '查看', type: 'primary' }, - { name: '同意', type: 'primary' }, - { name: '驳回', type: 'primary' }, - { name: '拒绝', type: 'danger' }, - ], - 3: [ - { name: '取消', type: 'primary' }, - ], -} +const approvalType = ref('') // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { - const status = $route.params.type + approvalType.value = $route.params.type as string if ($route.params.id) { infoId.value = $route.params.id as string } @@ -44,6 +33,10 @@ companyCity: '', companyCountry: '', companyProvince: '', + companyAreaName: '', + companyCityName: '', + companyCountryName: '', + companyProvinceName: '', createTime: '', director: '', fax: '', @@ -52,6 +45,10 @@ invoiceCity: '', invoiceCountry: '', invoiceProvince: '', + invoiceAreaName: '', + invoiceCityName: '', + invoiceCountryName: '', + invoiceProvinceName: '', mailbox: '', minioFileName: '', mobile: '', @@ -66,16 +63,6 @@ const getInfo = () => { getSoucreListDetail({ id: infoId.value }).then((res) => { dataForm.value = res.data - if (dataForm.value.approvalStatus) { - // 待审批 - if (dataForm.value.approvalStatus == '2') { - buttonArray.value = buttonsSet[dataForm.value.approvalStatus] - } - else if (dataForm.value.approvalStatus == '3') { // 审批中 - // todo:判断当前用户是否为发起人 - buttonArray.value = buttonsSet[dataForm.value.approvalStatus] - } - } }) } getInfo() @@ -122,8 +109,8 @@ // 取消 const handleCancel = () => { const params = { - taskId: dataForm.value.taskId!, - comments: '', + processInstanceId: dataForm.value.processId!, + comments: '取消审批', } ElMessageBox.confirm( '确认取消该审批吗?', @@ -133,15 +120,11 @@ cancelButtonText: '取消', type: 'warning', }, - ) - .then(() => { - submitApproval('revoke', params).then((res) => { - ElMessage({ - type: 'success', - message: '取消成功', - }) - }) + ).then(() => { + cancelApproval(params).then((res) => { + ElMessage.success('取消成功') }) + }) } const approvalDialog = ref() // 点击数据后的操作按钮 @@ -167,9 +150,18 @@