From 35ae46d6ec1a0ad13cb77f2dca46b02bff5256a3 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 20 Mar 2024 08:34:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E5=86=B2=E7=AA=81=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eam/basic/deviceItem/deviceItem.data.ts | 45 +++++---------- .../deviceInspectionMain.data.ts | 4 +- .../eam/device/deviceinspectionjob/index.vue | 30 ++++++++-- .../deviceMaintainOrderMain.data.ts | 4 +- .../deviceMaintenanceMain.data.ts | 4 +- src/views/eam/item/itemApplyMain/index.vue | 36 ++++++------ .../eam/mold/moldinspectionjob/index.vue | 55 ++++++++++++++++++- .../moldInspectionMain.data.ts | 4 +- .../moldMaintainOrderMain.data.ts | 4 +- .../moldMaintenanceMain.data.ts | 4 +- 10 files changed, 124 insertions(+), 66 deletions(-) diff --git a/src/views/eam/basic/deviceItem/deviceItem.data.ts b/src/views/eam/basic/deviceItem/deviceItem.data.ts index dfef901..6c97578 100644 --- a/src/views/eam/basic/deviceItem/deviceItem.data.ts +++ b/src/views/eam/basic/deviceItem/deviceItem.data.ts @@ -1,5 +1,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' - +import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' +import * as ItemApi from '@/api/eam/basic/item' +const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({}) +const itemListAll = await ItemApi.getItemNoPage({}) // 表单校验 export const DeviceItemRules = reactive({ itemNumber: [required], @@ -9,42 +12,24 @@ export const DeviceItemRules = reactive({ export const DeviceItem = useCrudSchemas(reactive([ { - label: '备件编号', - field: 'itemNumber', - sort: 'custom', - isSearch: true, - }, - { - label: '设备编号', + label: '设备', field: 'deviceNumber', sort: 'custom', isSearch: true, + api: () => deviceListAll, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return deviceListAll.find((account) => account.number == cellValue)?.name + }, }, - { - label: '是否可用', - field: 'available', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isSearch: true, - isTable: true, + label: '备件', + field: 'itemNumber', sort: 'custom', - table: { - width: 150 - }, - tableForm: { - type: 'Select', - inactiveValue: 'FALSE', - disabled: true + isSearch: true, + api: () => itemListAll, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return itemListAll.find((account) => account.number == cellValue)?.name }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - } }, { label: '操作', diff --git a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts index 5553e13..0d40aeb 100644 --- a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts @@ -509,7 +509,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ // tableData.value.itemNumbers1 = value.map(item => item.itemNumber) }, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -526,7 +526,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true diff --git a/src/views/eam/device/deviceinspectionjob/index.vue b/src/views/eam/device/deviceinspectionjob/index.vue index 84e5f06..96fea4b 100644 --- a/src/views/eam/device/deviceinspectionjob/index.vue +++ b/src/views/eam/device/deviceinspectionjob/index.vue @@ -42,7 +42,7 @@ :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain" :apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess" - :isBusiness="true" + :isBusiness="false" @onChange="onChange" :tableAllSchemas="DeviceInspectionDetail.allSchemas" :tableFormRules="DeviceInspectionDetailRules" @@ -72,6 +72,7 @@ :isSearchTableItem="true" :openFormCallBack="openFormCallBack" @detailOnChange="detailOnChange" + :buttonControllFunction="buttonControllFunction" /> @@ -188,7 +189,7 @@ const butttondata = (row) => { return [ // defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // 编辑 // defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // 删除 - defaultButtons.mainListEditBtn(null), // 编辑 + defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED')}), // 编辑 defaultButtons.mainInspectionOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //检修 defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //完成 ] @@ -322,8 +323,8 @@ function handleFinishOrder(row) { if (response.list.length == 0) { message.error(t('请先填写并完成检修明细内容!')) } else { - let unFinishedList = response.list.filters(item => { - return item.status == 0 + let unFinishedList = response.list.filter(item => { + return item.status == 1 }) if (unFinishedList != null && unFinishedList.length > 0) { message.error(t('请先完成各检修明细内容!')) @@ -534,6 +535,27 @@ const openFormCallBack = (type, row, masterParmas, callback) => { } +function buttonControllFunction(row, val) { + if (val == 'delete') { + return false + } else if (val == 'edit') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } + } else if(val == 'add') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } + } else { + return true + } +} + + /** 初始化 **/ onMounted(async () => { getList() diff --git a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts index 232a55c..5e1d466 100644 --- a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts +++ b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts @@ -393,7 +393,7 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive([ console.log('value', value) }, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -409,7 +409,7 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true diff --git a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts index 251a79e..07c469c 100644 --- a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts @@ -392,7 +392,7 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, searchPage: ItemApi.getItemList, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -409,7 +409,7 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true diff --git a/src/views/eam/item/itemApplyMain/index.vue b/src/views/eam/item/itemApplyMain/index.vue index 9bad023..062949d 100644 --- a/src/views/eam/item/itemApplyMain/index.vue +++ b/src/views/eam/item/itemApplyMain/index.vue @@ -38,9 +38,9 @@ :detailAllSchemas="ItemApplyDetail.allSchemas" :detailAllSchemasRules="ItemApplyDetailRules" :apiCreate="ItemApplyDetailApi.createItemApplyDetail" :apiUpdate="ItemApplyDetailApi.updateItemApplyDetail" :apiPage="ItemApplyDetailApi.getItemApplyDetailPage" :apiDelete="ItemApplyDetailApi.deleteItemApplyDetail" - @searchTableSuccessDetail="searchTableSuccessDetail" @detailSubmitForm='detailSubmitForm' - :isShowAddBtn="isShowAddBtn" - :detailButtonIsShow="detailButtonIsShow" + @searchTableSuccessDetail="searchTableSuccessDetail" @detailSubmitForm='detailSubmitForm' + :isShowAddBtn="isShowAddBtn" + :detailButtonIsShow="detailButtonIsShow" /> @@ -63,9 +63,9 @@ const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 - const routeName = ref() - const isShowAddBtn = ref(true) - const detailButtonIsShow = ref(false) + const routeName = ref() + const isShowAddBtn = ref(true) + const detailButtonIsShow = ref(false) routeName.value = route.name const tableColumns = ref(ItemApplyMain.allSchemas.tableColumns) @@ -225,13 +225,13 @@ /** 详情操作 */ const detailRef = ref() - const openDetail = (row : any, titleName : any, titleValue : any) => { - if(row.status!='0'){ - isShowAddBtn.value=false - detailButtonIsShow.value=true - }else{ - isShowAddBtn.value=true - detailButtonIsShow.value=false + const openDetail = (row : any, titleName : any, titleValue : any) => { + if(row.status!='0'){ + isShowAddBtn.value=false + detailButtonIsShow.value=true + }else{ + isShowAddBtn.value=true + detailButtonIsShow.value=false } detailRef.value.openDetail(row, titleName, titleValue, 'basicItemApplyMain') } @@ -334,17 +334,19 @@ getList() // 刷新当前列表 } const detailSubmitForm = async (formType, data, getList, formRef, tableList) => { - try { if (formType === 'create') { + try { + if (formType === 'create') { await ItemApplyDetailApi.createItemApplyDetail(data) message.success(t('common.createSuccess')) formRef.dialogVisible = false - formRef.getList + await formRef.getList } else { await ItemApplyDetailApi.updateItemApplyDetail(data) message.success(t('common.updateSuccess')) formRef.dialogVisible = false formRef.getList - } }catch { + } + }catch { } finally { formRef.formLoading = false } @@ -356,4 +358,4 @@ getList() importTemplateData.templateUrl = await ItemApplyMainApi.importTemplate() }) - + diff --git a/src/views/eam/mold/moldinspectionjob/index.vue b/src/views/eam/mold/moldinspectionjob/index.vue index 68aafc5..b2f9694 100644 --- a/src/views/eam/mold/moldinspectionjob/index.vue +++ b/src/views/eam/mold/moldinspectionjob/index.vue @@ -42,7 +42,7 @@ :apiUpdate="MoldInspectionMainApi.updateMoldInspectionMain" :apiCreate="MoldInspectionMainApi.createMoldInspectionMain" @searchTableSuccess="searchTableSuccess" - :isBusiness="true" + :isBusiness="false" @onChange="onChange" :tableAllSchemas="MoldInspectionDetail.allSchemas" :tableFormRules="MoldInspectionDetailRules" @@ -72,6 +72,7 @@ :isSearchTableItem="true" :openFormCallBack="openFormCallBack" @detailOnChange="detailOnChange" + :buttonControllFunction="buttonControllFunction" /> @@ -88,6 +89,8 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import { useUserStore } from '@/store/modules/user' import { selectAllFactoryArea } from '@/api/system/dept' import * as UserApi from '@/api/system/user' +import * as DeviceInspectionDetailApi from '@/api/eam/device/deviceInspectionDetail' +import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain' // import TableHead from '@/components/TableHead/src/TableHead.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue' @@ -184,7 +187,7 @@ const butttondata = (row) => { return [ // defaultButtons.mainListEditBtn({hasPermi:'eam:moldInspectionMain:update'}), // 编辑 // defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldInspectionMain:delete'}), // 删除 - defaultButtons.mainListEditBtn(null), // 编辑 + defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED')}), // 编辑 defaultButtons.mainInspectionOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //检修 defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //完成 ] @@ -300,7 +303,32 @@ function handleMaintenanceOrder(row) { } function handleFinishOrder(row) { - + let param = { + masterId : row.id + } + DeviceInspectionDetailApi.getDeviceInspectionDetailPage(param + ).then(response => { + if (response != null) { + if (response.list.length == 0) { + message.error(t('请先填写并完成检修明细内容!')) + } else { + let unFinishedList = response.list.filter(item => { + return item.status == 1 + }) + if (unFinishedList != null && unFinishedList.length > 0) { + message.error(t('请先完成各检修明细内容!')) + return + } else { + DeviceInspectionMainApi.finishInspection(row.id).then(res => { + message.success(t('common.finishSuccess')) + getList() + }) + } + } + } else { + message.error(t('common.finishFail')) + } + }) } const onChange = (field, cur, item) => { @@ -495,6 +523,27 @@ const openFormCallBack = (type, row, masterParmas, callback) => { callback() } + +function buttonControllFunction(row, val) { + if (val == 'delete') { + return false + } else if (val == 'edit') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } + } else if(val == 'add') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } + } else { + return true + } +} + /** 初始化 **/ onMounted(async () => { getList() diff --git a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts index bfcd80d..42bd205 100644 --- a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts +++ b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts @@ -506,7 +506,7 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ // tableData.value.itemNumbers1 = value.map(item => item.itemNumber) }, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -523,7 +523,7 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true diff --git a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts index 2559f95..440ddca 100644 --- a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts +++ b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts @@ -441,7 +441,7 @@ export const MoldMaintainOrderDetail = useCrudSchemas(reactive([ // tableData.value.itemNumbers1 = value.map(item => item.itemNumber) }, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -458,7 +458,7 @@ export const MoldMaintainOrderDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true diff --git a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts index 8cb7d25..20db7e1 100644 --- a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts +++ b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts @@ -330,7 +330,7 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, searchPage: ItemApi.getItemList, searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true @@ -347,7 +347,7 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive([ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ - key: 'deviceNumber', + key: 'number', value: 'deviceNumber', message: '请选择设备模具编号!', isMainValue: true