Explorar el Código

内审进度内审人员顺序和查阅不一致bug修复

shenQiLong hace 3 días
padre
commit
b6252a6822
Se han modificado 1 ficheros con 18 adiciones y 3 borrados
  1. 18 3
      src/views/system/jbdScan/goods/neishenzhuangtai.vue

+ 18 - 3
src/views/system/jbdScan/goods/neishenzhuangtai.vue

@@ -320,13 +320,28 @@ import * as echarts from 'echarts'
 export default {
   components: {},
   filters: {
+    // emfiltes: function (value, arr) {
+    //   const ids = value.split(',')
+    //   const matchedItems = arr.filter((item) => ids.includes(item.ID_))
+
+    //   if (matchedItems.length === 0) return value
+
+    //   return matchedItems.map((item) => item.NAME_).join(',')
+    // },
     emfiltes: function (value, arr) {
       const ids = value.split(',')
-      const matchedItems = arr.filter((item) => ids.includes(item.ID_))
+      // 1. 构建ID-名称映射,统一转为字符串,解决数字/字符串ID匹配问题
+      const idMap = new Map()
+      arr.forEach((item) => {
+        idMap.set(String(item.ID_), item.NAME_)
+      })
 
-      if (matchedItems.length === 0) return value
+      // 2. 按原ids顺序遍历,逐个取值(核心:保证顺序)
+      const result = ids.map((id) => {
+        return idMap.has(id) ? idMap.get(id) : id
+      })
 
-      return matchedItems.map((item) => item.NAME_).join(',')
+      return result.join(',')
     },
     partFilter: function (value, arr) {
       console.log(value, arr)