diff --git a/src/api/business/schedule/task.ts b/src/api/business/schedule/task.ts index 1c85c89..92ad9b6 100644 --- a/src/api/business/schedule/task.ts +++ b/src/api/business/schedule/task.ts @@ -78,6 +78,15 @@ }) } +// 收入(待检测->检测中)->收入) +export function myExecutiveReceive(data: object) { + return request({ + url: '/business/labExecutive/myExecutive/receive', + method: 'post', + data, + }) +} + // 分配 export function allocate(data: { id: string; measurePersonId: string; requireCertifications: string }) { return request({ diff --git a/src/api/business/schedule/task.ts b/src/api/business/schedule/task.ts index 1c85c89..92ad9b6 100644 --- a/src/api/business/schedule/task.ts +++ b/src/api/business/schedule/task.ts @@ -78,6 +78,15 @@ }) } +// 收入(待检测->检测中)->收入) +export function myExecutiveReceive(data: object) { + return request({ + url: '/business/labExecutive/myExecutive/receive', + method: 'post', + data, + }) +} + // 分配 export function allocate(data: { id: string; measurePersonId: string; requireCertifications: string }) { return request({ diff --git a/src/main.ts b/src/main.ts index 695df5c..3cf24ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,13 +16,14 @@ // 加载 iconify 图标(element plus) import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' +import buttonPerm from '@/utils/buttonPerm' // 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } - const app = createApp(App) app.config.globalProperties.hasPerm = hasPermission +app.config.globalProperties.buttonPerm = buttonPerm app.use(print) app.use(ElementPlus) app.use(pinia) diff --git a/src/api/business/schedule/task.ts b/src/api/business/schedule/task.ts index 1c85c89..92ad9b6 100644 --- a/src/api/business/schedule/task.ts +++ b/src/api/business/schedule/task.ts @@ -78,6 +78,15 @@ }) } +// 收入(待检测->检测中)->收入) +export function myExecutiveReceive(data: object) { + return request({ + url: '/business/labExecutive/myExecutive/receive', + method: 'post', + data, + }) +} + // 分配 export function allocate(data: { id: string; measurePersonId: string; requireCertifications: string }) { return request({ diff --git a/src/main.ts b/src/main.ts index 695df5c..3cf24ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,13 +16,14 @@ // 加载 iconify 图标(element plus) import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' +import buttonPerm from '@/utils/buttonPerm' // 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } - const app = createApp(App) app.config.globalProperties.hasPerm = hasPermission +app.config.globalProperties.buttonPerm = buttonPerm app.use(print) app.use(ElementPlus) app.use(pinia) diff --git a/src/utils/buttonPerm.ts b/src/utils/buttonPerm.ts new file mode 100644 index 0000000..205d84a --- /dev/null +++ b/src/utils/buttonPerm.ts @@ -0,0 +1,66 @@ +import { hasPermission } from '@/utils/composables/permission' + +function error(permPath: string) { + if (permPath === undefined) { + throw new Error('Button permission url is required!!!') + } +} + +export default { + agree: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + reject: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 3 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + refuse: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 2 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + edit: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && (row.approvalStatusName === '未通过-驳回' || row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消') + }, + }, + submit: { + if: (row: any) => { + row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消' + }, + }, + cancel: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '审批中' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '审批中' + }, + }, + delete: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName !== '未通过' && row.approvalStatusName !== '已通过' && row.approvalStatusName !== '未通过-驳回' + }, + disabled: (row: any) => { + return row.approvalStatusName === '未通过' || row.approvalStatusName === '已通过' + }, + }, +} diff --git a/src/api/business/schedule/task.ts b/src/api/business/schedule/task.ts index 1c85c89..92ad9b6 100644 --- a/src/api/business/schedule/task.ts +++ b/src/api/business/schedule/task.ts @@ -78,6 +78,15 @@ }) } +// 收入(待检测->检测中)->收入) +export function myExecutiveReceive(data: object) { + return request({ + url: '/business/labExecutive/myExecutive/receive', + method: 'post', + data, + }) +} + // 分配 export function allocate(data: { id: string; measurePersonId: string; requireCertifications: string }) { return request({ diff --git a/src/main.ts b/src/main.ts index 695df5c..3cf24ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,13 +16,14 @@ // 加载 iconify 图标(element plus) import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' +import buttonPerm from '@/utils/buttonPerm' // 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } - const app = createApp(App) app.config.globalProperties.hasPerm = hasPermission +app.config.globalProperties.buttonPerm = buttonPerm app.use(print) app.use(ElementPlus) app.use(pinia) diff --git a/src/utils/buttonPerm.ts b/src/utils/buttonPerm.ts new file mode 100644 index 0000000..205d84a --- /dev/null +++ b/src/utils/buttonPerm.ts @@ -0,0 +1,66 @@ +import { hasPermission } from '@/utils/composables/permission' + +function error(permPath: string) { + if (permPath === undefined) { + throw new Error('Button permission url is required!!!') + } +} + +export default { + agree: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + reject: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 3 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + refuse: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 2 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + edit: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && (row.approvalStatusName === '未通过-驳回' || row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消') + }, + }, + submit: { + if: (row: any) => { + row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消' + }, + }, + cancel: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '审批中' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '审批中' + }, + }, + delete: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName !== '未通过' && row.approvalStatusName !== '已通过' && row.approvalStatusName !== '未通过-驳回' + }, + disabled: (row: any) => { + return row.approvalStatusName === '未通过' || row.approvalStatusName === '已通过' + }, + }, +} diff --git a/src/views/business/lab/myMeasure/myMeasureList.vue b/src/views/business/lab/myMeasure/myMeasureList.vue index c604d3e..d998c13 100644 --- a/src/views/business/lab/myMeasure/myMeasureList.vue +++ b/src/views/business/lab/myMeasure/myMeasureList.vue @@ -10,9 +10,10 @@ import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' import { getDictByCode } from '@/api/system/dict' -import { getMyMeasureList } from '@/api/business/schedule/task' +import { getMyMeasureList, myExecutiveReceive } from '@/api/business/schedule/task' import type { dictType } from '@/global' import type { IMenu } from '@/components/buttonBox/buttonBox' + const { proxy } = getCurrentInstance() as any const $router = useRouter() // 右上角按钮 @@ -157,12 +158,12 @@ // 导出 const exportAll = () => { - const loading = ElLoading.service({ - lock: true, - text: '下载中请稍后', - background: 'rgba(255, 255, 255, 0.8)', - }) if (list.value.length > 0) { + const loading = ElLoading.service({ + lock: true, + text: '下载中请稍后', + background: 'rgba(255, 255, 255, 0.8)', + }) // const params = { // bussinessSize: listQuery.value.bussinessSize, // 业务规模 // customerName: listQuery.value.customerName, // 公司名称 @@ -174,11 +175,11 @@ // const blob = new Blob([res.data]) // exportFile(blob, '任务分发列表.xlsx') // }) + loading.close() } else { - ElMessage.warning('无数据可导出数据') + ElMessage.warning('无数据可导出') } - loading.close() } // 打印列表 @@ -222,6 +223,11 @@ { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }, ).then(() => { // 收入样品 + myExecutiveReceive([{ orderId: row.orderId, sampleId: row.sampleId }]).then((res) => { + if (res.code == 200) { + ElMessage.success('收入成功') + } + }) }) } @@ -278,7 +284,7 @@ active.value = window.sessionStorage.getItem('myMeasureActive') as string } else { - active.value = menu.value.find(item => item.name === '待检测')!.id // 待检测 + active.value = menu.value.find(item => item.name === '待检测')!.id as string // 待检测 } nextTick(() => { fetchData(true) diff --git a/src/api/business/schedule/task.ts b/src/api/business/schedule/task.ts index 1c85c89..92ad9b6 100644 --- a/src/api/business/schedule/task.ts +++ b/src/api/business/schedule/task.ts @@ -78,6 +78,15 @@ }) } +// 收入(待检测->检测中)->收入) +export function myExecutiveReceive(data: object) { + return request({ + url: '/business/labExecutive/myExecutive/receive', + method: 'post', + data, + }) +} + // 分配 export function allocate(data: { id: string; measurePersonId: string; requireCertifications: string }) { return request({ diff --git a/src/main.ts b/src/main.ts index 695df5c..3cf24ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,13 +16,14 @@ // 加载 iconify 图标(element plus) import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' +import buttonPerm from '@/utils/buttonPerm' // 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } - const app = createApp(App) app.config.globalProperties.hasPerm = hasPermission +app.config.globalProperties.buttonPerm = buttonPerm app.use(print) app.use(ElementPlus) app.use(pinia) diff --git a/src/utils/buttonPerm.ts b/src/utils/buttonPerm.ts new file mode 100644 index 0000000..205d84a --- /dev/null +++ b/src/utils/buttonPerm.ts @@ -0,0 +1,66 @@ +import { hasPermission } from '@/utils/composables/permission' + +function error(permPath: string) { + if (permPath === undefined) { + throw new Error('Button permission url is required!!!') + } +} + +export default { + agree: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + reject: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 3 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + refuse: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '待审批' && row.decisionItem !== 2 + }, + disabled: (row: any) => { + return row.approvalStatusName !== '待审批' && row.approvalStatusName !== '审批中' + }, + }, + edit: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && (row.approvalStatusName === '未通过-驳回' || row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消') + }, + }, + submit: { + if: (row: any) => { + row.approvalStatusName === '草稿箱' || row.approvalStatusName === '已取消' + }, + }, + cancel: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName === '审批中' + }, + disabled: (row: any) => { + return row.approvalStatusName !== '审批中' + }, + }, + delete: { + if: (row: any, permPath: string) => { + error(permPath) + return hasPermission(permPath) && row.approvalStatusName !== '未通过' && row.approvalStatusName !== '已通过' && row.approvalStatusName !== '未通过-驳回' + }, + disabled: (row: any) => { + return row.approvalStatusName === '未通过' || row.approvalStatusName === '已通过' + }, + }, +} diff --git a/src/views/business/lab/myMeasure/myMeasureList.vue b/src/views/business/lab/myMeasure/myMeasureList.vue index c604d3e..d998c13 100644 --- a/src/views/business/lab/myMeasure/myMeasureList.vue +++ b/src/views/business/lab/myMeasure/myMeasureList.vue @@ -10,9 +10,10 @@ import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' import { getDictByCode } from '@/api/system/dict' -import { getMyMeasureList } from '@/api/business/schedule/task' +import { getMyMeasureList, myExecutiveReceive } from '@/api/business/schedule/task' import type { dictType } from '@/global' import type { IMenu } from '@/components/buttonBox/buttonBox' + const { proxy } = getCurrentInstance() as any const $router = useRouter() // 右上角按钮 @@ -157,12 +158,12 @@ // 导出 const exportAll = () => { - const loading = ElLoading.service({ - lock: true, - text: '下载中请稍后', - background: 'rgba(255, 255, 255, 0.8)', - }) if (list.value.length > 0) { + const loading = ElLoading.service({ + lock: true, + text: '下载中请稍后', + background: 'rgba(255, 255, 255, 0.8)', + }) // const params = { // bussinessSize: listQuery.value.bussinessSize, // 业务规模 // customerName: listQuery.value.customerName, // 公司名称 @@ -174,11 +175,11 @@ // const blob = new Blob([res.data]) // exportFile(blob, '任务分发列表.xlsx') // }) + loading.close() } else { - ElMessage.warning('无数据可导出数据') + ElMessage.warning('无数据可导出') } - loading.close() } // 打印列表 @@ -222,6 +223,11 @@ { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }, ).then(() => { // 收入样品 + myExecutiveReceive([{ orderId: row.orderId, sampleId: row.sampleId }]).then((res) => { + if (res.code == 200) { + ElMessage.success('收入成功') + } + }) }) } @@ -278,7 +284,7 @@ active.value = window.sessionStorage.getItem('myMeasureActive') as string } else { - active.value = menu.value.find(item => item.name === '待检测')!.id // 待检测 + active.value = menu.value.find(item => item.name === '待检测')!.id as string // 待检测 } nextTick(() => { fetchData(true) diff --git a/src/views/measure/file/components/approve/templatePage.vue b/src/views/measure/file/components/approve/templatePage.vue index 44876b7..fb29410 100644 --- a/src/views/measure/file/components/approve/templatePage.vue +++ b/src/views/measure/file/components/approve/templatePage.vue @@ -299,18 +299,13 @@ - + @@ -320,19 +315,17 @@