Browse Source

【值班系统】后台管理-字典管理,搜索字典时,有结果时,建议将结果展示出来

CzRger 1 year ago
parent
commit
9a0c3d8c94
2 changed files with 20 additions and 4 deletions
  1. 4 2
      src/views/system/dict-manage/detail.vue
  2. 16 2
      src/views/system/dict-manage/index.vue

+ 4 - 2
src/views/system/dict-manage/detail.vue

@@ -15,12 +15,14 @@
             :span="24"
             required
             label="字典显示名称:"
-            v-model:param="cusDetail.dictLabel"/>
+            v-model:param="cusDetail.dictLabel"
+            :maxLength="10"/>
         <CusFormColumn
             :span="24"
             required
             label="字典值内容:"
-            v-model:param="cusDetail.dictValue"/>
+            v-model:param="cusDetail.dictValue"
+            :maxLength="10"/>
         <CusFormColumn
             :span="24"
             required

+ 16 - 2
src/views/system/dict-manage/index.vue

@@ -11,7 +11,7 @@
         </CusFormColumn>
       </div>
       <div class="tree-content">
-        <template v-for="p in dictTree">
+        <template v-for="p in (dictTreeFilterCpt ?? dictTree)">
           <div class="tree-parent __hover" :class="{active: p.expend}" @click="p.expend = !p.expend">{{p.name}}</div>
           <template v-if="p.expend">
             <template v-for="s in p.children?.filter(v => v.name.includes(treeFilter))">
@@ -268,6 +268,19 @@ export default defineComponent({
         })
       }).catch(() => {})
     }
+    const dictTreeFilterCpt = computed(() => {
+      if (state.treeFilter) {
+        const arr = []
+        state.dictTree.forEach(p => {
+          if (p.children.some(s => s.name.includes(state.treeFilter))) {
+            arr.push(Object.assign(p, {expend: true}))
+          }
+        })
+        return arr
+      } else {
+        return null
+      }
+    })
     onMounted(() => {
       state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
       initDictionary()
@@ -285,7 +298,8 @@ export default defineComponent({
       onView,
       handleTreeClick,
       onDel,
-      refreshSearch
+      refreshSearch,
+      dictTreeFilterCpt
     }
   },
 })