瀏覽代碼

字典BUG修复

songxy 1 年之前
父節點
當前提交
876cf26ca4

+ 3 - 3
BJYSYBZ_C/src/views/KgView/components/FourContent.vue

@@ -214,9 +214,9 @@ export default {
       this.isOther = false;
       this.isAllSelected = false;
       if (this.ydlx.length > 0) {
-        const pBms = this.ydlx.filter(arr => arr[0] === 'Q');
-        const pBm = pBms[0][0] || ''
-        if (pBm !== 'Q') {
+        const otherBms = this.ydlx.filter(arr => arr[0] === 'Q');
+        if (otherBms.length === 0) {
+          const pBm = this.ydlx[0][0]
           const selected = ydlxDicts.filter(item => item.value === pBm);
           if (selected && selected.length > 0) {
             if (selected[0]['children'].length === this.ydlx.length) {

+ 108 - 18
BJYSYBZ_C/src/views/WlydtbView/components/FourContent.vue

@@ -75,17 +75,15 @@
                 <tr>
                   <th>用地类型</th>
                   <td>
-                    <el-select v-model="lx" @change="lxChange" placeholder="请选择" size="medium" filterable clearable multiple collapse-tags style="width: 100%">
-                      <el-checkbox-group v-model="lxArr" @change="lxArrChange">
-                        <el-option
-                          v-for="(item, idx) in tdyts"
-                          :key="item+idx"
-                          :label="item"
-                          :value="item">
-                          <el-checkbox :label="item">{{ item }}</el-checkbox>
-                        </el-option>
-                      </el-checkbox-group>
-                    </el-select>
+                    <el-cascader
+                      v-model="ydlx"
+                      :options="ydlxDicts"
+                      :props="{ multiple: true }"
+                      collapse-tags
+                      collapse-tags-tooltip
+                      :max-collapse-tags="3"
+                      clearable
+                    />
                   </td>
                   <th>填报状态</th>
                   <td>
@@ -220,6 +218,8 @@
 
 <script>
 import CartItem from "@/views/components/CartItem.vue";
+import { ydlxDicts } from '@/utils/dicts';
+
 export default {
   name: "FourContent",
   components:{
@@ -231,6 +231,8 @@ export default {
       zs: 0,
       lx: [],
       lxArr: [],
+      ydlx: [],
+      ydlxDicts: ydlxDicts,
       query: {
         xzqmc: '',
         name: '',
@@ -269,7 +271,9 @@ export default {
         },
         total: 100
       },
-      nf: '2021'
+      nf: '2021',
+      isAllSelected: false,
+      isOther: false
     }
   },
   mounted() {
@@ -278,7 +282,24 @@ export default {
     this.getTsxzListData();
   },
   methods: {
-    queryData() {
+    async queryData() {
+      this.isOther = false;
+      this.isAllSelected = false;
+      if (this.ydlx.length > 0) {
+        const otherBms = this.ydlx.filter(arr => arr[0] === 'Q');
+        if (otherBms.length === 0) {
+          const pBm = this.ydlx[0][0]
+          const selected = ydlxDicts.filter(item => item.value === pBm);
+          if (selected && selected.length > 0) {
+            if (selected[0]['children'].length === this.ydlx.length) {
+              this.isAllSelected = true;
+            }
+          }
+        } else {
+          this.isAllSelected = true;
+          this.isOther = true;
+        }
+      }
       this.initHZ()
       this.getTsxzListData();
       let refreshP = "(sfygd is null or sfygd = '')"
@@ -317,13 +338,64 @@ export default {
       if (this.query.name) {
         refreshP += ` and dkbh = '${this.query.name}'`
       }
-      this.$vm.$emit("changeLayer", {id: "bj-wlyd",param: refreshP,layerIdx1: 0,layerIdx2: 1})
+      const result = await this.queryWlydZydxzList();
+      const dataResult = result['data']
+      if (dataResult && dataResult.length > 0) { 
+        let pstr = '';
+        dataResult.forEach((it,index) => {
+          pstr += "'"
+          pstr += it
+          if (index === dataResult.length - 1) {
+            pstr += "'";
+          } else {
+            pstr += "',"
+          }
+        })
+        if (this.isOther) {
+          refreshP += ` and zydxz not in (${pstr})`
+        } else {
+          refreshP += ` and zydxz in (${pstr})`
+        }
+      }
+      setTimeout(() => {
+        this.$vm.$emit("updateLayer", { id: "bj-wlyd", param: refreshP, layerIdx: 'ysybz:bjwlyd2000' })
+        this.$vm.$emit('change-layer')
+      }, 200)
+    },
+    queryWlydZydxzList() {
+      const urlApi = `/api/ybz-bj/wlydZydxzList/query`;
+      let p = {}
+      p['isOther'] = this.isOther
+      if (this.isOther) {
+        p['dlbms'] = ydlxDicts.map((item) => item['value']);
+      } else {
+        if (this.ydlx.length > 0) {
+          p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
+        }
+      }
+      return new Promise((resolve, reject) => {
+        if (this.ydlx.length > 0) {
+          this.$ajax.get(urlApi, p, this, false).then((result) => {
+            resolve(result)
+          })
+          return;
+        }
+        resolve({data: []})
+      })
     },
     initHZ() {
       let p = {
         ...this.query,
         lx: this.lx.join(";")
       }
+      p['isOther'] = this.isOther
+      if (this.isOther) {
+        p['dlbms'] = ydlxDicts.map((item) => item['value']);
+      } else {
+        if (this.ydlx.length > 0) {
+          p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
+        }
+      }
       const urlApi = `/api/ybz-bj/wlydTJ`;
       this.$ajax.get(urlApi, p, this, false).then(result=>{
         const { num,mj } = result.data
@@ -346,6 +418,15 @@ export default {
         pageIndex: this.config.page.index,
         pageSize: this.config.page.count
       }
+      
+      p['isOther'] = this.isOther
+      if (this.isOther) {
+        p['dlbms'] = ydlxDicts.map((item) => item['value']);
+      } else {
+        if (this.ydlx.length > 0) {
+          p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
+        }
+      }
       this.$ajax.get(urlApi, p, this, false).then((result) => {
         const data = result["data"] || {};
         this.xzList = data['list'];
@@ -370,6 +451,18 @@ export default {
     },
     exportExcel() {
       const urlApi = `/api/ybz-bj/exportWlydExcel`;
+      const sendData = {
+        ...this.query,
+        lx: this.lx.join(";")
+      };
+      sendData['isOther'] = this.isOther
+      if (this.isOther) {
+        sendData['dlbms'] = ydlxDicts.map((item) => item['value']);
+      } else {
+        if (this.ydlx.length > 0) {
+          sendData['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
+        }
+      }
       this.$axios({
           baseURL: window.ApplicationConfig.baseUrl,
           url: urlApi,
@@ -377,10 +470,7 @@ export default {
           responseType: 'blob', // 服务器返回的数据类型
           params: { // 其他参数
           },
-          data: {
-            ...this.query,
-            lx: this.lx.join(";")
-          }
+          data: sendData
         }).then(res => {
           // 此处有个坑。这里用content保存文件流,最初是content=res,但下载的test.xls里的内容如下图1,
           // 检查了下才发现,后端对文件流做了一层封装,所以将content指向res.data即可

+ 3 - 3
BJYSYBZ_C/src/views/WlydxqView/components/FourContent.vue

@@ -352,9 +352,9 @@ export default {
       this.isOther = false;
       this.isAllSelected = false;
       if (this.ydlx.length > 0) {
-        const pBms = this.ydlx.filter(arr => arr[0] === 'Q');
-        const pBm = pBms.length > 0 ? pBms[0][0] || '' : ''
-        if (pBm !== 'Q') {
+        const otherBms = this.ydlx.filter(arr => arr[0] === 'Q');
+        if (otherBms.length === 0) {
+          const pBm = this.ydlx[0][0]
           const selected = ydlxDicts.filter(item => item.value === pBm);
           if (selected && selected.length > 0) {
             if (selected[0]['children'].length === this.ydlx.length) {