You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
7.7 KiB

1 year ago
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<CrudSchema[]>([
{
label: '代码',
field: 'code',
sort: 'custom',
table: {
width: 150
1 year ago
},
},
{
label: '客户代码',
field: 'customerCode',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
11 months ago
enterSearch:true,
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择客户代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '客户基础信息', // 查询弹窗标题
searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类
searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}]
}
}
},
{
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,
}
}
1 year ago
},
{
label: '默认库位',
field: 'defaultLocationCode',
sort: 'custom',
table: {
width: 150
},
11 months ago
isForm:true,
form: {
11 months ago
// // labelMessage: '信息提示说明!!!',
11 months ago
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: '请选择仓库',
11 months ago
action: '==',
isSearch: true,
isMainValue: false, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用
isFormModel:true, // filters中添加筛选的数据--取于formModel
required:true, // 前置添加必有,和isFormModel结合使用
}]
11 months ago
}
}
1 year ago
},
{
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',
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isSearch: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '创建者',
field: 'creator',
isSearch: false,
isTable: false,
isForm: false,
sort: 'custom',
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'}
],
11 months ago
// defaultLocationCode:[
// { required: true, message: '请选择库位代码', trigger: 'blur' },
// ],
1 year ago
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' }
],
1 year ago
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})