import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as WorkshopApi from '@/api/wms/workshop' import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' import { handleTreeToComponentOptions } from '@/utils/tree' import * as DeptApi from '@/api/system/dept' import * as UserApi from '@/api/system/user' import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data' import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts' export interface User { id: number, nickname: string } const deptList = ref([]) // 树形结构 const workshopNoPage = await WorkshopApi.getWorkshopNoPage({}) const userList = ref([]) // 加载部门树(默认格式) deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList()) // 表单校验 export const EquipmentSigningRules = reactive({ equipmentCode: [required], operationDate: [required], operationer: [required], operationDept: [required], supplierCode: [required], status: [required], storageLocation: [required], concurrencyStamp: [required] }) export const EquipmentSigning = 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: 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '验收人部门', field: 'operationDept', sort: 'custom', isSearch: true, form: { component: 'TreeSelect', componentProps: { // 假设deptList是部门数据列表 data: deptList, disabled: false, placeholder: "请选择部门", filterable: true, multiple: false, } } }, { label: '验收人', field: 'operationer', sort: 'custom', isSearch: true, form: { component: 'Select', componentProps: { // 假设deptList是部门数据列表 options: [], optionsAlias: { valueField: 'id', labelField: 'nickname' }, disabled: false, placeholder: "请先选择部门", filterable: true, multiple: false, } } }, { label: '验收人联系方式', field: 'telephone', sort: 'custom', isSearch: false }, { label: '供应商编号', field: 'supplierCode', sort: 'custom', isSearch: true }, { label: '供应商联系人', field: 'supplierPeople', sort: 'custom', isSearch: true }, { label: '供应商联系方式', field: 'supplierTelephone', sort: 'custom', isSearch: false }, // { // label: '流程状态', // field: 'status', // sort: 'custom', // isSearch: true, // dictType: DICT_TYPE.JOB_STATUS, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 // form: { // component: 'Select' // } // }, // { // label: '审核人', // field: 'approver', // sort: 'custom', // isSearch: true, // form: { // component: 'InputNumber', // value: 0 // } // }, // { // label: '审核内容', // field: 'approveContent', // sort: 'custom', // isSearch: false, // form: { // component: 'Input', // componentProps: { // type: 'textarea', // valueHtml: '', // height: 200 // } // } // }, // { // label: '审核时间', // field: 'approveTime', // 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')] // } // }, // form: { // component: 'DatePicker', // componentProps: { // type: 'datetime', // valueFormat: 'x' // } // } // }, // { // label: '自动审核', // field: 'autoExamine', // sort: 'custom', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 // isSearch: false, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, // { // label: '自动通过', // field: 'autoAgree', // sort: 'custom', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 // isSearch: false, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, // { // label: '直接生成记录', // field: 'directCreateRecord', // sort: 'custom', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 // isSearch: false, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, { label: '存放位置描述', field: 'storageLocation', sort: 'custom', isSearch: false, form: { component: 'Input', componentProps: { type: 'textarea', placeholder: '请输入存放位置描述' } } }, // { // label: '所属厂区编号', // field: 'factoryAreaCode', // sort: 'custom', // isSearch: false // }, { 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: { component: 'Select' } }, { label: '工序编号', field: 'processCode', sort: 'custom', isSearch: true, form: { component: 'Select' } }, { label: '工位编号', field: 'workstationCode', sort: 'custom', isSearch: true, form: { component: 'Select' } }, { 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' } } ]))