123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- /**
- * @fileoverview 物料明细表格配置文件
- * @description 定义物料明细表格的AvueJS配置选项、数据类型和相关常量
- */
- /**
- * 物料明细状态枚举
- * @readonly
- * @enum {string}
- */
- export const MATERIAL_DETAIL_STATUS = {
- /** 待确认 */
- PENDING: '0',
- /** 已确认 */
- CONFIRMED: '1',
- /** 已取消 */
- CANCELLED: '2'
- }
- /**
- * @typedef {keyof typeof MATERIAL_DETAIL_STATUS} MaterialDetailStatusKey
- * @typedef {typeof MATERIAL_DETAIL_STATUS[MaterialDetailStatusKey]} MaterialDetailStatus
- */
- /**
- * @typedef {Object} MaterialDetailQueryParams
- * @description 物料明细查询参数类型定义
- * @property {string} itemName - 物料名称,支持模糊查询
- * @property {string} itemCode - 物料编码,支持模糊查询
- * @property {string} specification - 规格型号,支持模糊查询
- * @property {string} warehouseName - 仓库名称,支持模糊查询
- * @property {number} current - 当前页码,从1开始
- * @property {number} size - 每页条数,范围1-100
- */
- /**
- * @typedef {Object} MaterialDetailFormData
- * @description 物料明细表单数据类型定义
- * @property {string} itemCode - 物料编码,必填,最大长度50
- * @property {string} itemName - 物料名称,必填,最大长度100
- * @property {string} specification - 规格型号,可选,最大长度100
- * @property {string} mainCategoryName - 主物料分类名称,只读
- * @property {string} warehouseName - 仓库名称,只读
- * @property {number} availableQuantity - 可用数量,非负数,精度2位小数
- * @property {number} orderQuantity - 订单数量,非负数,精度2位小数
- * @property {number} confirmQuantity - 确认数量,非负数,精度2位小数
- * @property {number} unitPrice - 单价,非负数,精度2位小数
- * @property {number} taxRate - 税率,范围0-100,精度2位小数
- * @property {number} taxAmount - 税额,自动计算,精度2位小数
- * @property {number} totalAmount - 总金额,自动计算,精度2位小数
- * @property {MaterialDetailStatus} detailStatus - 明细状态
- */
- /**
- * @typedef {Object} MaterialDetailItem
- * @description 物料明细列表项类型定义
- * @property {string} id - 明细ID,唯一标识符
- * @property {string} itemId - 物料ID,关联物料表
- * @property {string} itemCode - 物料编码,业务唯一标识
- * @property {string} itemName - 物料名称
- * @property {string} specification - 规格型号
- * @property {string} mainCategoryId - 主物料分类ID
- * @property {string} mainCategoryName - 主物料分类名称
- * @property {string} warehouseId - 仓库ID
- * @property {string} warehouseName - 仓库名称
- * @property {number} availableQuantity - 可用数量
- * @property {number} orderQuantity - 订单数量
- * @property {number} confirmQuantity - 确认数量
- * @property {number} unitPrice - 单价
- * @property {number} taxRate - 税率
- * @property {number} taxAmount - 税额
- * @property {number} totalAmount - 总金额
- * @property {MaterialDetailStatus} detailStatus - 明细状态
- * @property {string} createTime - 创建时间,ISO 8601格式
- * @property {string} updateTime - 更新时间,ISO 8601格式
- */
- /**
- * @typedef {import('@smallwei/avue').AvueCrudOption} AvueCrudOption
- * @typedef {import('@smallwei/avue').AvueCrudColumn} AvueCrudColumn
- */
- /**
- * AvueJS表格配置选项类型定义
- * @typedef {Object} AvueTableOption
- * @description 物料明细表格的AvueJS配置对象
- * @property {boolean} border - 是否显示边框
- * @property {boolean} index - 是否显示序号列
- * @property {boolean} indexLabel - 序号列标题
- * @property {boolean} stripe - 是否显示斑马纹
- * @property {boolean} menuAlign - 操作列对齐方式
- * @property {boolean} align - 表格内容对齐方式
- * @property {boolean} refreshBtn - 是否显示刷新按钮
- * @property {boolean} columnBtn - 是否显示列设置按钮
- * @property {boolean} searchBtn - 是否显示搜索按钮
- * @property {boolean} addBtn - 是否显示新增按钮
- * @property {boolean} editBtn - 是否显示编辑按钮
- * @property {boolean} delBtn - 是否显示删除按钮
- * @property {boolean} viewBtn - 是否显示查看按钮
- * @property {boolean} selection - 是否显示多选框
- * @property {boolean} reserveSelection - 是否保留选择状态
- * @property {string} height - 表格高度
- * @property {string} calcHeight - 计算高度的偏移量
- * @property {Array<AvueColumnOption>} column - 列配置数组
- */
- /**
- * AvueJS列配置选项类型定义
- * @typedef {Object} AvueColumnOption
- * @description 表格列的配置对象
- * @property {string} label - 列标题
- * @property {string} prop - 列属性名
- * @property {string} [type] - 列类型
- * @property {number} [minWidth] - 最小宽度
- * @property {number} [width] - 固定宽度
- * @property {boolean} [sortable] - 是否可排序
- * @property {boolean} [search] - 是否可搜索
- * @property {string} [align] - 对齐方式
- * @property {boolean} [overHidden] - 是否隐藏溢出内容
- * @property {string} [searchPlaceholder] - 搜索框占位符
- * @property {Array<{label: string, value: string}>} [dicData] - 字典数据
- * @property {Object} [props] - 字典属性配置
- * @property {string} [formatter] - 格式化函数名
- */
- /**
- * 获取物料明细表格配置选项
- * @description 返回AvueJS表格组件的配置对象,表格始终为只读模式,不支持编辑、新增、删除操作
- * @returns {AvueTableOption} AvueJS表格配置对象
- * @since 2.0.0
- * @example
- * // 使用示例
- * const tableOption = getMaterialDetailOption()
- * // tableOption.addBtn === false
- * // tableOption.editBtn === false
- * // tableOption.delBtn === false
- */
- export function getMaterialDetailOption() {
- return {
- border: true,
- index: true,
- indexLabel: '序号',
- stripe: true,
- menuAlign: 'center',
- align: 'center',
- addBtn: false,
- editBtn: false,
- delBtn: false,
- viewBtn: true,
- searchShow: true,
- searchMenuSpan: 6,
- column: [
- {
- label: '物料编码',
- prop: 'itemCode',
- search: true,
- width: 120,
- rules: [{
- required: true,
- message: '请输入物料编码',
- trigger: 'blur'
- }]
- },
- {
- label: '物料名称',
- prop: 'itemName',
- search: true,
- width: 150,
- rules: [{
- required: true,
- message: '请输入物料名称',
- trigger: 'blur'
- }]
- },
- {
- label: '规格型号',
- prop: 'specification',
- search: true,
- width: 120
- },
- {
- label: '主物料分类',
- prop: 'mainCategoryName',
- width: 120
- },
- {
- label: '仓库名称',
- prop: 'warehouseName',
- search: true,
- width: 120
- },
- {
- label: '可用数量',
- prop: 'availableQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right'
- },
- {
- label: '订单数量',
- prop: 'orderQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- rules: [{
- required: true,
- message: '请输入订单数量',
- trigger: 'blur'
- }]
- },
- {
- label: '确认数量',
- prop: 'confirmQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right'
- },
- {
- label: '单价',
- prop: 'unitPrice',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- rules: [{
- required: true,
- message: '请输入单价',
- trigger: 'blur'
- }]
- },
- {
- label: '税率(%)',
- prop: 'taxRate',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right'
- },
- {
- label: '税额',
- prop: 'taxAmount',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right'
- },
- {
- label: '总金额',
- prop: 'totalAmount',
- type: 'number',
- precision: 2,
- width: 120,
- align: 'right'
- },
- {
- label: '明细状态',
- prop: 'detailStatus',
- type: 'select',
- dicData: [
- { label: '待确认', value: '0' },
- { label: '已确认', value: '1' },
- { label: '已取消', value: '2' }
- ],
- width: 100
- },
- {
- label: '物料ID',
- prop: 'itemId',
- hide: true
- },
- {
- label: '主物料分类ID',
- prop: 'mainCategoryId',
- hide: true
- },
- {
- label: '仓库ID',
- prop: 'warehouseId',
- hide: true
- }
- ]
- }
- }
- /**
- * 获取物料导入筛选表格配置
- * @description 生成物料导入弹窗中筛选表格的AvueJS配置选项
- * @returns {AvueCrudOption} AvueJS表格配置对象
- */
- export function getMaterialImportOption() {
- return {
- border: true,
- index: true,
- indexLabel: '序号',
- stripe: true,
- menuAlign: 'center',
- align: 'center',
- addBtn: false,
- editBtn: false,
- delBtn: false,
- viewBtn: false,
- menu: false,
- searchShow: false,
- selection: true,
- selectionWidth: 60,
- page: true,
- column: [
- {
- label: '物料编码',
- prop: 'itemCode',
- width: 120
- },
- {
- label: '物料名称',
- prop: 'itemName',
- width: 150
- },
- {
- label: '规格型号',
- prop: 'specification',
- width: 120
- },
- {
- label: '物料描述',
- prop: 'itemDescription',
- width: 200,
- overHidden: true
- },
- {
- label: '主物料分类',
- prop: 'mainCategoryName',
- width: 120
- },
- {
- label: '分类编码',
- prop: 'mainCategoryCode',
- width: 100
- },
- {
- label: '单位',
- prop: 'inventoryInfoName',
- width: 80,
- align: 'center'
- },
- {
- label: '仓库名称',
- prop: 'warehouseName',
- width: 120
- },
- {
- label: '仓库编码',
- prop: 'warehouseCode',
- width: 100
- },
- {
- label: '可用数量',
- prop: 'availableQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right'
- },
- {
- label: '销售员',
- prop: 'saleserName',
- width: 100
- },
- {
- label: '发货仓库',
- prop: 'shipmentWarehouseName',
- width: 120
- },
- {
- label: '组织名称',
- prop: 'orgName',
- width: 120
- },
- {
- label: '创建时间',
- prop: 'createTime',
- width: 150,
- type: 'datetime',
- format: 'YYYY-MM-DD HH:mm:ss'
- },
- {
- label: '物料ID',
- prop: 'itemId',
- hide: true
- },
- {
- label: '主物料分类ID',
- prop: 'mainCategoryId',
- hide: true
- },
- {
- label: '仓库ID',
- prop: 'warehouseId',
- hide: true
- },
- {
- label: '库存信息ID',
- prop: 'inventoryInfoId',
- hide: true
- },
- {
- label: '销售员ID',
- prop: 'saleserId',
- hide: true
- },
- {
- label: '发货仓库ID',
- prop: 'shipmentWarehouseId',
- hide: true
- },
- {
- label: '组织ID',
- prop: 'orgId',
- hide: true
- }
- ]
- }
- }
- /**
- * 默认物料明细查询参数
- * @type {MaterialDetailQueryParams}
- */
- export const DEFAULT_QUERY_PARAMS = {
- itemName: '',
- itemCode: '',
- specification: '',
- warehouseName: '',
- current: 1,
- size: 10
- }
- /**
- * 默认物料明细表单数据
- * @type {MaterialDetailFormData}
- */
- export const DEFAULT_FORM_DATA = {
- itemCode: '',
- itemName: '',
- specification: '',
- mainCategoryName: '',
- warehouseName: '',
- availableQuantity: 0,
- orderQuantity: 0,
- confirmQuantity: 0,
- unitPrice: 0,
- taxRate: 0,
- taxAmount: 0,
- totalAmount: 0,
- detailStatus: '0'
- }
|