Browse Source

修复模具台账问题,添加部分长度类型校验

master
ljlong_2630 9 months ago
parent
commit
970ea4e606
  1. 44
      src/views/eam/basic/fixedAssets/fixedAssets.data.ts
  2. 61
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  3. 6
      src/views/eam/device/deviceRepair/deviceRepair.data.ts
  4. 10
      src/views/eam/device/deviceRepair/index.vue
  5. 5
      src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts
  6. 43
      src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts
  7. 79
      src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts
  8. 4
      src/views/eam/device/devicemaintenancejob/index.vue
  9. 14
      src/views/eam/mold/moldRepair/index.vue

44
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<CrudSchema[]>([
{
label: '编号唯一标识',
label: '固定资产编号',
field: 'number',
sort: 'custom',
table: {

61
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<CrudSchema[]>([
@ -201,21 +231,6 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
},
{
label: '维修状态',

6
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],
})

10
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 () => {
})
</script>

5
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<CrudSchema
table: {
width: '150',
},
api: () => 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',

43
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<CrudSchema[]>([
}
},
{
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<CrudSchema[]>([
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择修人"
placeholder: "请选择修人"
},
}
},
// {
// label: '维修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{
label: '检修人联系电话',
field: 'maintenancePhone',
sort: 'custom',
table: {
width: '150',
},
},
{
label: '状态',
field: 'status',

79
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<CrudSchema[]>([
@ -48,6 +47,24 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
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<CrudSchema[]>([
},
},
{
label: '工程师',
field: 'engineer',
label: '接单人员',
field: 'maintenance',
sort: 'custom',
isSearch: false,
table: {
@ -143,24 +160,6 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
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<CrudSchema[]>([
}
},
},
// {
// 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',

4
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), //

14
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);
}
</script>

Loading…
Cancel
Save