From 0bed62c8ff8c35094ef04c7ee7bcc3df7ac75fef Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 21 Mar 2024 08:33:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail/src/Detail.vue | 1 - .../device/deviceRepair/deviceRepair.data.ts | 10 ++++ .../deviceInspectionMain.data.ts | 56 ++++++++++--------- .../deviceMaintenanceMain.data.ts | 9 ++- .../eam/device/devicemaintenancejob/index.vue | 8 +-- .../eam/mold/moldRepair/moldRepair.data.ts | 7 +++ .../moldInspectionMain.data.ts | 11 +++- .../eam/mold/moldmaintenancejob/index.vue | 8 +-- .../moldMaintenanceMain.data.ts | 6 +- 9 files changed, 74 insertions(+), 42 deletions(-) diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index 186f463..85b8ae9 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -496,7 +496,6 @@ const openForm = async (type: string, row?: number) => { } } } - if (await props.openFormCallBack) { props.openFormCallBack(type, row, masterParmas.value, () => { formRef.value.open(type, row, masterParmas.value) diff --git a/src/views/eam/device/deviceRepair/deviceRepair.data.ts b/src/views/eam/device/deviceRepair/deviceRepair.data.ts index c9aec40..b7b9e3e 100644 --- a/src/views/eam/device/deviceRepair/deviceRepair.data.ts +++ b/src/views/eam/device/deviceRepair/deviceRepair.data.ts @@ -120,6 +120,16 @@ export const DeviceRepair = useCrudSchemas(reactive([ formatter: (_: Recordable, __: TableColumn, cellValue: number) => { return deviceListNoPage.find((account) => account.number == cellValue)?.name }, + search: { + component: 'Select', + componentProps: { + options: deviceListNoPage, + optionsAlias: { + labelField: 'name', + valueField: 'number' + }, + }, + }, form: { component: 'Select', componentProps: { diff --git a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts index ecddefa..9d50652 100644 --- a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts @@ -50,7 +50,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ width: '150', fixed: 'left', }, - isSearch: true, + isSearch: false, isForm: false, }, { @@ -60,12 +60,12 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ table: { width: '150', }, + isSearch: false, api: () => repairList, // formatter: (_: Recordable, __: TableColumn, cellValue: number) => { // return repairList.find((account) => account.number == cellValue)?.name // }, search: { - show: true, component: 'Select', api: () => repairList, componentProps: { @@ -87,76 +87,77 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ } }, { - label: '设备', - field: 'deviceNumber', + label: '厂区', + field: 'factoryAreaNumber', sort: 'custom', - isSearch: true, + isSearch: false, + isDetail: false, table: { width: '150', }, - api: () => deviceList, + api: () => factoryList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return deviceListAll.find((account) => account.number == cellValue)?.name + return factoryList.find((account) => account.id == cellValue)?.name }, search: { show: true, component: 'Select', - api: () => deviceList, + api: () => factoryList, componentProps: { optionsAlias: { labelField: 'name', - valueField: 'number' + valueField: 'id' } } }, form: { component: 'Select', - api: () => deviceList, + api: () => factoryList, componentProps: { + disabled: true, optionsAlias: { labelField: 'name', - valueField: 'number' + valueField: 'id' }, + placeholder: "请选择设备" }, } }, { - label: '厂区', - field: 'factoryAreaNumber', + label: '设备', + field: 'deviceNumber', sort: 'custom', - isSearch: false, - isDetail: false, + isSearch: true, table: { width: '150', }, - api: () => factoryList, + api: () => deviceList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return factoryList.find((account) => account.id == cellValue)?.name + return deviceListAll.find((account) => account.number == cellValue)?.name }, search: { show: true, component: 'Select', - api: () => factoryList, + api: () => deviceList, componentProps: { optionsAlias: { labelField: 'name', - valueField: 'id' + valueField: 'number' } } }, form: { component: 'Select', - api: () => factoryList, + api: () => deviceList, componentProps: { - disabled: true, optionsAlias: { labelField: 'name', - valueField: 'id' + valueField: 'number' }, - placeholder: "请选择设备" }, } }, + { label: '检修人', field: 'maintenance', @@ -359,9 +360,12 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ valueField: 'id' } }, - api: () => dutyUserList, - formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',') + formatter: (_: Recordable, __: TableColumn, cellValue) => { + const cellValueList = cellValue?.split(','); + return userListAll + .filter(item => cellValueList.includes(item.id.toString())) + .map(item => item.nickname) + .join(','); }, form: { component: 'Select', diff --git a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts index 07c469c..8d0aba3 100644 --- a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts @@ -345,12 +345,15 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([ }, { label: '维修人', - field: 'maintenance', + field: 'maintenances', sort: 'custom', isDetail: false, - api: () => userListAll, formatter: (_: Recordable, __: TableColumn, cellValue) => { - return userListAll.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.nickname)?.join(',') + const cellValueList = cellValue ? cellValue.split(',') : []; + return userListAll + .filter(item => cellValueList.includes(item.id.toString())) + .map(item => item.nickname) + .join(','); }, tableForm: { type: 'Select', diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index b391c8f..1df9aa0 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -695,7 +695,7 @@ const detailValidate = (data) => { } } // 子表提交 -const detailSubmitForm= async (formType,data,formRef,tableList) => { +const detailSubmitForm = async (formType, data, formRef, tableList) => { try { let data1 = { id:data.id, @@ -737,7 +737,7 @@ const detailSubmitForm= async (formType,data,formRef,tableList) => { const openFormCallBack = (type, row, masterParmas, callback) => { if (operatRecord.value.type == 'TECH') { DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'TECH', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); @@ -746,7 +746,7 @@ const openFormCallBack = (type, row, masterParmas, callback) => { }) } else if (operatRecord.value.type == 'DEVICE') { DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); @@ -755,7 +755,7 @@ const openFormCallBack = (type, row, masterParmas, callback) => { }) } else if (operatRecord.value.type == 'MOLD') { DeviceMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); diff --git a/src/views/eam/mold/moldRepair/moldRepair.data.ts b/src/views/eam/mold/moldRepair/moldRepair.data.ts index d7d96c7..8380ff6 100644 --- a/src/views/eam/mold/moldRepair/moldRepair.data.ts +++ b/src/views/eam/mold/moldRepair/moldRepair.data.ts @@ -2,6 +2,9 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept' import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts' +import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' +import * as UserApi from '@/api/system/user' +const userListAll = await UserApi.getSimpleUserList() // 邮箱账号的列表 @@ -21,6 +24,10 @@ export const MoldRepairRules = reactive({ type: [required], available: [required], concurrencyStamp: [required], + declarerPhone: [ + required, + { validator:validateHanset, message: '输入手机号格式不正确', trigger: 'blur'} + ] // result: [required], }) diff --git a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts index dd51c75..bbfd416 100644 --- a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts +++ b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts @@ -7,8 +7,10 @@ import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain' import { dateFormatter } from '@/utils/formatTime' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' +import * as UserApi from '@/api/system/user' import { validateHanset, validateNumDot, validateNum, validateEmail } from '@/utils/validator' const userStore = useUserStore() +const userListAll = await UserApi.getSimpleUserList() const factoryList = await selectAllFactoryArea() const moldList = await MoldAccountsApi.getMoldAccountsNoPage({}) const moldListAll = await MoldAccountsApi.getMoldAccountsAllNoPage({}) @@ -56,12 +58,12 @@ export const MoldInspectionMain = useCrudSchemas(reactive([ table: { width: '150', }, + isSearch: false, api: () => repairList, // formatter: (_: Recordable, __: TableColumn, cellValue: number) => { // return repairList.find((account) => account.number == cellValue)?.name // }, search: { - show: false, component: 'Select', api: () => repairList, componentProps: { @@ -352,9 +354,12 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ valueField: 'id' } }, - api: () => dutyUserList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',') + const cellValueList = cellValue ? cellValue.split(',') : []; + return userListAll + .filter(item => cellValueList.includes(item.id.toString())) + .map(item => item.nickname) + .join(','); }, form: { component: 'Select', diff --git a/src/views/eam/mold/moldmaintenancejob/index.vue b/src/views/eam/mold/moldmaintenancejob/index.vue index 11c9eff..7092fa9 100644 --- a/src/views/eam/mold/moldmaintenancejob/index.vue +++ b/src/views/eam/mold/moldmaintenancejob/index.vue @@ -299,7 +299,7 @@ const isShowMainButton = (row, val) => { // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED') && isReceiver(row.maintenance)}), // 编辑 + defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED' && isReceiver(row.maintenance)) }), // 编辑 defaultButtons.acceptOrderBtn({ hide: !( row.status == 'PENDING' && @@ -602,7 +602,7 @@ const detailSubmitForm= async (formType,data,getList,formRef,tableList) => { const openFormCallBack = (type, row, masterParmas, callback) => { if (operatRecord.value.type == 'TECH') { MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'TECH', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); @@ -611,7 +611,7 @@ const openFormCallBack = (type, row, masterParmas, callback) => { }) } else if (operatRecord.value.type == 'DEVICE') { MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); @@ -620,7 +620,7 @@ const openFormCallBack = (type, row, masterParmas, callback) => { }) } else if (operatRecord.value.type == 'MOLD') { MoldMaintenanceDetail.allSchemas.formSchema.forEach((item) => { - if (item.field == 'maintenance') { + if (item.field == 'maintenances') { selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }).then(response => { item.componentProps.options = response callback(); diff --git a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts index fcd1524..4a0a5a0 100644 --- a/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts +++ b/src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts @@ -302,7 +302,11 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive([ sort: 'custom', api: () => userListAll, formatter: (_: Recordable, __: TableColumn, cellValue) => { - return userListAll.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.nickname).join(',') + const cellValueList = cellValue ? cellValue.split(',') : []; + return userListAll + .filter(item => cellValueList.includes(item.id.toString())) + .map(item => item.nickname) + .join(','); }, tableForm: { type: 'Select',