From 970ea4e6061c23f75e1367ad758703620cce85c4 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 7 Mar 2024 09:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=85=B7=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E9=97=AE=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=95=BF=E5=BA=A6=E7=B1=BB=E5=9E=8B=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eam/basic/fixedAssets/fixedAssets.data.ts | 44 +++++++++-- .../deviceAccounts/deviceAccounts.data.ts | 61 ++++++++------ .../device/deviceRepair/deviceRepair.data.ts | 6 +- src/views/eam/device/deviceRepair/index.vue | 10 +-- .../deviceSpotInspectionRecordMain.data.ts | 5 +- .../deviceInspectionMain.data.ts | 43 ++++++---- .../deviceMaintainOrderMain.data.ts | 79 +++++-------------- .../eam/device/devicemaintenancejob/index.vue | 4 +- src/views/eam/mold/moldRepair/index.vue | 16 +++- 9 files changed, 154 insertions(+), 114 deletions(-) diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index 07518cf..1f3a90c 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -1,18 +1,50 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' // 表单校验 export const FixedAssetsRules = reactive({ - name: [required], - locationNumber: [required], - supplierNumber: [required], - purchasePrice: [required], - qty: [required] + name: [ + required, + { max: 50, message: '不得超过50个字符', trigger: 'blur' }, + ], + accountingUnit: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + specifications: [ + { max: 50, message: '不得超过20个字符', trigger: 'blur' }, + ], + locationNumber: [ + required, + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + purchaseDept: [ + { max: 50, message: '不得超过20个字符', trigger: 'blur' }, + ], + supplierNumber: [ + required, + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + purchasePrice: [ + required, + { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} + ], + manageDept: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + unit: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + qty: [ + required, + { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} + ], + }) export const FixedAssets = useCrudSchemas(reactive([ { - label: '编号唯一标识', + label: '固定资产编号', field: 'number', sort: 'custom', table: { diff --git a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts index fe7b0f6..1998ec6 100644 --- a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts +++ b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts @@ -1,17 +1,47 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept' +import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' const factoryList = await selectAllFactoryArea() // 表单校验 export const DeviceAccountsRules = reactive({ - // number: [required], - name: [required], - // factoryAreaNumber: [required], - // purchaseTime: [required], - // deptId: [required], - // purchaser: [required], - // supplierNumber: [required], - concurrencyStamp: [required] + name: [ + required, + { max: 50, message: '不得超过50个字符', trigger: 'blur' }, + ], + specification: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + type: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + status: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + power: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} + ], + describes: [ + { max: 600, message: '不得超过600个字符', trigger: 'blur' }, + ], + factoryAreaNumber: [ + required, + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + purchaseDept: [ + { max: 100, message: '不得超过100个字符', trigger: 'blur' }, + ], + purchaser: [ + { max: 300, message: '不得超过300个字符', trigger: 'blur' }, + ], + supplierNumber: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + ], + purchasePrice: [ + { max: 20, message: '不得超过20个字符', trigger: 'blur' }, + { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} + ], }) export const DeviceAccounts = useCrudSchemas(reactive([ @@ -201,21 +231,6 @@ export const DeviceAccounts = useCrudSchemas(reactive([ width: '150', }, }, - { - label: '创建时间', - field: 'createTime', - sort: 'custom', - formatter: dateFormatter, - isForm: false - }, - - { - label: '是否可用', - field: 'available', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - }, { label: '维修状态', diff --git a/src/views/eam/device/deviceRepair/deviceRepair.data.ts b/src/views/eam/device/deviceRepair/deviceRepair.data.ts index f29e3f9..6273ceb 100644 --- a/src/views/eam/device/deviceRepair/deviceRepair.data.ts +++ b/src/views/eam/device/deviceRepair/deviceRepair.data.ts @@ -3,6 +3,7 @@ import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' +import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' // 邮箱账号的列表 const factoryList = await selectAllFactoryArea() const deviceList = ref([]); @@ -18,7 +19,10 @@ export const DeviceRepairRules = reactive({ faultType: [required], type: [required], available: [required], - concurrencyStamp: [required], + declarerPhone: [ + required, + { validator:validateHanset, message: '输入手机号格式不正确', trigger: 'blur'} + ] // result: [required], }) diff --git a/src/views/eam/device/deviceRepair/index.vue b/src/views/eam/device/deviceRepair/index.vue index 47b71ce..5ec5f88 100644 --- a/src/views/eam/device/deviceRepair/index.vue +++ b/src/views/eam/device/deviceRepair/index.vue @@ -293,11 +293,12 @@ function handleBackout(row) { } const onChange = (field, cur, item) => { - if (field == 'factoryAreaNumber') { + // if (field == 'factoryAreaNumber') { - // 获取当前的工厂区域编号 - DeviceRepair.allSchemas.formSchema - } + // // 获取当前的工厂区域编号 + // DeviceRepair.allSchemas.formSchema + // } + } @@ -309,7 +310,6 @@ onMounted(async () => { }) - diff --git a/src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts b/src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts index ebeff46..e328c92 100644 --- a/src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts +++ b/src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts @@ -7,10 +7,12 @@ import { selecUserByType } from '@/api/system/dept' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' +import * as UserApi from '@/api/system/user' // 邮箱账号的列表 const factoryList = await selectAllFactoryArea() const moldList = await MoldAccountsApi.getMoldAccountsNoPage({}) const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }) +const userListAll = await UserApi.getSimpleUserList() const moldListNoPage = await MoldAccountsApi.getMoldAccountsAllNoPage({}) const moldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD') const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE) @@ -65,9 +67,8 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive userList, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userList.find((account) => account.id == cellValue)?.name + return userListAll.find((account) => account.id == cellValue)?.nickname }, form: { component: 'Select', diff --git a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts index 116e2d6..1ede60f 100644 --- a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts @@ -1,28 +1,36 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { selectAllFactoryArea } from '@/api/system/dept' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' -import { useUserStore } from '@/store/modules/user' import { selecUserByType } from '@/api/system/dept' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' import { dateFormatter } from '@/utils/formatTime' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' -const userStore = useUserStore() +import { validateHanset, validateNumDot, validateEmail } from '@/utils/validator' +import * as UserApi from '@/api/system/user' +const userListAll = await UserApi.getSimpleUserList() 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 repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE') // 表单校验 export const DeviceInspectionMainRules = reactive({ number: [required], - // maintenanceNumber: [required], - deviceNumber: [required], - factoryAreaNumber: [required], + deviceNumber: [ + required, + ], + factoryAreaNumber: [ + required, + ], + describes: [ + ], + maintenancePhone: [ + { max: 11, message: '不得超过11个字符', trigger: 'blur' }, + { validator:validateHanset, message: '请输入数字格式', trigger: 'blur'} + ], status: [required], type: [required], - concurrencyStamp: [required], faultType: [required], }) @@ -141,16 +149,16 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ } }, { - label: '维修人', + label: '检修人', field: 'maintenance', sort: 'custom', isSearch: false, table: { width: '150', }, - api: () => userList, + api: () => userListAll, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userList.find((account) => account.id == cellValue)?.name + return userListAll.find((account) => account.id == cellValue)?.nickname }, search: { show: true, @@ -172,15 +180,18 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ labelField: 'name', valueField: 'id' }, - placeholder: "请选择维修人" + placeholder: "请选择检修人" }, } }, - // { - // label: '维修人联系电话', - // field: 'maintenancePhone', - // sort: 'custom', - // }, + { + label: '检修人联系电话', + field: 'maintenancePhone', + sort: 'custom', + table: { + width: '150', + }, + }, { label: '状态', field: 'status', diff --git a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts index 940b604..5fd941a 100644 --- a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts +++ b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts @@ -17,7 +17,6 @@ export const DeviceMaintainOrderMainRules = reactive({ factoryAreaNumber: [required], status: [required], type: [required], - concurrencyStamp: [required], }) export const DeviceMaintainOrderMain = useCrudSchemas(reactive([ @@ -48,6 +47,24 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive([ width: '150', }, }, + { + label: '描述', + field: 'describes', + sort: 'custom', + isSearch: true, + table: { + width: '150', + }, + }, + { + label: '工单所属周期', + field: 'executePeriod', + sort: 'custom', + isSearch: false, + table: { + width: '150', + }, + }, { label: '厂区编号', field: 'factoryAreaNumber', @@ -131,8 +148,8 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive([ }, }, { - label: '工程师', - field: 'engineer', + label: '接单人员', + field: 'maintenance', sort: 'custom', isSearch: false, table: { @@ -143,24 +160,6 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive([ value: 0 }, }, - - { - label: '指派时间', - field: 'assignTime', - sort: 'custom', - isSearch: false, - table: { - width: '150', - }, - formatter: dateFormatter, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - }, - }, { label: '完成时间', field: 'finishedTime', @@ -195,44 +194,6 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive([ } }, }, - - // { - // label: '创建时间', - // field: 'createTime', - // sort: 'custom', - // formatter: dateFormatter, - // isSearch: false, - // search: { - // component: 'DatePicker', - // componentProps: { - // valueFormat: 'YYYY-MM-DD HH:mm:ss', - // type: 'daterange', - // defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] - // } - // }, - // isForm: false, - // }, - // { - // label: '地点ID', - // field: 'siteId', - // sort: 'custom', - // isSearch: false, - // }, - // { - // label: '是否可用', - // field: 'available', - // sort: 'custom', - // isSearch: false, - // }, - // { - // label: '并发乐观锁', - // field: 'concurrencyStamp', - // sort: 'custom', - // form: { - // component: 'InputNumber', - // value: 0 - // }, - // }, { label: '操作', field: 'action', diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index 80ca9c5..fd9e1e9 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -193,7 +193,9 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ defaultButtons.defaultAddBtn({ - hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') + hide: !userStore?.userSelfInfo?.posts?.some((item) => { + return item.code == 'worker' + }) }), // 新增 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 diff --git a/src/views/eam/mold/moldRepair/index.vue b/src/views/eam/mold/moldRepair/index.vue index d141b00..038ee4e 100644 --- a/src/views/eam/mold/moldRepair/index.vue +++ b/src/views/eam/mold/moldRepair/index.vue @@ -291,7 +291,21 @@ onMounted(async () => { }) const onChange = (field, cur, item) => { - + if (field == 'declarerPhone') { + if (cur != null && cur != '') { + if(validatePhoneNumber(cur)) { + console.log("手机号码格式正确"); + } else { + message.error('手机号码格式不正确!') + } + } + } +} + +function validatePhoneNumber(phoneNumber) { + // 正则表达式,用于校验手机号码格式 + const reg = /^1[3-9]\d{9}$/; + return reg.test(phoneNumber); }