Browse Source

parts edit

haojianlong 5 years ago
parent
commit
f4e88ba32c

+ 54 - 0
src/api/scan/request.js

@@ -855,4 +855,58 @@ export function getBasicMatch(param) {
     console.log(param, "param")
     let data = param
     return fetch({ method: 'POST', url: `${venders}/basic/autoFillId`, data })
+}
+
+//设备清单-查询设备内容
+export function getEquipTableCon(param) {
+    let data = param;
+    return fetch({ method: 'POST', url: `${baseUrl}/equip-component/equip-query/equip-components`, data })
+}
+
+//设备清单-查询当前设备下的部件分类
+export function getEquipPartsType(param) {
+    let data = param;
+    return fetch({ method: 'POST', url: `${baseUrl}/equip-component/equip-query/components-count`, data })
+}
+
+//设备清单-查询当前设备类下的部件分类
+export function getPartsAllType(param) {
+    let data = param;
+    return fetch({ method: 'GET', url: `${baseUrl}/equip-component/equip-query/equip-compon?category=${data.category}&id=${data.id}` })
+}
+
+//all - 查询数据字典 --列表表头
+export function getDataDictionary(param) {
+    let data = param;
+    return fetch({ method: 'POST', url: `${baseUrl}/datacenter/data-dictionary/query`, data })
+}
+
+//设备清单 - 根据分类查询部件列表内容
+export function getEquipPartsCon(param) {
+    let data = param;
+    return fetch({ method: 'POST', url: `${baseUrl}/equip-component/equip-query/components-property`, data })
+}
+
+//设备清单 - 新增部件
+export function createPart(param) {
+    let data = param.data;
+    return fetch({ method: 'POST', url: `${baseUrl}/datacenter/component/create?projectId=${param.projectId}`, data })
+}
+
+//设备清单 - 删除部件
+export function deleteParts(param) {
+    let data = param.data;
+    return fetch({ method: 'POST', url: `${baseUrl}/datacenter/component/delete?projectId=${param.projectId}`, data })
+}
+
+//设备清单 - 更新部件
+export function updateParts(param) {
+    let data = param.data;
+    return fetch({ method: 'POST', url: `${baseUrl}/datacenter/component/update?projectId=${param.projectId}`, data })
+}
+
+//创建资产
+export function createPropertyData(param) {
+    let data = param.data;
+    return fetch({ method: 'POST', url: `${baseUrl}/datacenter/property/create?projectId=${param.projectId}`, data })
 }

+ 254 - 55
src/utils/handsontable/notShow.js

@@ -3,33 +3,33 @@ import text from "@/utils/handsontable/mainText"
 import tools from "@/utils/scan/tools"
 //在编辑模式下并且勾选隐藏自动填充的信息点不显示的字段
 let noShowArr = [
-    "Brand",
-    "Specification",
-    "Manufacturer",
-    "Supplier",
-    "SupplierContactor",
-    "SupplierPhone",
-    "SupplierEmail",
-    "SupplierWeb",
-    "SupplierFax",
-    "Maintainer",
-    "MaintainerContactor",
-    "MaintainerPhone",
-    "MaintainerEmail",
-    "MaintainerWeb",
-    "Principal",
-    "MaintainerFax",
-    "Insurer",
-    "InsurerContactor",
-    "InsurerPhone",
-    "InsurerEmail",
-    "InsurerWeb",
-    "InsurerFax",
-    "InsuranceFile",
-    "EquipID",
-    "EquipName",
-]
-//在编辑模式下不显示的字段
+        "Brand",
+        "Specification",
+        "Manufacturer",
+        "Supplier",
+        "SupplierContactor",
+        "SupplierPhone",
+        "SupplierEmail",
+        "SupplierWeb",
+        "SupplierFax",
+        "Maintainer",
+        "MaintainerContactor",
+        "MaintainerPhone",
+        "MaintainerEmail",
+        "MaintainerWeb",
+        "Principal",
+        "MaintainerFax",
+        "Insurer",
+        "InsurerContactor",
+        "InsurerPhone",
+        "InsurerEmail",
+        "InsurerWeb",
+        "InsurerFax",
+        "InsuranceFile",
+        "EquipID",
+        "EquipName",
+    ]
+    //在编辑模式下不显示的字段
 let cantShow = [
     "EquipQRCode",
     "EquipID",
@@ -85,23 +85,51 @@ let cutArr = [{
 }]
 
 let newData = [{
-    name: "品牌型号",
-    code: "DPManufacturerID",
-    num: 2,
-}, {
-    name: "供应商信息",
-    code: "DPSupplierID",
-    num: 8
-}, {
-    name: "维修商信息",
-    code: "DPMaintainerID",
-    num: 35
-}, {
-    name: "保险公司信息",
-    code: "DPInsurerID",
-    num: 42
-}]
-
+        name: "品牌型号",
+        code: "DPManufacturerID",
+        num: 2,
+    }, {
+        name: "供应商信息",
+        code: "DPSupplierID",
+        num: 8
+    }, {
+        name: "维修商信息",
+        code: "DPMaintainerID",
+        num: 35
+    }, {
+        name: "保险公司信息",
+        code: "DPInsurerID",
+        num: 42
+    }]
+    //创建部件固定不显示-管理部件固定不显示(即编辑模式)
+let partsAddNoShow = [
+    'EquipID',
+    'EquipName',
+    'EquipQRCode',
+    'BIMID',
+    'BIMLocation',
+    'Brand',
+    'Specification',
+    'Manufacturer',
+    'Supplier',
+    'SupplierContactor',
+    'SupplierPhone',
+    'SupplierEmail',
+    'SupplierWeb',
+    'SupplierFax',
+    'Maintainer',
+    'MaintainerContactor',
+    'MaintainerPhone',
+    'MaintainerEmail',
+    'MaintainerWeb',
+    'MaintainerFax',
+    'Insurer',
+    "InsurerContactor",
+    "InsurerPhone",
+    "InsurerEmail",
+    "InsurerWeb",
+    "InsurerFax",
+]
 const showTools = {
     addArr: () => {
         return cutArr
@@ -115,7 +143,15 @@ const showTools = {
         })
         return falg
     },
-
+    fixedNoShowField: (noShowList, code) => {
+        let flag = true
+        noShowList.map(item => {
+            if (item == code) {
+                flag = false
+            }
+        })
+        return flag
+    },
     //几种类型不显示
     technologyParam: (item) => {
         if (
@@ -222,6 +258,7 @@ const showTools = {
                     arr.splice(item, 0, {
                         InfoPointName: "保险公司信息",
                         InfoPointCode: "DPInsurerID",
+                        Path: 'DPInsurerID',
                         InputMode: "Own",
                         Unit: "",
                         SecondTag: "",
@@ -232,6 +269,7 @@ const showTools = {
                     arr.splice(item, 0, {
                         InfoPointName: "维修商信息",
                         InfoPointCode: "DPMaintainerID",
+                        Path: 'DPMaintainerID',
                         InputMode: "Own",
                         Unit: "",
                         SecondTag: "",
@@ -242,6 +280,7 @@ const showTools = {
                     arr.splice(item, 0, {
                         InfoPointName: "供应商信息",
                         InfoPointCode: "DPSupplierID",
+                        Path: 'DPSupplierID',
                         InputMode: "Own",
                         Unit: "",
                         SecondTag: "",
@@ -252,6 +291,7 @@ const showTools = {
                     arr.splice(item, 0, {
                         InfoPointName: "品牌型号",
                         InfoPointCode: "DPManufacturerID",
+                        Path: 'DPManufacturerID',
                         InputMode: "Own",
                         Unit: "",
                         SecondTag: "",
@@ -514,7 +554,7 @@ const showTools = {
             if (item.InfoPointCode == "BIMLocation") {
                 return undefined
             }
-            if (onlyRead || (!!readArr && readArr.indexOf(item.InputMode) > -1 )) {
+            if (onlyRead || (!!readArr && readArr.indexOf(item.InputMode) > -1)) {
                 if (item.Visible || !allMess) {
                     if (!showTools.cantShow(item.InfoPointCode) && !onlyRead && !taizhang) {
                         return undefined
@@ -561,13 +601,13 @@ const showTools = {
                     if (!showTools.cantShow(item.InfoPointCode) && !onlyRead) {
                         return undefined
                     }
-    
+
                     if (!showTools.isShow(item.InfoPointCode)) {
                         if (isWatch && !onlyRead) {
                             return undefined
                         }
                     }
-    
+
                     if (item.InfoPointCode == "EquipQRCode") {
                         return {
                             data: item.InfoPointCode,
@@ -575,7 +615,7 @@ const showTools = {
                             readOnly: onlyRead
                         }
                     }
-    
+
                     //图片类型
                     if (
                         item.InfoPointCode == "InstallPic" ||
@@ -590,7 +630,7 @@ const showTools = {
                             readOnly: onlyRead
                         }
                     }
-    
+
                     //文件类型
                     if (item.InfoPointCode == "InsuranceFile" ||
                         item.InfoPointCode == "Archive" ||
@@ -601,15 +641,15 @@ const showTools = {
                             readOnly: onlyRead
                         }
                     }
-    
-                    if (item.InputMode == "D1" || item.InputMode == "E1") {//单选
+
+                    if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
                         return {
                             data: item.InfoPointCode,
                             renderer: tools.customDropdownRenderer,
                             editor: "chosen",
                             readOnly: onlyRead,
                             chosenOptions: {
-                                data: item.DataSource? tools.formatDataSource(item.DataSource): ""
+                                data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
                             }
                         };
                     } else if (item.InputMode == "D2") {
@@ -620,7 +660,7 @@ const showTools = {
                             readOnly: onlyRead,
                             chosenOptions: {
                                 multiple: true, //多选
-                                data: item.DataSource? tools.formatDataSource(item.DataSource): ""
+                                data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
                             }
                         };
                     } else if (item.InputMode == "A1" || item.InputMode == "A2") {
@@ -662,7 +702,166 @@ const showTools = {
             }
         }).filter(item => item);
         return data
-    }
+    },
+
+    tableHeadFilter(arr, readArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
+        if (!taizhang) {
+            arr = showTools.arrToArr(arr)
+        }
+        let data = arr.map(item => {
+            if (falg) {
+                if (item.FirstTag == "控制参数" ||
+                    item.FirstTag == "设定参数" ||
+                    item.FirstTag == "运行参数") {
+                    return undefined
+                }
+            }
+
+            if (item.InfoPointCode == "BIMLocation") {
+                return undefined
+            }
+            if (onlyRead || (!!readArr && readArr.indexOf(item.InputMode) > -1)) {
+                if (item.Visible || !allMess) {
+                    if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
+                        return undefined
+                    }
+                    if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
+                        if (isWatch && !onlyRead) {
+                            return undefined
+                        }
+                    }
+                    if (!item.Unit || item.Unit == "") {
+                        return item.InfoPointName;
+                    } else {
+                        return item.InfoPointName + "(" + item.Unit + ")";
+                    }
+                } else {
+                    return undefined
+                }
+            } else {
+                return undefined;
+            }
+        }).filter(d => d);
+        return data
+    },
+    tableHeaderTypes(arr, typeArr, onlyRead, isWatch, allMess, falg = false, taizhang = false) {
+        if (!taizhang) {
+            arr = showTools.arrToArr(arr)
+        }
+        let data = arr.map(item => {
+            if (falg) {
+                if (item.FirstTag == "控制参数" ||
+                    item.FirstTag == "设定参数" ||
+                    item.FirstTag == "运行参数") {
+                    return undefined
+                }
+            }
+            if (item.Path == "BIMLocation") {
+                return undefined
+            }
+            if (onlyRead || (!!typeArr && typeArr.indexOf(item.InputMode) > -1)) {
+                if (item.Visible || !allMess) {
+                    //固定不显示的code
+                    if (!showTools.fixedNoShowField(partsAddNoShow, item.InfoPointCode) && !onlyRead && !taizhang) {
+                        return undefined
+                    }
+                    if (!showTools.isShow(item.InfoPointCode) && !taizhang) {
+                        if (isWatch && !onlyRead) {
+                            return undefined
+                        }
+                    }
+                    if (item.InfoPointCode == "EquipQRCode") {
+                        return {
+                            data: item.Path,
+                            renderer: text.lookQRCode,
+                            readOnly: onlyRead
+                        }
+                    }
+                    //图片类型
+                    if (
+                        item.InfoPointCode == "InstallPic" ||
+                        item.InfoPointCode == "InstallDrawing" ||
+                        item.InfoPointCode == "Nameplate" ||
+                        item.InfoPointCode == "Pic" ||
+                        item.InfoPointCode == "Drawing"
+                    ) {
+                        return {
+                            data: item.Path,
+                            renderer: text.picType,
+                            readOnly: onlyRead
+                        }
+                    }
+
+                    //文件类型
+                    if (item.InfoPointCode == "InsuranceFile" ||
+                        item.InfoPointCode == "Archive" ||
+                        item.InfoPointCode == "CheckReport") {
+                        return {
+                            data: item.Path,
+                            renderer: text.fileType,
+                            readOnly: onlyRead
+                        }
+                    }
+
+                    if (item.InputMode == "D1" || item.InputMode == "E1") { //单选
+                        return {
+                            data: item.Path,
+                            renderer: tools.customDropdownRenderer,
+                            editor: "chosen",
+                            readOnly: onlyRead,
+                            chosenOptions: {
+                                data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
+                            }
+                        };
+                    } else if (item.InputMode == "D2") {
+                        return {
+                            data: item.Path,
+                            renderer: tools.customDropdownRenderer,
+                            editor: "chosen",
+                            readOnly: onlyRead,
+                            chosenOptions: {
+                                multiple: true, //多选
+                                data: item.DataSource ? tools.formatDataSource(item.DataSource) : ""
+                            }
+                        };
+                    } else if (item.InputMode == "A1" || item.InputMode == "A2") {
+                        return {
+                            data: item.Path,
+                            type: "numeric",
+                            readOnly: onlyRead,
+                            numericFormat: {
+                                pattern: "0,0.00"
+                            }
+                        };
+                    } else if (item.InputMode == "C5") {
+                        return {
+                            data: item.Path,
+                            type: "date",
+                            dateFormat: "YYYY-MM-DD",
+                            readOnly: onlyRead,
+                            correctFormat: true
+                        };
+                    } else if (item.InputMode == "Own" && !onlyRead) {
+                        return {
+                            data: item.Path,
+                            renderer: text.idType,
+                            readOnly: onlyRead
+                        }
+                    } else {
+                        return {
+                            data: item.Path,
+                            readOnly: onlyRead
+                        };
+                    }
+                } else {
+                    return undefined
+                }
+            } else {
+                return undefined
+            }
+        }).filter(item => item);
+        return data
+    },
 }
 
 export default showTools

+ 245 - 228
src/views/ledger/facility/parts/index.vue

@@ -1,11 +1,13 @@
 <template>
   <div id="partsList">
     <el-row>
-      <el-tabs @tab-click="handleClick" v-model="tabVal">
-        <el-tab-pane label="用户管理" name="first"></el-tab-pane>
-        <el-tab-pane label="配置管理" name="second"></el-tab-pane>
-        <el-tab-pane label="角色管理" name="third"></el-tab-pane>
-        <el-tab-pane label="定时任务补偿" name="fourth"></el-tab-pane>
+      <el-tabs @tab-click="getTableHeader" v-model="tabVal">
+        <el-tab-pane
+          v-for="t in partsTypeList"
+          :key="t.Category"
+          :name="t.Category"
+          :label="t.CategoryName+'('+t.count+')'"
+        ></el-tab-pane>
       </el-tabs>
     </el-row>
     <el-row class="right">
@@ -37,6 +39,8 @@
       layout="total, sizes, prev, pager, next, jumper"
       :total="page.total"
     ></el-pagination>
+    <!-- 二维码弹窗 -->
+    <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
   </div>
 </template>
 <script>
@@ -45,25 +49,23 @@ import handsonUtils from "@/utils/hasontableUtils";
 import showTools from "@/utils/handsontable/notShow";
 import text from "@/utils/handsontable/mainText";
 
-import cenoteType from "@/components/ledger/lib/cenoteType";
+import qrcode from "@/components/ledger/lib/qrcode";
 import handsonTable from "@/components/common/handsontable";
 import {
-  getCenoteTableHeader,
-  getCenoteTableData,
-  updataCenoteTableData,
-  deleteCenoteTableData,
-  saveCenoteRelateSpace
+  getEquipPartsType,
+  getDataDictionary,
+  getEquipPartsCon,
+  deleteParts
 } from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
-    cenoteType,
+    qrcode, //二维码页面
     handsonTable
   },
   data() {
     return {
-      cenoteId: "", //部件类型id
-      shaftId: "", //要操作的部件id
+      deviceId: "", //设备id
       isTableRightShow: false,
       spaceList: "",
       onlyRead: true,
@@ -78,187 +80,103 @@ export default {
       tableData: [],
       copyTableData: [],
       tableExample: null,
-      tabVal:'first'
+      tabVal: "",
+      partsTypeList: [], //tabs
+      readArr: [
+        "A1",
+        "A2",
+        "B1",
+        "C5",
+        "D1",
+        "D2",
+        "E1",
+        "F1",
+        "F2",
+        "L",
+        "L1",
+        "L2",
+        "X"
+      ],
+      qrcodeUrl:'',
+      myDialog: {
+        qrcode: false, //二维码弹窗
+        firm: false, //厂商弹窗
+        supply: false, //选择供应合同
+        supplier: false, //供应商选择
+        guarantee: false, //选择保单
+        maintainer: false, //选择维修商
+        insurer: false, //选择保险公司
+        uploadFiles: false, //上传文件
+        uploadImgs: false, //上传单个图片
+        pic: false, //多个图片
+        addDevice: false,
+        systemType: false,
+        details: false, //详情页
+        changeRea: false,
+        lookPic: false //图片查看
+      }
     };
   },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
-    this.getTableHeader();
+    this.deviceId = this.$route.params.deviceId;
+    this.getTypes();
   },
   methods: {
-    //tab页点击事件
-    handleClick(){
-      console.log(this.tabVal)
+    //获取当前设备下的部件类
+    async getTypes() {
+      let params = {
+        Filters: `id='${this.deviceId}'`,
+        PageNumber: 1,
+        PageSize: 50
+      };
+      await getEquipPartsType(params).then(res => {
+        this.partsTypeList = res.data.Content;
+        this.tabVal = this.partsTypeList[0].Category;
+        this.getTableHeader();
+      });
     },
     // 获取表头数据(初始化表格)
     async getTableHeader() {
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: {
-          CollectFlag: this.allMess
-        }
+      let params = {
+        PageNumber: 1,
+        PageSize: 500,
+        Filters: `type='Equipment' or type='${this.tabVal}'`
       };
-      await getCenoteTableHeader(param, res => {
-        this.tableHeader = res.Content;
-        this.getTableData();
+      await getDataDictionary(params).then(res => {
+        let response = res.data;
+        if (response.Result == "success") {
+          this.tableHeader = response.Content;
+          this.getTableData();
+        } else {
+          this.$message.error("请求错误:" + response.Result);
+        }
       });
     },
+    //获取表格数据
     async getTableData() {
-      //获取表格数据
-      let data = {
-        Filters: this.cenoteId
-          ? `ProjectId='${this.projectId}';structureInfo.ShaftFuncType='${
-              this.cenoteId
-            }'`
-          : `ProjectId='${this.projectId}'`,
+      let params = {
         PageNumber: this.page.pageNumber,
-        PageSize: this.page.pageSize
-      };
-      const params = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: data
+        PageSize: this.page.PageSize,
+        Filters: `category='${this.tabVal}';parentId='${this.deviceId}'`
       };
-      await getCenoteTableData(params, res => {
-        this.tableData = res.Content;
-        this.copyTableData = tools.deepCopy(res.Content);
-        this.page.pageNumber = res.PageNumber;
-        this.page.total = res.Total;
-        if (this.tableData && this.tableData.length) {
-          this.initTable();
-        }
-      });
-    },
-    // 修改表格内容
-    async updateTableData(data, change) {
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: {
-          Content: [],
-          Projection: []
-        }
-      };
-      //生成要修改字段列表
-      change.map(item => {
-        if (item[1] && param.data.Projection.indexOf(item[1]) == -1) {
-          param.data.Projection.push(item[1]);
-        }
-      });
-      //生成对应修改数据
-      data.map((item, index) => {
-        let keyarr = change[index][1].split(".");
-        if (keyarr && keyarr.length > 1) {
-          item[keyarr[0]][keyarr[1]] =
-            item[keyarr[0]][keyarr[1]] != ""
-              ? item[keyarr[0]][keyarr[1]]
-              : null;
+      await getEquipPartsCon(params).then(res => {
+        let response = res.data;
+        if (response.Result) {
+          this.tableData = response.Content;
+          this.copyTableData = tools.deepCopy(response.Content);
+          this.page.pageNumber = response.PageNumber;
+          this.page.total = response.Total;
+          if (this.tableData && this.tableData.length) {
+            this.initTable();
+          }
         } else {
-          item[keyarr[0]] = item[keyarr[0]] != "" ? item[keyarr[0]] : null;
+          this.$message.error("请求错误:" + response.Result);
         }
-        param.data.Content.push(item);
-      });
-
-      await updataCenoteTableData(param, res => {});
-    },
-    // 删除表格数据
-    async deleteTableData(params) {
-      await deleteCenoteTableData(params, res => {
-        this.$message.success("删除成功!");
-        this.getTableHeader();
-      });
-    },
-    //保存元空间关联
-    async saveSpaceList() {
-      let data = {
-        ShaftId: this.shaftId,
-        SpaceId: this.spaceList
-      };
-      const params = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: data
-      };
-      await saveCenoteRelateSpace(params, res => {
-        this.$message.success("关联成功!");
-        this.getTableHeader();
       });
     },
-    // 添加部件
-    handleCreateTableData() {
-      this.$router.push({ name: "cenoteadd" });
-    },
-    // 删除表格行
-    handleDeleteTableRow() {
-      let params = tools.differenceArr(this.tableData, this.copyTableData);
-      if (params.length < 1 || this.tableData > this.copyTableData) {
-        return;
-      }
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: []
-      };
-      params.map(item => {
-        param.data.push(item.ShaftID);
-      });
-      this.$confirm("此操作将删除部件,是否继续?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          this.deleteTableData(param);
-        })
-        .catch(() => {
-          this.getTableHeader();
-          this.$message("取消删除");
-        });
-    },
-    //修改
-    handleUpdataTable(changeData, source) {
-      if (!this.onlyRead) {
-        if (changeData) {
-          let trimmedArr = this.trimmedRows();
-          let param = handsonUtils.getParam(
-            changeData,
-            source,
-            this.tableExample,
-            trimmedArr
-          );
-          let data = [];
-          for (let i = 0; i < param.length; i++) {
-            data.push(param[i]);
-          }
-          //如果data中包含/且data长度为1,将其转换成.
-          if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
-            changeData[0][1] = changeData[0][1].split("/").join(".");
-          }
-
-          // 存在data进行修改请求
-          if (data && data.length) {
-            this.updateTableData(data, changeData);
-          }
-        }
-      }
-    },
-    //撤回
-    undo() {
-      this.tableExample.undo();
-    },
-    //切换部件类型
-    changeFloor(value) {
-      this.cenoteId = value.Id;
-      this.getTableHeader();
-    },
-    //关闭右侧关联元空间输入按钮
-    handleCloseRight() {
-      this.isTableRightShow = false;
-      this.spaceList = "";
-    },
     //切换每页显示多少条数据
     handleSizeChange(val) {
       this.page.pageSize = val;
@@ -275,32 +193,14 @@ export default {
       arr.map(item => {
         item.Visible = true;
       });
-      let readArr = [
-        "A1",
-        "A2",
-        "B1",
-        "C5",
-        "D1",
-        "D2",
-        "E1",
-        "F1",
-        "F2",
-        "L",
-        "L1",
-        "L2",
-        "X"
-      ];
-      if (!this.onlyRead) {
-        readArr.push("Own");
-      }
       let data = showTools.changeHeader(
         arr,
-        readArr,
+        this.readArr,
         this.onlyRead,
         false,
         this.allMess
       );
-      data.unshift("关联的元空间");
+      data.unshift("查看详情", "当前关联的资产");
       return data;
     },
     formatHeaderType(list) {
@@ -310,33 +210,24 @@ export default {
         //缺少信息点
         item.Visible = true;
       });
-      let readArr = [
-        "A1",
-        "A2",
-        "B1",
-        "C5",
-        "D1",
-        "D2",
-        "E1",
-        "F1",
-        "F2",
-        "L",
-        "L1",
-        "L2",
-        "X"
-      ];
       let data = showTools.showHeaderTypes(
         arr,
-        readArr,
+        this.readArr,
         this.onlyRead,
         false,
         this.allMess
       );
-      data.unshift({
-        data: "SpaceCount",
-        renderer: tools.num,
-        readOnly: true
-      });
+      data.unshift(
+        {
+          data: "caozuo",
+          renderer: tools.lookDetails,
+          readOnly: true
+        },
+        {
+          data: "PropertyName",
+          readOnly: true
+        }
+      );
       return data;
     },
     initTable() {
@@ -355,26 +246,13 @@ export default {
           }
         },
         // 事件
-        afterChange: this.handleUpdataTable, //修改后
         afterRemoveRow: this.handleDeleteTableRow, //右键删除
         afterOnCellMouseDown: this.handleTdClick //鼠标点击
       };
       this.$nextTick(() => {
-        console.log(this.$refs.table);
         this.tableExample = this.$refs.table.init(settings);
       });
     },
-    //获取到了正确的信息
-    getInfors(infos, row) {
-      //其他的开始判断
-      let val = this.tableExample.colToProp(row.col);
-      this.shaftId = infos.ShaftID; //要操作的数据id
-      //点击关联的元空间
-      if (val === "SpaceCount") {
-        this.spaceList = infos.SpaceList;
-        this.isTableRightShow = true;
-      }
-    },
     //表格点击事件
     handleTdClick(el, rowArr) {
       //点击的是表头
@@ -419,6 +297,112 @@ export default {
       }
       return dataArr || [];
     },
+    getInfors(infos, row) {
+      //其他的开始判断
+      let val = this.tableExample.colToProp(row.col);
+      //设备二维码图片
+      if (val == "EquipQRCode") {
+        this.myDialog.qrcode = true;
+        this.$refs.qrcode.getCanvas(1111);
+      }
+      //关联系统
+      if (val == "linkSystem") {
+        // this.systemList = this.tableData[row.row].linkSystem || [];
+        this.myDialog.systemType = true;
+      }
+      //品牌型号弹窗
+      if (val == "DPManufacturerID") {
+        this.myDialog.firm = true;
+      }
+      //供应商信息弹窗
+      if (val == "DPSupplierID") {
+        this.myDialog.supplier = true;
+      }
+      //维修商信息弹窗
+      if (val == "DPMaintainerID") {
+        this.myDialog.maintainer = true;
+      }
+      //保险公司信息
+      if (val == "DPInsurerID") {
+        this.myDialog.insurer = true;
+      }
+      //供应合同编号
+      if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPSupplierID.split("-")[0];
+          }
+        }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.supply = true;
+        } else {
+          this.$message("请先选择供应商");
+        }
+      }
+      //保险单号
+      if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
+        //选择保单
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPInsurerID.split("-")[0];
+          }
+        }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.guarantee = true;
+        } else {
+          this.$message("请先选择保险商");
+        }
+      }
+      //保险文件--设备文档
+      if (
+        val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
+        val == "LedgerParam.PhotoDoc.Archive"
+      ) {
+        this.filesArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? [this.tableData[row.row].infos[val.split(".")[1]]]
+            : []
+          : [];
+        this.myDialog.uploadFiles = true;
+      }
+      //安装照片--安装图纸--设备铭牌照片--设备图纸
+      if (
+        val == "LedgerParam.Siteinstall.InstallPic" ||
+        val == "LedgerParam.Siteinstall.InstallDrawing" ||
+        val == "LedgerParam.PhotoDoc.Nameplate" ||
+        val == "LedgerParam.PhotoDoc.Drawing"
+      ) {
+        if (val == "LedgerParam.PhotoDoc.Nameplate") {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]].key]
+              : []
+            : [];
+        } else {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]]]
+              : []
+            : [];
+        }
+        this.myDialog.uploadImgs = true;
+      }
+      //设备照片
+      if (val == "LedgerParam.PhotoDoc.Pic") {
+        this.picsArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+            : []
+          : [];
+        this.myDialog.pic = true;
+      }
+      this.row = row.row;
+      this.messKey = val;
+    },
     //去除数组中相同的元素
     array_diff(a, b) {
       for (var i = 0; i < b.length; i++) {
@@ -430,6 +414,39 @@ export default {
         }
       }
       return a;
+    },
+    // 删除表格行
+    handleDeleteTableRow() {
+      let params = tools.differenceArr(this.tableData, this.copyTableData);
+      if (params.length < 1 || this.tableData > this.copyTableData) {
+        return;
+      }
+      let param = {
+        projectId: this.projectId,
+        data: []
+      };
+      params.map(item => {
+        param.data.push(item.EquipID);
+      });
+      this.$confirm("此操作将删除部件,是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          this.deleteTableData(param);
+        })
+        .catch(() => {
+          this.getTableHeader();
+          this.$message("取消删除");
+        });
+    },
+    // 删除表格数据
+    async deleteTableData(params) {
+      await deleteParts(params).then(res => {
+        this.$message.success("删除成功!");
+        this.getTypes();
+      });
     }
   }
 };

+ 468 - 145
src/views/ledger/facility/partsmanage/addparts/index.vue

@@ -1,14 +1,14 @@
 <template>
   <div id="deviceList">
     <el-row class="right">
-      <span style="float:left;">当前选择的部件类型:{{'--'}}</span>
+      <span style="float:left;">当前选择的部件类型:{{category.Name}}</span>
       <div style="width:200px;display:inline-block;text-align:left;color:gray;">
         <span>隐藏自动填充的信息</span>
-        <el-checkbox v-model="allMess" @change="getTableHeader"></el-checkbox>
+        <el-checkbox v-model="isWatch" @change="getTableHeader"></el-checkbox>
       </div>
       <span>增加</span>
       <el-input v-model="addNum" style="width:40px;" size="small"></el-input>
-      <span>个{{'--'}}</span>
+      <span>个{{category.Name}}</span>
       <el-button @click="handleAddTableRow">增加</el-button>
     </el-row>
     <div class="tableBox">
@@ -23,157 +23,304 @@
       </div>
     </div>
     <el-row class="center">
-      <el-button type="primary" size="medium" @click="handleCreateTableData">创建部件</el-button>
+      <el-button
+        type="primary"
+        size="medium"
+        @click="handleCreateTableData"
+        class="create_button"
+      >创建部件</el-button>
     </el-row>
+    <!-- 二维码弹窗 -->
+    <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
+    <!-- 型号弹窗 -->
+    <firm :mess="{deviceId: firmId}" ref="firm" @changeFirm="firmChange" :dialog="myDialog"></firm>
+    <!-- 供应商合同弹窗 -->
+    <supply-dialog ref="supply" @change="supplyChange" :id="id" :dialog="myDialog"></supply-dialog>
+    <!-- 供应商弹窗 -->
+    <supplier-dialog ref="supplier" @changeSupplier="supplierChange" :dialog="myDialog"></supplier-dialog>
+    <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"></guarantee-dialog>
+    <upload-files-dialog
+      :read="onlyRead ? true : false"
+      ref="upload"
+      @changeFile="fileChange"
+      :keysArr="filesArr"
+      :dialog="myDialog"
+    ></upload-files-dialog>
+    <upload-img-dialog
+      :read="onlyRead ? true : false"
+      @changeFile="imgChange"
+      :keysArr="imgsArr"
+      :dialog="myDialog"
+    ></upload-img-dialog>
+    <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
+    <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
+    <pic-dialog
+      :read="onlyRead ? true : false"
+      :dialog="myDialog"
+      :keysArr="picsArr"
+      @change="changePics"
+    ></pic-dialog>
+    <system-type :infos="systemId" :graphyId="graphyId" :dialog="myDialog"></system-type>
+    <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
   </div>
 </template>
 <script>
-import tools from "@/utils/scan/tools"
-import handsonUtils from "@/utils/hasontableUtils"
-import showTools from "@/utils/handsontable/notShow"
-import text from "@/utils/handsontable/mainText"
-import session from "@/framework/utils/storage"
+import tools from "@/utils/scan/tools";
+import handsonUtils from "@/utils/hasontableUtils";
+import showTools from "@/utils/handsontable/notShow";
+import text from "@/utils/handsontable/mainText";
+import session from "@/framework/utils/storage";
 
-import handsonTable from "@/components/common/handsontable"
-import { getCenoteTableHeader, createCenoteTableData } from "@/api/scan/request"
+import handsonTable from "@/components/common/handsontable";
+import {
+  getDataDictionary,
+  createPart,
+  getEquipmentFamily,
+  createPropertyData
+} from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
+
+import qrcode from "@/components/ledger/lib/qrcode";
+import firm from "@/components/dialogs/list/firm";
+import supplyDialog from "@/components/dialogs/list/supplyDialog";
+import supplierDialog from "@/components/dialogs/list/supplierDialog";
+import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
+import insurerDialog from "@/components/dialogs/list/insurerDialog";
+import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
+import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
+import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
+import picDialog from "@/components/dialogs/list/picDialog";
+import systemType from "@/components/dialogs/list/systemType";
 export default {
   components: {
+    qrcode, //二维码页面
+    firm, //品牌型号弹窗
+    supplyDialog,
+    supplierDialog,
+    maintainerDialog,
+    insurerDialog,
+    guaranteeDialog,
+    uploadFilesDialog,
+    uploadImgDialog,
+    picDialog,
+    systemType,
     handsonTable
   },
   data() {
     return {
       addNum: 1,
-      shaftId: "",//要操作的部件id
-      isTableRightShow: false,
-      relationids: "",
       onlyRead: false,
-      allMess: true,
       tableHeader: [],
-      tableData: session.get("cenoteAddData")? session.get("cenoteAddData").length? session.get("cenoteAddData"): [{}]: [{}],
-      copyTableData: []
+      tableData: session.get("partsAddData")
+        ? session.get("partsAddData").length
+          ? session.get("partsAddData")
+          : [{ Checked: 1 }]
+        : [{ Checked: 1 }],
+      isWatch: true,
+      copyTableData: [],
+      category: "", //当前设备类
+      myDialog: {
+        qrcode: false, //二维码弹窗
+        firm: false, //厂商弹窗
+        supply: false, //选择供应合同
+        supplier: false, //供应商选择
+        guarantee: false, //选择保单
+        maintainer: false, //选择维修商
+        insurer: false, //选择保险公司
+        uploadFiles: false, //上传文件
+        uploadImgs: false, //上传单个图片
+        pic: false, //多个图片
+        addDevice: false,
+        systemType: false,
+        details: false, //详情页
+        changeRea: false,
+        lookPic: false //图片查看
+      },
+      qrcodeUrl: "", //二维码图片地址
+      filesArr: [], //保存临时的文件key
+      imgsArr: [], //临时保存的图片key数组
+      picsArr: [], //临时设备图片keys数组
+      systemId: null,
+      graphyId: null,
+      mess: {},
+      id: 0,
+      readArr: [
+        "A1",
+        "A2",
+        "B1",
+        "C5",
+        "D1",
+        "D2",
+        "E1",
+        "F1",
+        "F2",
+        "L",
+        "L1",
+        "L2"
+      ],
+      EquipmentList: [],
+      firmId: "" //品牌型号所需字段
     };
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ])
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
-    this.getTableHeader()
+    this.category = this.$route.params;
+    this.category.ParentId = this.category.Code.substr(0, 4);
+    this.mess = {
+      deviceId: this.category.ParentId
+    };
+    this.getEquipmentFamilyList();
+    this.getTableHeader();
   },
-  // watch: {
-
-  // },
   methods: {
+    getEquipmentFamilyList() {
+      getEquipmentFamily(res => {
+        this.EquipmentList = res.Content;
+        this.changeCader();
+      });
+    },
     // 获取表头数据(初始化表格)
     async getTableHeader() {
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: {
-          "CollectFlag": this.allMess
+      let params = {
+        PageNumber: 1,
+        PageSize: 500,
+        Filters: `type='Equipment' or type='${this.category.Code}'`
+      };
+      await getDataDictionary(params).then(res => {
+        let response = res.data;
+        if (response.Result == "success") {
+          this.tableHeader = response.Content;
+          this.initTable();
+        } else {
+          this.$message.error("请求错误:" + response.Result);
         }
-      }
-      await getCenoteTableHeader(param, res => {
-        this.tableHeader = res.Content
-        this.initTable()
-      })
+      });
     },
     // 创建部件数据
     async handleCreateTableData() {
-      let newData = this.tableData.filter((item) => {
-        let keys = Object.keys(item)
-        keys.map((key) => { //将值为空字符串的属性删除
-          if(item[key] == "") {
-            delete item[key]
+      let newData = this.tableData.filter(item => {
+        let keys = Object.keys(item);
+        keys.map(key => {
+          //将值为空字符串的属性删除
+          if (item[key] == "") {
+            delete item[key];
           }
-        })
-        if(keys.length && Object.keys(item).length) {
-          return item
+        });
+        if (keys.length && Object.keys(item).length) {
+          return item;
         }
-      })
-      if(!newData.length) {
-        this.$message("创建信息为空,请录入信息后再创建!")
-        return
+      });
+      if (!newData.length) {
+        this.$message("创建信息为空,请录入信息后再创建!");
+        return;
       }
-      const params = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: newData
+      let data = {
+        ParentId: this.category.deviceId, //当前设备id
+        Category: this.category.Code //当前部件分类
+      };
+      let params = { projectId: this.projectId }
+
+      for (let i = 0; i < newData.length; i++) {
+        params.data = Object.assign(data, newData[i]);
+        await createPart(params).then(res => {
+          let response = res.data;
+          if(response.Result=='success'){
+            if(newData[i].Checked){//同时创建资产
+              params.data.EquipmentId = response.Id
+              createPropertyData(params);
+            }
+            if(i==newData.length-1){
+              this.$router.push({
+                name: "partsmanageLedger",
+                params: {
+                  deviceId: this.category.deviceId,
+                  typeId: this.category.ParentId
+                }
+              });
+              session.remove("partsAddData")
+            }
+          }
+        });
       }
-      await createCenoteTableData(params, (res) => {
-        this.$message.success("添加成功!")
-        session.remove("cenoteAddData")
-        this.$router.push({ name: 'cenotelist'})
-      })
     },
     // 删除表格行
     handleDeleteTableRow() {
-      this.$message.success("删除成功")
-      this.formaTableData()
+      this.$message.success("删除成功");
+      this.formaTableData();
     },
     // 添加行
     handleAddTableRow() {
-      let addRowLength = this.addNum
-      for(let i = 0; i < addRowLength; i++){
-        this.tableData.push({})
+      let addRowLength = this.addNum;
+      for (let i = 0; i < addRowLength; i++) {
+        this.tableData.push({ Checked: 1 });
       }
-      this.initTable()
-      this.formaTableData()
+      this.initTable();
+      this.formaTableData();
     },
     //修改
     handleUpdataTable(changeData, source) {
-      this.formaTableData()
+      this.formaTableData();
     },
     //保存去掉空字段的新增数据
     formaTableData() {
-      let newData = this.tableData.filter((item) => {
-        let keys = Object.keys(item)
-        keys.map((key) => { //将值为空字符串的属性删除
-          if(item[key] == "") {
-            delete item[key]
+      let newData = this.tableData.filter(item => {
+        let keys = Object.keys(item);
+        keys.map(key => {
+          //将值为空字符串的属性删除
+          if (item[key] == "") {
+            delete item[key];
           }
-        })
-        if(keys.length && Object.keys(item).length) {
-          return item
+        });
+        if (keys.length && Object.keys(item).length) {
+          return item;
         }
-      })
-      session.set("cenoteAddData", newData)
-    },
-    //关闭右侧关联元空间输入按钮
-    handleCloseRight() {
-      this.isTableRightShow = false
+      });
+      session.set("partsAddData", newData);
     },
-    formatHeaderData(list) {//格式化表头显示的数据
-      let arr = tools.copyArr(list)
-      arr.map((item) => {
-        item.Visible = true
-      })
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "F1", "F2", "L", "L1", "L2", "X"]
+    //格式化表头显示的数据
+    formatHeaderData(list) {
+      let arr = tools.copyArr(list);
+      arr.map(item => {
+        item.Visible = true;
+      });
       if (!this.onlyRead) {
-        readArr.push("Own")
+        this.readArr.push("Own");
       }
-      let data = showTools.changeHeader(arr, readArr, this.onlyRead, false, this.allMess)
-      // data.unshift("关联的元空间");
+      let data = showTools.tableHeadFilter(
+        arr,
+        this.readArr,
+        this.onlyRead,
+        this.isWatch,
+        false
+      );
+      data.unshift("同时创建资产");
       return data;
     },
-    formatHeaderType(list) {//格式化表头头映射的数据
+    formatHeaderType(list) {
+      //格式化表头头映射的数据
       let arr = tools.copyArr(list);
-      arr.map((item) => { //缺少信息点
-        item.Visible = true
-      })
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "F1", "F2", "L", "L1", "L2", "X"]
-      let data = showTools.showHeaderTypes(arr, readArr, this.onlyRead, false, this.allMess)
-      // data.unshift({
-      //   data: "SpaceCount",
-      //   readOnly: this.onlyRead
-      // })
+      let data = showTools.tableHeaderTypes(
+        arr,
+        this.readArr,
+        this.onlyRead,
+        this.isWatch,
+        false
+      );
+      data.unshift({
+        type: "checkbox",
+        checkedTemplate: 1,
+        uncheckedTemplate: 0,
+        data: "Checked",
+        label: {
+          position: "after"
+        }
+      });
       return data;
     },
-    initTable() {//实例化表格
+    initTable() {
+      //实例化表格
       let settings = {
         data: this.tableData,
         colHeaders: this.formatHeaderData(this.tableHeader),
@@ -194,21 +341,95 @@ export default {
         afterOnCellMouseDown: this.handleTdClick //鼠标点击
       };
       this.$nextTick(() => {
-        console.log(this.$refs.table);
         this.tableExample = this.$refs.table.init(settings);
       });
     },
-    //获取到了正确的信息
-    getInfors(infos, row) {
-      //其他的开始判断
-      let val = this.tableExample.colToProp(row.col);
-      this.row = row.row //要操作的列号
-      this.messKey = val //要操作的列类型
-      //点击关联的元空间
-      // if (val === "SpaceCount") {
-      //   this.isTableRightShow = true;
-      // }
+    //去除数组中相同的元素
+    array_diff(a, b) {
+      for (var i = 0; i < b.length; i++) {
+        for (var j = 0; j < a.length; j++) {
+          if (a[j] == b[i]) {
+            a.splice(j, 1);
+            j = j - 1;
+          }
+        }
+      }
+      return a;
+    },
+    //选择型号修改
+    firmChange(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name + "/" + data.brand;
+          this.utilToKey(key, "venderId", data, "DPManufacturerID");
+        }
+        this.utilToKey(key, "specificationId", data, "DPSpecificationID");
+      }
+    },
+    supplyChange(data) {
+      let changeData = { id: data };
+      this.utilToKey("id", "id", changeData, "SupplierContractID");
+    },
+    //如果选择供应商之后
+    supplierChange(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPSupplierID");
+        }
+      }
+    },
+    //保险合同
+    guaranteeChange(data) {
+      for (let key in data) {
+        this.utilToKey(key, "insuranceNo", data, "InsuranceNum");
+        if (key == "contractFile") {
+          if (!!data[key]) {
+            data[key] = [data[key]];
+          }
+        }
+        this.utilToKey(key, "contractFile", data, "InsuranceFile");
+      }
+    },
+    //上传文件弹窗触发事件
+    fileChange(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+    },
+    //上传图片弹窗触发事件
+    imgChange(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+    },
+    //维修商变更
+    changeMaintainer(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPMaintainerID");
+        }
+      }
+    },
+    //保险商变更
+    changeInsurer(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPInsurerID");
+        }
+      }
+    },
+    //设备图片弹窗改变事件
+    changePics(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+    },
+    setGraphyId(graphyId, assetGroupList) {
+      this.graphyId = graphyId;
+      this.assetGroupList = assetGroupList;
     },
+    //触发父组件change
+    getClose(val) {
+      this.$emit("close", val);
+    },
+    reset() {},
     //表格点击事件
     handleTdClick(el, rowArr) {
       //点击的是表头
@@ -226,7 +447,8 @@ export default {
         this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
       } else if (isSort) {
         //排序后的数组
-        let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper.__arrayMap;
+        let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
+          .__arrayMap;
         let infos = this.tableData[sortArr[rowArr.row]];
         this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
       } else if (trimmedArr.length) {
@@ -239,7 +461,6 @@ export default {
     },
     //获取被筛选掉的行号
     trimmedRows() {
-      // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
       var plugin = this.tableExample.getPlugin("trimRows").trimmedRows;
       let dataLength = this.tableData.length;
       let dataArr = new Array();
@@ -252,24 +473,143 @@ export default {
         dataArr = this.array_diff(dataArr, plugin);
       }
       return dataArr || [];
-      // var DataArray = new Array();
-
-      // for (var i = 0; i < plugin.length; i++) {
-      //     // 通过行号获取数据
-      //     DataArray.push(this.tableExample.getSourceDataAtRow(plugin[i]));
-      // }
     },
-    //去除数组中相同的元素
-    array_diff(a, b) {
-      for (var i = 0; i < b.length; i++) {
-        for (var j = 0; j < a.length; j++) {
-          if (a[j] == b[i]) {
-            a.splice(j, 1);
-            j = j - 1;
+    getInfors(infos, row) {
+      //其他的开始判断
+      let val = this.tableExample.colToProp(row.col);
+      //设备二维码图片
+      if (val == "EquipQRCode") {
+        this.myDialog.qrcode = true;
+        this.$refs.qrcode.getCanvas(1111);
+      }
+      //关联系统
+      if (val == "linkSystem") {
+        // this.systemList = this.tableData[row.row].linkSystem || [];
+        this.myDialog.systemType = true;
+      }
+      //品牌型号弹窗
+      if (val == "DPManufacturerID") {
+        this.myDialog.firm = true;
+      }
+      //供应商信息弹窗
+      if (val == "DPSupplierID") {
+        this.myDialog.supplier = true;
+      }
+      //维修商信息弹窗
+      if (val == "DPMaintainerID") {
+        this.myDialog.maintainer = true;
+      }
+      //保险公司信息
+      if (val == "DPInsurerID") {
+        this.myDialog.insurer = true;
+      }
+      //供应合同编号
+      if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPSupplierID.split("-")[0];
           }
         }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.supply = true;
+        } else {
+          this.$message("请先选择供应商");
+        }
+      }
+      //保险单号
+      if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
+        //选择保单
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPInsurerID.split("-")[0];
+          }
+        }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.guarantee = true;
+        } else {
+          this.$message("请先选择保险商");
+        }
+      }
+      //保险文件--设备文档
+      if (
+        val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
+        val == "LedgerParam.PhotoDoc.Archive"
+      ) {
+        this.filesArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? [this.tableData[row.row].infos[val.split(".")[1]]]
+            : []
+          : [];
+        this.myDialog.uploadFiles = true;
+      }
+      //安装照片--安装图纸--设备铭牌照片--设备图纸
+      if (
+        val == "LedgerParam.Siteinstall.InstallPic" ||
+        val == "LedgerParam.Siteinstall.InstallDrawing" ||
+        val == "LedgerParam.PhotoDoc.Nameplate" ||
+        val == "LedgerParam.PhotoDoc.Drawing"
+      ) {
+        if (val == "LedgerParam.PhotoDoc.Nameplate") {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]].key]
+              : []
+            : [];
+        } else {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]]]
+              : []
+            : [];
+        }
+        this.myDialog.uploadImgs = true;
+      }
+      //设备照片
+      if (val == "LedgerParam.PhotoDoc.Pic") {
+        this.picsArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+            : []
+          : [];
+        this.myDialog.pic = true;
+      }
+      this.row = row.row;
+      this.messKey = val;
+    },
+    //修改设备类型
+    changeCader() {
+      this.EquipmentList.map(item => {
+        if (!!item.content && item.content.length) {
+          item.content.map(child => {
+            if (child.code == this.mess.deviceId) {
+              this.firmId = item.code;
+            }
+          });
+        }
+      });
+    },
+    utilToKey(key, name, data, messName) {
+      if (key == name) {
+        this.setDataToMain(data[key], messName, this.row);
+      }
+    },
+    //判断是否有值,有值赋值
+    setDataToMain(data, key, row) {
+      if (!!data && data != "--") {
+        if (!!this.tableData[row]) {
+          //铭牌照片特殊处理
+          this.tableData[row][key] = data;
+        } else {
+          this.tableData[row] = {};
+          this.tableData[row][key] = data;
+        }
+      } else {
+        this.tableData[row][key] = "";
       }
-      return a;
     }
   }
 };
@@ -286,7 +626,7 @@ export default {
   }
   .search-header {
     overflow: hidden;
-    padding:0 10px 10px 10px;
+    padding: 0 10px 10px 10px;
     border-bottom: 1px solid #bcbcbc;
   }
   .tableBox {
@@ -294,27 +634,10 @@ export default {
     height: calc(100% - 100px);
     margin-top: 10px;
     .tableLeft {
-      flex: 2;
-    }
-    .tableRight {
       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;
-      }
     }
   }
-  .create_button{
+  .create_button {
     margin-top: 10px;
   }
 }

+ 503 - 155
src/views/ledger/facility/partsmanage/index.vue

@@ -1,11 +1,13 @@
 <template>
   <div id="deviceList">
     <el-row>
-      <el-tabs @tab-click="handleClick" v-model="tabVal">
-        <el-tab-pane label="用户管理" name="first"></el-tab-pane>
-        <el-tab-pane label="配置管理" name="second"></el-tab-pane>
-        <el-tab-pane label="角色管理" name="third"></el-tab-pane>
-        <el-tab-pane label="定时任务补偿" name="fourth"></el-tab-pane>
+      <el-tabs @tab-click="tabsClick" v-model="tabVal">
+        <el-tab-pane
+          v-for="t in partsTypeList"
+          :key="t.Id"
+          :name="t.Code"
+          :label="t.Name+'('+t.Count+')'"
+        ></el-tab-pane>
       </el-tabs>
     </el-row>
     <el-row class="right">
@@ -37,29 +39,88 @@
       :page-sizes="page.pageSizes"
       :page-size="page.pageSize"
       layout="total, sizes, prev, pager, next, jumper"
-      :total="page.total">
-    </el-pagination>
+      :total="page.total"
+    ></el-pagination>
+    <!-- 二维码弹窗 -->
+    <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
+    <!-- 型号弹窗 -->
+    <firm :mess="{deviceId: firmId}" ref="firm" @changeFirm="firmChange" :dialog="myDialog"></firm>
+    <!-- 供应商合同弹窗 -->
+    <supply-dialog ref="supply" @change="supplyChange" :id="id" :dialog="myDialog"></supply-dialog>
+    <!-- 供应商弹窗 -->
+    <supplier-dialog ref="supplier" @changeSupplier="supplierChange" :dialog="myDialog"></supplier-dialog>
+    <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"></guarantee-dialog>
+    <upload-files-dialog
+      :read="onlyRead ? true : false"
+      ref="upload"
+      @changeFile="fileChange"
+      :keysArr="filesArr"
+      :dialog="myDialog"
+    ></upload-files-dialog>
+    <upload-img-dialog
+      :read="onlyRead ? true : false"
+      @changeFile="imgChange"
+      :keysArr="imgsArr"
+      :dialog="myDialog"
+    ></upload-img-dialog>
+    <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
+    <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
+    <pic-dialog
+      :read="onlyRead ? true : false"
+      :dialog="myDialog"
+      :keysArr="picsArr"
+      @change="changePics"
+    ></pic-dialog>
+    <system-type :infos="systemId" :graphyId="graphyId" :dialog="myDialog"></system-type>
+    <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
   </div>
 </template>
 <script>
-import tools from "@/utils/scan/tools"
-import handsonUtils from "@/utils/hasontableUtils"
-import showTools from "@/utils/handsontable/notShow"
-import text from "@/utils/handsontable/mainText"
+import tools from "@/utils/scan/tools";
+import handsonUtils from "@/utils/hasontableUtils";
+import showTools from "@/utils/handsontable/notShow";
+import text from "@/utils/handsontable/mainText";
 
-import cenoteType from "@/components/ledger/lib/cenoteType";
 import handsonTable from "@/components/common/handsontable";
-import { getCenoteTableHeader, getCenoteTableData, updataCenoteTableData, deleteCenoteTableData, saveCenoteRelateSpace } from "@/api/scan/request"
+import {
+  getPartsAllType,
+  getDataDictionary,
+  getEquipPartsCon,
+  updateParts,
+  deleteParts,
+  getEquipmentFamily
+} from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
+
+import qrcode from "@/components/ledger/lib/qrcode";
+import firm from "@/components/dialogs/list/firm";
+import supplyDialog from "@/components/dialogs/list/supplyDialog";
+import supplierDialog from "@/components/dialogs/list/supplierDialog";
+import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
+import insurerDialog from "@/components/dialogs/list/insurerDialog";
+import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
+import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
+import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
+import picDialog from "@/components/dialogs/list/picDialog";
+import systemType from "@/components/dialogs/list/systemType";
 export default {
   components: {
-    cenoteType,
+    qrcode, //二维码页面
+    firm, //品牌型号弹窗
+    supplyDialog,
+    supplierDialog,
+    maintainerDialog,
+    insurerDialog,
+    guaranteeDialog,
+    uploadFilesDialog,
+    uploadImgDialog,
+    picDialog,
+    systemType,
     handsonTable
   },
   data() {
     return {
-      cenoteId: "",//部件类型id
-      shaftId: "",//要操作的部件id
+      shaftId: "", //要操作的部件id
       isTableRightShow: false,
       spaceList: "",
       onlyRead: false,
@@ -72,157 +133,234 @@ export default {
         total: 0
       },
       tableData: [],
+      isWatch: true,
       copyTableData: [],
-      tableExample:null,
-      tabVal:'first'
+      tableExample: null,
+      tabVal: "",
+      activeTab: {}, //当前tab页index
+      partsTypeList: [], //tabs
+      myDialog: {
+        qrcode: false, //二维码弹窗
+        firm: false, //厂商弹窗
+        supply: false, //选择供应合同
+        supplier: false, //供应商选择
+        guarantee: false, //选择保单
+        maintainer: false, //选择维修商
+        insurer: false, //选择保险公司
+        uploadFiles: false, //上传文件
+        uploadImgs: false, //上传单个图片
+        pic: false, //多个图片
+        addDevice: false,
+        systemType: false,
+        details: false, //详情页
+        changeRea: false,
+        lookPic: false //图片查看
+      },
+      qrcodeUrl: "", //二维码图片地址
+      filesArr: [], //保存临时的文件key
+      imgsArr: [], //临时保存的图片key数组
+      picsArr: [], //临时设备图片keys数组
+      systemId: null,
+      graphyId: null,
+      mess: {},
+      id: 0,
+      readArr: [
+        "A1",
+        "A2",
+        "B1",
+        "C5",
+        "D1",
+        "D2",
+        "E1",
+        "F1",
+        "F2",
+        "L",
+        "L1",
+        "L2"
+      ],
+      EquipmentList: [],
+      firmId: "" //品牌型号所需字段
     };
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ])
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
-    this.getTableHeader()
+    this.deviceId = this.$route.params.deviceId; //设备id
+    this.typeId = this.$route.params.typeId; //设备类id
+    this.mess.deviceId = this.typeId;
+    this.getTypes();
+    this.getEquipmentFamilyList();
   },
   methods: {
+    getEquipmentFamilyList() {
+      getEquipmentFamily(res => {
+        this.EquipmentList = res.Content;
+        this.changeCader();
+      });
+    },
     //tab页点击事件
-    handleClick(){
-      console.log(this.tabVal)
+    tabsClick(tab) {
+      this.activeTab = this.partsTypeList[tab.index];
+      this.getTableHeader();
+    },
+    //获取当前设备类下的所有部件类
+    async getTypes() {
+      let params = {
+        category: this.typeId, //设备类型
+        id: this.deviceId //设备id
+      };
+      await getPartsAllType(params).then(res => {
+        this.partsTypeList = res.data.Content;
+        this.tabVal = this.partsTypeList[0].Code;
+        this.activeTab = this.partsTypeList[0];
+        this.getTableHeader();
+      });
     },
     // 获取表头数据(初始化表格)
     async getTableHeader() {
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
-        data: {
-          "CollectFlag": this.allMess
+      let params = {
+        PageNumber: 1,
+        PageSize: 500,
+        Filters: `type='Equipment' or type='${this.tabVal}'`
+      };
+      await getDataDictionary(params).then(res => {
+        let response = res.data;
+        if (response.Result == "success") {
+          this.tableHeader = response.Content;
+          this.getTableData();
+        } else {
+          this.$message.error("请求错误:" + response.Result);
         }
-      }
-      await getCenoteTableHeader(param, res => {
-        this.tableHeader = res.Content;
-        this.getTableData()
-      })
+      });
     },
-    async getTableData() {//获取表格数据
-      let data = {
-        Filters: this.cenoteId? `ProjectId='${this.projectId}';structureInfo.ShaftFuncType='${this.cenoteId}'`: `ProjectId='${this.projectId}'`,
+    //获取表格数据
+    async getTableData() {
+      let params = {
         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.copyTableData = tools.deepCopy(res.Content)
-        this.page.pageNumber = res.PageNumber
-        this.page.total = res.Total
-        if(this.tableData && this.tableData.length){
-          this.initTable()
+        PageSize: this.page.pageSize,
+        Filters: `category='${this.tabVal}';parentId='${this.deviceId}'`
+      };
+      await getEquipPartsCon(params).then(res => {
+        let response = res.data;
+        this.tableData = response.Content;
+        this.copyTableData = tools.deepCopy(response.Content);
+        this.page.pageNumber = response.PageNumber;
+        this.page.total = response.Total;
+        if (this.tableData && this.tableData.length) {
+          this.initTable();
         }
-      })
+      });
     },
     // 修改表格内容
     async updateTableData(data, change) {
       let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
+        projectId: this.projectId,
         data: {
           Content: [],
           Projection: []
         }
       };
       //生成要修改字段列表
-      change.map((item) => {
-        if(item[1] && param.data.Projection.indexOf(item[1]) == -1) {
-          param.data.Projection.push(item[1])
+      change.map(item => {
+        if (item[1] && param.data.Projection.indexOf(item[1]) == -1) {
+          param.data.Projection.push(item[1]);
         }
-      })
+      });
       //生成对应修改数据
       data.map((item, index) => {
-        let keyarr = change[index][1].split(".")
+        let keyarr = change[index][1].split(".");
         if (keyarr && keyarr.length > 1) {
-          item[keyarr[0]][keyarr[1]] = item[keyarr[0]][keyarr[1]] != ""? item[keyarr[0]][keyarr[1]]: null
+          item[keyarr[0]][keyarr[1]] =
+            item[keyarr[0]][keyarr[1]] != ""
+              ? item[keyarr[0]][keyarr[1]]
+              : null;
         } else {
-          item[keyarr[0]] = item[keyarr[0]] != ""? item[keyarr[0]]: null
+          item[keyarr[0]] = item[keyarr[0]] != "" ? item[keyarr[0]] : null;
         }
         param.data.Content.push(item);
       });
-
-      await updataCenoteTableData(param, (res) => {
-        
-      })
+      await updateParts(param).then(res => {});
     },
     // 删除表格数据
     async deleteTableData(params) {
-      await deleteCenoteTableData(params, (res) => {
-        this.$message.success("删除成功!")
-        this.getTableHeader()
-      })
+      await deleteParts(params).then(res => {
+        this.$message.success("删除成功!");
+        this.getTypes();
+      });
     },
     //保存元空间关联
     async saveSpaceList() {
       let data = {
         ShaftId: this.shaftId,
         SpaceId: this.spaceList
-      }
+      };
       const params = {
         ProjId: this.projectId,
         secret: this.secret,
         data: data
-      }
-      await saveCenoteRelateSpace(params, (res) => {
-        this.$message.success("关联成功!")
-        this.getTableHeader()
-      })
+      };
+      await saveCenoteRelateSpace(params, res => {
+        this.$message.success("关联成功!");
+        this.getTableHeader();
+      });
     },
     // 添加部件
     handleCreateTableData() {
-      this.$router.push({ name: 'addparts'})
+      this.activeTab.deviceId = this.deviceId;
+      this.$router.push({
+        name: "addparts",
+        params: this.activeTab
+      });
     },
     // 删除表格行
     handleDeleteTableRow() {
-      let params = tools.differenceArr(this.tableData, this.copyTableData)
+      let params = tools.differenceArr(this.tableData, this.copyTableData);
       if (params.length < 1 || this.tableData > this.copyTableData) {
-        return
+        return;
       }
       let param = {
-        ProjId: this.projectId,
-        secret: this.secret,
+        projectId: this.projectId,
         data: []
-      }
+      };
       params.map(item => {
-        param.data.push(item.ShaftID)
-      })
+        param.data.push(item.EquipID);
+      });
       this.$confirm("此操作将删除部件,是否继续?", "提示", {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        this.deleteTableData(param)
-      }).catch(() => {
-        this.getTableHeader()
-        this.$message("取消删除")
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
       })
+        .then(() => {
+          this.deleteTableData(param);
+        })
+        .catch(() => {
+          this.getTableHeader();
+          this.$message("取消删除");
+        });
     },
     //修改
     handleUpdataTable(changeData, source) {
       if (!this.onlyRead) {
         if (changeData) {
           let trimmedArr = this.trimmedRows();
-          let param = handsonUtils.getParam(changeData, source, this.tableExample, trimmedArr);
+          let param = handsonUtils.getParam(
+            changeData,
+            source,
+            this.tableExample,
+            trimmedArr
+          );
           let data = [];
           for (let i = 0; i < param.length; i++) {
             data.push(param[i]);
           }
           //如果data中包含/且data长度为1,将其转换成.
-          if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
-            changeData[0][1] = changeData[0][1].split("/").join(".")
+          if (
+            changeData.length == 1 &&
+            changeData[0][1] &&
+            changeData[0][1].indexOf("/") > 0
+          ) {
+            changeData[0][1] = changeData[0][1].split("/").join(".");
           }
 
           // 存在data进行修改请求
@@ -236,54 +374,63 @@ export default {
     undo() {
       this.tableExample.undo();
     },
-    //切换部件类型
-    changeFloor(value) {
-      this.cenoteId = value.Id
-      this.getTableHeader()
-    },
-    //关闭右侧关联元空间输入按钮
-    handleCloseRight() {
-      this.isTableRightShow = false
-      this.spaceList = ""
-    },
     //切换每页显示多少条数据
     handleSizeChange(val) {
-      this.page.pageSize = val
-      this.getTableHeader()
+      this.page.pageSize = val;
+      this.getTableHeader();
     },
     //切换页数
     handleCurrentChange(val) {
-      this.page.pageNumber = val
-      this.getTableHeader()
+      this.page.pageNumber = val;
+      this.getTableHeader();
     },
-    formatHeaderData(list) {//格式化表头显示的数据
-      let arr = tools.copyArr(list)
-      arr.map((item) => {
-        item.Visible = true
-      })
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "F1", "F2", "L", "L1", "L2", "X"]
+    formatHeaderData(list) {
+      //格式化表头显示的数据
+      let arr = tools.copyArr(list);
+      arr.map(item => {
+        item.Visible = true;
+      });
       if (!this.onlyRead) {
-        readArr.push("Own")
+        this.readArr.push("Own");
       }
-      let data = showTools.changeHeader(arr, readArr, this.onlyRead, false, this.allMess)
-      data.unshift("关联的元空间");
+      let data = showTools.tableHeadFilter(
+        arr,
+        this.readArr,
+        this.onlyRead,
+        this.isWatch,
+        false
+      );
+      data.unshift("查看详情", "当前关联的资产");
       return data;
     },
-    formatHeaderType(list) {//格式化表头头映射的数据
+    formatHeaderType(list) {
+      //格式化表头头映射的数据
       let arr = tools.copyArr(list);
-      arr.map((item) => { //缺少信息点
-        item.Visible = true
-      })
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "E1", "F1", "F2", "L", "L1", "L2", "X"]
-      let data = showTools.showHeaderTypes(arr, readArr, this.onlyRead, false, this.allMess)
-      data.unshift({
-        data: "SpaceCount",
-        renderer: tools.num,
-        readOnly: true
-      })
+      arr.map(item => {
+        item.Visible = true;
+      });
+      let data = showTools.tableHeaderTypes(
+        arr,
+        this.readArr,
+        this.onlyRead,
+        this.isWatch,
+        false
+      );
+      data.unshift(
+        {
+          data: "caozuo",
+          renderer: tools.lookDetails,
+          readOnly: true
+        },
+        {
+          data: "PropertyName",
+          readOnly: true
+        }
+      );
       return data;
     },
-    initTable() {//实例化表格
+    initTable() {
+      //实例化表格
       let settings = {
         data: this.tableData,
         colHeaders: this.formatHeaderData(this.tableHeader),
@@ -303,21 +450,95 @@ export default {
         afterOnCellMouseDown: this.handleTdClick //鼠标点击
       };
       this.$nextTick(() => {
-        console.log(this.$refs.table);
         this.tableExample = this.$refs.table.init(settings);
       });
     },
-    //获取到了正确的信息
-    getInfors(infos, row) {
-      //其他的开始判断
-      let val = this.tableExample.colToProp(row.col)
-      this.shaftId = infos.ShaftID //要操作的数据id
-      //点击关联的元空间
-      if (val === "SpaceCount") {
-        this.spaceList = infos.SpaceList
-        this.isTableRightShow = true
+    //去除数组中相同的元素
+    array_diff(a, b) {
+      for (var i = 0; i < b.length; i++) {
+        for (var j = 0; j < a.length; j++) {
+          if (a[j] == b[i]) {
+            a.splice(j, 1);
+            j = j - 1;
+          }
+        }
       }
+      return a;
+    },
+    //选择型号修改
+    firmChange(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name + "/" + data.brand;
+          this.utilToKey(key, "venderId", data, "DPManufacturerID");
+        }
+        this.utilToKey(key, "specificationId", data, "DPSpecificationID");
+      }
+    },
+    supplyChange(data) {
+      let changeData = { id: data };
+      this.utilToKey("id", "id", changeData, "SupplierContractID");
+    },
+    //如果选择供应商之后
+    supplierChange(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPSupplierID");
+        }
+      }
+    },
+    //保险合同
+    guaranteeChange(data) {
+      for (let key in data) {
+        this.utilToKey(key, "insuranceNo", data, "InsuranceNum");
+        if (key == "contractFile") {
+          if (!!data[key]) {
+            data[key] = [data[key]];
+          }
+        }
+        this.utilToKey(key, "contractFile", data, "InsuranceFile");
+      }
+    },
+    //上传文件弹窗触发事件
+    fileChange(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+    },
+    //上传图片弹窗触发事件
+    imgChange(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
     },
+    //维修商变更
+    changeMaintainer(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPMaintainerID");
+        }
+      }
+    },
+    //保险商变更
+    changeInsurer(data) {
+      for (let key in data) {
+        if (key == "venderId") {
+          data[key] = data[key] + "-" + data.name;
+          this.utilToKey(key, "venderId", data, "DPInsurerID");
+        }
+      }
+    },
+    //设备图片弹窗改变事件
+    changePics(keys) {
+      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+    },
+    setGraphyId(graphyId, assetGroupList) {
+      this.graphyId = graphyId;
+      this.assetGroupList = assetGroupList;
+    },
+    //触发父组件change
+    getClose(val) {
+      this.$emit("close", val);
+    },
+    reset() {},
     //表格点击事件
     handleTdClick(el, rowArr) {
       //点击的是表头
@@ -335,7 +556,8 @@ export default {
         this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
       } else if (isSort) {
         //排序后的数组
-        let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper.__arrayMap;
+        let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
+          .__arrayMap;
         let infos = this.tableData[sortArr[rowArr.row]];
         this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
       } else if (trimmedArr.length) {
@@ -348,7 +570,6 @@ export default {
     },
     //获取被筛选掉的行号
     trimmedRows() {
-      // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
       var plugin = this.tableExample.getPlugin("trimRows").trimmedRows;
       let dataLength = this.tableData.length;
       let dataArr = new Array();
@@ -362,17 +583,142 @@ export default {
       }
       return dataArr || [];
     },
-    //去除数组中相同的元素
-    array_diff(a, b) {
-      for (var i = 0; i < b.length; i++) {
-        for (var j = 0; j < a.length; j++) {
-          if (a[j] == b[i]) {
-            a.splice(j, 1);
-            j = j - 1;
+    getInfors(infos, row) {
+      //其他的开始判断
+      let val = this.tableExample.colToProp(row.col);
+      //设备二维码图片
+      if (val == "EquipQRCode") {
+        this.myDialog.qrcode = true;
+        this.$refs.qrcode.getCanvas(1111);
+      }
+      //关联系统
+      if (val == "linkSystem") {
+        // this.systemList = this.tableData[row.row].linkSystem || [];
+        this.myDialog.systemType = true;
+      }
+      //品牌型号弹窗
+      if (val == "DPManufacturerID") {
+        this.myDialog.firm = true;
+      }
+      //供应商信息弹窗
+      if (val == "DPSupplierID") {
+        this.myDialog.supplier = true;
+      }
+      //维修商信息弹窗
+      if (val == "DPMaintainerID") {
+        this.myDialog.maintainer = true;
+      }
+      //保险公司信息
+      if (val == "DPInsurerID") {
+        this.myDialog.insurer = true;
+      }
+      //供应合同编号
+      if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPSupplierID.split("-")[0];
           }
         }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.supply = true;
+        } else {
+          this.$message("请先选择供应商");
+        }
+      }
+      //保险单号
+      if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
+        //选择保单
+        let falg = null;
+        if (!!this.tableData[row.row].infos) {
+          if (!!this.tableData[row.row].infos) {
+            falg = this.tableData[row.row].infos.DPInsurerID.split("-")[0];
+          }
+        }
+        if (!!falg) {
+          this.id = falg;
+          this.myDialog.guarantee = true;
+        } else {
+          this.$message("请先选择保险商");
+        }
+      }
+      //保险文件--设备文档
+      if (
+        val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
+        val == "LedgerParam.PhotoDoc.Archive"
+      ) {
+        this.filesArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? [this.tableData[row.row].infos[val.split(".")[1]]]
+            : []
+          : [];
+        this.myDialog.uploadFiles = true;
+      }
+      //安装照片--安装图纸--设备铭牌照片--设备图纸
+      if (
+        val == "LedgerParam.Siteinstall.InstallPic" ||
+        val == "LedgerParam.Siteinstall.InstallDrawing" ||
+        val == "LedgerParam.PhotoDoc.Nameplate" ||
+        val == "LedgerParam.PhotoDoc.Drawing"
+      ) {
+        if (val == "LedgerParam.PhotoDoc.Nameplate") {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]].key]
+              : []
+            : [];
+        } else {
+          this.imgsArr = this.tableData[row.row].infos
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+              ? [this.tableData[row.row].infos[val.split(".")[1]]]
+              : []
+            : [];
+        }
+        this.myDialog.uploadImgs = true;
+      }
+      //设备照片
+      if (val == "LedgerParam.PhotoDoc.Pic") {
+        this.picsArr = this.tableData[row.row].infos
+          ? this.tableData[row.row].infos[val.split(".")[1]]
+            ? this.tableData[row.row].infos[val.split(".")[1]]
+            : []
+          : [];
+        this.myDialog.pic = true;
+      }
+      this.row = row.row;
+      this.messKey = val;
+    },
+    //修改设备类型
+    changeCader() {
+      this.EquipmentList.map(item => {
+        if (!!item.content && item.content.length) {
+          item.content.map(child => {
+            if (child.code == this.mess.deviceId) {
+              this.firmId = item.code;
+            }
+          });
+        }
+      });
+    },
+    utilToKey(key, name, data, messName) {
+      if (key == name) {
+        this.setDataToMain(data[key], messName, this.row);
+      }
+    },
+    //判断是否有值,有值赋值
+    setDataToMain(data, key, row) {
+      if (!!data && data != "--") {
+        if (!!this.tableData[row]) {
+          this.tableData[row][key] = data;
+          this.handleUpdataTable([[row, key, null, data]], "edit");
+        } else {
+          this.tableData[row] = {};
+          this.tableData[row][key] = data;
+        }
+      } else {
+        this.tableData[row][key] = "";
       }
-      return a;
     }
   }
 };
@@ -389,19 +735,21 @@ export default {
   }
   .search-header {
     overflow: hidden;
-    padding:0 10px 10px 10px;
+    padding: 0 10px 10px 10px;
     border-bottom: 1px solid #bcbcbc;
   }
   .tableBox {
     display: flex;
     height: calc(100% - 150px);
     margin-top: 10px;
-    .tableLeft {
+    .tableLeft,
+    .middle_sty {
       flex: 1;
     }
   }
 }
-.el-pagination button, .el-pagination span:not([class*=suffix]) {
-    vertical-align: middle;
+.el-pagination button,
+.el-pagination span:not([class*="suffix"]) {
+  vertical-align: middle;
 }
 </style>