2 Commits 187772dc7e ... 006828ec78

Author SHA1 Message Date
  hanyaolong 006828ec78 debug 3 years ago
  hanyaolong 8710dd4bd9 空间任务可选中建筑 3 years ago

+ 17 - 0
src/api/workScope.js

@@ -23,3 +23,20 @@ export function dict_rels(params) {
 export function sys_eq(params) {
 export function sys_eq(params) {
     return httputils.getJson(`/clmt/dict/sys_eq`, params)
     return httputils.getJson(`/clmt/dict/sys_eq`, params)
 }
 }
+
+//设置交付范围
+export function set_scope(params) {
+    return httputils.postJson(`/clmt/scope/set_scope`, params)
+}
+// 查询交付范围
+export function get_scope(params) {
+    return httputils.postJson(`/clmt/scope/get_scope`, params)
+}
+// 系统交付范围
+export function set_major_sys_scope(params) {
+    return httputils.postJson(`/clmt/scope/set_major_sys_scope`, params)
+}
+// get涉及设备交付范围
+export function sys_eq_for_scope(params) {
+    return httputils.postJson(`/clmt/scope/sys_eq_for_scope`, params)
+}

+ 5 - 1
src/components/leftAside.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <div>
   <div>
     <el-menu
     <el-menu
-      default-active="workscope"
+      :default-active="defaultUrl"
       class="el-menu-vertical-demo"
       class="el-menu-vertical-demo"
       background-color="#545c64"
       background-color="#545c64"
       text-color="#fff"
       text-color="#fff"
@@ -37,7 +37,11 @@ export default {
           router: "spacetask",
           router: "spacetask",
         },
         },
       ],
       ],
+      defaultUrl:''
     };
     };
   },
   },
+  created(){
+    this.defaultUrl = this.$route.name;
+  }
 };
 };
 </script>
 </script>

+ 1 - 1
src/components/topHead.vue

@@ -1,3 +1,3 @@
 <template>
 <template>
-  <div>顶部导航</div>
+  <div></div>
 </template>
 </template>

+ 79 - 7
src/components/workscope/equip.vue

@@ -1,18 +1,31 @@
 <template>
 <template>
   <div>
   <div>
+    <el-row>
+      <el-col class="btn-top" :span="12">
+        <el-button type="primary" @click="saveData">设置范围</el-button>
+        <el-button @click="clearData">清空</el-button>
+      </el-col>
+    </el-row>
     <el-tree
     <el-tree
       :data="eqList"
       :data="eqList"
       show-checkbox
       show-checkbox
-      node-key="id"
-      :default-expanded-keys="[2, 3]"
-      :default-checked-keys="[5]"
+      ref="tree"
+      node-key="aliasCode"
+      @check="checkChange"
+      :default-checked-keys="choiceCheckList"
+      :default-expanded-keys="choiceCheckList"
       :props="defaultProps"
       :props="defaultProps"
     >
     >
     </el-tree>
     </el-tree>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { sys_eq } from "@/api/workScope.js";
+import {
+  sys_eq,
+  set_scope,
+  get_scope,
+  sys_eq_for_scope,
+} from "@/api/workScope.js";
 
 
 export default {
 export default {
   data() {
   data() {
@@ -22,19 +35,78 @@ export default {
         children: "children",
         children: "children",
         label: "aliasName",
         label: "aliasName",
       },
       },
+      choiceCheckList: [],
     };
     };
   },
   },
   methods: {
   methods: {
+    checkChange(node, choiceKey, v) {
+      const list = [];
+      choiceKey.checkedKeys.forEach((msg) => {
+        if (msg != undefined) {
+          list.push(msg);
+        }
+      });
+      this.choiceCheckList = list;
+    },
     // 专业系统设备树
     // 专业系统设备树
     getSys_eq_tree() {
     getSys_eq_tree() {
-      sys_eq({ scopeFilter: true, target: "rtn" }).then((res) => {
-        console.log("res", res);
+      sys_eq_for_scope({ target: "rtn" }).then((res) => {
         this.eqList = res.rtn;
         this.eqList = res.rtn;
+        this.readData();
+      });
+    },
+    readData() {
+      const data = { type: "device", target: "rtn" };
+      get_scope(data).then((res) => {
+        this.choiceCheckList = res.rtn.map((a) => {
+          return a.code;
+        });
       });
       });
     },
     },
+    // 保存数据
+    saveData() {
+      let data = {
+        type: "device",
+        target: "action",
+        codes: this.choiceCheckList,
+      };
+      set_scope(data).then(() => {
+        this.readData();
+      });
+    },
+    //清空
+    clearData() {
+      this.$confirm("是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.choiceCheckList = [];
+          this.$refs.tree.setCheckedKeys([]);
+          this.saveData();
+          this.$message({
+            type: "success",
+            message: "删除成功!",
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
   },
   },
   created() {
   created() {
     this.getSys_eq_tree();
     this.getSys_eq_tree();
   },
   },
 };
 };
-</script>
+</script>
+<style lang="less" scoped>
+.btn-top {
+  margin-bottom: 12px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 141 - 16
src/components/workscope/floorSpace.vue

@@ -1,12 +1,18 @@
 <template>
 <template>
   <div id="floor_space">
   <div id="floor_space">
     <el-row>
     <el-row>
+      <el-col class="btn-top" :span="12">
+        <el-button type="primary" @click="saveData">设置范围</el-button>
+        <el-button @click="clearData">清空</el-button>
+      </el-col>
+    </el-row>
+    <el-row>
       <el-col :span="12">
       <el-col :span="12">
         <el-input
         <el-input
           type="textarea"
           type="textarea"
           :rows="2"
           :rows="2"
           placeholder="此处填写范围描述"
           placeholder="此处填写范围描述"
-          v-model="textarea"
+          v-model="floorSpaceTeXt"
         >
         >
         </el-input>
         </el-input>
       </el-col>
       </el-col>
@@ -15,25 +21,27 @@
       <el-col :span="6">
       <el-col :span="6">
         <h5>空间类型</h5>
         <h5>空间类型</h5>
         <el-tree
         <el-tree
+          ref="tree"
+          @check="checkChange"
           :data="spaceTree"
           :data="spaceTree"
+          :default-checked-keys="choiceCheckList"
+          :default-expanded-keys="choiceCheckList"
           show-checkbox
           show-checkbox
           node-key="id"
           node-key="id"
-          :default-expanded-keys="[2, 3]"
-          :default-checked-keys="[5]"
           :props="defaultProps"
           :props="defaultProps"
         >
         >
         </el-tree>
         </el-tree>
       </el-col>
       </el-col>
       <el-col :span="6">
       <el-col :span="6">
         <h5>空间分区</h5>
         <h5>空间分区</h5>
-        <el-checkbox-group v-model="checkList">
+        <el-checkbox-group v-model="SpacecheckList">
           <el-checkbox
           <el-checkbox
             v-for="(item, key) in partitioneList"
             v-for="(item, key) in partitioneList"
             :key="key"
             :key="key"
             class="checkList"
             class="checkList"
             :label="item.name"
             :label="item.name"
+            :value="item.code"
           ></el-checkbox>
           ></el-checkbox>
-          <el-checkbox class="checkList" label="复选框 A"></el-checkbox>
         </el-checkbox-group>
         </el-checkbox-group>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
@@ -41,7 +49,12 @@
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { space_fun, space_zone } from "@/api/workScope.js";
+import {
+  space_fun,
+  space_zone,
+  set_scope,
+  get_scope,
+} from "@/api/workScope.js";
 import { treeTranslation } from "@/until.js";
 import { treeTranslation } from "@/until.js";
 export default {
 export default {
   data() {
   data() {
@@ -49,41 +62,153 @@ export default {
       // 分区范围
       // 分区范围
       partitioneList: [],
       partitioneList: [],
       spaceTree: [], //空间树
       spaceTree: [], //空间树
+      choiceCheckList: [], //选中的树
       defaultProps: {
       defaultProps: {
         children: "children",
         children: "children",
         label: "label",
         label: "label",
       },
       },
       checkList: [],
       checkList: [],
+      SpacecheckList: [], // 选中的空间分区
+      floorSpaceTeXt: "", // 楼层空间文本
     };
     };
   },
   },
   methods: {
   methods: {
+    checkChange(node, choiceKey) {
+      const list = [];
+      choiceKey.checkedKeys.forEach((msg) => {
+        if (msg != undefined) {
+          list.push(msg);
+        }
+      });
+      this.choiceCheckList = list;
+    },
+
     //请求树结构
     //请求树结构
     getSpaceTree() {
     getSpaceTree() {
-      space_fun({ target: "rtn" }).then((res) => {
-        this.spaceTree = treeTranslation(res.rtn, ["code", "name", "children"]);
+      return new Promise((reslve, reject) => {
+        space_fun({ target: "rtn" })
+          .then((res) => {
+            this.spaceTree = treeTranslation(res.rtn, [
+              "code",
+              "name",
+              "children",
+            ]);
+            reslve();
+          })
+          .catch(() => {
+            reject();
+          });
       });
       });
     },
     },
     //请求空间区域类型
     //请求空间区域类型
     spaceZone() {
     spaceZone() {
-      space_zone({}).then((res) => {
-        res.rtn.forEach((item) => {
-          this.partitioneList.push({
-            name: item.name,
-            id: item.code,
+      return new Promise((reslve, reject) => {
+        space_zone({}).then((res) => {
+          res.rtn.forEach((item) => {
+            this.partitioneList.push({
+              name: item.name,
+              id: item.code,
+            });
           });
           });
+          reslve();
         });
         });
+      }).catch(() => {
+        reject();
       });
       });
     },
     },
-  },
 
 
+    // 保存数据
+    saveData() {
+      let data1 = {
+        type: "zone",
+        target: "action",
+        codes: [],
+      };
+      let data2 = {
+        type: "sp_fun",
+        target: "action",
+        codes: [],
+      };
+
+      // 如果功能分区有选择
+      if (this.SpacecheckList.length) {
+        const codes = [];
+        this.partitioneList.forEach((item) => {
+          if (this.SpacecheckList.includes(item.name)) {
+            codes.push(item.id);
+          }
+        });
+        data1.codes = codes;
+      }
+      if (this.choiceCheckList.length) {
+        const codes = [];
+        data2.codes = this.choiceCheckList;
+      }
+      Promise.all([set_scope(data1), set_scope(data2)]).then(() => {
+        this.readData();
+      });
+    },
+    readData() {
+      const data1 = { type: "zone", target: "rtn" };
+      const data2 = { type: "sp_fun", target: "rtn" };
+      Promise.all([get_scope(data1), get_scope(data2)]).then((res) => {
+        // 功能分区
+        const checkList = res[0].rtn.map((obj) => {
+          return obj.code;
+        });
+        const nameList = [];
+        this.partitioneList.forEach((item) => {
+          if (checkList.includes(item.id)) {
+            nameList.push(item.name);
+          }
+        });
+        this.SpacecheckList = nameList;
+
+        // 空间树回显
+        this.choiceCheckList = res[1].rtn.map((a) => {
+          return a.code;
+        });
+      });
+    },
+    //清空
+    clearData() {
+      this.$confirm("是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.SpacecheckList = [];
+          this.choiceCheckList = [];
+          this.$refs.tree.setCheckedKeys([]);
+          this.saveData();
+          this.$message({
+            type: "success",
+            message: "删除成功!",
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+  },
   created() {
   created() {
-    this.getSpaceTree();
-    this.spaceZone();
+    Promise.all([this.getSpaceTree(), this.spaceZone()]).then((res) => {
+      this.readData();
+    });
   },
   },
 };
 };
 </script>
 </script>
 <style lang="less" scoped>
 <style lang="less" scoped>
 #floor_space {
 #floor_space {
+  .btn-top {
+    margin-bottom: 12px;
+    display: flex;
+    justify-content: flex-end;
+  }
   .checkList {
   .checkList {
     display: block;
     display: block;
   }
   }

+ 12 - 1
src/components/workscope/pipe.vue

@@ -55,7 +55,7 @@
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { major_mr } from "@/api/workScope.js";
+import { major_mr, major_sys } from "@/api/workScope.js";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -102,8 +102,19 @@ export default {
       // 机房list
       // 机房list
       mrList: [],
       mrList: [],
       checkList: [],
       checkList: [],
+      value: "",
     };
     };
   },
   },
+  methods: {
+    majorSys() {
+      major_sys({ scopeFilter: true, target: "rtn" }).then((res) => {
+        console.log(res);
+      });
+    },
+  },
+  created() {
+    this.majorSys();
+  },
   mounted() {
   mounted() {
     major_mr({ target: "rtn" }).then((res) => {
     major_mr({ target: "rtn" }).then((res) => {
       this.mrList = res.rtn.map((item) => {
       this.mrList = res.rtn.map((item) => {

+ 98 - 7
src/components/workscope/system.vue

@@ -1,22 +1,37 @@
 <template>
 <template>
   <div>
   <div>
+    <el-row>
+      <el-col class="btn-top" :span="12">
+        <el-button type="primary" @click="saveData">设置范围</el-button>
+        <el-button @click="clearData">清空</el-button>
+      </el-col>
+    </el-row>
     <el-tree
     <el-tree
       :data="treeList"
       :data="treeList"
+      ref="tree"
+      @check="checkChange"
       show-checkbox
       show-checkbox
-      node-key="id"
-      :default-expanded-keys="[2, 3]"
-      :default-checked-keys="[5]"
+      :default-checked-keys="choiceCheckList"
+      :default-expanded-keys="choiceCheckList"
+      node-key="code"
       :props="defaultProps"
       :props="defaultProps"
     >
     >
     </el-tree>
     </el-tree>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { major_sys } from "@/api/workScope.js";
+import {
+  major_sys,
+  set_scope,
+  get_scope,
+  set_major_sys_scope,
+} from "@/api/workScope.js";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
       treeList: [],
       treeList: [],
+      choiceCheckList: [], //选中的树
+      parentChecckList: [], //专业id
       defaultProps: {
       defaultProps: {
         children: "children",
         children: "children",
         label: "aliasName",
         label: "aliasName",
@@ -24,14 +39,90 @@ export default {
     };
     };
   },
   },
   methods: {
   methods: {
+    checkChange(node, choiceKey, v) {
+      const list = [];
+      let parentList = [];
+      choiceKey.checkedNodes.forEach((item) => {
+        if (item.children) {
+          parentList.push({
+            code: item.code,
+            type: "major",
+          });
+        } else {
+          list.push({
+            code: item.code,
+            type: "sys",
+          });
+        }
+      });
+      this.choiceCheckList = list;
+      choiceKey.halfCheckedKeys.forEach((code) => {
+        parentList.push({
+          code: code,
+          type: "major",
+        });
+      });
+      this.parentChecckList = [...parentList];
+      console.log(this.parentChecckList);
+    },
     majorSys() {
     majorSys() {
-      major_sys({ scopeFilter: true, target: "rtn" }).then((res) => {
+      major_sys({ target: "rtn" }).then((res) => {
         this.treeList = res.rtn;
         this.treeList = res.rtn;
+        this.readData();
+      });
+    },
+    readData() {
+      const data = { type: "sys", target: "rtn" };
+      get_scope(data).then((res) => {
+        this.choiceCheckList = res.rtn.map((a) => {
+          return a.code;
+        });
+      });
+    },
+    // 保存数据
+    saveData() {
+      let data = {
+        type: "sys",
+        target: "action",
+        codes: [...this.choiceCheckList, ...this.parentChecckList],
+      };
+      set_major_sys_scope(data).then(() => {
+        this.readData();
       });
       });
     },
     },
+    //清空
+    clearData() {
+      this.$confirm("是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.choiceCheckList = [];
+          this.$refs.tree.setCheckedKeys([]);
+          this.saveData();
+          this.$message({
+            type: "success",
+            message: "删除成功!",
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
   },
   },
   created() {
   created() {
-    this.majorSys()
+    this.majorSys();
   },
   },
 };
 };
-</script>
+</script>
+<style lang="less" scoped>
+.btn-top {
+  margin-bottom: 12px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 25 - 17
src/views/spacetask.vue

@@ -3,19 +3,17 @@
     <div class="top">
     <div class="top">
       <div class="top-item">
       <div class="top-item">
         <span>建筑/楼层:</span>
         <span>建筑/楼层:</span>
-        <el-select
-          v-model="floorValue"
+        <el-cascader
           @change="changeFloor"
           @change="changeFloor"
-          placeholder="请选择"
-        >
-          <el-option
-            v-for="item in floorOptions"
-            :key="item.id"
-            :label="item.localName"
-            :value="item.id"
-          >
-          </el-option>
-        </el-select>
+          :options="floorOptions"
+          :props="{
+            checkStrictly: true,
+            value: 'id',
+            label: 'localName',
+            children: 'floor',
+          }"
+          clearable
+        ></el-cascader>
       </div>
       </div>
       <div class="top-item">
       <div class="top-item">
         <span>功能分区:</span>
         <span>功能分区:</span>
@@ -42,7 +40,7 @@
         <span>任务状态:</span>
         <span>任务状态:</span>
         <el-select
         <el-select
           v-model="jobStatusValue"
           v-model="jobStatusValue"
-          @change="changeFloor"
+          @change="spaceJob"
           placeholder="请选择"
           placeholder="请选择"
         >
         >
           <el-option
           <el-option
@@ -185,7 +183,7 @@ const tableHead = [
   },
   },
   {
   {
     lable: "数字化交付编码编码",
     lable: "数字化交付编码编码",
-    prop: "id",
+    prop: "spaceCode",
     width: "380",
     width: "380",
   },
   },
   {
   {
@@ -241,9 +239,9 @@ export default {
       return new Promise((reslove, reject) => {
       return new Promise((reslove, reject) => {
         building_floor({ target: "rtn" })
         building_floor({ target: "rtn" })
           .then((res) => {
           .then((res) => {
-            this.floorOptions = res.rtn[0].floor;
-            this.buildingId = res.rtn[0].id;
-            this.buildName = res.rtn[0].localName;
+            this.floorOptions = res.rtn;
+            // this.buildingId = res.rtn[0].id;
+            // this.buildName = res.rtn[0].localName;
             reslove();
             reslove();
           })
           })
           .catch(() => {
           .catch(() => {
@@ -305,6 +303,16 @@ export default {
     },
     },
     // 改变楼层
     // 改变楼层
     changeFloor(a, b) {
     changeFloor(a, b) {
+      this.buildingId = "";
+      this.floorValue = "";
+      if (a.length == 0) {
+        this.buildingId = "";
+        this.floorValue = "";
+      } else if (a.length == 1) {
+        [this.buildingId] = a;
+      } else {
+        [this.buildingId, this.floorValue] = a;
+      }
       this.spaceJob();
       this.spaceJob();
     },
     },
     //重置工作状态
     //重置工作状态

+ 24 - 8
src/views/workscope.vue

@@ -1,22 +1,30 @@
 <template>
 <template>
   <div id="workScopes">
   <div id="workScopes">
-    <el-tabs v-model="activeName" @tab-click="handleClick">
+    <el-tabs v-model="activeName">
       <el-tab-pane label="建筑空间区域范围" name="first">
       <el-tab-pane label="建筑空间区域范围" name="first">
-        <div class="box">
+        <div class="box" v-if="activeName == 'first'">
           <floorSpace></floorSpace>
           <floorSpace></floorSpace>
         </div>
         </div>
       </el-tab-pane>
       </el-tab-pane>
       <el-tab-pane label="专业系统范围" name="second">
       <el-tab-pane label="专业系统范围" name="second">
-        <system></system>
+        <div class="box" v-if="activeName == 'second'">
+          <system></system>
+        </div>
       </el-tab-pane>
       </el-tab-pane>
       <el-tab-pane label="管道范围" name="third">
       <el-tab-pane label="管道范围" name="third">
-        <pipe></pipe>
+        <div class="box" v-if="activeName == 'third'">
+          <pipe></pipe>
+        </div>
       </el-tab-pane>
       </el-tab-pane>
       <el-tab-pane label="设备设施范围" name="fourth">
       <el-tab-pane label="设备设施范围" name="fourth">
-        <equip></equip>
+        <div class="box" v-if="activeName == 'fourth'">
+          <equip></equip>
+        </div>
       </el-tab-pane>
       </el-tab-pane>
       <el-tab-pane label="关系范围" name="fifth">
       <el-tab-pane label="关系范围" name="fifth">
-        <relation></relation>
+        <div class="box" v-if="activeName == 'fifth'">
+          <relation></relation>
+        </div>
       </el-tab-pane>
       </el-tab-pane>
     </el-tabs>
     </el-tabs>
   </div>
   </div>
@@ -41,13 +49,21 @@ export default {
       activeName: "first",
       activeName: "first",
     };
     };
   },
   },
-  mounted(){
-  }
+  mounted() {
+    const workScopes = document.getElementById("workScopes");
+    document.getElementsByClassName("box").forEach((dom) => {
+      dom.style.height = workScopes.offsetHeight - 60 + "px";
+    });
+  },
 };
 };
 </script>
 </script>
 <style lang="less" scoped>
 <style lang="less" scoped>
 #workScopes {
 #workScopes {
   width: 100%;
   width: 100%;
   height: 100%;
   height: 100%;
+  .box {
+    width: 100%;
+    overflow-y: auto;
+  }
 }
 }
 </style>
 </style>