From d170cb2747e24e01198e497caae6a3886fc7d051 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Tue, 13 Aug 2024 10:15:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E9=AA=8C=E4=BB=BB=E5=8A=A1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=92=8C=E6=89=BF=E6=8E=A5=E6=8C=89=E9=92=AE=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/qms/inspectionJob/addForm.vue | 5 +- src/views/qms/inspectionJob/index.vue | 78 ++++++++++++++++--------- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/src/views/qms/inspectionJob/addForm.vue b/src/views/qms/inspectionJob/addForm.vue index 5627ed1a2..9d92b889c 100644 --- a/src/views/qms/inspectionJob/addForm.vue +++ b/src/views/qms/inspectionJob/addForm.vue @@ -925,8 +925,9 @@ const buttonBaseClick = async (val) => { } // 关闭 else if (val == 'close') { - // await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) + await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) dialogVisible.value = false + emit('close') } // 暂存 else if (val == 'staging') { @@ -934,7 +935,7 @@ const buttonBaseClick = async (val) => { } } // 传递给父类 -const emit = defineEmits(['submitForm', 'searchTableSuccess']) +const emit = defineEmits(['submitForm', 'searchTableSuccess','close']) const validateForm = (formRef) => { let _lists = formRef?.map((v) => v.validate()) return Promise.all(_lists) diff --git a/src/views/qms/inspectionJob/index.vue b/src/views/qms/inspectionJob/index.vue index c6d5d8191..be20c57a1 100644 --- a/src/views/qms/inspectionJob/index.vue +++ b/src/views/qms/inspectionJob/index.vue @@ -20,7 +20,8 @@ - - + v-model="showQualityReport" + :title="t('质检明细')" + :append-to-body="false" + destroy-on-close + fullscreen + > + @@ -119,6 +121,7 @@ import TableHead from '@/components/TableHead/src/TableHead.vue' import AddForm from './addForm.vue' import Detail from './detail.vue' import { getReportUrl } from '@/utils/systemParam' +import { useUserStore } from '@/store/modules/user' // 采购订单 defineOptions({ name: 'inspectionJobMain' }) @@ -129,6 +132,7 @@ const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns) +const userStore = useUserStore() // 字段设置 更新主列表字段 const updataTableColumns = (val) => { @@ -199,7 +203,7 @@ const buttonBaseClick = (val, item) => { handleExport() } else if (val == 'refresh') { // 刷新 - if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { + if (tableObject.params.filters && tableObject.params.filters.length > 0) { searchFormClick({ filters: tableObject.params.filters }) @@ -231,24 +235,35 @@ const isShowMainButton2 = (row, val) => { return true } } - +// 根据状态返回该按钮是否显示 +const isShowMainButton1 = (row, val) => { + if (val.indexOf(row.status) > -1) { + if (userStore.getUser.id == row.acceptUserId) { + return false + } else { + return true + } + } else { + return true + } +} // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListJobAccBtn({ - hide: isShowMainButton(row, ['1']), - hasPermi: 'qms:inspection-job-main:accept' - }), // 承接 + // defaultButtons.mainListJobAccBtn({ + // hide: isShowMainButton(row, ['1']), + // hasPermi: 'qms:inspection-job-main:accept' + // }), // 承接 defaultButtons.mainListJobCloBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'qms:inspection-job-main:close' }), // 关闭 defaultButtons.mainListJobAbaBtn({ - hide: isShowMainButton(row, ['2']), + hide: isShowMainButton1(row, ['2']), hasPermi: 'qms:inspection-job-main:abandon' }), // 放弃 defaultButtons.mainListJobExeBtn({ - hide: isShowMainButton(row, ['2']), + hide: isShowMainButton(row, ['1', '2']), hasPermi: 'qms:inspection-job-main:execute' }), // 执行 defaultButtons.mainListOrderPubBtn({ @@ -312,10 +327,19 @@ const openDetail = (row: any, titleName: any, titleValue: any) => { detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain') } //执行 - const formRef = ref() -const execute = async (type: string, row?: number) => { - formRef.value.open(type, row) +const execute = async (type: string, row?: any) => { + if (row.status == '2') { + if (userStore.getUser.id == row.acceptUserId) { + formRef.value.open(type, row) + } else { + message.error('承接人与当前登录人不一致') + } + } else if (row.status == '1') { + await handleAccept(row.id) + formRef.value.open(type, row) + await getList() + } } /** 关闭按钮操作 */ const handleClose = async (id: number) => { @@ -326,7 +350,7 @@ const handleClose = async (id: number) => { await InspectionJobMainApi.closeInspectionJobMain(id) message.success(t('common.closeSuccess')) // 刷新列表 - buttonBaseClick('refresh',null) + buttonBaseClick('refresh', null) } catch {} } /** 发布按钮操作 */ @@ -338,19 +362,19 @@ const handleRelease = async (id: number) => { await InspectionJobMainApi.releaseInspectionJobMain(id) message.success('发布成功!') // 刷新列表 - buttonBaseClick('refresh',null) + buttonBaseClick('refresh', null) } catch {} } // 承接 const handleAccept = async (id: number) => { try { // 承接的二次确认 - await message.confirm(t('common.confirmAccept')) + // await message.confirm(t('common.confirmAccept')) // 发起承接 await InspectionJobMainApi.acceptInspectionJobMain(id) - message.success(t('common.acceptSuccess')) + // message.success(t('common.acceptSuccess')) // 刷新列表(TB反馈,取消承接后刷新页面) - buttonBaseClick('refresh',null) + // buttonBaseClick('refresh',null) } catch {} } // 放弃任务 @@ -362,7 +386,7 @@ const handleAbandon = async (id: number) => { await InspectionJobMainApi.abandonInspectionJobMain(id) message.success(t('common.giveupSuccess')) // 刷新列表 - buttonBaseClick('refresh',null) + buttonBaseClick('refresh', null) } catch {} } @@ -408,8 +432,8 @@ const submitForm = async (formType, data) => { // 刷新当前列表 if (formType === 'create') { getList() - }else{ - buttonBaseClick('refresh',null) + } else { + buttonBaseClick('refresh', null) } } finally { formRef.value.formLoading = false