import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import * as ItembasicApi from '@/api/wms/itembasic' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import * as getPlansettingApi from '@/api/wms/plansetting/index' const { t } = useI18n() // 国际化 // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 const queryParams = { pageSize:10, pageNo:1, code:'CountPlan' } const data = await getPlansettingApi.getPlansettingPage(queryParams) const plansettingData =data?.list[0]||{} /** * @returns {Array} 盘点计划主表 */ export const CountPlanMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', table: { width: 180, fixed: 'left' }, isSearch: true, isForm: false, }, { label: '盘点类型', field: 'type', dictType: DICT_TYPE.COUNT_TYPE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { value:'MANUAL', }, isSearch: true }, { label: '状态', field: 'status', dictType: DICT_TYPE.PLAN_STATUS, dictClass: 'string', isSearch: true, isForm: false, isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '',//执行周期 field: 'crontab', sort: 'custom', table: { width: 150 }, isDetail:false, isTable:false, form:{ componentProps:{ disabled:true } } }, // { // label: '执行周期',//执行周期 // field: 'crontab', // sort: 'custom', // table: { // width: 150 // }, // isForm:false, // form:{ // componentProps:{ // disabled:true // } // } // }, { label: '任务拆分方式', field: 'countSplitType', dictType: DICT_TYPE.COUNT_SPLIT_TYPE, dictClass: 'string', sort: 'custom', table: { width: 150 }, isTable:true, isForm: true, form: { value: 'locationCode' } }, { label: '维度', field: 'dimension', dictType: DICT_TYPE.COUNT_DIMENSION, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { value: 'BY_INEVNEOTY' } }, // { // label: '限值', // field: 'limitedValue', // sort: 'custom', // table: { // width: 150 // }, // form: { // component: 'InputNumber', // componentProps:{ // disabled:false // } // } // }, { label: '冻结盘点', field: 'isFreeze', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '盘点空库位', field: 'isCountEmptyLocation', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '盘点零库存', field: 'isCountZeroInventory', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '盘点负库存', field: 'isCountNegativeInventory', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '明盘', field: 'isOpenCount', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '业务类型', field: 'businessType', sort: 'custom', table: { width: 150 }, isTable:false, isForm: false, form: { value: 'Count', componentProps: { disabled: true } } }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, isTable: false }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isTable:true, isForm: false, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTable:true, isForm: false, 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')] }, }, }, { label: '开始时间', field: 'beginTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '结束时间', field: 'endTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: false, isForm: false, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, }, { label: '自动提交', field: 'autoCommit', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoCommit, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动通过', field: 'autoAgree', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoAgree, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动执行', field: 'autoExecute', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoExecute, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '最后更新时间', field: 'updateTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, isTable: false, }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, isTable:false, isForm: false, },{ label: '物料忽略名单', field: 'ignoreListOfItem', sort: 'custom', table: { width: 150 }, isForm:false, form: { componentProps: { isSearchList: true, // 开启查询弹窗 multiple:true,//是否可以多选 searchListPlaceholder: '请选择物料忽略名单', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法 } } }, { label: '库位忽略名单', field: 'ignoreListOfLocation', sort: 'custom', table: { width: 150 }, isForm: false, form: { componentProps: { isSearchList: true, // 开启查询弹窗 multiple:true,//是否可以多选 searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库位信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法 } } }, // { // label: '盘点范围列表', // field: 'scopeList', // sort: 'custom', // table: { // width: 150 // }, // }, { label: '快照盘点', field: 'isSnapshot', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, isForm:false, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, sort: 'custom', table: { width: 150 }, }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 300, fixed: 'right' }, } ])) //表单校验 export const CountPlanMainRules = reactive({ type: [ { required: true, message: '请选择盘点类型', trigger: 'change' } ], countSplitType: [ { required: true, message: '请选择任务拆分方式', trigger: 'change' } ], crontab: [ { required: false, message: '请填写执行周期', trigger: ['change','blur'] },{ max: 50, message: '不得超过50个字符', trigger: 'blur' } ], isSnapshot: [ { required: true, message: '请选择快照盘点', trigger: 'change' } ], isFreeze: [ { required: true, message: '请选择冻结盘点', trigger: 'change' } ], isCountEmptyLocation: [ { required: true, message: '请选择盘点空库位', trigger: 'change' } ], isCountZeroInventory: [ { required: true, message: '请选择盘点零库存', trigger: 'change' } ], isCountNegativeInventory: [ { required: true, message: '请选择盘点负库存', trigger: 'change' } ], isOpenCount: [ { required: true, message: '请选择明盘', trigger: 'change' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], status: [ { required: true, message: '请选择状态', trigger: 'change' } ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], }) /** * @returns {Array} 盘点计划子表 */ // export const CountPlanDetail = useCrudSchemas(([ // { // label: '盘点范围类型', // field: 'type', // dictType: DICT_TYPE.COUNT_TYPE, // dictClass: 'string', // isTable: true, // sort: 'custom', // table: { // width: 150 // }, // tableForm: { // type: 'Select' // } // }, // { // label: '盘点范围值', // field: 'value', // sort: 'custom', // table: { // width: 150 // }, // }, // { // label: '单据号', // field: 'number', // sort: 'custom', // table: { // width: 150, // }, // isTableForm: false, // form: { // componentProps: { // disabled: true // } // } // }, // { // label: '物料代码', // field: 'itemCode', // sort: 'custom', // table: { // width: 150 // }, // }, // { // label: '备注', // field: 'remark', // sort: 'custom', // table: { // width: 150 // }, // }, // { // label: '创建者', // field: 'creator', // sort: 'custom', // table: { // width: 150 // }, // isTableForm: false, // isForm: false, // }, // { // label: '创建时间', // field: 'createTime', // formatter: dateFormatter, // detail: { // dateFormat: 'YYYY-MM-DD HH:mm:ss' // }, // sort: 'custom', // table: { // width: 180 // }, // form: { // component: 'DatePicker', // componentProps: { // style: {width:'100%'}, // type: 'datetime', // dateFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'x', // } // }, // isTableForm: false, // isForm: false, // }, // { // label: '最后更新时间', // field: 'updateTime', // formatter: dateFormatter, // detail: { // dateFormat: 'YYYY-MM-DD HH:mm:ss' // }, // sort: 'custom', // table: { // width: 180 // }, // form: { // component: 'DatePicker', // componentProps: { // style: {width:'100%'}, // type: 'datetime', // dateFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'x', // } // }, // isTableForm: false, // isForm: false, // }, // { // label: '最后更新者', // field: 'updater', // sort: 'custom', // table: { // width: 150 // }, // isTableForm: false, // isForm: false, // }, // { // label: '计划数量', // field: 'planQty', // sort: 'custom', // table: { // width: 150 // }, // form: { // component: 'InputNumber', // componentProps: { // min: 1, // precision: 6 // } // }, // tableForm: { // type: 'InputNumber', // min: 1, // precision: 6 // } // }, // { // label: '计量单位', // field: 'uom', // dictType: DICT_TYPE.UOM, // dictClass: 'string', // isTable: true, // sort: 'custom', // table: { // width: 150 // }, // tableForm: { // type: 'Select' // } // }, // { // label: '是否可用', // field: 'available', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // isTable: true, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // }, // sort: 'custom', // table: { // width: 150 // }, // tableForm: { // type: 'Select' // } // }, // { // label: '操作', // field: 'action', // isDetail: false, // isForm: false , // table: { // width: 150, // fixed: 'right' // }, // isTableForm:false, // } // ])) //表单校验 export const CountPlanDetail = useCrudSchemas(([ { label: '盘点范围类型', field: 'type', dictType: DICT_TYPE.COUNT_SCOPE_TYPE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 400 }, tableForm: { type: 'Select', width: '300' } }, { label: '盘点范围值', field: 'value', isTable: true, sort: 'custom', table: { width: 300 }, tableForm: { width: 400, isInpuFocusShow: true, // 开启查询弹窗 searchListPlaceholder: '请选择盘点范围类型', searchField: 'type', multiple:true,//是否可以多选 searchTitle: '物料信息', searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true }], // 失去焦点校验参数 }, form: { componentProps: { disable:true, isSearchList: true, // 开启查询弹窗 multiple:true,//是否可以多选 searchListPlaceholder: '请选择盘点范围类型', // 输入框占位文本 searchField: 'type', // 查询弹窗赋值字段 searchTitle: '物料信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法 } } }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' }, hiddenInMain:true, isTableForm:false, } ])) export const CountPlanDetailRules = reactive({ type: [ { required: true, message: '请选择盘点范围类型', trigger: 'change' } ], value: [ { required: true, message: '请选择盘点范围值', trigger: ['blur','change'] } ], }) /** * @returns {Array} 盘点计划主表 */ export const CountPlanMain1 = useCrudSchemas(reactive([ { label: '物料忽略名单', field: 'ignoreListOfItem', sort: 'custom', table: { width: 150 }, form: { componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 multiple:true,//是否可以多选 searchListPlaceholder: '请选择物料忽略名单', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 verificationPage: ItembasicApi.getItemListByCodes, verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true }], // 失去焦点校验参数 } } }, { label: '库位忽略名单', field: 'ignoreListOfLocation', sort: 'custom', table: { width: 150 }, form: { componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 multiple:true,//是否可以多选 searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库位信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 verificationPage: LocationApi.getLocationByCodes, verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true }], // 失去焦点校验参数 } } }, ]))