123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- /**
- * @fileoverview 物料明细表格配置文件
- * @description 定义物料明细表格的AvueJS配置选项、数据类型和相关常量
- */
- // 从constants.js导入常量
- import {
- MaterialDetailStatus,
- DEFAULT_PAGINATION_CONFIG,
- MATERIAL_DETAIL_STATUS_OPTIONS
- } from './constants'
- // 从types.js导入类型定义
- import { MaterialDetailDataSource } from './constants'
- // 重新导出常量供其他模块使用
- export { MaterialDetailStatus, DEFAULT_PAGINATION_CONFIG, MATERIAL_DETAIL_STATUS_OPTIONS }
- /**
- * @typedef {import('./constants').MaterialDetailRecord} MaterialDetailRecord
- * @typedef {import('./constants').MaterialDetailQueryParams} MaterialDetailQueryParams
- * @typedef {import('./constants').ValidationRule} ValidationRule
- * @typedef {import('./constants').OrderFormModel} OrderFormModel
- */
- /**
- * @typedef {import('@smallwei/avue').AvueCrudOption} AvueCrudOption
- * @typedef {import('@smallwei/avue').AvueCrudColumn} AvueCrudColumn
- */
- /**
- * AvueJS分页配置选项类型定义
- * @typedef {Object} AvuePaginationOption
- * @description AvueJS表格分页配置对象
- * @property {number} pageSize - 每页显示条数,默认10
- * @property {number[]} pageSizes - 每页显示个数选择器的选项设置
- * @property {string} layout - 组件布局,子组件名用逗号分隔
- */
- /**
- * AvueJS表格配置选项类型定义
- * @typedef {Object} AvueTableOption
- * @description 物料明细表格的AvueJS配置对象
- * @property {boolean} border - 是否显示边框
- * @property {boolean} index - 是否显示序号列
- * @property {string} indexLabel - 序号列标题
- * @property {boolean} stripe - 是否显示斑马纹
- * @property {'left'|'center'|'right'} menuAlign - 操作列对齐方式
- * @property {'left'|'center'|'right'} align - 表格内容对齐方式
- * @property {boolean} [refreshBtn] - 是否显示刷新按钮
- * @property {boolean} [columnBtn] - 是否显示列设置按钮
- * @property {boolean} searchShow - 是否显示搜索区域
- * @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 {AvuePaginationOption|boolean} page - 分页配置,true启用默认分页,对象为详细配置
- * @property {AvueColumnOption[]} column - 列配置数组
- */
- /**
- * AvueJS列配置选项类型定义
- * @typedef {Object} AvueColumnOption
- * @description 表格列的配置对象
- * @property {string} label - 列标题
- * @property {string} prop - 列属性名
- * @property {'text'|'number'|'select'|'date'|'datetime'} [type] - 列类型
- * @property {number} [minWidth] - 最小宽度
- * @property {number} [width] - 固定宽度
- * @property {boolean} [sortable] - 是否可排序
- * @property {'left'|'center'|'right'} [align] - 对齐方式
- * @property {boolean} [overHidden] - 是否隐藏溢出内容
- * @property {boolean} [hide] - 是否隐藏列
- * @property {number} [precision] - 数字精度
- * @property {{label: string, value: string|number}[]} [dicData] - 字典数据
- * @property {ValidationRule[]} [rules] - 验证规则
- */
- /**
- * 获取物料明细表格配置
- * @param {boolean} [isEditMode=false] - 是否为编辑模式
- * @returns {AvueTableOption} AvueJS表格配置对象
- */
- export function getMaterialDetailOption(isEditMode = false) {
- return {
- border: true,
- index: true,
- indexLabel: '序号',
- stripe: true,
- menuAlign: 'center',
- align: 'center',
- addBtn: false,
- editBtn: false,
- delBtn: false,
- viewBtn: false,
- searchShow: false,
- cellBtn: isEditMode,
- page: DEFAULT_PAGINATION_CONFIG,
- menuWidth: 120,
- rowKey: 'id',
- column: [
- {
- label: '物料编码',
- prop: 'itemCode',
- width: 120,
- rules: [{
- required: true,
- message: '请输入物料编码',
- trigger: 'blur'
- }]
- },
- {
- label: '物料名称',
- prop: 'itemName',
- width: 150,
- rules: [{
- required: true,
- message: '请输入物料名称',
- trigger: 'blur'
- }]
- },
- {
- label: '规格型号',
- prop: 'specs',
- width: 120
- },
- {
- label: '主物料分类',
- prop: 'mainItemCategoryName',
- width: 120
- },
- {
- label: '仓库名称',
- prop: 'warehouseName',
- width: 120
- },
- {
- label: '可用数量',
- prop: 'availableQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- slot: true
- },
- {
- label: '订单数量',
- prop: 'orderQuantity',
- type: 'number',
- precision: 4,
- width: 100,
- align: 'right',
- slot: true
- },
- {
- label: '确认数量',
- prop: 'confirmQuantity',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- slot: true
- },
- {
- label: '单价',
- prop: 'unitPrice',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- slot: true,
- rules: [{
- required: true,
- message: '请输入单价',
- trigger: 'blur'
- }]
- },
- {
- label: '税率(%)',
- prop: 'taxRate',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- slot: true
- },
- {
- label: '税额',
- prop: 'taxAmount',
- type: 'number',
- precision: 2,
- width: 100,
- align: 'right',
- slot: true
- },
- {
- label: '总金额',
- prop: 'totalAmount',
- type: 'number',
- precision: 2,
- width: 120,
- align: 'right',
- slot: true
- },
- {
- label: '明细状态',
- prop: 'status',
- type: 'select',
- dicData: MATERIAL_DETAIL_STATUS_OPTIONS,
- 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
- }
- // 重新导出MaterialDetailDataSource供其他模块使用
- export { MaterialDetailDataSource }
- /**
- * 默认表单数据
- * @type {Readonly<MaterialDetailRecord>}
- */
- export const DEFAULT_FORM_DATA = {
- itemCode: '',
- itemName: '',
- specification: '',
- mainCategoryName: '',
- warehouseName: '',
- availableQuantity: 0,
- orderQuantity: 0,
- confirmQuantity: 0,
- unitPrice: 0,
- taxRate: 0,
- taxAmount: 0,
- totalAmount: 0,
- status: '0', // MaterialDetailStatus.PENDING
- dataSource: MaterialDetailDataSource.IMPORTED,
- isDeletable: true
- }
|