Browse Source

互联网-社管一张图-企业一张图,打开此页面,图层默认仅开企业图层,其他要素未隐藏

CzRger 1 year ago
parent
commit
e4769fa898

+ 12 - 0
src/store/modules/gis.ts

@@ -794,6 +794,18 @@ const actions = {
     }
   },
   LOAD_GIS_ELEMENT({state, dispatch, getters, rootState}: any, activeArr: any = []) {
+    if (activeArr.length > 0) {
+      state.element.list.forEach(p => {
+        if (p.children?.length > 0) {
+          p.children.forEach(s => {
+            s.active = activeArr.includes(s.value)
+          })
+          p.active = p.children.every(v => v.active)
+        } else {
+          p.active = activeArr.includes(p.value)
+        }
+      })
+    }
     const cql: any = ["(geoType = 2)"]
     cql.push(`(typeValue in (${getters['elementActiveArr'].length > 0 ? getters['elementActiveArr'].map(v => `'${v.value}'`).join(',') : -1}))`)
     const notIds: Array<string> = []

+ 1 - 1
src/views/gis/business/common/business-main.vue

@@ -45,7 +45,7 @@ export default defineComponent({
       expend: true
     })
     const toIndex = () => {
-      store.dispatch('gis/LOAD_GIS_ELEMENT', ['lgszyjkscsb', 'jgzzmgs', 'lgsjkyfl', 'galsb', 'shlsb', 'mylsb'])
+      store.dispatch('gis/LOAD_GIS_ELEMENT', store.state.dictionary.elementTypeList.filter(v => ['qy', 'sb'].includes(v.dictType)).map(v => v.dictValue))
       router.push('/gis/index')
     }
     onMounted(() => {

+ 1 - 1
src/views/gis/business/enterprise/index.vue

@@ -263,7 +263,7 @@ export default defineComponent({
     })
     onActivated(() => {
       nextTick(() => {
-        store.dispatch('gis/LOAD_GIS_ELEMENT', ['lgszyjkscsb', 'jgzzmgs', 'lgsjkyfl'])
+        store.dispatch('gis/LOAD_GIS_ELEMENT', store.state.dictionary.elementTypeList.filter(v => ['qy'].includes(v.dictType)).map(v => v.dictValue))
       })
     })
     return {