From 1088c8b5a193291c2b39dc487cf2ab144e995f45 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Thu, 21 Mar 2024 10:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E4=BF=AE=E5=92=8C=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E5=B7=A5=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/validator.ts | 12 ++++ .../deviceInspectionMain.data.ts | 59 ++++++++++--------- .../deviceMaintainOrderMain.data.ts | 4 +- .../eam/device/devicemaintainjob/index.vue | 6 +- .../deviceMaintenanceMain.data.ts | 1 + .../eam/device/devicemaintenancejob/index.vue | 4 ++ .../moldInspectionMain.data.ts | 7 ++- .../moldMaintainOrderMain.data.ts | 3 +- 8 files changed, 61 insertions(+), 35 deletions(-) diff --git a/src/utils/validator.ts b/src/utils/validator.ts index 60671f7..20ec1a6 100644 --- a/src/utils/validator.ts +++ b/src/utils/validator.ts @@ -208,6 +208,17 @@ export function validateNum(rule, value, callback) { callback() } } +export function validateNum100(rule, value, callback) { + if (value) { + if (value<=100) { + callback() + } else { + callback(new Error('预估人数不得超出100')) + } + } else { + callback() + } +} //数字和小数点 export function validateNumDot(rule, value, callback) { @@ -749,6 +760,7 @@ export default { validateChinese, validatePostCode, validateNum, + validateNum100, validateNumDot, validateZYS, validateOrganization, diff --git a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts index 9d50652..9337efb 100644 --- a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts @@ -6,7 +6,7 @@ import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMai import { dateFormatter } from '@/utils/formatTime' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' -import { validateHanset, validateInteger, validateNum } from '@/utils/validator' +import { validateHanset, validateNum, validateNum100 } from '@/utils/validator' import * as UserApi from '@/api/system/user' import { useUserStore } from '@/store/modules/user' const userStore = useUserStore() @@ -33,9 +33,9 @@ export const DeviceInspectionMainRules = reactive({ { max: 200, message: '不得超过200个字符', trigger: 'blur' }, ], maintenancePhone: [ - { validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'} + { validator: validateHanset, message: '输入电话格式不正确', trigger: 'blur' } ], - + status: [required], type: [required], faultType: [required], @@ -157,7 +157,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ }, } }, - + { label: '检修人', field: 'maintenance', @@ -268,7 +268,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ dictType: DICT_TYPE.FAULT_TYPE, dictClass: 'string', form: { - value: 'PM', + value: 'PM', component: 'Select', componentProps: { // disabled: true, @@ -306,27 +306,32 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ width: 150, fixed: 'right' }, - isDetail:false + isDetail: false } ])) - + // 表单校验 export const DeviceInspectionDetailRules = reactive({ - chargePeoples:[ + chargePeoples: [ required, ], - estimatedMinutes:[ + peoples: [ required, - { validator:validateNum, message: '请输入正整数', trigger: 'blur'}, + { validator: validateNum, message: '请输入正整数', trigger: 'blur' }, + { validator: validateNum100, message: '预估人数不得超出100', trigger: 'blur' }, + ], + estimatedMinutes: [ + required, + { validator: validateNum, message: '请输入正整数', trigger: 'blur' }, ], number: [required], actualMinutes: [ - { validator:validateNum, message: '请输入正整数', trigger: 'blur'}, + { validator: validateNum, message: '请输入正整数', trigger: 'blur' }, ], maintenance: [required], - uncompleted :[ - { required:true, message: '该项为必填项', trigger: 'blur'} + uncompleted: [ + { required: true, message: '该项为必填项', trigger: 'blur' } ], }) @@ -352,9 +357,9 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ tableForm: { type: 'Select', initOptions: userList, - multiple:true, - collapseTags:true, - collapseTagsTooltip:true, + multiple: true, + collapseTags: true, + collapseTagsTooltip: true, optionsAlias: { labelField: 'name', valueField: 'id' @@ -395,7 +400,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ }, }, { - label: '人数', + label: '预估人数', field: 'peoples', sort: 'custom', table: { @@ -410,7 +415,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ type: 'InputNumber', }, }, - + { label: '实际分钟', field: 'actualMinutes', @@ -460,7 +465,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ } }, }, - + { label: '完成时间', field: 'completionTime', @@ -502,12 +507,12 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ sort: 'custom', table: { }, - tableForm:{ + tableForm: { isInpuFocusShow: true, // 开启查询弹窗 searchListPlaceholder: '请选择备件', searchField: 'itemNumbers1', searchTitle: '备件', - multiple:true, + multiple: true, searchAllSchemas: ItemSearchTable.allSchemas, searchPage: ItemApi.getItemList, tableSelectionChange: (value) => { @@ -528,9 +533,9 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ searchListPlaceholder: '请选择备件', // 输入框占位文本 searchField: 'itemNumbers1', // 查询弹窗赋值字段 searchTitle: '备件', // 查询弹窗标题 - multiple:true, - searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 - searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 + multiple: true, + searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类 + searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法 searchCondition: [{ key: 'number', value: 'deviceNumber', @@ -547,9 +552,9 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ sort: 'custom', table: { }, - isForm:false, - isDetail:false, - isTable:false, + isForm: false, + isDetail: false, + isTable: false, isSearch: false, isTableForm: false, }, diff --git a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts index 7a80e5a..3f2d6fb 100644 --- a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts +++ b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts @@ -4,7 +4,7 @@ import { selecUserByType } from '@/api/system/dept' import { dateFormatter } from '@/utils/formatTime' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' -import { validateHanset, validateInteger, validateNum } from '@/utils/validator' +import { validateNum100, validateNum } from '@/utils/validator' const factoryList = await selectAllFactoryArea() const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }) const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: null }) @@ -226,6 +226,8 @@ export const DeviceMaintainOrderDetailRules = reactive({ required, { validator:validateNum, message: '请输入正整数', trigger: 'blur'}, + { validator:validateNum100, message: '预估人数不得超出100', trigger: 'blur'}, + ], estimatedMinutes: [ diff --git a/src/views/eam/device/devicemaintainjob/index.vue b/src/views/eam/device/devicemaintainjob/index.vue index ec353f4..a49dfa1 100644 --- a/src/views/eam/device/devicemaintainjob/index.vue +++ b/src/views/eam/device/devicemaintainjob/index.vue @@ -507,11 +507,7 @@ function buttonControllFunction(row, val) { return true } } else if(val == 'add') { - if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance)) { - return false - } else { - return true - } + return false } else { return true } diff --git a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts index 8d0aba3..a7dd310 100644 --- a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts @@ -182,6 +182,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ formatter: (_: Recordable, __: TableColumn, cellValue: number) => { return deviceMoldTypeList.find((account) => account.value == cellValue)?.label }, + dictType: DICT_TYPE.APP_DEVICE_MOLD_TYPE, isSearch: true, search: { component: 'Select', diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index 1df9aa0..58929f4 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -479,6 +479,10 @@ const openFormSec = async (type: string, row?: any) => { /** 详情操作 */ const detailRef = ref() const openDetail = (row: any, titleName: any, titleValue: any) => { + + const deviceMoldType = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE) + row.typeName = deviceMoldType.find((account) => account.value == row.type)?.label + console.log(row) operatRecord.value = row; detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintenanceMain') } diff --git a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts index bbfd416..d10cc57 100644 --- a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts +++ b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts @@ -8,7 +8,7 @@ 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' +import { validateHanset, validateNum, validateNum100 } from '@/utils/validator' const userStore = useUserStore() const userListAll = await UserApi.getSimpleUserList() const factoryList = await selectAllFactoryArea() @@ -311,6 +311,11 @@ export const MoldInspectionDetailRules = reactive({ chargePeoples:[ required, ], + peoples: [ + required, + { validator: validateNum, message: '请输入正整数', trigger: 'blur' }, + { validator: validateNum100, message: '预估人数不得超出100', trigger: 'blur' }, + ], estimatedMinutes:[ required, { validator:validateNum, message: '请输入正整数', trigger: 'blur'} diff --git a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts index e5ee530..329adb4 100644 --- a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts +++ b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts @@ -4,7 +4,7 @@ import { selecUserByType } from '@/api/system/dept' import { dateFormatter } from '@/utils/formatTime' import { ItemSearchTable } from '../../basic/item/item.data' import * as ItemApi from '@/api/eam/basic/item' -import { validateNum } from '@/utils/validator' +import { validateNum,validateNum100 } from '@/utils/validator' const factoryList = await selectAllFactoryArea() const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 }) const dutyUserList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: undefined }) @@ -286,6 +286,7 @@ export const MoldMaintainOrderDetailRules = reactive({ peoples: [ required, { validator: validateNum, message: '请输入正整数', trigger: 'blur' }, + { validator: validateNum100, message: '预估人数不得超出100', trigger: 'blur' }, ], estimatedMinutes: [ required,