Browse Source

竖井页面

zhangyu 5 years ago
parent
commit
400a8a7e88

+ 7 - 0
config/index.js

@@ -18,6 +18,13 @@ module.exports = {
                     "^/admin": "/"
                 }
             },
+            '/api': {
+                target: 'http://172.16.0.235:8080',
+                changeOrigin: true,
+                pathRewrite: {
+                    "^/api": "/"
+                }
+            },
             '/data-platform-3': {
                 // 目标 API 地址
                 target: 'http://192.168.20.225:8080/',

+ 1 - 0
src/api/scan/config.js

@@ -1,3 +1,4 @@
+export const baseUrl = '/api';
 export const api = '/ScanBuilding';
 export const sass = 'sass';
 export const physics = '/data-platform-3';

+ 0 - 1
src/api/scan/httpUtil.js

@@ -4,7 +4,6 @@ import fetch from './fetch'
 function successResponse(vm, response, success, failed) {
     let resp = response.data;
     let result = resp.result ? resp.result : resp.Result;
-
     if (result === 'success') {
         if (success) {
             success(resp);

+ 16 - 2
src/api/scan/request.js

@@ -1,5 +1,5 @@
 import fetch from './fetch'
-import { api, physics, business, venders } from './config.js'
+import { api, physics, business, venders, baseUrl } from './config.js'
 import http from './httpUtil'
 let arithmetic = '/arithmetic'
 
@@ -730,7 +730,21 @@ export function delBatchList(param, success) {
 
 //台账获取竖井类型
 export function getCenoteType(param, success) {
-    let url = `${api}/datacenter/shaft/queryShaftFuncType?projectId=${param.ProjId}&secret=${param.secret}`
+    let url = `${baseUrl}/datacenter/shaft/queryShaftFuncType?projectId=${param.ProjId}&secret=${param.secret}`
+    let data = param.data
+    http.postJson(url, data, success)
+}
+
+//获取竖井表头信息
+export function getCenoteTableHeader(param, success) {
+    let url = `${baseUrl}/datacenter/shaft/queryDic?projectId=${param.ProjId}&secret=${param.secret}`
+    let data = param.data
+    http.postJson(url, data, success)
+}
+
+//获取竖井表格内容信息
+export function getCenoteTableData(param, success) {
+    let url = `${baseUrl}/datacenter/shaft/queryWithCount?projectId=${param.ProjId}&secret=${param.secret}`
     let data = param.data
     http.postJson(url, data, success)
 }

+ 27 - 96
src/components/ledger/lib/cenoteType.vue

@@ -1,46 +1,28 @@
 <template>
   <div id="cascaderMap">
     <span class="buildFloor" style="margin-right: 12px;">竖井类型</span>
-    <el-cascader
-      placeholder="请选择"
-      :options="options"
-      v-model="onlyRead"
-      :props="props"
-      filterable
-      :style="isWidth ? '' : 'width:160px;'"
-      size="small"
-      @change="changeVal"
-      change-on-select
-    ></el-cascader>
+    <el-select v-model="id" @change="changeVal">
+    <el-option
+      v-for="item in options"
+      :key="item.ID"
+      :label="item.Name"
+      :value="item.ID">
+    </el-option>
+  </el-select>
   </div>
 </template>
 <script>
 import { mapGetters } from "vuex";
-import { getEqCode } from "@/api/scan/request";
+import { getCenoteType } from "@/api/scan/request";
 export default {
   name: "getCode",
-  props: {
-    isWidth: {
-      type: Boolean,
-      default: true
-    },
-    isAll: {
-      type: Boolean,
-      default: false
-    }
-  },
   computed: {
-    ...mapGetters("layout", ["projectId"])
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   data() {
     return {
-      value: [""],
-      props: {
-        value: "code",
-        label: "facility"
-      },
-      falg: true,
-      content: []
+      id: "",
+      options: []
     };
   },
   created() {
@@ -48,87 +30,36 @@ export default {
   },
   watch: {
     projectId() {
-      this.value = [""];
+      this.id = "";
     }
   },
   methods: {
-    setValue(val) {
-      this.value = val;
-    },
     //修改val
     changeVal(val) {
       let value = {};
       this.options.map(item => {
-        if (item.code == val) {
+        if (item.ID == val) {
           value = item;
         }
       });
-      this.value = val;
+      this.id = val;
       this.$emit("change", value);
     },
     async getData() {
-      await getEqCode().then(res => {
-        if (this.isAll) {
-          let data = this.changeArr(res.data.Content);
-          data.unshift({
-            code: "all",
-            facility: "全部"
-          });
-          this.options = data;
-          console.log(this.options, "options");
-          this.value = ["all"];
-        } else {
-          this.options = this.changeArr(res.data.Content);
-        }
-        if (!!this.value && this.value.length) {
-          let value = {};
-          this.options.map(item => {
-            if (item.code == this.value[0]) {
-              value = item;
-            }
-          });
-          this.$emit("change", value);
-        }
-        if (!this.falg) {
-          this.changeList();
-        }
-      });
-    },
-    changeArr(arr) {
-      let data = [];
-      arr.map(item => {
-        if (item.content && item.content.length) {
-          return item.content.map(children => {
-            if (children.content && children.content.length) {
-              return children.content.map(i => {
-                data.push(i);
-              });
-            }
-          });
-        }
-      });
-      return data;
-    },
-
-    pushData(content) {
-      this.content = content;
-      if (this.options.length) {
-        this.falg = true;
-        this.changeList();
-      } else {
-        this.falg = false;
+      let param = {
+        ProjId: this.projectId,
+        secret: this.secret,
+        data: {}
       }
-    },
-
-    changeList() {
-      this.options.map(item => {
-        item.disabled = true;
-        this.content.map(child => {
-          if (item.code == child) {
-            item.disabled = false;
-          }
+      await getCenoteType (param, res => {
+        var data = res.Content;
+        data.unshift({
+          ID: "",
+          Name: "全部"
         });
-      });
+        this.options = data;
+        this.id = "";
+      })
     }
   }
 };

+ 111 - 28
src/views/ledger/cenotelist/index.vue

@@ -5,8 +5,7 @@
     </div>
     <el-row class="right">
       <span style="float:left;">当前筛选条件下共{{page.total || '--'}}设备</span>
-      <el-checkbox v-show="onlyRead" v-model="allMess">只看要采集的信息</el-checkbox>
-      <el-checkbox v-show="!onlyRead" v-model="isWatch">隐藏自动填充的信息点</el-checkbox>
+      <el-checkbox v-show="onlyRead" v-model="allMess" @change="handleChangeAllMess">只看要采集的信息</el-checkbox>
       <el-select v-model="onlyRead">
         <el-option
           v-for="item in options"
@@ -28,7 +27,7 @@
       </div>
     </div>
     <el-pagination
-      class="center"
+      class="right"
       @size-change="handleSizeChange"
       @current-change="handleCurrentChange"
       :current-page="page.pageNumber"
@@ -40,17 +39,20 @@
   </div>
 </template>
 <script>
+import tools from "@/utils/scan/tools";
+
 import cenoteType from "@/components/ledger/lib/cenoteType";
-import hansonTable from "@/components/common/handsontable";
-import { getCenoteType, getGraphyId, getEquipmentFamily } from "@/api/scan/request"
+import handsonTable from "@/components/common/handsontable";
+import { getCenoteTableHeader, getCenoteTableData, getEquipmentFamily } from "@/api/scan/request"
 import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
     cenoteType,
-    hansonTable
+    handsonTable
   },
   data() {
     return {
+      cenoteId: "",
       options: [{
         value: true,
         label: '只读模式'
@@ -60,13 +62,14 @@ export default {
       }],
       onlyRead: true,
       allMess: true,
-      isWatch:true,
+      tableHeader: [],
       page: {
         pageSize: 20,
         pageSizes: [10, 20, 50, 100],
         pageNumber: 1,
         total: 400
       },
+      tableData: [],
       param: {
         buildId: "",
         floorId: "",
@@ -88,7 +91,7 @@ export default {
   created() {
     this.param.ProjId = this.projectId
     this.param.secret = this.secret
-    this.handleGetCenoteType()
+    this.getTableHeader()
     // this.getProjName()
   },
   watch: {
@@ -98,21 +101,100 @@ export default {
       }
   },
   methods: {
-    handleGetCenoteType() {
+    async getTableHeader() {
       let param = {
         ProjId: this.projectId,
         secret: this.secret,
-        data: {}
+        data: {
+          "CollectFlag": this.allMess
+        }
       }
-      getCenoteType(param).then(res => {
-        if (res.data.Result == "success") {
-          debugger;
-        } else {
-          this.$message.error("请求失败:" + res.data.ResultMsg)
+      await getCenoteTableHeader(param, res => {
+        this.tableHeader = res.Content;
+        this.getTableData()
+      })
+    },
+    handleChangeAllMess() {
+      this.getTableHeader()
+    },
+    formatHeaderData(list) {
+      let arr = tools.copyArr(list)
+      let data = arr.map((item) => {
+        return item.Name;
+      })
+      data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
+      debugger;
+      return data;
+    },
+    formatHeaderType(list) {
+      let arr = tools.copyArr(list)
+      let data = arr.map(item => {
+
+        if (item.Field == "") {
+          item.renderer = text.picType
+        }
+        if (item.data == "infos." + "Archive" ||
+          item.data == "infos." + "CheckReport" ||
+          item.data == "infos." + "InsuranceFile") {
+          item.renderer = text.fileType
         }
-      }).catch(_ => {
-        this.$message.error("请求失败")
       })
+      data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
+      debugger;
+      return data;
+    },
+    async getTableData() {
+      let data = {};
+      if(this.cenoteId){
+        data = {
+          Filters: `ID=${this.cenoteId}`,
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize
+        }
+      } else {
+        data = {
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize
+        }
+      }
+      const params = {
+        ProjId: this.projectId,
+        secret: this.secret,
+        data: data
+      }
+      await getCenoteTableData(params, (res) => {
+        this.tableData = res.Content
+        if(this.tableData && this.tableData.length){
+          this.initTable()
+        }
+      })
+    },
+    initTable() {
+      let settings = {
+        data: this.tableData,
+        colHeaders: this.formatHeaderData(this.tableHeader),
+        columns: this.formatHeaderType(this.tableHeader),
+        rowHeights: 30,
+        maxRows: this.tableData.length,
+        fixedRowsTop: 1,
+        fixedColumnsLeft: 4,
+        contextMenu: {
+          items: {
+            remove_row: {
+              name: "删除竖井"
+            }
+          }
+        },
+        // 事件
+        afterChange: this.tdChange, //修改后
+        afterFilter: this.trimmedRows, //排序前
+        afterRemoveRow: this.romoveFm, //右键删除
+        afterOnCellMouseDown: this.handleTdClick //鼠标点击
+      };
+      this.$nextTick(() => {
+        console.log(this.$refs.table);
+        this.tableExample = this.$refs.table.init(settings);
+      });
     },
     // getProjName() {
     //   let param = {
@@ -191,16 +273,9 @@ export default {
         this.$message.error("请求错误")
       })
     },
-    //修改楼层
+    //切换竖井类型
     changeFloor(value) {
-      if (value[0]) {
-        this.param.buildId = value[0]
-      }
-      if (value[1]) {
-        this.param.floorId = value[1]
-      } else {
-        this.param.floorId = null
-      }
+      const id = value.ID;
       if (!!this.param.deviceId) {
           if(this.$refs.tableMain)
         this.$refs.tableMain.getHeaderData(this.param);
@@ -220,7 +295,11 @@ export default {
         return;
       }
 
-    }
+    },
+    handleSizeChange() {
+
+    },
+    handleCurrentChange() {},
   }
 };
 </script>
@@ -237,14 +316,18 @@ export default {
   }
   .tableBox {
     display: flex;
-    height: calc(100% - 130px);
+    height: calc(100% - 140px);
+    margin-top: 10px;
     .tableLeft {
       flex: 2;
+      margin-right: 20px;
     }
     .tableRight {
       flex: 1;
       // display: none;
       border-left: 1px solid #dadada;
+      margin-right: 5px;
+      box-shadow: 0px 1px 5px 0px rgba(59, 66, 84, 0.15);
     }
   }
 }