Przeglądaj źródła

feat: 润天字段调整

wuzh 4 dni temu
rodzic
commit
eae77aa554

+ 30 - 11
src/views/material/BOMmanage/components/detailedList.vue

@@ -76,9 +76,9 @@
         </el-input>
       </template>
 
-      <!-- 序号:按层级单独计数(同层 1、2、3…,层级变了重新从 1 开始) -->
+      <!-- 序号:与新 columns 方案绑定。新方案按层级单独计数(同层 1、2、3…),老方案用连续行号 -->
       <template v-slot:rowIndex="{ row, $index }">
-        {{ levelSeqMap[row.id] != null ? levelSeqMap[row.id] : levelSeq(row, $index) }}
+        {{ rowIndexText(row, $index) }}
       </template>
 
       <!-- 总重:前端按 用量 × 单重 计算(用量/单重改了立即跟着变) -->
@@ -308,9 +308,8 @@
         levelSeqKey: '',
         produceTypeList,
         clientEnvironmentId: this.$store.state.user.info.clientEnvironmentId,
-        // 是否启用新 columns 方案(true=新方案,false=老方案)
-        // 是否启用新 columns 方案(true=新方案,false=老方案);层级序号只在新方案生效
-        useNewColumns: true,
+        // 是否启用新 columns 方案(true=新方案,false=老方案);序号方案与新 columns 方案绑定
+        useNewColumns: false,
         pagination: {
           tableTotal: 0
         },
@@ -843,6 +842,16 @@
     },
 
     methods: {
+      // 序号方案与新 columns 方案绑定:老方案用连续行号,新方案按层级计数
+      rowIndexText(row, index) {
+        if (!this.useNewColumns) {
+          return (this.currentPage - 1) * this.currentLimit + index + 1;
+        }
+        return this.levelSeqMap[row.id] != null
+          ? this.levelSeqMap[row.id]
+          : this.levelSeq(row, index);
+      },
+
       // 拉整棵树的清单,算出每行在“同层级”里的序号(跨页也连续)
       async ensureLevelSeqMap(where) {
         const attr = this.attributeData || {};
@@ -952,11 +961,19 @@
         });
       },
 
-      // 根据系统参数 is_runtian 判断是否启用新 columns 方案
-      // 是否启用新 columns 方案这里固定为 true(层级序号只在新方案生效),
-      // 不再根据系统参数 is_runtian 覆盖。
+      // 根据系统参数 is_runtian 判断是否启用新 columns 方案;序号方案随之切换
+      // 兼容常见返回:'1' / 1 / { value: 1 } / { paramValue: '1' } / true
       async getRuntianConfig() {
-        this.useNewColumns = true;
+        try {
+          const data = await parameterGetByCode({ code: 'is_runtian' });
+          const val =
+            typeof data === 'object' && data !== null
+              ? data.value ?? data.paramValue ?? data.val
+              : data;
+          this.useNewColumns = val === '1' || val === 1 || val === true;
+        } catch (e) {
+          this.useNewColumns = false;
+        }
       },
 
       rootCategoryLevelIdText(v) {
@@ -1093,8 +1110,10 @@
           bomType: this.attributeData.bomType
         });
 
-        // 序号按层级计数且跨页连续:拉一次整棵树的清单算出每行在同层级里的序号
-        await this.ensureLevelSeqMap(where);
+        // 新 columns 方案下序号按层级计数且跨页连续:拉一次整棵树的清单算出每行在同层级里的序号
+        if (this.useNewColumns) {
+          await this.ensureLevelSeqMap(where);
+        }
 
         if (this.isList) {
           data = this.listTow;

+ 9 - 3
src/views/material/BOMmanage/index.vue

@@ -569,8 +569,6 @@
         radioSubmit: 1,
         currentNodeData: {},
         pageSize: this.$store.state.tablePageSize,
-        // 是否启用新 columns 方案(true=新方案,false=老方案);层级序号只在新方案生效
-        useNewColumns: true,
         // 序号列由 type:index 改成 rowIndex 数据列,换 key 清一次列设置缓存
         // (ele-pro-table 按列 key 从 localStorage 恢复列顺序,新列不在旧缓存里会被排到最前)
         cacheKeyUrl: '68be265a-material-BOMmanage-v3',
@@ -584,6 +582,14 @@
         return this.$store.state.user.info.clientEnvironmentId;
       },
       ...mapGetters(['user']),
+      // 是否启用新 columns 方案:PBOM(activeName 为 1/'1')且系统参数 is_runtian === 1。
+      // 序号方案与新 columns 方案绑定:新方案用 rowIndex(跨页连续),老方案沿用 type:index。
+      useNewColumns() {
+        const isPBOM = this.activeName == 1 || this.activeName === '1';
+        const val = this.isRuntianValue;
+        const isRuntianOk = val === '1' || val === 1 || val === true;
+        return isPBOM && isRuntianOk;
+      },
       // 新方案默认展示的 prop 集合(自动从 newColumnsConfig 推导,避免漏配导致老列覆盖新列)
       newPropSet() {
         const set = new Set();
@@ -709,7 +715,7 @@
         });
       },
 
-      // 取系统参数 is_runtian 的原始值(新 columns 方案已固定启用,这里仅保留参数读取)
+      // 取系统参数 is_runtian 的原始值(由 computed useNewColumns 配合 activeName 共同判断)
       // 兼容常见返回:'1' / 1 / { value: 1 } / { paramValue: '1' } / true
       async getRuntianConfig() {
         try {