import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as CustomerApi from '@/api/wms/customer' import { Customer } from '../customer/customer.data' import * as DockApi from '@/api/wms/dock' import { Dock } from '../../factoryModeling/dock/dock.data' import * as WarehouseApi from '@/api/wms/warehouse' import { Warehouse } from '../../factoryModeling/warehouse/warehouse.data' import * as LocationApi from '@/api/wms/location' import { Location } from '../../factoryModeling/location/location.data' const { t } = useI18n() // 国际化 import {validateHanset,validateYS} from '@/utils/validator' /** * @returns {Array} 客户月台 */ export const Customerdock = useCrudSchemas(reactive([ { label: '代码', field: 'code', sort: 'custom', table: { width: 150 }, }, { label: '客户代码', field: 'customerCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '客户基础信息', // 查询弹窗标题 searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类 searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', action: '==', isSearch: true, isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } }, { label: '名称', field: 'name', isSearch: true, sort: 'custom', table: { width: 150 }, }, { label: '描述', field: 'description', sort: 'custom', table: { width: 150 }, }, { label: '城市', field: 'city', sort: 'custom', table: { width: 150 }, }, { label: '地址', field: 'address', sort: 'custom', table: { width: 150 }, }, { label: '联系人姓名', field: 'contactPerson', sort: 'custom', table: { width: 150 }, }, { label: '联系人电话', field: 'contactPhone', sort: 'custom', table: { width: 150 }, }, { label: '仓库', field: 'warehouseCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, searchListPlaceholder: '请选择从仓库代码', searchField: 'code', searchTitle: '仓库基础信息', searchAllSchemas: Warehouse.allSchemas, searchPage: WarehouseApi.getWarehousePage, verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } }, { label: '默认库位', field: 'defaultLocationCode', sort: 'custom', table: { width: 150 }, isForm:true, form: { // // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, disabled:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库位代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库位基础信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.selectConfigToLocation, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isSearch: true, isMainValue: false }, { key: 'warehouseCode', value: 'warehouseCode', message: '请选择仓库', action: '==', isSearch: true, isMainValue: false, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 isFormModel:true, // filters中添加筛选的数据--取于formModel required:true, // 前置添加必有,和isFormModel结合使用 }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } }, }, { label: '生效时间', field: 'activeTime', isTable: true, 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: 'expireTime', isTable: true, 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: 'remark', sort: 'custom', table: { width: 150 }, }, { label: '创建时间', field: 'createTime', isForm: false, table: { width: 180 }, formatter: dateFormatter, detail: { dateFormat : 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } } }, { label: '创建者', field: 'creator', table: { width: 130 }, isForm: false, isTable: true }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', isDetail: true, isForm: false, isTable: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } } }, { label: '最后更新者', field: 'updater', isDetail: true, isForm: false, isTable: false, table: { width: 150 } }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' } } ])) //表单校验 export const CustomerdockRules = reactive({ code: [ { required: true, message: '请输入代码', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' }, { validator:validateYS, message: '请输入正确的代码', trigger: 'blur'} ], // defaultLocationCode:[ // { required: true, message: '请选择库位代码', trigger: 'blur' }, // ], name: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], description: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], city: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], address: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], contactPerson: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], contactPhone: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' }, { validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'} ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], customerCode: [ { required: true, message: '请输入客户代码', trigger: 'blur' } ], warehouseCode: [ { required: true, message: '请选择仓库', trigger: 'blur' } ], defaultLocationCode: [ { required: true, message: '请选择默认库位', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], })