You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

586 lines
12 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept'
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,validateNum100 } from '@/utils/validator'
import * as UserApi from '@/api/system/user'
const userListAll = await UserApi.getSimpleUserList()
const factoryList = await selectAllFactoryArea()
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: undefined })
// 表单校验
export const MoldMaintainOrderMainRules = reactive({
number: [required],
name: [required],
planNumber: [required],
moldNumber: [required],
factoryAreaNumber: [required],
status: [required],
type: [required],
concurrencyStamp: [required],
})
export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '保养单号',
field: 'number',
sort: 'custom',
isSearch: false,
table: {
width: '150',
fixed: 'left',
},
},
{
label: '保养计划单号',
field: 'planNumber',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
},
{
label: '模具',
field: 'deviceNumber',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
},
{
label: '工单所属周期',
field: 'executePeriod',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
},
{
label: '厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
isDetail: false,
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: String) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
}
},
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
placeholder: "请先选择设备"
},
},
detail: {
}
},
{
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail: true
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
form: {
component: 'Radio'
},
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
},
{
label: '描述',
field: 'describes',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: false,
isTable: false,
table: {
width: '150',
},
form: {
component: 'Select'
},
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
},
{
label: '接单人员',
field: 'maintenance',
sort: 'custom',
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
},
isSearch: false,
table: {
width: '150',
},
isDetail:false
},
{
label: '接单人员',
field: 'maintenanceName',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
isForm:false,
isDetail:true,
isTable:false,
},
{
label: '接单时间',
field: 'receiveTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
detail:{
dateFormat:'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '完成时间',
field: 'completionTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
detail:{
dateFormat:'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '审批人',
field: 'verifyer',
sort: 'custom',
isSearch: false,
isTableForm: false,
isForm: false,
isDetail: false,
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
},
},
{
label: '审批人',
field: 'verifyerDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '审批意见',
field: 'verifyContent',
sort: 'custom',
isSearch: false,
isTableForm: false,
isForm: false,
},
// {
// 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',
isForm: false,
table: {
width: 200,
fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const MoldMaintainOrderDetailRules = reactive({
concurrencyStamp: [required],
name: [required],
number: [required],
status: [required],
peoples: [
required,
{ validator: validateNum, message: '请输入正整数', trigger: 'blur' },
{ validator: validateNum100, message: '预估人数不得超出100', trigger: 'blur' },
],
estimatedMinutes: [
required,
{ validator: validateNum, message: '请输入正整数', trigger: 'blur' },
],
actualMinutes: [
required,
{ validator: validateNum, message: '请输入正整数', trigger: 'blur' },
],
chargePeoples: [required],
completionTime: [required],
engineer: [required],
uncompleted: [required],
contents: [required],
})
export const MoldMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '保养工单号',
field: 'number',
sort: 'custom',
isSearch: true,
form: {
component: 'Input',
componentProps: {
disabled: true,
}
},
},
{
label: '预估人数',
field: 'peoples',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
componentProps:{
disabled:true
}
},
isTable: true,
tableForm: {
type: 'InputNumber',
},
},
{
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
componentProps:{
disabled:true
}
},
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
},
{
label: '责任人多选',
field: 'chargePeoples',
sort: 'custom',
table: {
width: '150',
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple: true,
collapseTags: true,
collapseTagsTooltip: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item => cellValue?.includes(item.id)).map(cur => cur.name).join(',')
},
form: {
component: 'Select',
api: () => dutyUserList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
placeholder: "请选择责任人",
multiple: true,
},
}
},
{
label: '是否完成',
field: 'status',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
dictType: DICT_TYPE.JX_DETAILS_STATUS,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: false,
}
},
tableForm: {
type: 'Select',
componentProps: {
disabled: false,
}
},
}, {
label: '完成时间',
field: 'completionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
detail:{
dateFormat:'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '未完成原因',
field: 'uncompleted',
sort: 'custom',
isSearch: false,
isTable: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '保养内容',
field: 'contents',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
disabled: true,
}
}
},
{
label: '模具保养部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: false,
},
{
label: '备件',
field: 'itemNumbers1',
sort: 'custom',
table: {
},
tableForm: {
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
searchField: 'itemNumbers1',
searchTitle: '备件',
multiple: true,
searchAllSchemas: ItemSearchTable.allSchemas,
searchPage: ItemApi.getItemList,
tableSelectionChange: (value) => {
console.log('value', value)
// tableData.value.itemNumbers1 = value.map(item => item.itemNumber)
},
searchCondition: [{
key: 'number',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple: true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'number',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
}
},
isSearch: false,
},
{
label: '备件1',
field: 'itemNumbers',
sort: 'custom',
table: {
},
isForm: false,
isDetail: false,
isTable: false,
isSearch: false,
isTableForm: false,
},
{
label: '工程师确认',
field: 'engineer',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isDetail: false,
isTableForm: false,
}
]))