From 138cd9363e1f413633bebff4742821e7ebcd368e Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 7 Feb 2024 18:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=85=BB=E5=B7=A5=E5=8D=95=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eam/device/deviceInspectionMain/index.ts | 2 +- .../device/deviceMaintainOrderMain/index.ts | 5 + src/components/Detail/src/Detail.vue | 131 +++++++++++++----- .../eam/device/deviceInspectionMain/index.vue | 13 +- .../deviceMaintainOrderMain.data.ts | 9 +- .../device/deviceMaintainOrderMain/index.vue | 11 +- 6 files changed, 124 insertions(+), 47 deletions(-) diff --git a/src/api/eam/device/deviceInspectionMain/index.ts b/src/api/eam/device/deviceInspectionMain/index.ts index 232d254..3f908cc 100644 --- a/src/api/eam/device/deviceInspectionMain/index.ts +++ b/src/api/eam/device/deviceInspectionMain/index.ts @@ -54,4 +54,4 @@ export const exportDeviceInspectionMain = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/device-inspection-main/get-import-template' }) -} \ No newline at end of file +} diff --git a/src/api/eam/device/deviceMaintainOrderMain/index.ts b/src/api/eam/device/deviceMaintainOrderMain/index.ts index 44f7ba6..46ce24a 100644 --- a/src/api/eam/device/deviceMaintainOrderMain/index.ts +++ b/src/api/eam/device/deviceMaintainOrderMain/index.ts @@ -57,4 +57,9 @@ export const exportDeviceMaintainOrderMain = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/device-maintain-order-main/get-import-template' }) +} + +// 保养接单 +export const orderClick = (id: number) => { + return request.get({ url: '/eam/device-maintain-order-main/orderClick?id=' + id }) } \ No newline at end of file diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index e9eebb3..40478d6 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -1,14 +1,28 @@ @@ -283,11 +348,11 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: setBeiJian() let detailButtonAdd: any = [] - detailButtonAdd = props.isShowAddBtn ? [ + detailButtonAdd = props.isShowAddBtn?[ defaultButtons.defaultAddBtn({ hide: isShowMainButton(row, ['1']) }) - ] : [] + ]:[] HeadButttondata.value = [...detailButtonAdd] // 动态显示操作列按钮 if (!props.detailButtonIsShow) { @@ -374,8 +439,8 @@ const buttonBaseClick = (val, item) => { // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { - console.log(val) - console.log(row) + console.log(val) + console.log(row) if (val == 'edit') { // 编辑 openForm('update', row) @@ -397,7 +462,7 @@ const openForm = async (type: string, row?: number) => { let isChargePeoples = false let isItemNUmbersTrue = false isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances') - isChargePeoples = detailAllSchemasRef.value.tableColumns.some( + isChargePeoples = detailAllSchemasRef.value.tableColumns.some( (item) => item.field == 'chargePeoples' ) isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some( @@ -408,7 +473,7 @@ const openForm = async (type: string, row?: number) => { row.maintenances = row.maintenances.split(',').map(Number) } } - if (isChargePeoples) { + if(isChargePeoples) { if (row.chargePeoples && isString(row.chargePeoples)) { row.chargePeoples = row.chargePeoples.split(',').map(Number) } @@ -453,7 +518,7 @@ const handleDelete = async (id: number) => { await getList() updateKey.value += 1 setBeiJian() - } catch { } + } catch {} } // 筛选提交 const searchFormClick = async (searchData) => { diff --git a/src/views/eam/device/deviceInspectionMain/index.vue b/src/views/eam/device/deviceInspectionMain/index.vue index fe4fd93..becb4aa 100644 --- a/src/views/eam/device/deviceInspectionMain/index.vue +++ b/src/views/eam/device/deviceInspectionMain/index.vue @@ -55,18 +55,22 @@ - + :isSearchTableItem="true" + /> { // 查询页面返回——详情 const searchTableSuccessDetail = (formField, searchField, val, formRef) => { - debugger nextTick(() => { const setV = {} setV[formField] = val[0][searchField] @@ -412,13 +415,11 @@ const handleDeleteTable = (item, index) => { // 主子数据 提交 const submitForm = async (formType, data) => { - debugger data.subList = tableData.value.map((item) => { item.chargePeoples = item.chargePeoples.join(','); return item; }) // 拼接子表数据参数 console.log(data.subList) - debugger try { if (formType === 'create') { await DeviceInspectionMainApi.createDeviceInspectionMain(data) diff --git a/src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts b/src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts index 71cef95..a500a68 100644 --- a/src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts +++ b/src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts @@ -10,9 +10,9 @@ import * as ItemApi from '@/api/eam/basic/item' const userStore = useUserStore() const factoryList = await selectAllFactoryArea() const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) -const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }) -const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined }) -const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 2}) +const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 1 }) +const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: undefined }) +const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 2}) const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE') // 表单校验 @@ -310,7 +310,8 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive([ }, api: () => dutyUserList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',') + + return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',') }, form: { component: 'Select', diff --git a/src/views/eam/device/deviceMaintainOrderMain/index.vue b/src/views/eam/device/deviceMaintainOrderMain/index.vue index 2a7daa6..d47d46d 100644 --- a/src/views/eam/device/deviceMaintainOrderMain/index.vue +++ b/src/views/eam/device/deviceMaintainOrderMain/index.vue @@ -82,7 +82,7 @@ @detailOpenForm="detailOpenForm" :detailValidate="detailValidate" @detailSubmitForm="detailSubmitForm" - :isSearchTableItem="true" + :isSearchTableItem="true" /> @@ -222,9 +222,11 @@ const butttondata = (row) => { return [ // defaultButtons.mainListEditBtn(null), // 编辑 defaultButtons.acceptOrderBtn({ + hide: !( row.status == 'PENDING' && - userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') + (userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') || + userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) ) }), // 接单 // defaultButtons.turnOrderBtn({ @@ -340,7 +342,10 @@ const searchFormClick = (searchData) => { // 接单 function acceptOrder(row) { - DeviceMaintainOrderMainApi.orderStepChange(row) + DeviceMaintainOrderMainApi.orderClick(row.id).then(() => { + message.success('接单成功') + getList(); + }); } // 转办 function turnOrder() {}