From 38b5a3b86d5afe5fcb4fff106cb2d3e7ac4106f2 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Fri, 15 Mar 2024 08:41:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/src/DetailDeviceLedger.vue | 6 +++ src/utils/disposition/tabsList.ts | 3 +- src/views/eam/device/deviceAccounts/index.vue | 49 ++++------------- .../device/deviceRepair/deviceRepair.data.ts | 18 ------- .../eam/device/devicemaintainjob/index.vue | 6 +++ src/views/eam/mold/moldAccounts/index.vue | 54 ++++--------------- .../eam/mold/moldRepair/moldRepair.data.ts | 18 ------- src/views/eam/mold/moldmaintainjob/index.vue | 33 +++++++++++- 8 files changed, 66 insertions(+), 121 deletions(-) diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue index cf0a09a..b81e182 100644 --- a/src/components/Detail/src/DetailDeviceLedger.vue +++ b/src/components/Detail/src/DetailDeviceLedger.vue @@ -354,6 +354,11 @@ const props = defineProps({ required: false, default: 1 }, + tabName: { + type: String, + required: false, + default: '' + }, // tableObject 数据过滤条件 针对 详情扩展标签页 传入不同条件 tableObjectExtend: { type: Array, @@ -843,6 +848,7 @@ const openDialog = async(row: any, titleName: any, titleValue: any) => { defaultParams: getDialogParams(row) }) dialogVisible.value = true + dialogTitle.value = props.tabName dialogAllSchemasRef.value = props.dialogAllSchemas dialogTableObjectRef.value = tableObject dialogTableMethodsRef.value = tableMethods diff --git a/src/utils/disposition/tabsList.ts b/src/utils/disposition/tabsList.ts index a734947..17df0f4 100644 --- a/src/utils/disposition/tabsList.ts +++ b/src/utils/disposition/tabsList.ts @@ -19,7 +19,8 @@ export const DeviceLedgerTabsList = [ { label: "维修记录", prop: 'RepairRecord', -},{ +}, +{ label: "保养记录", prop: 'MaintenanceRecord', }, diff --git a/src/views/eam/device/deviceAccounts/index.vue b/src/views/eam/device/deviceAccounts/index.vue index 2a83fb9..5245cb3 100644 --- a/src/views/eam/device/deviceAccounts/index.vue +++ b/src/views/eam/device/deviceAccounts/index.vue @@ -67,6 +67,7 @@ :detailAllSchemas="detailAllSchemas" :apiPage="apiPage" :tabsExtend="tabsExtend" + :tabName="tabName" :tableObjectExtend="tableObjectExtend" :getImageApi="uploadApi.getImage" :uploadImage="uploadApi.uploadImage" @@ -331,21 +332,25 @@ const searchFormClick = (searchData) => { const DeviceLedgerSubTabsList = getStrDictOptions(DICT_TYPE.DEVICE_DOC_TYPE) const tabsExtend = ref() +const tabName = ref() const funcCode = ref('device_mould_picture') // tabs 切换事件 const changeTabs = (item) => { if (item.prop == 'Image') { tabsExtend.value = 1 + tabName.value = item.label funcCode.value = 'device_mould_picture' // apiPage.value = CustomeritemApi.getCustomeritemPage // detailAllSchemas.value = Customeritem.allSchemas } else if (item.prop == 'Word') { tabsExtend.value = 2 + tabName.value = item.label funcCode.value = 'device_mould_attachment' // apiPage.value = PurchaseDetailApi.getPurchaseDetailPage // detailAllSchemas.value = PurchaseMain.allSchemas } else if (item.prop == 'Part') { tabsExtend.value = 4 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -353,6 +358,7 @@ const changeTabs = (item) => { detailAllSchemas.value = DeviceItem.allSchemas } else if (item.prop == 'DeviceReportRecord') { tabsExtend.value = 4 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -360,6 +366,7 @@ const changeTabs = (item) => { detailAllSchemas.value = DeviceRepair.allSchemas } else if (item.prop == 'RepairRecord') { tabsExtend.value = 3 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -369,6 +376,7 @@ const changeTabs = (item) => { dialogAllSchemas.value = DeviceMaintenanceDetail.allSchemas } else if (item.prop == 'MaintenanceRecord') { tabsExtend.value = 3 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -426,7 +434,7 @@ const openItem = async (number: String) => { searchTableRef.value.open( '选择备件', Item.allSchemas, - getDeviceItemList, + ItemApi.getItemPage, null, Item.allSchemas.searchSchema, true, @@ -448,45 +456,6 @@ const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, row console.log('deviceItemRelList', deviceItemRelList) } -const getItemWithOutBind = async () => { - try { - const res = await ItemApi.getItemPage({ - ...Item.allSchemas.searchSchema - }) - if (res.list?.length > 0) { - // const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema); - // const filteredList = res.list.filter(item => { - // return !response.list?.some(element => { - // return item.number === element.itemNumber - // }); - // }); - // console.log('filteredList',filteredList); - const filteredList = res.list - return filteredList // 返回过滤后的列表 - } - return [] // 如果没有数据,返回空数组 - } catch (error) { - console.error(error) - throw error // 抛出错误 - } -} - -// 将 getListApi 替换为 getItemWithOutBind -const getDeviceItemList = async () => { - tableObject.loading = true - try { - const res = await getItemWithOutBind() - let result = { - list: res, - total: res.length - } - return result - } catch (error) { - console.error(error) - } finally { - tableObject.loading = false - } -} const getDeviceItemBindData = async (params) => { const response = await getDeviceItemPage(params); diff --git a/src/views/eam/device/deviceRepair/deviceRepair.data.ts b/src/views/eam/device/deviceRepair/deviceRepair.data.ts index 6273ceb..c47a210 100644 --- a/src/views/eam/device/deviceRepair/deviceRepair.data.ts +++ b/src/views/eam/device/deviceRepair/deviceRepair.data.ts @@ -185,24 +185,6 @@ export const DeviceRepair = useCrudSchemas(reactive([ }, }, - { - label: '是否可用', - field: 'available', - sort: 'custom', - table: { - width: '150', - }, - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, { label: '维修状态', field: 'result', diff --git a/src/views/eam/device/devicemaintainjob/index.vue b/src/views/eam/device/devicemaintainjob/index.vue index e21bad6..05a050b 100644 --- a/src/views/eam/device/devicemaintainjob/index.vue +++ b/src/views/eam/device/devicemaintainjob/index.vue @@ -498,6 +498,12 @@ onMounted(async () => { function buttonControllFunction(row, val) { if (val == 'delete') { return false + } else if (val == 'edit') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } } else { return true } diff --git a/src/views/eam/mold/moldAccounts/index.vue b/src/views/eam/mold/moldAccounts/index.vue index 4141202..e4965e3 100644 --- a/src/views/eam/mold/moldAccounts/index.vue +++ b/src/views/eam/mold/moldAccounts/index.vue @@ -67,6 +67,7 @@ :detailAllSchemas="detailAllSchemas" :apiPage="apiPage" :tabsExtend="tabsExtend" + :tabName="tabName" :tableObjectExtend="tableObjectExtend" :getImageApi="uploadApi.getImage" :uploadImage="uploadApi.uploadImage" @@ -150,7 +151,7 @@ const dialogAllSchemas = ref() const dialogAllSchemasRules = ref() const milestone = ref("milestone") const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL -const src = ref(BASE_URL + '/jmreport/view/924987924638945280?token=' + getAccessToken()) +const src = ref(BASE_URL + '/jmreport/view/928216752216293376?token=' + getAccessToken()) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef) => { @@ -330,21 +331,25 @@ const searchFormClick = (searchData) => { const MoldLedgerSubTabsList = getStrDictOptions(DICT_TYPE.MOLD_DOC_TYPE) const tabsExtend = ref() +const tabName = ref() const funcCode = ref('mold_mould_picture') // tabs 切换事件 const changeTabs = (item) => { if (item.prop == 'Image') { tabsExtend.value = 1 + tabName.value = item.label funcCode.value = 'mold_mould_picture' // apiPage.value = CustomeritemApi.getCustomeritemPage // detailAllSchemas.value = Customeritem.allSchemas } else if (item.prop == 'Word') { tabsExtend.value = 2 + tabName.value = item.label funcCode.value = 'mold_mould_attachment' // apiPage.value = PurchaseDetailApi.getPurchaseDetailPage // detailAllSchemas.value = PurchaseMain.allSchemas } else if (item.prop == 'Part') { tabsExtend.value = 4 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -352,6 +357,7 @@ const changeTabs = (item) => { detailAllSchemas.value = DeviceItem.allSchemas } else if (item.prop == 'MoldReportRecord') { tabsExtend.value = 4 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -359,6 +365,7 @@ const changeTabs = (item) => { detailAllSchemas.value = MoldRepair.allSchemas } else if (item.prop == 'RepairRecord') { tabsExtend.value = 3 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -368,6 +375,7 @@ const changeTabs = (item) => { dialogAllSchemas.value = MoldMaintenanceDetail.allSchemas } else if (item.prop == 'MaintenanceRecord') { tabsExtend.value = 3 + tabName.value = item.label defaultParams.value = { deviceNumber: itemCodeRow } @@ -377,6 +385,7 @@ const changeTabs = (item) => { dialogAllSchemas.value = MoldMaintainOrderDetail.allSchemas } else if (item.prop == 'Milestone') { tabsExtend.value = 5 + tabName.value = item.label defaultParams.value = { moldNumber: itemCodeRow } @@ -429,7 +438,7 @@ const openItem = async (number: String) => { searchTableRef.value.open( '选择备件', Item.allSchemas, - getDeviceItemList, + ItemApi.getItemPage, null, Item.allSchemas.searchSchema, true, @@ -451,47 +460,6 @@ const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, row console.log('deviceItemRelList', deviceItemRelList) } -const getItemWithOutBind = async () => { - try { - const res = await ItemApi.getItemPage({ - ...Item.allSchemas.searchSchema - }) - if (res.list?.length > 0) { - // const response = await getDeviceItemPage(MoldAccounts.allSchemas.searchSchema); - // const filteredList = res.list.filter(item => { - // return !response.list?.some(element => { - // return item.number === element.itemNumber - // }); - // }); - // console.log('filteredList',filteredList); - const filteredList = res.list - return filteredList // 返回过滤后的列表 - } - return [] // 如果没有数据,返回空数组 - } catch (error) { - console.error(error) - throw error // 抛出错误 - } -} - -// 将 getListApi 替换为 getItemWithOutBind -const getDeviceItemList = async () => { - tableObject.loading = true - try { - const res = await getItemWithOutBind() - let result = { - list: res, - total: res.length - } - return result - } catch (error) { - console.error(error) - } finally { - tableObject.loading = false - } -} - - const qrCodeBatch = async (val,item) => { const qrCodeList = tableObject.tableList.map(item => `'${item?.number}'`).join(', ') window.open(src.value + "&number=" + qrCodeList) diff --git a/src/views/eam/mold/moldRepair/moldRepair.data.ts b/src/views/eam/mold/moldRepair/moldRepair.data.ts index 901bbad..26b1f28 100644 --- a/src/views/eam/mold/moldRepair/moldRepair.data.ts +++ b/src/views/eam/mold/moldRepair/moldRepair.data.ts @@ -148,24 +148,6 @@ export const MoldRepair = useCrudSchemas(reactive([ }, }, - { - label: '是否可用', - field: 'available', - sort: 'custom', - table: { - width: '150', - }, - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - }, - }, { label: '维修状态', field: 'result', diff --git a/src/views/eam/mold/moldmaintainjob/index.vue b/src/views/eam/mold/moldmaintainjob/index.vue index 0640536..33ed0ec 100644 --- a/src/views/eam/mold/moldmaintainjob/index.vue +++ b/src/views/eam/mold/moldmaintainjob/index.vue @@ -83,6 +83,8 @@ :detailValidate="detailValidate" @detailSubmitForm="detailSubmitForm" :isSearchTableItem="true" + :buttonControllFunction="buttonControllFunction" + @detailOnChange="detailOnChange" /> @@ -226,7 +228,8 @@ const butttondata = (row) => { hide: !( row.status == 'PENDING' && (userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') || - userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) + userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) || + row.status == 1 ) }), // 接单 // defaultButtons.turnOrderBtn({ @@ -485,6 +488,34 @@ const detailSubmitForm= async (formType,data,getList,formRef,tableList) => { } } + +function buttonControllFunction(row, val) { + if (val == 'delete') { + return false + } else if (val == 'edit') { + if (row.status == 'COMPLETED') { + return false + } else { + return true + } + } else { + return true + } +} + +function detailOnChange(field, cur, item) { + if (field == 'status') { + if (cur == '1') { + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false + DeviceMaintainOrderDetailRules.uncompleted = [required] + } else { + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + delete DeviceMaintainOrderDetailRules.uncompleted; + } + } +} + /** 初始化 **/ onMounted(async () => { getList()