refactor(web): 更新字段管理逻辑以始终展示所有相关子表

- 修改FieldsManager类中的子表展示逻辑,确保所有与订单相关的子表始终可见
- 移除基于订单类型的条件判断,避免子表显示不一致的问题
- 更新注释以反映新的逻辑,提升代码可读性和维护性
- 删除不再使用的server/server和server_restart.log文件,清理项目结构
This commit is contained in:
zhouyonggao 2025-12-17 16:10:46 +08:00
parent 1dd006b09c
commit f9d6ed151c
4 changed files with 9 additions and 23 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ marketing-system-data-tool.tar
.idea/
web/config.js
server/server.log
server/server

Binary file not shown.

View File

@ -1,2 +0,0 @@
/opt/homebrew/opt/go/libexec/src/crypto/x509/cert_pool.go:10:2: package encoding/pem is not in std (/opt/homebrew/opt/go/libexec/src/encoding/pem)
cmd/server/main.go:7:2: open /Users/zhouyonggao/Library/Caches/go-build/81/81aa4fdeaa93757df0aec25e30b31ebae853b2651233ed934d1a1b081249443a-d: operation not permitted

View File

@ -110,30 +110,17 @@ class FieldsManager {
const orderFields = this.getTableFields('order');
const children = orderFields.map(f => ({ value: f.value, label: f.label }));
// 添加公共子表
// 添加公共子表(这些表与订单类型无关,应始终展示)
children.push(this.buildTreeNode('merchant', this.getTableFields('merchant')));
children.push(this.buildTreeNode('activity', this.getTableFields('activity')));
// 根据订单类型添加特定子表
if (orderType === 2) {
// 直充卡密
children.push(this.buildTreeNode('order_digit', this.getTableFields('order_digit')));
} else if (orderType === 3) {
// 立减金
children.push(this.buildTreeNode('order_voucher', this.getTableFields('order_voucher')));
children.push(this.buildTreeNode('goods_voucher_batch', this.getTableFields('goods_voucher_batch')));
children.push(this.buildTreeNode('goods_voucher_subject_config', this.getTableFields('goods_voucher_subject_config')));
} else if (orderType === 1) {
// 红包
children.push(this.buildTreeNode('order_cash', this.getTableFields('order_cash')));
} else {
// 全部类型
children.push(this.buildTreeNode('order_voucher', this.getTableFields('order_voucher')));
children.push(this.buildTreeNode('order_cash', this.getTableFields('order_cash')));
children.push(this.buildTreeNode('order_digit', this.getTableFields('order_digit')));
children.push(this.buildTreeNode('goods_voucher_batch', this.getTableFields('goods_voucher_batch')));
children.push(this.buildTreeNode('goods_voucher_subject_config', this.getTableFields('goods_voucher_subject_config')));
}
// 为避免“有时显示有时不显示”的问题,这里不再按订单类型裁剪子表,
// 而是始终展示所有与订单相关的子表,由业务在导出层面控制是否使用。
children.push(this.buildTreeNode('order_digit', this.getTableFields('order_digit')));
children.push(this.buildTreeNode('order_voucher', this.getTableFields('order_voucher')));
children.push(this.buildTreeNode('order_cash', this.getTableFields('order_cash')));
children.push(this.buildTreeNode('goods_voucher_batch', this.getTableFields('goods_voucher_batch')));
children.push(this.buildTreeNode('goods_voucher_subject_config', this.getTableFields('goods_voucher_subject_config')));
return children;
}