From 60e16bd5406c4cbdf61bf20a50e8e1b49a45b2aa Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 06 Sep 2024 11:14:59 +0800
Subject: [PATCH] Merge branch 'feature_1.0'

---
 src/views/list/Unit.vue |   50 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/src/views/list/Unit.vue b/src/views/list/Unit.vue
index 06d199a..7cd8255 100644
--- a/src/views/list/Unit.vue
+++ b/src/views/list/Unit.vue
@@ -5,7 +5,7 @@
         <a-form-item label="������:">
           <a-input v-model="serch.name" style="width: 200px" />
         </a-form-item>
-        <a-form-item label="������������:">
+        <!-- <a-form-item label="������������:">
           <a-cascader
             placeholder="���������"
             labelInValue
@@ -14,9 +14,19 @@
             :options="parentListOptions"
             @change="positionLevel"
           />
-        </a-form-item>
+        </a-form-item> -->
+
         <a-form-item label="������������:">
-          <a-select
+          <a-cascader
+            placeholder="���������"
+            v-model="serch.areaCode"
+            labelInValue
+            multiple
+            style="width: 200px"
+            :options="parentListOptions"
+            @change="belongToRegion"
+          />
+          <!-- <a-select
             ref="select"
             v-model="serch.areaCode"
             style="width: 200px"
@@ -29,7 +39,7 @@
             >
               {{ item.areaName }}
             </a-select-option>
-          </a-select>
+          </a-select> -->
         </a-form-item>
         <a-form-item>
           <a-button type="primary" html-type="submit" @click="handleSearch">
@@ -300,14 +310,12 @@
 
   private handleSearch(): void {
     console.log(this.serch);
-    const data = this.serch.parentCode;
-    let code = data[data.length - 1];
+    const data = this.serch.areaCode;
+    let code = data[data.length - 2];
 
     get("unit/selectUint", {
       name: this.serch.name,
-      parentCode: code,
-      parentCodeList: this.serch.parentCode,
-      areaCode: this.serch.areaCode,
+      unitId: data[data.length - 1],
       page: this.pagination.current,
       size: this.pagination.pageSize,
     })
@@ -319,7 +327,10 @@
         console.log(err);
       });
   }
-
+  belongToRegion(val: any) {
+    console.log("123", val);
+    console.log("123", this.serch.parentCode);
+  }
   private handlerTableChange(pagination: any, filter: any, sorter: any): void {
     console.log("pagination", pagination);
     this.pagination.current = pagination.current;
@@ -404,14 +415,30 @@
         lists = lists.replace(/"areaName"/g, '"label"');
 
         const treeLists = JSON.parse(lists);
-        this.parentListOptions = JSON.parse(JSON.stringify(treeLists));
         this.newParentListOptions = JSON.parse(JSON.stringify(treeLists));
       })
       .catch((err) => {
         console.log(err);
       });
   }
+  queryUnit() {
+    get("/unit/query", {})
+      .then((res) => {
+        console.log("00000000000000", res);
+        let org = res.data.data;
+        let lists = JSON.stringify(org);
 
+        lists = lists.replace(/"unitId"/g, '"value"');
+
+        lists = lists.replace(/"unitName"/g, '"label"');
+
+        const treeLists = JSON.parse(lists);
+        this.parentListOptions = JSON.parse(JSON.stringify(treeLists));
+      })
+      .catch((err) => {
+        console.log(err);
+      });
+  }
   private positionLevel(val: any) {
     this.serch.areaCode = "";
     this.editForm.areaCode = "";
@@ -432,6 +459,7 @@
   private mounted() {
     this.handleSearch();
     this.cityData();
+    this.queryUnit();
   }
 
   private updatedAtRender(text: string) {

--
Gitblit v1.8.0