Browse Source

Merge branch 'master' of http://39.106.8.246:3003/web/ibms

xiaohuan 5 years ago
parent
commit
c7784f9b78
1 changed files with 104 additions and 50 deletions
  1. 104 50
      src/views/ledger/cenotelist/index.vue

+ 104 - 50
src/views/ledger/cenotelist/index.vue

@@ -5,8 +5,8 @@
     </div>
     <el-row class="right">
       <span style="float:left;">当前筛选条件下共{{page.total || '--'}}设备</span>
-      <el-checkbox v-show="onlyRead" v-model="allMess" @change="handleChangeAllMess">只看要采集的信息</el-checkbox>
-      <el-select v-model="onlyRead">
+      <el-checkbox v-show="onlyRead" v-model="allMess" @change="getTableHeader">只看要采集的信息</el-checkbox>
+      <el-select v-model="onlyRead" @change="getTableHeader">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -29,7 +29,20 @@
         <handson-table ref="table"></handson-table>
       </div>
       <div class="tableRight" v-show="tableData && tableData.length">
-
+        <div class="table_right_box"><span class="iconfont close_right">&#xe66b;</span></div>
+        <h5>管理需要关联的元空间</h5>
+        <p style="margin-bottom: 10px;">以下为关联的元空间id</p>
+        <el-input
+          type="textarea"
+          :autosize="{ minRows: 6, maxRows: 10}"
+          :disabled="onlyRead"
+          placeholder="请输入元空间id,以“,”分割"
+          v-model="relationids">
+        </el-input>
+        <el-row class="right" v-show="!onlyRead">
+          <el-button>取消</el-button>
+          <el-button type="primary">保存</el-button>
+        </el-row>
       </div>
     </div>
     <el-pagination
@@ -50,7 +63,7 @@ import tools from "@/utils/scan/tools";
 
 import cenoteType from "@/components/ledger/lib/cenoteType";
 import handsonTable from "@/components/common/handsontable";
-import { getCenoteTableHeader, getCenoteTableData, getEquipmentFamily } from "@/api/scan/request"
+import { getCenoteType, getCenoteTableHeader, getCenoteTableData } from "@/api/scan/request"
 import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
@@ -60,6 +73,8 @@ export default {
   data() {
     return {
       cenoteId: "",
+      cenoteTypeList: [],
+      relationids: "",
       options: [{
         value: true,
         label: '只读模式'
@@ -98,6 +113,7 @@ export default {
   created() {
     this.param.ProjId = this.projectId
     this.param.secret = this.secret
+    this.getCenoteTypeData()
     this.getTableHeader()
     // this.getProjName()
   },
@@ -108,6 +124,22 @@ export default {
       }
   },
   methods: {
+    //获取竖井类型
+    async getCenoteTypeData() {
+      let param = {
+        ProjId: this.projectId,
+        secret: this.secret,
+        data: {}
+      }
+      await getCenoteType (param, res => {
+        let data = res.Content
+        this.cenoteTypeList = data.map((item) => {
+          item.Code = item.ID
+          return item
+        })
+      })
+    },
+    //获取表头数据(初始化表格)
     async getTableHeader() {
       let param = {
         ProjId: this.projectId,
@@ -121,10 +153,50 @@ export default {
         this.getTableData()
       })
     },
-    handleChangeAllMess() {
+    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
+        this.page.pageNumber = res.PageNumber
+        this.page.total = res.Total
+        if(this.tableData && this.tableData.length){
+          this.initTable()
+        }
+      })
+    },
+    //切换竖井类型
+    changeFloor(value) {
+      this.cenoteId = value.ID
+      this.getTableHeader()
+    },
+    //切换每页显示多少条数据
+    handleSizeChange(val) {
+      this.page.pageSize = val
       this.getTableHeader()
     },
-    formatHeaderData(list) {
+    //切换页数
+    handleCurrentChange(val) {
+      this.page.pageNumber = val
+      this.getTableHeader()
+    },
+    formatHeaderData(list) {//格式化表头显示的数据
       let arr = tools.copyArr(list)
       let data = arr.map((item) => {
         if (item.Field == "SpaceCount" || item.Field == "SpaceList"){
@@ -136,15 +208,25 @@ export default {
       data.unshift("关联的元空间");
       return data;
     },
-    formatHeaderType(list) {
+    formatHeaderType(list) {//格式化表头头映射的数据
       let arr = tools.copyArr(list)
       let data = arr.map(item => {
         if (item.Field == "SpaceCount" || item.Field == "SpaceList") {
           return undefined
+        } else if(item.Field == "ShaftFuncType") {
+          return {
+            data: item.Field,
+            readOnly: this.onlyRead,
+            renderer: tools.customDropdownRenderer,
+            editor: "chosen",
+            chosenOptions: {
+                data: this.cenoteTypeList
+            }
+          }
         } else {
           return {
             data: item.Field,
-            readOnly: true
+            readOnly: this.onlyRead
           }
         }
       }).filter(d => d)
@@ -154,35 +236,7 @@ export default {
       })
       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
-        this.page.pageNumber = res.PageNumber
-        this.page.total = res.Total
-        if(this.tableData && this.tableData.length){
-          this.initTable()
-        }
-      })
-    },
-    initTable() {
+    initTable() {//实例化表格
       let settings = {
         data: this.tableData,
         colHeaders: this.formatHeaderData(this.tableHeader),
@@ -207,6 +261,9 @@ export default {
         this.tableExample = this.$refs.table.init(settings);
       });
     },
+    handleTdClick() {
+      
+    },
     // getProjName() {
     //   let param = {
     //     list: [{ id: this.param.ProjId }],
@@ -284,11 +341,6 @@ export default {
         this.$message.error("请求错误")
       })
     },
-    //切换竖井类型
-    changeFloor(value) {
-      this.cenoteId = value.ID
-      this.getTableHeader()
-    },
 
     //修改设备族
     changeDevice(value) {
@@ -301,14 +353,6 @@ export default {
         return;
       }
     },
-    handleSizeChange(val) {
-      this.page.pageSize = val
-      this.getTableHeader()
-    },
-    handleCurrentChange(val) {
-      this.page.pageNumber = val
-      this.getTableHeader()
-    },
   }
 };
 </script>
@@ -335,8 +379,18 @@ export default {
       flex: 1;
       // display: none;
       border-left: 1px solid #dadada;
+      padding: 5px 15px;
       margin-right: 5px;
       box-shadow: 0px 1px 5px 0px rgba(59, 66, 84, 0.15);
+      .table_right_box::after{
+        display: block;
+        content: "";
+        clear: both;
+      }
+      .close_right {
+        float: right;
+        cursor: pointer;
+      }
     }
   }
 }