import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { ElTag } from 'element-plus' // 表单校验 export const WorkSchedulingRules = reactive({ }) export const WorkScheduling = useCrudSchemas(reactive([ { label: '主键', field: 'id', sort: 'custom', isSearch: false, isTable: false, isForm:false, isDetail:false, }, { label: '状态', field: 'status', sort: 'custom', isSearch: false, isTable: false, isForm:false, isDetail:false, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm:false, isDetail: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')] } }, }, { label: '计划编号', field: 'planMasterCode', sort: 'custom', isSearch: true, isForm: true, form:{ component: 'Input', componentProps: { placeholder: '请输入计划编号', disabled:true } } }, { label: '工单编号', field: 'schedulingCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '产品编号', field: 'productCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '车间', field: 'workroomCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '产线', field: 'lineCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '工艺路线', field: 'prouteCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '计划数量', field: 'planCount', sort: 'custom', isForm: false, }, { label: '完工数量', field: 'finishCount', sort: 'custom', isForm: false, }, { label: '合格数量', field: 'qualifiedCount', sort: 'custom', isForm: false, }, { label: '不合格数量', field: 'unqualifiedCount', sort: 'custom', isForm: false, }, { label: '执行状态', // field: 'flagDo', field: 'status', sort: 'custom', isSearch: true, isForm:false, dictType: DICT_TYPE.MESDO_STATUS, dictClass: 'string', form: { component: 'Select', }, }, { label: '当前工序', field: 'workingNode', sort: 'custom', isForm: false, }, { label: '加工序号', field: 'workSort', sort: 'custom', isForm: false, }, { label: '当前任务号', field: 'workingTaskSort', sort: 'custom', isForm: true, }, { label: '工单模式', field: 'formType', sort: 'custom', isForm: false, dictType: DICT_TYPE.MES_WORKBILL_MODEL, dictClass: 'string', form: { component: 'Select', }, }, { label: '操作', field: 'action', isForm: false, width: '220px', table: { width: 'wrapContent', fixed: 'right' } } ])) // 表单校验 export const WorkSchedulingDetailRules = reactive({ }) export const WorkSchedulingDetail = useCrudSchemas(reactive([ { label: '主键', field: 'id', sort: 'custom', isSearch: false, isTable: true, isForm:false, isDetail:false, }, { label: '状态', field: 'status', sort: 'custom', isSearch: false, isTable: false, isForm:false, isDetail:false, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm:false, isDetail: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')] } }, }, { label: '工单号', field: 'schedulingCode', sort: 'custom', isSearch: true, }, // { // label: '任务ID', // field: 'schedulingId', // sort: 'custom', // isSearch: true, // form: { // component: 'InputNumber', // value: 0 // }, // }, { label: '任务序号', field: 'taskSort', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '工序编号', field: 'nodeCode', sort: 'custom', isSearch: true, }, { label: '允许工位', field: 'workstationValidate', formatter: (_: Recordable, __: TableColumn, cellValue: String) => { return h( ElTag, { type:'primary' }, () => JSON.parse(cellValue).map((item: any) => { return '['+item.name+']' }).join('\r\n') ) }, sort: 'custom', }, { label: '允许设备', field: 'deviceValidate', formatter: (_: Recordable, __: TableColumn, cellValue: String) => { return h( ElTag, { type:'primary' }, () => JSON.parse(cellValue).map((item: any) => { return '['+item.name+']' }).join('\r\n') ) }, sort: 'custom', }, { label: '允许人员', field: 'personValidate', formatter: (_: Recordable, __: TableColumn, cellValue: String) => { return h( ElTag, { type:'primary' }, () => JSON.parse(cellValue).map((item: any) => { return '['+item.name+']' }).join('\r\n') ) }, sort: 'custom', }, { label: '计划数量', field: 'planCount', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '报工人', field: 'reportPerson', sort: 'custom', isSearch: true, }, { label: '报工数量', field: 'reportCount', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '报工方式', field: 'reportType', sort: 'custom', isSearch: true, form: { component: 'SelectV2' }, }, { label: '合格数', field: 'qualifiedCount', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '不合格数', field: 'unqualifiedCount', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '生产工位', field: 'receiveWorkstation', sort: 'custom', isSearch: true, }, { label: '生产设备', field: 'receiveDevice', sort: 'custom', isSearch: true, }, { label: '生产人', field: 'receivePerson', sort: 'custom', isSearch: true, }, // { // label: '生产物料', // field: 'materialValidate', // sort: 'custom', // }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false, isTable: false, isForm:false, isDetail:false, }, // { // label: '操作', // field: 'action', // isForm: false, // table: { // width: 150, // fixed: 'right' // } // } ]))