import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as UserApi from '@/api/system/user' import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data' import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts' import * as ProductionlineApi from '@/api/wms/productionline' import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data' import * as WorkshopApi from '@/api/wms/workshop' import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' import * as ProcessApi from '@/api/wms/process' import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data' import * as WorkStationApi from '@/api/wms/workstation' import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data' export interface User { id: number, nickname: string } const userList = ref([]) userList.value = await UserApi.getSimpleUserList() // 表单校验 export const EquipmentShutdownRules = reactive({ equipmentCode: [required], operationDate: [required], concurrencyStamp: [required] }) export const EquipmentShutdown = useCrudSchemas(reactive([ { label: '设备编码', field: 'equipmentCode', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择设备', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '设备信息', // 查询弹窗标题 searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类 searchPage: EquipmentAccountsApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } }, }, { label: '操作日期', field: 'operationDate', 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' } } }, { label: '操作人', field: 'operationer', sort: 'custom', isSearch: true, form: { component: 'Select', componentProps: { // 假设deptList是部门数据列表 options: userList.value, optionsAlias: { valueField: 'id', labelField: 'nickname' }, disabled: false, placeholder: "请选择操作人", filterable: true, multiple: false, } } }, // { // label: '所属厂区编号', // field: 'factoryAreaCode', // sort: 'custom', // isSearch: true // }, { label: '车间编号', field: 'workshopCode', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择车间代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '车间信息', // 查询弹窗标题 searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类 searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } }, }, { label: '产线编号', field: 'lineCode', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择生产线代码', // 输入框占位文本 multiple:true, searchField: 'code', // 查询弹窗赋值字段 searchTitle: '生产线信息', // 查询弹窗标题 searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法 searchCondition: [{ key:'workshopCode', value:'workshopCode', message: '请填写车间代码!', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, // { // label: '工序编号', // field: 'processCode', // sort: 'custom', // isSearch: true, // form:{ // componentProps: { // isSearchList: true, // searchListPlaceholder: '请选择工序代码', // searchField: 'code', // searchTitle: '工序信息', // searchAllSchemas: Process.allSchemas, // searchPage: ProcessApi.getProcessPage, // searchCondition: [{ // key:'productionLineCode', // value:'lineCode', // message: '请填写生产线代码!', // isMainValue: true // },{ // key:'workshopCode', // value:'workshopCode', // message: '请填写车间代码!', // isMainValue: true // },{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // } // }, // }, // { // label: '工位编号', // field: 'workstationCode', // sort: 'custom', // isSearch: true, // form:{ // componentProps: { // isSearchList: true, // 开启查询弹窗 // searchListPlaceholder: '请选择工位', // 输入框占位文本 // searchField: 'code', // 查询弹窗赋值字段 // searchTitle: '工位信息', // 查询弹窗标题 // searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 // searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法 // searchCondition: [{ // key:'productionLineCode', // value:'lineCode', // message: '请填写生产线代码!', // isMainValue: true // },{ // key:'workshopCode', // value:'workshopCode', // message: '请填写车间代码!', // isMainValue: true // },{ // key:'available', // value:'TRUE', // isMainValue: false // }] // } // }, // }, { label: '是否停机', field: 'status', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { component: 'Radio' } }, { label: '设备停机原因', field: 'shutdownCause', sort: 'custom', isSearch: false, form: { component: 'Input', componentProps: { type: 'textarea' } } }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false }, // { // label: '是否可用', // field: 'available', // sort: 'custom', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 // isSearch: true, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))