|
|
@@ -3,24 +3,15 @@
|
|
|
* @description 定义物料明细表格的AvueJS配置选项、数据类型和相关常量
|
|
|
*/
|
|
|
|
|
|
-/**
|
|
|
- * 物料明细状态枚举
|
|
|
- * @readonly
|
|
|
- * @enum {string}
|
|
|
- */
|
|
|
-export const MATERIAL_DETAIL_STATUS = {
|
|
|
- /** 待确认 */
|
|
|
- PENDING: '0',
|
|
|
- /** 已确认 */
|
|
|
- CONFIRMED: '1',
|
|
|
- /** 已取消 */
|
|
|
- CANCELLED: '2'
|
|
|
-}
|
|
|
+// 从constants.js导入常量
|
|
|
+import {
|
|
|
+ MaterialDetailStatus,
|
|
|
+ DEFAULT_PAGINATION_CONFIG,
|
|
|
+ MATERIAL_DETAIL_STATUS_OPTIONS
|
|
|
+} from './constants'
|
|
|
|
|
|
-/**
|
|
|
- * @typedef {keyof typeof MATERIAL_DETAIL_STATUS} MaterialDetailStatusKey
|
|
|
- * @typedef {typeof MATERIAL_DETAIL_STATUS[MaterialDetailStatusKey]} MaterialDetailStatus
|
|
|
- */
|
|
|
+// 重新导出常量供其他模块使用
|
|
|
+export { MaterialDetailStatus, DEFAULT_PAGINATION_CONFIG, MATERIAL_DETAIL_STATUS_OPTIONS }
|
|
|
|
|
|
/**
|
|
|
* @typedef {Object} MaterialDetailQueryParams
|
|
|
@@ -34,50 +25,27 @@ export const MATERIAL_DETAIL_STATUS = {
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
- * @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 {import('./types').MaterialDetailFormData} MaterialDetailFormData
|
|
|
+ * @typedef {import('./types').MaterialDetailItem} MaterialDetailItem
|
|
|
+ * @typedef {import('./types').MaterialDetailStatus} MaterialDetailStatus
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
- * @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
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
- * @typedef {import('@smallwei/avue').AvueCrudOption} AvueCrudOption
|
|
|
- * @typedef {import('@smallwei/avue').AvueCrudColumn} AvueCrudColumn
|
|
|
+ * @typedef {import('./types').ValidationRule} ValidationRule
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * AvueJS分页配置选项类型定义
|
|
|
+ * @typedef {Object} AvuePaginationOption
|
|
|
+ * @description AvueJS表格分页配置对象
|
|
|
+ * @property {number} pageSize - 每页显示条数,默认10
|
|
|
+ * @property {number[]} pageSizes - 每页显示个数选择器的选项设置
|
|
|
+ * @property {string} layout - 组件布局,子组件名用逗号分隔
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
@@ -86,22 +54,23 @@ export const MATERIAL_DETAIL_STATUS = {
|
|
|
* @description 物料明细表格的AvueJS配置对象
|
|
|
* @property {boolean} border - 是否显示边框
|
|
|
* @property {boolean} index - 是否显示序号列
|
|
|
- * @property {boolean} indexLabel - 序号列标题
|
|
|
+ * @property {string} indexLabel - 序号列标题
|
|
|
* @property {boolean} stripe - 是否显示斑马纹
|
|
|
- * @property {boolean} menuAlign - 操作列对齐方式
|
|
|
- * @property {boolean} align - 表格内容对齐方式
|
|
|
- * @property {boolean} refreshBtn - 是否显示刷新按钮
|
|
|
- * @property {boolean} columnBtn - 是否显示列设置按钮
|
|
|
- * @property {boolean} searchBtn - 是否显示搜索按钮
|
|
|
+ * @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 {Array<AvueColumnOption>} column - 列配置数组
|
|
|
+ * @property {boolean} [selection] - 是否显示多选框
|
|
|
+ * @property {boolean} [reserveSelection] - 是否保留选择状态
|
|
|
+ * @property {string} [height] - 表格高度
|
|
|
+ * @property {string} [calcHeight] - 计算高度的偏移量
|
|
|
+ * @property {AvuePaginationOption|boolean} page - 分页配置,true启用默认分页,对象为详细配置
|
|
|
+ * @property {AvueColumnOption[]} column - 列配置数组
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
@@ -110,24 +79,22 @@ export const MATERIAL_DETAIL_STATUS = {
|
|
|
* @description 表格列的配置对象
|
|
|
* @property {string} label - 列标题
|
|
|
* @property {string} prop - 列属性名
|
|
|
- * @property {string} [type] - 列类型
|
|
|
+ * @property {'text'|'number'|'select'|'date'|'datetime'} [type] - 列类型
|
|
|
* @property {number} [minWidth] - 最小宽度
|
|
|
* @property {number} [width] - 固定宽度
|
|
|
* @property {boolean} [sortable] - 是否可排序
|
|
|
- * @property {boolean} [search] - 是否可搜索
|
|
|
- * @property {string} [align] - 对齐方式
|
|
|
+ * @property {'left'|'center'|'right'} [align] - 对齐方式
|
|
|
* @property {boolean} [overHidden] - 是否隐藏溢出内容
|
|
|
- * @property {string} [searchPlaceholder] - 搜索框占位符
|
|
|
- * @property {Array<{label: string, value: string}>} [dicData] - 字典数据
|
|
|
- * @property {Object} [props] - 字典属性配置
|
|
|
- * @property {string} [formatter] - 格式化函数名
|
|
|
+ * @property {boolean} [hide] - 是否隐藏列
|
|
|
+ * @property {number} [precision] - 数字精度
|
|
|
+ * @property {{label: string, value: string|number}[]} [dicData] - 字典数据
|
|
|
+ * @property {ValidationRule[]} [rules] - 验证规则
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
* 获取物料明细表格配置选项
|
|
|
* @description 返回AvueJS表格组件的配置对象,表格始终为只读模式,不支持编辑、新增、删除操作
|
|
|
* @returns {AvueTableOption} AvueJS表格配置对象
|
|
|
- * @since 2.0.0
|
|
|
* @example
|
|
|
* // 使用示例
|
|
|
* const tableOption = getMaterialDetailOption()
|
|
|
@@ -147,13 +114,12 @@ export function getMaterialDetailOption() {
|
|
|
editBtn: false,
|
|
|
delBtn: false,
|
|
|
viewBtn: true,
|
|
|
- searchShow: true,
|
|
|
- searchMenuSpan: 6,
|
|
|
+ searchShow: false,
|
|
|
+ page: DEFAULT_PAGINATION_CONFIG,
|
|
|
column: [
|
|
|
{
|
|
|
label: '物料编码',
|
|
|
prop: 'itemCode',
|
|
|
- search: true,
|
|
|
width: 120,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
@@ -164,7 +130,6 @@ export function getMaterialDetailOption() {
|
|
|
{
|
|
|
label: '物料名称',
|
|
|
prop: 'itemName',
|
|
|
- search: true,
|
|
|
width: 150,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
@@ -175,7 +140,6 @@ export function getMaterialDetailOption() {
|
|
|
{
|
|
|
label: '规格型号',
|
|
|
prop: 'specification',
|
|
|
- search: true,
|
|
|
width: 120
|
|
|
},
|
|
|
{
|
|
|
@@ -186,7 +150,6 @@ export function getMaterialDetailOption() {
|
|
|
{
|
|
|
label: '仓库名称',
|
|
|
prop: 'warehouseName',
|
|
|
- search: true,
|
|
|
width: 120
|
|
|
},
|
|
|
{
|
|
|
@@ -259,11 +222,7 @@ export function getMaterialDetailOption() {
|
|
|
label: '明细状态',
|
|
|
prop: 'detailStatus',
|
|
|
type: 'select',
|
|
|
- dicData: [
|
|
|
- { label: '待确认', value: '0' },
|
|
|
- { label: '已确认', value: '1' },
|
|
|
- { label: '已取消', value: '2' }
|
|
|
- ],
|
|
|
+ dicData: MATERIAL_DETAIL_STATUS_OPTIONS,
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
@@ -454,5 +413,5 @@ export const DEFAULT_FORM_DATA = {
|
|
|
taxRate: 0,
|
|
|
taxAmount: 0,
|
|
|
totalAmount: 0,
|
|
|
- detailStatus: '0'
|
|
|
+ detailStatus: '0' // MaterialDetailStatus.PENDING
|
|
|
}
|