瀏覽代碼

优化代码

linweizeng 2 年之前
父節點
當前提交
7540983f01
共有 1 個文件被更改,包括 2 次插入10 次删除
  1. 2 10
      src/business/platform/org/position/panel.vue

+ 2 - 10
src/business/platform/org/position/panel.vue

@@ -238,11 +238,7 @@ export default {
                         const frist = this.$store.getters.level.first || ''
                         const frist = this.$store.getters.level.first || ''
                         if ((type === '1' || type === '2') && this.filtrate && frist) {
                         if ((type === '1' || type === '2') && this.filtrate && frist) {
                             const showBoo = arr.some((item) => item.id === frist)
                             const showBoo = arr.some((item) => item.id === frist)
-                            if (showBoo) {
-                                arrList = arr.filter((item) => item.id === frist)
-                            } else {
-                                arrList = arr
-                            }
+                            arrList = showBoo ? arr.filter(item => item.id === frist) : arr
                         } else {
                         } else {
                             arrList = arr
                             arrList = arr
                         }
                         }
@@ -279,11 +275,7 @@ export default {
                     const second = this.$store.getters.level.second || ''
                     const second = this.$store.getters.level.second || ''
                     if ((type === '1' || type === '2') && this.filtrate && second) {
                     if ((type === '1' || type === '2') && this.filtrate && second) {
                         const showBoo = arr.some((item) => item.id === second)
                         const showBoo = arr.some((item) => item.id === second)
-                        if (showBoo) {
-                            arrList = arr.filter((item) => item.id === second)
-                        } else {
-                            arrList = arr
-                        }
+                        arrList = showBoo ? arr.filter((item) => item.id === second) : arr
                     } else {
                     } else {
                         arrList = arr
                         arrList = arr
                     }
                     }