From b5043575e436a15b21a1c3613d82f3ebd8fcc87b Mon Sep 17 00:00:00 2001 From: b2894lxlx <517289602@qq.com> Date: Sun, 27 Sep 2026 23:39:38 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E8=B4=A7=E7=89=A9=E7=BB=84=E7=BB=87=E7=AD=9B=E9=80=89=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=E5=88=97=E8=A1=A8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=B8=8E=E5=B8=B8=E7=94=A8=E5=9C=B0=E5=9D=80=E8=A1=8C=E6=94=BF?= =?UTF-8?q?=E5=8C=BA=E5=88=92=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/option/business/common-cargo.js | 282 ++++++++++++++-------------- src/views/base/common-address.vue | 2 +- src/views/business/common-cargo.vue | 29 ++- 3 files changed, 169 insertions(+), 144 deletions(-) diff --git a/src/option/business/common-cargo.js b/src/option/business/common-cargo.js index 5640611..f9211fa 100644 --- a/src/option/business/common-cargo.js +++ b/src/option/business/common-cargo.js @@ -35,26 +35,7 @@ export const formatCargoValue = value => { }; export const option = createCrudOption([ - { - label: '一级货物类型', - prop: 'firstCargoTypeName', - formslot: true, - order: 60, - span: 12, - minWidth: 150, - editDisabled: true, - rules: [{ required: true, message: '请选择一级货物类型', trigger: 'change' }], - }, - { - label: '二级货物类型', - prop: 'secondCargoTypeName', - formslot: true, - order: 59, - span: 12, - minWidth: 150, - editDisabled: true, - rules: [{ required: true, message: '请选择二级货物类型', trigger: 'change' }], - }, + // ---------- 列表字段(顺序即表格展示顺序) ---------- { label: '货物名称', prop: 'cargoName', @@ -79,12 +60,24 @@ export const option = createCrudOption([ ], }, { - label: '一级货物类型编码', - prop: 'firstCargoTypeCode', - hide: true, - display: false, - addDisplay: false, + label: '一级货物类型', + prop: 'firstCargoTypeName', + formslot: true, + order: 60, + span: 12, + minWidth: 150, editDisabled: true, + rules: [{ required: true, message: '请选择一级货物类型', trigger: 'change' }], + }, + { + label: '二级货物类型', + prop: 'secondCargoTypeName', + formslot: true, + order: 59, + span: 12, + minWidth: 150, + editDisabled: true, + rules: [{ required: true, message: '请选择二级货物类型', trigger: 'change' }], }, { label: '二级货物类型编码', @@ -92,9 +85,132 @@ export const option = createCrudOption([ display: false, addDisplay: false, editDisabled: true, - minWidth: 180, + minWidth: 160, }, - // 搜索字段与表格、表单字段独立,避免筛选配置影响数据展示和编辑布局。 + { + label: '包装', + prop: 'packageType', + type: 'select', + dicData: packageOptions, + order: 39, + span: 12, + minWidth: 100, + }, + { + label: '品牌', + prop: 'brand', + search: false, + order: 40, + span: 12, + minWidth: 120, + placeholder: '请输入', + rules: textRule('品牌', 50), + }, + { + label: '规格', + prop: 'specification', + order: 29, + span: 12, + minWidth: 120, + placeholder: '请输入', + rules: textRule('规格', 50), + }, + { + label: '型号', + prop: 'model', + order: 19, + span: 12, + minWidth: 120, + placeholder: '请输入', + rules: textRule('型号', 50, true), + }, + { + label: '单价', + prop: 'cargoValue', + formslot: true, + order: 30, + formatter: row => formatCargoValue(row.cargoValue), + minWidth: 120, + rules: [ + { + validator: (rule, value, callback) => { + if (value === undefined || value === null || value === '') { + callback(); + return; + } + if (!/^\d+(\.\d{1,2})?$/.test(String(value))) { + callback(new Error('单价只能输入数字,最多保留2位小数')); + return; + } + callback(); + }, + trigger: 'blur', + }, + ], + }, + { + label: '计价单位', + prop: 'priceUnit', + type: 'select', + dicData: [], + display: false, + minWidth: 120, + }, + { + label: '尺寸', + prop: 'sizeText', + minWidth: 120, + addDisplay: false, + editDisplay: false, + rules: textRule('尺寸', 100), + }, + { + label: '说明', + prop: 'descriptionOne', + order: 20, + span: 12, + minWidth: 160, + placeholder: '请输入', + rules: textRule('说明', 100), + }, + { + label: '备注', + prop: 'remark', + type: 'textarea', + order: 10, + minRows: 2, + span: 24, + maxlength: 200, + showWordLimit: true, + placeholder: '请输入', + rules: textRule('备注', 200), + }, + { + label: '组织', + prop: 'deptName', + minWidth: 150, + addDisplay: false, + editDisplay: false, + }, + ...auditColumns + .filter(column => ['updateTime', 'createTime'].includes(column.prop)) + .sort( + (first, second) => + ['updateTime', 'createTime'].indexOf(first.prop) - + ['updateTime', 'createTime'].indexOf(second.prop) + ), + + // ---------- 表单隐藏字段 ---------- + { + label: '一级货物类型编码', + prop: 'firstCargoTypeCode', + hide: true, + display: false, + addDisplay: false, + editDisabled: true, + }, + + // ---------- 搜索字段(与表格、表单独立) ---------- { label: '货物名称', prop: 'searchCargoName', @@ -186,118 +302,6 @@ export const option = createCrudOption([ editDisplay: false, viewDisplay: false, }, - { - label: '包装', - prop: 'packageType', - type: 'select', - dicData: packageOptions, - order: 39, - span: 12, - minWidth: 100, - }, - { - label: '品牌', - prop: 'brand', - search: false, - order: 40, - span: 12, - minWidth: 120, - placeholder: '请输入', - rules: textRule('品牌', 50), - }, - { - label: '规格', - prop: 'specification', - order: 29, - span: 12, - minWidth: 120, - placeholder: '请输入', - rules: textRule('规格', 50), - }, - { - label: '货值', - prop: 'cargoValue', - formslot: true, - order: 30, - formatter: row => formatCargoValue(row.cargoValue), - minWidth: 120, - rules: [ - { - validator: (rule, value, callback) => { - if (value === undefined || value === null || value === '') { - callback(); - return; - } - if (!/^\d+(\.\d{1,2})?$/.test(String(value))) { - callback(new Error('货值只能输入数字,最多保留2位小数')); - return; - } - callback(); - }, - trigger: 'blur', - }, - ], - }, - { - label: '计价单位', - prop: 'priceUnit', - type: 'select', - dicData: [], - display: false, - minWidth: 120, - }, - { - label: '型号', - prop: 'model', - order: 19, - span: 12, - minWidth: 120, - placeholder: '请输入', - rules: textRule('型号', 50, true), - }, - { - label: '尺寸', - prop: 'sizeText', - minWidth: 120, - addDisplay: false, - editDisplay: false, - rules: textRule('尺寸', 100), - }, - { - label: '说明', - prop: 'descriptionOne', - order: 20, - span: 12, - minWidth: 160, - placeholder: '请输入', - rules: textRule('说明', 100), - }, - { - label: '备注', - prop: 'remark', - type: 'textarea', - order: 10, - minRows: 2, - span: 24, - maxlength: 200, - showWordLimit: true, - placeholder: '请输入', - rules: textRule('备注', 200), - }, - { - label: '组织', - prop: 'deptName', - minWidth: 150, - addDisplay: false, - editDisplay: false, - }, - ...auditColumns - .filter(column => ['updateTime', 'createTime'].includes(column.prop)) - .sort( - (first, second) => - ['updateTime', 'createTime'].indexOf(first.prop) - - ['updateTime', 'createTime'].indexOf(second.prop) - ), ]); // 搜索栏标签统一加宽,给较长的货物类型字段预留足够展示空间。 diff --git a/src/views/base/common-address.vue b/src/views/base/common-address.vue index 724cb2a..d182b28 100644 --- a/src/views/base/common-address.vue +++ b/src/views/base/common-address.vue @@ -182,8 +182,8 @@ { + if (this.$refs.crud?.searchForm) { + this.$refs.crud.searchForm.searchDeptId = deptId; + } + }); + }, initDeptTree() { getDeptTree(this.userInfo.tenantId).then(res => { this.deptOptions = this.flattenDept(res.data.data || []); @@ -485,7 +501,7 @@ export default { return false; } if (row.cargoValue && !/^\d+(\.\d{1,2})?$/.test(String(row.cargoValue))) { - this.$message.warning('货值只能输入数字,最多保留2位小数'); + this.$message.warning('单价只能输入数字,最多保留2位小数'); return false; } if (!row.model) { @@ -619,8 +635,9 @@ export default { }, searchReset() { this.query = {}; + this.applyDefaultDeptSearch(); this.page.currentPage = 1; - this.onLoad(this.page); + this.onLoad(this.page, this.query); }, searchChange(params, done) { this.query = params; @@ -649,7 +666,11 @@ export default { onLoad(page, params = {}) { this.loading = true; api - .getList(page.currentPage, page.pageSize, { ...params, ...this.query, allDept: 0 }) + .getList(page.currentPage, page.pageSize, { + ...params, + ...this.query, + allDept: this.isAdmin ? 1 : 0, + }) .then(res => { const result = res.data.data; this.page.total = result.total; @@ -663,7 +684,7 @@ export default { buildExportParams() { return { ...this.query, - allDept: 0, + allDept: this.isAdmin ? 1 : 0, ids: this.ids, [this.website.tokenHeader]: getToken(), };