hanyaolong 3 سال پیش
والد
کامیت
fbf13739a6
4فایلهای تغییر یافته به همراه170 افزوده شده و 38 حذف شده
  1. 8 0
      src/api/workScope.js
  2. 70 37
      src/components/workscope/pipe.vue
  3. 85 0
      src/components/workscope/systemImage.vue
  4. 7 1
      src/views/workscope.vue

+ 8 - 0
src/api/workScope.js

@@ -53,3 +53,11 @@ export function set_pipe(params) {
 export function get_pipe(params) {
     return httputils.postJson(`/clmt/scope/get_pipe`, params)
 }
+// 设置某系统是否需要系统图
+export function set_sys_diagram(params) {
+    return httputils.postJson(`/clmt/scope/set_sys_diagram`, params)
+}
+// 查询某系统是否需要系统图
+export function get_sys_diagram(params) {
+    return httputils.postJson(`/clmt/scope/get_sys_diagram`, params)
+}

+ 70 - 37
src/components/workscope/pipe.vue

@@ -16,11 +16,14 @@
             :name="key + 1"
           >
             <div style="float: right">
-              <el-button icon="el-icon-plus" @click="addPipe" size="mini"
+              <el-button
+                icon="el-icon-plus"
+                @click="openaddPipe(item)"
+                size="mini"
                 >添加</el-button
               >
             </div>
-            <el-table :data="tableData" stripe style="width: 100%">
+            <el-table :data="item.tableData" stripe style="width: 100%">
               <el-table-column
                 v-for="(headitem, key) in tableHead"
                 :key="key"
@@ -28,6 +31,14 @@
                 :label="headitem.label"
                 :width="headitem.width"
               >
+                <template slot-scope="scope">
+                  <div v-if="scope.row[headitem.name] == 'name'">
+                    {{ scope.row[headitem.name]  }}
+                  </div>
+                  <div v-else>
+                  <el-checkbox :value="scope.row[headitem.name] == '1'?true:false"></el-checkbox>
+                  </div>
+                </template>
               </el-table-column>
               <el-table-column label="操作">
                 <template slot-scope="scope">
@@ -38,67 +49,70 @@
                 </template>
               </el-table-column>
             </el-table>
-            <div class="table-type">
-              <span>需要系统图:</span>
-              <el-switch
-                v-model="value"
-                active-color="#13ce66"
-                inactive-color="#ff4949"
-              >
-              </el-switch>
-            </div>
-            <div class="table-type">
+            <!-- <div class="table-type">
               <span>精细化机房</span>
               <el-checkbox v-model="checked"></el-checkbox>
-            </div>
+            </div> -->
           </el-collapse-item>
         </el-collapse>
       </el-col>
     </el-row>
     <el-dialog
-      title="提示"
+      title="新增管道"
       :visible.sync="dialogVisible"
       width="40%"
       :before-close="handleClose"
     >
       <div>
-        <el-cascader
-          @change="changePipe"
-          :options="pipeTypeList"
-          :props="{
-            value: 'code',
-            label: 'name',
-            children: 'children',
-          }"
-          clearable
-        ></el-cascader>
-
+        <div>
+          <el-cascader
+            :options="pipeTypeList"
+            v-model="addpipeValue"
+            :props="{
+              value: 'code',
+              label: 'name',
+              children: 'children',
+            }"
+            clearable
+          ></el-cascader>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="handleClose">取 消</el-button>
+          <el-button type="primary" @click="addPipe">确 定</el-button>
+        </span>
       </div>
     </el-dialog>
   </div>
 </template>
 <script>
-import { major_mr, major_sys, dict_pipe } from "@/api/workScope.js";
+import {
+  major_mr,
+  major_sys,
+  dict_pipe,
+  set_sys_diagram,
+  get_sys_diagram,
+} from "@/api/workScope.js";
 export default {
   data() {
     return {
       activeName: "1",
       pipeList: [],
       pipeTypeList: [], // 所有设备类型
+      addpipeValue: [], // 新增管道类型
       tableHead: [
         {
           label: "管道类型名",
-          name: "pipeName",
+          name: "name",
           width: "180",
         },
         {
           label: "仅干管",
-          name: "onlyMain",
+          name: "main",
           width: "180",
         },
         {
           label: "含支路管道",
-          name: "andBranch",
+          name: "branch",
           width: "180",
         },
         {
@@ -107,13 +121,6 @@ export default {
           width: "180",
         },
       ],
-      tableData: [
-        // {
-        //   date: "2016-05-02",
-        //   pipeName: "王小虎",
-        //   label: "上海市普陀区金沙江路 1518 弄",
-        // },
-      ],
       defaultProps: {
         children: "children",
         label: "name",
@@ -122,21 +129,37 @@ export default {
       checked: false,
       value: "",
       dialogVisible: false, // 弹窗显示
+      currentItem: null, // 当前选中的系统管道
     };
   },
   methods: {
     // 更改勾选内容
     changePipe(node, choiceKey, v) {},
+    // 删除管道
+    handleEdit() {},
     // 添加管道
-    addPipe() {
+    openaddPipe(item) {
       const data = {};
+      this.currentItem = null;
       dict_pipe(data).then((res) => {
         if (res.rtn && res.rtn.length) {
           this.pipeTypeList = res.rtn;
         }
         this.dialogVisible = true;
+        this.currentItem = item;
       });
     },
+    addPipe() {
+      this.currentItem.tableData.push({
+        name: 123,
+        code: this.addpipeValue[1],
+        main: 0,
+        branch: 0,
+        anthor: 0,
+      });
+      this.addpipeValue = [];
+      this.dialogVisible = false;
+    },
     // 关闭弹窗
     handleClose() {
       this.dialogVisible = false;
@@ -184,6 +207,11 @@ export default {
             ? (arr = [...arr, ...item.children])
             : arr;
         });
+        arr.map((item) => {
+          return Object.assign(item, {
+            tableData: [],
+          });
+        });
         this.pipeList = arr;
       });
     },
@@ -210,4 +238,9 @@ export default {
     margin-right: 12px;
   }
 }
+.dialog-footer {
+  margin-top: 12px;
+  display: flex;
+  justify-content: flex-end;
+}
 </style>

+ 85 - 0
src/components/workscope/systemImage.vue

@@ -0,0 +1,85 @@
+<template>
+  <div id="systemImage">
+    <el-tree
+      :data="treeList"
+      ref="tree"
+      @check="checkChange"
+      show-checkbox
+      :default-checked-keys="choiceCheckList"
+      :default-expanded-keys="choiceCheckList"
+      node-key="code"
+      :props="defaultProps"
+    >
+    </el-tree>
+  </div>
+</template>
+<script>
+import {
+  major_sys,
+  get_sys_diagram,
+  set_sys_diagram,
+} from "@/api/workScope.js";
+export default {
+  data() {
+    return {
+      treeList: [],
+      choiceCheckList: [],
+      defaultProps: {
+        children: "children",
+        label: "aliasName",
+      },
+    };
+  },
+  methods: {
+    majorSys() {
+      major_sys({ target: "rtn", scopeFilter: true }).then((res) => {
+        this.treeList = res.rtn;
+        this.readData();
+      });
+    },
+    checkChange(node, choiceKey, v) {
+      let choiceCode = [];
+      if (node.children) {
+        if (!node.children.length) return;
+        node.children.forEach((obj) => {
+          choiceCode.push(obj.code);
+        });
+      } else {
+        choiceCode.push(node.code);
+      }
+      choiceCode.forEach((code) => {
+        let diagram = false;
+        if (choiceKey.checkedKeys.includes(code)) {
+          diagram = true;
+        }
+        const data = {
+          sys: code,
+          diagram: diagram,
+          target: "action",
+        };
+        set_sys_diagram(data).then((res) => {
+          // 设置完成后回显
+          this.readData();
+        });
+      });
+    },
+    readData() {
+      const data = {};
+      get_sys_diagram(data).then((res) => {
+        this.choiceCheckList = res.rtn.map((a) => {
+          if (a.diagram) {
+            return a.code;
+          }
+        });
+      });
+    },
+  },
+  created() {
+    this.majorSys();
+  },
+};
+</script>
+<style lang="less" scoped>
+#systemImage {
+}
+</style>

+ 7 - 1
src/views/workscope.vue

@@ -26,6 +26,11 @@
           <relation></relation>
         </div>
       </el-tab-pane>
+      <el-tab-pane label="系统图" name="sixth">
+        <div class="box" v-if="activeName == 'sixth'">
+          <systemImage></systemImage>
+        </div>
+      </el-tab-pane>
     </el-tabs>
   </div>
 </template>
@@ -35,7 +40,7 @@ import floorSpace from "@/components/workscope/floorSpace";
 import pipe from "@/components/workscope/pipe";
 import relation from "@/components/workscope/relation";
 import system from "@/components/workscope/system";
-
+import systemImage from "@/components/workscope/systemImage";
 export default {
   components: {
     equip,
@@ -43,6 +48,7 @@ export default {
     pipe,
     relation,
     system,
+    systemImage,
   },
   data() {
     return {