Bläddra i källkod

1. public下添加首页json数据;2. 自定义模型修改

Bella 2 år sedan
förälder
incheckning
be27e2e797

+ 85 - 0
public/static/json/home/layout_forest.json

@@ -0,0 +1,85 @@
+[{
+    "name":"北蔡镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"林地面积",
+        "area":150
+    },{
+        "year":2020,
+        "type":"林地面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"林地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"公益林面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"公益林面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"公益林面积",
+        "area":170
+    }]
+},{
+    "name":"祝桥镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"林地面积",
+        "area":150
+    },{
+        "year":2020,
+        "type":"林地面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"林地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"公益林面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"公益林面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"公益林面积",
+        "area":170
+    }]
+},{
+    "name":"大团镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"林地面积",
+        "area":130
+    },{
+        "year":2020,
+        "type":"林地面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"林地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"公益林面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"公益林面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"公益林面积",
+        "area":170
+    }]
+}]

+ 157 - 0
public/static/json/home/layout_land.json

@@ -0,0 +1,157 @@
+[{
+    "name":"北蔡镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"基本农田面积",
+        "area":150
+    },{
+        "year":2020,
+        "type":"基本农田面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"基本农田面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"一般耕地面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"一般耕地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"一般耕地面积",
+        "area":170
+    }]
+},{
+    "name":"祝桥镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"基本农田面积",
+        "area":150
+    },{
+        "year":2020,
+        "type":"基本农田面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"基本农田面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"一般耕地面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"一般耕地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"一般耕地面积",
+        "area":170
+    }]
+},{
+    "name":"大团镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"基本农田面积",
+        "area":130
+    },{
+        "year":2020,
+        "type":"基本农田面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"基本农田面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"减量化面积",
+        "area":160
+    },{
+        "year":2021,
+        "type":"减量化面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2020,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"储备土地面积",
+        "area":170
+    },{
+        "year":2019,
+        "type":"一般耕地面积",
+        "area":210
+    },{
+        "year":2020,
+        "type":"一般耕地面积",
+        "area":170
+    },{
+        "year":2021,
+        "type":"一般耕地面积",
+        "area":170
+    }]
+}]

+ 49 - 0
public/static/json/home/layout_money.json

@@ -0,0 +1,49 @@
+[{
+    "name":"北蔡镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资金",
+        "area":150
+    },{
+        "year":2020,
+        "type":"资金",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资金",
+        "area":170
+    }]
+},{
+    "name":"祝桥镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资金",
+        "area":150
+    },{
+        "year":2020,
+        "type":"资金",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资金",
+        "area":170
+    }]
+},{
+    "name":"大团镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资金",
+        "area":130
+    },{
+        "year":2020,
+        "type":"资金",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资金",
+        "area":170
+    }]
+}]

+ 121 - 0
public/static/json/home/layout_project.json

@@ -0,0 +1,121 @@
+[{
+    "name":"北蔡镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资源环境项目",
+        "area":150
+    },{
+        "year":2020,
+        "type":"资源环境项目",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2021,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2021,
+        "type":"调查项目",
+        "area":170
+    }]
+},{
+    "name":"祝桥镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资源环境项目",
+        "area":150
+    },{
+        "year":2020,
+        "type":"资源环境项目",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2021,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2021,
+        "type":"调查项目",
+        "area":170
+    }]
+},{
+    "name":"大团镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"资源环境项目",
+        "area":130
+    },{
+        "year":2020,
+        "type":"资源环境项目",
+        "area":160
+    },{
+        "year":2021,
+        "type":"资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"自然资源环境项目",
+        "area":160
+    },{
+        "year":2021,
+        "type":"自然资源环境项目",
+        "area":170
+    },{
+        "year":2019,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2020,
+        "type":"调查项目",
+        "area":170
+    },{
+        "year":2021,
+        "type":"调查项目",
+        "area":170
+    }]
+}]

+ 121 - 0
public/static/json/home/layout_water.json

@@ -0,0 +1,121 @@
+[{
+    "name":"北蔡镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"水域数量",
+        "area":150
+    },{
+        "year":2020,
+        "type":"水域数量",
+        "area":160
+    },{
+        "year":2021,
+        "type":"水域数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2021,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2021,
+        "type":"镇管河道数量",
+        "area":170
+    }]
+},{
+    "name":"祝桥镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"水域数量",
+        "area":150
+    },{
+        "year":2020,
+        "type":"水域数量",
+        "area":160
+    },{
+        "year":2021,
+        "type":"水域数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2021,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2021,
+        "type":"镇管河道数量",
+        "area":170
+    }]
+},{
+    "name":"大团镇",
+    "pid":310115105000,
+    "data":[{
+        "year":2019,
+        "type":"水域数量",
+        "area":130
+    },{
+        "year":2020,
+        "type":"水域数量",
+        "area":160
+    },{
+        "year":2021,
+        "type":"水域数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"区管河道数量",
+        "area":160
+    },{
+        "year":2021,
+        "type":"区管河道数量",
+        "area":170
+    },{
+        "year":2019,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2020,
+        "type":"镇管河道数量",
+        "area":170
+    },{
+        "year":2021,
+        "type":"镇管河道数量",
+        "area":170
+    }]
+}]

+ 399 - 28
src/components/common/BottomForm/CustomModelDialog.vue

@@ -2,7 +2,7 @@
   <el-dialog
     :title="modelTitle ? modelTitle : '自定义模型'"
     :visible.sync="outerDialogVisible"
-    width="40%"
+    width="750px"
     center
   >
     <el-dialog
@@ -20,14 +20,79 @@
         <el-button type="primary" @click="confirm()">确认</el-button>
       </span>
     </el-dialog>
-    <TreeTransfer />
-    <!--  <el-checkbox-group v-model="checkedList">
-      <el-checkbox
-        v-for="item in checkArr"
-        :key="item"
-        :label="item"
-      ></el-checkbox>
-    </el-checkbox-group> -->
+    <div class="transfer-container">
+      <div class="transfer-container-left">
+        <div class="search">
+          <el-input
+            v-model="filterText"
+            placeholder="请输入搜索内容"
+          ></el-input>
+        </div>
+        <div class="tree">
+          <el-tree
+            :default-expanded-keys="checkedList"
+            :data="transferData"
+            :props="defaultProps"
+            @check-change="transferCheckChange"
+            ref="transferTree"
+            node-key="id"
+            :filter-node-method="filterNode"
+          >
+            <span class="custom-tree-node" slot-scope="{ node }">
+              <template
+                v-if="node.level < 4 && node.parent.label !== '预设模型'"
+              >
+                <div
+                  :class="{
+                    'tree-arrow': !node.expanded,
+                    'tree-arrow-expanded': node.expanded,
+                  }"
+                ></div>
+                <span>{{ node.label }}</span>
+              </template>
+              <template
+                v-else-if="node.level === 4 || node.parent.label === '预设模型'"
+              >
+                <el-checkbox v-model="node.checked" style="position: relative"
+                  >{{ node.label }}
+                </el-checkbox>
+              </template>
+            </span>
+          </el-tree>
+        </div>
+      </div>
+      <div class="transfer-container-center">
+        <div class="inner">
+          <el-button
+            size="normal"
+            type="primary"
+            icon="el-icon-arrow-left"
+            @click="deleteCheckList"
+          ></el-button>
+          <el-button
+            size="normal"
+            type="primary"
+            icon="el-icon-arrow-right"
+            @click="addCheckList"
+          ></el-button>
+        </div>
+      </div>
+      <div class="transfer-container-right">
+        <el-checkbox-group v-model="checkedList">
+          <div class="inner-group" v-for="item in checkArr" :key="item">
+            <el-checkbox :key="item" :label="item"></el-checkbox>
+          </div>
+        </el-checkbox-group>
+      </div>
+    </div>
+    <!-- <TreeTransfer ref="transferRef">
+      <el-checkbox-group v-model="checkedList">
+        <div class="inner-group" v-for="item in checkArr" :key="item">
+          <el-checkbox :key="item" :label="item"></el-checkbox>
+        </div>
+      </el-checkbox-group>
+    </TreeTransfer> -->
+
     <div
       v-if="overlayBtnShow"
       class="overlay-container"
@@ -55,7 +120,7 @@
   </el-dialog>
 </template>
 <script>
-import TreeTransfer from "../TreeTransfer.vue";
+import publicFun from "@/utils/publicFunction.js";
 /**
  * 底部菜单(自定义模型)组件
  * @author: Gao Lu
@@ -63,7 +128,7 @@ import TreeTransfer from "../TreeTransfer.vue";
  */
 export default {
   name: "CustomModelDialog",
-  components: { TreeTransfer },
+  components: {},
   data() {
     return {
       btnChecked: false,
@@ -72,8 +137,16 @@ export default {
       overlayBtnShow: false,
       modelTitle: null,
       inputName: "自定义模型1",
-      checkedList: [],
       checkArr: [],
+      checkedList: [],
+      defaultProps: {
+        children: "children",
+        label: "label",
+      },
+      transferData: [],
+      filterText: "",
+      transferTreeIdMap: new Map(),
+      createModelParams: {},
     };
   },
   watch: {
@@ -81,7 +154,9 @@ export default {
       console.log(val, "checkedList");
     },
   },
-  created() {},
+  created() {
+    this.getColumnList();
+  },
   mounted() {
     // 监听自定义模型
     this.$bus.$off("customModelEvent");
@@ -109,6 +184,137 @@ export default {
     this.overlayBtnShow = false;
   },
   methods: {
+    getColumnList() {
+      this.transferData = [];
+      this.$Post(this.urlsCollection.getColumnList).then((res) => {
+        if (res.code === 200 && res.content.length > 0) {
+          let data = res.content.map((item1) => {
+            if (item1.title === "所有图层" && item1.columnList.length > 0) {
+              this.transferTreeIdMap.set(
+                item1.title,
+                `${item1.title}_${item1.id}`
+              );
+              return {
+                id: `${item1.title}_${item1.id}`,
+                label: item1.title,
+                // 镇
+                children:
+                  item1.columnList.length === 0
+                    ? []
+                    : item1.columnList.map((item2) => {
+                        this.transferTreeIdMap.set(
+                          item2.title,
+                          `${item2.title}_${item2.id}`
+                        );
+                        return {
+                          id: `${item2.title}_${item2.id}`,
+                          label: item2.title,
+                          // 水资源,土地资源,林地资源
+                          children:
+                            item2.columnList.length === 0
+                              ? []
+                              : item2.columnList.map((item3) => {
+                                  this.transferTreeIdMap.set(
+                                    item3.title,
+                                    `${item3.title}_${item3.id}`
+                                  );
+                                  return {
+                                    id: `${item3.title}_${item3.id}`,
+                                    label: item3.title,
+                                    tag: item3.tag,
+                                    children:
+                                      item3.columnList.length === 0
+                                        ? []
+                                        : item3.columnList.map((item4) => {
+                                            this.transferTreeIdMap.set(
+                                              item4.title,
+                                              `${item4.title}_${item4.id}`
+                                            );
+                                            // this.rightPanelDataMap.set(
+                                            //   item4.title,
+                                            //   item4.children
+                                            // );
+
+                                            // this.randomColor.set(
+                                            //   `${item4.title}_${item2.title}`,
+                                            //   publicFun.getRandomColor()
+                                            // );
+
+                                            return {
+                                              id: `${item4.title}_${item4.id}`,
+                                              label: item4.title,
+                                              children: [],
+                                              columnId: item4.id,
+                                              modelName: item4.modelName,
+                                              modelId: item4.modelId,
+                                              tag: item4.tag,
+                                              type: item3.title,
+                                              town: item2.title,
+                                              // color: publicFun.getRandomColor(),
+                                            };
+                                          }),
+                                  };
+                                }),
+                        };
+                      }),
+              };
+            }
+            if (item1.title === "预设模型" && item1.columnList.length > 0) {
+              this.transferTreeIdMap.set(
+                item1.title,
+                `${item1.title}_${item1.id}`
+              );
+              return {
+                id: `${item1.title}_${item1.id}`,
+                label: item1.title,
+                children:
+                  item1.columnList.length === 0
+                    ? []
+                    : item1.columnList.map((item2) => {
+                        this.transferTreeIdMap.set(
+                          item2.title,
+                          `${item2.title}_${item2.id}`
+                        );
+                        return {
+                          id: `${item2.title}_${item2.id}`,
+                          label: item2.title,
+                          children: [],
+                        };
+                      }),
+              };
+            }
+          });
+
+          data.forEach((c) => {
+            if (c) {
+              this.transferData.unshift(c);
+            }
+          });
+        }
+      });
+    },
+    transferCheckChange(data, checked) {
+      // console.log(this.$refs.transferTree.getCheckedKeys(),"getCheckedKeys");
+    },
+    deleteCheckList() {
+      if (this.checkedList.length > 0) {
+      }
+    },
+    addCheckList() {
+      this.$nextTick(() => {
+        if (this.$refs.transferTree) {
+          console.log(
+            this.$refs.transferTree.getCheckedKeys(),
+            "当前选中的keys"
+          );
+        }
+      });
+    },
+    // 节点过滤事件
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
     // 弹窗关闭时询问
     handleClose() {
       // if (this.outerDialogVisible) {
@@ -129,10 +335,18 @@ export default {
       this.outerDialogVisible = true;
       console.log(this.$store.state.treeDataCollection, "treeDataCollection");
       this.checkedList = [];
+      this.checkArr = [];
+      // this.transferCheckedKeys = [];
       if (this.$store.state.treeDataCollection.size > 0) {
         this.$store.state.treeDataCollection.forEach((v, i) => {
+          this.checkArr.push(i);
           this.checkedList.push(i);
         });
+        this.$nextTick((e) => {
+          console.log(this.$refs.transferTree, "this.$refs.transferTre");
+
+          this.$refs.transferTree.setCheckedKeys(this.checkedList);
+        });
       }
       // this.checkedList = [];
       this.inputName = "自定义模型1";
@@ -150,8 +364,6 @@ export default {
     },
     confirm() {
       this.$confirm("确认保存吗?").then(() => {
-        this.$message.success("模型以保存");
-        this.clearDialogVisible();
         // modify -- 改变数组类型
         if (this.$store.state.modelStatus === "modify") {
           this.$store.state.customModelsArr.map((v) => {
@@ -168,6 +380,24 @@ export default {
             name: this.inputName,
             data: this.checkedList,
           });
+
+          // let createModel = {
+
+          // }
+          // 设置需要添加的参数
+
+          let params = new FormData();
+          params = {
+            columnId: "",
+            modelId: "",
+            content: JSON.stringify(this.createModelParams),
+          };
+          this.$Post(this.urlsCollection.addContent, params).then((res) => {
+            if (res.code === 200) {
+              this.$message.success("模型以保存");
+              this.clearDialogVisible();
+            }
+          });
         }
       });
     },
@@ -181,6 +411,7 @@ export default {
 };
 </script>
 <style lang="less" scoped>
+@commonBorderColor: rgb(0, 170, 255);
 .model-name {
   // pointer-events: auto;
   width: 100%;
@@ -200,25 +431,165 @@ export default {
     width: 70%;
   }
 }
+.transfer-container {
+  width: 700px;
+  height: 330px;
+  position: relative;
+  margin: 0 auto;
+  color: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+  &-left {
+    width: 270px;
+    height: 320px;
+    border: 1px solid @commonBorderColor;
+    border-radius: 5px;
+    .search {
+      width: 240px;
+      height: 40px;
+      position: absolute;
+      left: 17px;
+      top: 10px;
+    }
+    .tree {
+      width: 240px;
+      height: calc(90% - 40px);
+      position: absolute;
+      top: 60px;
+      left: 10px;
+      // border: 1px solid peachpuff;
+      overflow: auto;
+      .tree-arrow {
+        position: relative;
+        top: 0;
+        left: 0;
+        display: inline-block;
+        width: 0px;
+        height: 0px;
+        border: 7px solid transparent;
+        border-left-color: #fff;
+      }
+      .tree-arrow-expanded {
+        position: relative;
+        top: 4px;
+        left: -3px;
+        display: inline-block;
+        width: 0px;
+        height: 0px;
+        border: 7px solid transparent;
+        border-top-color: #fff;
+      }
+      .custom-tree-node {
+        position: relative;
+        width: 250px;
+        // .el-checkbox {
+        //   width: 50%;
+        // }
+        .el-checkbox {
+          width: 50%;
+          color: #fff;
+          /deep/.el-checkbox__input.is-checked + .el-checkbox__label {
+            color: rgba(116, 255, 255, 1);
+          }
+
+          /deep/.el-checkbox__input.is-checked .el-checkbox__inner::after {
+            width: 70%;
+            height: 70%;
+            background: #74ffff;
+            border-radius: 0;
+            transform: rotate(0deg) scaleY(1);
+            position: static;
+          }
+
+          /deep/.el-checkbox__inner {
+            border: 1px solid #dcdfe6;
+            background: rgba(0, 170, 255, 0);
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            position: static;
+            &::after {
+              transition: 0ms;
+            }
+          }
+
+          /deep/.el-checkbox__label {
+            padding-left: 0;
+            font-size: 15px;
+            position: absolute;
+            top: 1px;
+            left: 25px;
+          }
+        }
+      }
+    }
+  }
+  &-center {
+    width: 150px;
+    height: 320px;
+    // border: 1px solid yellow;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    .inner {
+      // border: 1px solid black;
+      width: 150px;
+      height: 30%;
+      display: flex;
+      align-items: center;
+      justify-content: space-around;
+    }
+  }
+  &-right {
+    width: 270px;
+    height: 320px;
+    border: 1px solid @commonBorderColor;
+    border-radius: 5px;
+    overflow: auto;
+  }
+}
 
 .el-checkbox-group {
+  width: 100%;
   display: flex;
-  flex-wrap: wrap;
-  justify-content: space-around;
+  flex-direction: column;
+  justify-content: flex-start;
+  align-items: center;
   overflow: auto;
-  height: 150px;
+  height: 310px;
+  .inner-group {
+    width: 210px;
+    height: 30px;
+    position: relative;
+    /deep/.el-checkbox {
+      font-weight: 500;
+      font-size: 15px;
+      cursor: pointer;
+      // width: 10px;
+      height: 30px;
+      line-height: 30px;
+      color: #e6e6e6;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      position: relative;
+      left: 0;
+      // margin-left: 0;
+      // margin-right: 0;
+    }
+    /deep/.el-checkbox_label {
+      width: 200px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
+  }
 }
 
-.el-checkbox {
-  font-weight: 500;
-  font-size: 15px;
-  cursor: pointer;
-  width: 27%;
-  height: 30px;
-  line-height: 30px;
-  color: #e6e6e6;
-  margin-right: 0;
-}
+// /deep/.el-checkbox_label{
+//   width: 200px !important;
+// }
 .overlay-container {
   width: 100%;
   height: 35px;

+ 0 - 33
src/components/common/TreeTransfer.vue

@@ -1,33 +0,0 @@
-<template>
-  <div class="transfer-container">
-    开发中 ! ! !
-  </div>
-</template>
-<script>
-/**
- * 针对树结构的穿梭框组件
- */
-export default {
-  name: "TreeTransfer",
-  components: {},
-  data() {
-    return {};
-  },
-  mounted() {},
-  methods: {},
-};
-</script>
-<style lang="less" scoped>
-.transfer-container {
-  width: 700px;
-  height: 300px;
-  // border: 1px solid yellow;
-  position: relative;
-  margin: 0 auto;
-  color: #fff;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  font-size: 25px;
-}
-</style>

+ 2 - 2
src/components/popup/AttributePopup.vue

@@ -22,8 +22,8 @@
       ></el-table-column>
 
       <el-table-column
-        label="年份"
-        prop="year"
+        label="类型"
+        prop="columnName"
         align="center"
       ></el-table-column>
     </el-table>

+ 227 - 110
src/views/ComprehensiveAnalysis.vue

@@ -74,7 +74,7 @@
           <el-input
             class="control-container-input"
             v-model="filterText"
-            placeholder="请输入文本"
+            placeholder="请输入搜索内容"
           ></el-input>
           <el-tooltip
             effect="light"
@@ -98,9 +98,12 @@
               node-key="id"
               ref="tree"
               :filter-node-method="filterNode"
+              @node-click="handleNodeClick"
             >
               <span class="custom-tree-node" slot-scope="{ node }">
-                <template v-if="node.level < 4">
+                <template
+                  v-if="node.level < 4 && node.parent.label !== '预设模型'"
+                >
                   <div
                     :class="{
                       'tree-arrow': !node.expanded,
@@ -109,7 +112,11 @@
                   ></div>
                   <span>{{ node.label }}</span>
                 </template>
-                <template v-else-if="node.level === 4">
+                <template
+                  v-else-if="
+                    node.level === 4 || node.parent.label === '预设模型'
+                  "
+                >
                   <el-checkbox v-model="node.checked" style="position: relative"
                     >{{ node.label
                     }}<span
@@ -350,7 +357,7 @@ export default {
     },
     getCustomModel: {
       handler(val) {
-        // console.log(val, "目前存在的自定义模型");
+        console.log(val, "目前存在的自定义模型");
         // let myModelRef = this.$refs.tree.data[2];
         // if (myModelRef.label === "我的模型") {
         //   this.$refs.tree.data[2].children = val.map((ele) => {
@@ -465,7 +472,10 @@ export default {
         if (res.code === 200 && res.content.length > 0) {
           let data = res.content.map((item1) => {
             if (item1.title === "所有图层" && item1.columnList.length > 0) {
-              treeIdMap.set(item1.title, `${item1.title}_${item1.id}`);
+              treeIdMap.set(
+                `${item1.title}_${item1.id}`,
+                `${item1.title}_${item1.id}`
+              );
               return {
                 id: `${item1.title}_${item1.id}`,
                 label: item1.title,
@@ -475,7 +485,7 @@ export default {
                     ? []
                     : item1.columnList.map((item2) => {
                         treeIdMap.set(
-                          item2.title,
+                          `${item2.title}_${item2.id}`,
                           `${item2.title}_${item2.id}`
                         );
                         return {
@@ -487,7 +497,7 @@ export default {
                               ? []
                               : item2.columnList.map((item3) => {
                                   treeIdMap.set(
-                                    item3.title,
+                                    `${item3.title}_${item3.id}`,
                                     `${item3.title}_${item3.id}`
                                   );
                                   return {
@@ -499,7 +509,7 @@ export default {
                                         ? []
                                         : item3.columnList.map((item4) => {
                                             treeIdMap.set(
-                                              item4.title,
+                                              `${item4.title}_${item4.id}`,
                                               `${item4.title}_${item4.id}`
                                             );
                                             this.rightPanelDataMap.set(
@@ -522,6 +532,7 @@ export default {
                                               tag: item4.tag,
                                               type: item3.title,
                                               town: item2.title,
+                                              mainType: item1.title,
                                               color: publicFun.getRandomColor(),
                                             };
                                           }),
@@ -531,9 +542,56 @@ export default {
                       }),
               };
             }
+            if (item1.title === "预设模型" && item1.columnList.length > 0) {
+              treeIdMap.set(
+                `${item1.title}_${item1.id}`,
+                `${item1.title}_${item1.id}`
+              );
+              return {
+                id: `${item1.title}_${item1.id}`,
+                label: item1.title,
+                children:
+                  item1.columnList.length === 0
+                    ? []
+                    : item1.columnList.map((item2) => {
+                        treeIdMap.set(
+                          `${item2.title}_${item2.id}`,
+                          `${item2.title}_${item2.id}`
+                        );
+                        this.randomColor.set(
+                          `${item2.title}_${item2.id}`,
+                          publicFun.getRandomColor()
+                        );
+                        return {
+                          id: `${item2.title}_${item2.id}`,
+                          label: item2.title,
+                          children: [],
+                          mainType: item1.title,
+                          // color: publicFun.getRandomColor(),
+                        };
+                      }),
+              };
+            }
+
+            if (item1.title === "我的模型") {
+              // treeIdMap.set(item1.title, `${item1.title}_${item1.id}`);
+              treeIdMap.set(
+                `${item1.title}_${item1.id}`,
+                `${item1.title}_${item1.id}`
+              );
+              return {
+                id: `${item1.title}_${item1.id}`,
+                children: [],
+                label: item1.title,
+              };
+            }
           });
 
-          this.modelData = [data[0]];
+          data.forEach((v) => {
+            if (v) {
+              this.modelData.unshift(v);
+            }
+          });
         }
       });
     },
@@ -628,111 +686,176 @@ export default {
     handleDelete(node) {
       console.log(node, "删除节点");
     },
+    handleNodeClick(node) {
+      // console.log(node, "node");
+    },
     // 节点change事件
     handleCheckChange(data, checked) {
       let guid = data.id;
       if (checked) {
         console.log(data, "选中的数据");
         this.showRightBox = true;
-        this.rightPanelTitle = data.label;
-        this.originalData[`${data.label}_${data.town}`] =
-          this.rightPanelDataMap.get(data.label);
+        if (data.mainType === "所有图层") {
+          this.rightPanelTitle = data.label;
+          this.originalData[`${data.label}_${data.town}`] =
+            this.rightPanelDataMap.get(data.label);
 
-        let searchParam = [];
-        let targetTown = this.classTextToIndex["浦东新区行政区划"].get(
-          data.town
-        );
-        let targetType = this.classTextToIndex["任务类型"].get(data.type);
+          let searchParam = [];
+          let targetTown = this.classTextToIndex["浦东新区行政区划"].get(
+            data.town
+          );
+          let targetType = this.classTextToIndex["任务类型"].get(data.type);
 
-        let paramUser = {
-          field: "c_user_id",
-          searchType: "2",
-          content: {
-            value: localStorage.getItem("USER_ID"),
-          },
-        };
-        searchParam.push(paramUser);
-        let paramTown = {
-          field: "c_area_code",
-          searchType: "1",
-          content: {
-            value: targetTown,
-          },
-        };
-        searchParam.push(paramTown);
-        let paramType = {
-          field: "c_task_type",
-          searchType: "1",
-          content: {
-            value: targetType,
-          },
-        };
-        searchParam.push(paramType);
+          let paramUser = {
+            field: "c_user_id",
+            searchType: "2",
+            content: {
+              value: localStorage.getItem("USER_ID"),
+            },
+          };
+          searchParam.push(paramUser);
+          let paramTown = {
+            field: "c_area_code",
+            searchType: "1",
+            content: {
+              value: targetTown,
+            },
+          };
+          searchParam.push(paramTown);
+          let paramType = {
+            field: "c_task_type",
+            searchType: "1",
+            content: {
+              value: targetType,
+            },
+          };
+          searchParam.push(paramType);
 
-        let params = new FormData();
-        params = {
-          columnId: 61,
-          states: "2,3",
-          pageSize: 10,
-          page: 0,
-          search: JSON.stringify(searchParam),
-        };
+          let params = new FormData();
+          params = {
+            columnId: 61,
+            states: "2,3",
+            pageSize: 10,
+            page: 0,
+            search: JSON.stringify(searchParam),
+          };
+          console.log(params, "所有图层不显示");
 
-        this.$Post(this.urlsCollection.selectContentList, params).then(
-          (res) => {
-            // console.log(res, "获取数据");
-            if (res.code === 202 && res.content === "数据不存在") {
-              this.$message.info("当前用户无权限!");
+          this.$Post(this.urlsCollection.selectContentList, params).then(
+            (res) => {
+              // console.log(res, "获取数据");
+              // debugger
+              if (res.code === 202 && res.content === "数据不存在") {
+                this.$message.info("当前用户无权限!");
+              }
+
+              if (res.code === 200 && res.content.data.length > 0) {
+                console.log("有权限");
+                console.log(data, "有权限的图层");
+                this.$store.state.treeDataCollection.set(data.id, {
+                  mainType: data.mainType,
+                  town: data.town,
+                  type: data.type,
+                });
+
+                let layerParams = new FormData();
+                layerParams = {
+                  columnId: data.columnId,
+                  states: 3,
+                  pageSize: 10,
+                  page: 0,
+                };
+                this.$Post(
+                  this.urlsCollection.selectContentList,
+                  layerParams
+                ).then((res) => {
+                  if (res.code === 200 && res.content.data.length > 0) {
+                    console.log(res.content, "获取到的数据");
+                    let uniqueId = `${data.label}_${data.town}`;
+                    this.originalData[uniqueId] = res.content.data.map(
+                      (ele) => {
+                        let cid = `${data.label}_${ele.id}`;
+
+                        let geometry = ele.c_geometry;
+                        map2DViewer.polygons[`${cid}_polygon`] = [];
+                        this.layerIdMap.set(data.id, `${cid}_polygon`);
+                        // 激活当前展开面板
+                        this.activeNames = [
+                          "myLabel",
+                          `${data.label}_${data.town}`,
+                        ];
+                        this.$store.state.mapMethodsCollection
+                          .get("RENDER")
+                          .addSinglePolygon(
+                            geometry,
+                            cid,
+                            this.randomColor.get(uniqueId)
+                          );
+                        return {
+                          id: ele.id,
+                          name: ele.c_yichang,
+                          columnName: ele.column_name,
+                          town: data.town,
+                          area: ele.c_c_shui_area,
+                          nature: ele.c_yichang,
+                          // year: ele.c_c_year,
+                        };
+                      }
+                    );
+                  }
+                });
+              }
             }
+          );
+        }
 
-            if (res.code === 200 && res.content.data.length > 0) {
-              console.log("有权限");
-              let layerParams = new FormData();
-              layerParams = {
-                columnId: data.columnId,
-                states: 3,
-                pageSize: 10,
-                page: 0,
-              };
-              this.$Post(
-                this.urlsCollection.selectContentList,
-                layerParams
-              ).then((res) => {
-                if (res.code === 200 && res.content.data.length > 0) {
-                  console.log(res.content, "获取到的数据");
-                  let uniqueId = `${data.label}_${data.town}`;
-                  this.originalData[uniqueId] = res.content.data.map((ele) => {
-                    let cid = `${data.label}_${ele.id}`;
+        if (data.mainType === "预设模型") {
+          this.rightPanelTitle = `${data.label}(${data.mainType})`;
+          let params = new FormData();
+          params = {
+            columnId: data.id.split("_")[1],
+            states: "3",
+            pageSize: 10,
+            page: 0,
+          };
 
-                    let geometry = ele.c_geometry;
-                    map2DViewer.polygons[`${cid}_polygon`] = [];
-                    this.layerIdMap.set(data.id, `${cid}_polygon`);
-                    // 激活当前展开面板
-                    this.activeNames = [
-                      "myLabel",
-                      `${data.label}_${data.town}`,
-                    ];
-                    this.$store.state.mapMethodsCollection
-                      .get("RENDER")
-                      .addSinglePolygon(
-                        geometry,
-                        cid,
-                        this.randomColor.get(uniqueId)
-                      );
-                    return {
-                      id: ele.id,
-                      name: ele.c_yichang,
-                      columnName: ele.column_name,
-                      town: data.town,
-                      area: ele.c_c_shui_area,
-                      year: ele.c_c_year,
-                    };
-                  });
-                }
-              });
+          this.$Post(this.urlsCollection.selectContentList, params).then(
+            (res) => {
+              if (res.code === 200 && res.content.data.length > 0) {
+                console.log(res.content.data, "点击预设模型后获取到的数据");
+                this.$store.state.treeDataCollection.set(data.id, {
+                  mainType: data.mainType,
+                });
+                // id: "水资源_88"
+                let uniqueId = data.id;
+                this.originalData[uniqueId] = res.content.data.map((ele) => {
+                  let cid = uniqueId;
+                  let geometry = ele.c_geometry;
+                  map2DViewer.polygons[`${cid}_polygon`] = [];
+                  this.layerIdMap.set(data.id, `${cid}_polygon`);
+                  // 激活当前展开面板
+                  this.activeNames = ["myLabel", data.id];
+                  console.log(this.randomColor.get(uniqueId), "check color");
+                  this.$store.state.mapMethodsCollection
+                    .get("RENDER")
+                    .addSinglePolygon(
+                      geometry,
+                      cid,
+                      this.randomColor.get(uniqueId)
+                    );
+
+                  return {
+                    id: ele.id,
+                    name: ele.c_yichang,
+                    columnName: ele.column_name,
+                    area: ele.c_c_shui_area,
+                    nature: ele.c_xingzhi,
+                  };
+                });
+              }
             }
-          }
-        );
+          );
+        }
 
         // 选中所有图层
         // if (guid.indexOf("defaultLayer") > -1) {
@@ -783,7 +906,7 @@ export default {
         delete this.originalData[`${data.label}_${data.town}`];
         this.layerIdMap.delete(data.id);
         //关联自定义模型
-        this.$store.state.treeDataCollection.delete(data.label);
+        this.$store.state.treeDataCollection.delete(data.id);
         console.log(this.$store.state.treeDataCollection, "treeDataCollection");
 
         // 只激活我的标记
@@ -811,13 +934,6 @@ export default {
           border: `1px solid ${this.randomColor.get(c.name)}`,
         };
       });
-      // console.log(legendTItle);
-      // this.legendIcon = this.legendTitle.map((v) => {
-      //   return {
-      //     background: "transparent",
-      //     border: `1px solid ${data.color}`,
-      //   };
-      // });
     },
     // 右侧面板项点击事件
     listItemClick(type, data) {
@@ -835,11 +951,12 @@ export default {
         this.boxHeight = "200";
         console.log(data, "defaultTable");
         this.tableData.push({
-          nature:data.name,
+          nature: data.nature,
           area: data.area,
           town: data.town,
           year: this.$dayjs(data.year).format("YYYY"),
-          name:data.columnName
+          name: data.name,
+          columnName: data.columnName,
           // version: data.properties["版本"],
           // nature: data.properties["性质"],
           // area: data.properties["面积"],