Bläddra i källkod

处理系统图信息点为图片类型

zhangyu 3 år sedan
förälder
incheckning
8b50a89122

+ 23 - 44
src/components/ledger/handsontables/system.vue

@@ -16,9 +16,9 @@
       <el-button v-show="!onlyRead" size="small" style="width: 80px" @click="undo" icon="iconfont icon-undo">撤销</el-button>
     </div>
     <qrcode :dialog="myDialog" :addBody="true" ref="qrcode"></qrcode>
-    <upload-files-dialog ref="upload" @changeFile="fileChange" :keysArr="filesArr"
+    <upload-files-dialog ref="upload" @changeFile="fileChange" :keysArr="filesArr" firmDataType="row"
                          :dialog="myDialog"></upload-files-dialog>
-    <upload-img-dialog @changeFile="imgChange" :keysArr="imgsArr" :dialog="myDialog"></upload-img-dialog>
+    <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr" firmDataType="row" :dialog="myDialog"></upload-img-dialog>
     <pic-dialog :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
     <div class="center middle_sty" style="height: 91%" v-show="!mess.deviceId && (!tableData || !tableData.length)">
       <p><i class="icon-wushuju iconfont"></i>请选择系统类型</p>
@@ -72,8 +72,8 @@ import tools from "@/utils/scan/tools";
 import handsonUtils from "@/utils/scan/hasontableUtils"
 import showTools from "@/utils/handsontable/notShow"
 import qrcode from "@/components/business_space/lib/qrcode"
-import uploadFilesDialog from "@/components/business_space/dialogs/list/filesDialog"
-import uploadImgDialog from "@/components/business_space/dialogs/list/uploadImgDialog"
+import uploadFilesDialog from "@/components/dialogs/list/filesDialog"
+import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog"
 import picDialog from "@/components/business_space/dialogs/list/picDialog"
 import myPagination from "@/components/common/myPagination"
 import detailsDialog from "@/components/business_space/lib/detailsDia"
@@ -548,7 +548,7 @@ export default {
       //其他的开始判断
       let val = this.hot.colToProp(row.col);
       let inputData = this.inputMap[val];
-      this.systemId = infos.SysID
+      this.systemId = infos.SysID;
       this.row = row.row
       this.messKey = val
       switch (val) {
@@ -583,6 +583,14 @@ export default {
             this.$refs.editFloor.showDialog(this.tableData[row.row]);
           }
           return false
+				//系统图(F2)
+        case "infos.systemChart":
+          let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
+          this.imgsArr = SSPPdata ? SSPPdata : [];
+          if (!this.onlyRead || this.imgsArr.length) {
+            this.myDialog.uploadImgs = true;
+          }
+          return false;
         default:
           break;
       }
@@ -647,57 +655,28 @@ export default {
     },
     //上传文件弹窗触发事件
     fileChange(keys) {
-      this.setDataToMain(keys[0], this.messKey.split(".")[1], this.row)
-      //   tools.setItem(this.deviceType.code, this.tableData)
+			this.setDataToMain(keys, this.messKey, this.row);
     },
     //上传图片弹窗触发事件
     imgChange(keys) {
-      this.setDataToMain(keys[0], this.messKey.split(".")[1], this.row)
-      //   tools.setItem(this.deviceType.code, this.tableData)
+			this.setDataToMain(keys, this.messKey, this.row);
     },
     //设备图片弹窗改变事件
     changePics(keys) {
-      this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
-      //   tools.setItem(this.deviceType.code, this.tableData)
+			this.setDataToMain(keys, this.messKey, this.row);
     },
     //判断是否有值,有值赋值
     setDataToMain(data, key, row) {
-      if (!!data && data != '--') {
-        if (!!this.tableData[row].infos) {
-          //falg确定每个的是否有值
-          let falg = false
-          if (!this.tableData[row].infos[key]) {
-            falg = true
-          }
-          //铭牌照片特殊处理
-          if (key == 'Nameplate') {
-            this.tableData[row].infos[key] = {
-              "systemId": "dataPlatform",
-              "name": "铭牌照片",
-              "type": "image",
-              "key": data
-            }
-          } else {
-            this.tableData[row].infos[key] = data
-          }
-          if (falg) {
-            this.updateBusiness([this.tableData[row]], [[0, "infos." + key, null, data]])
-          }
+			if (!!data && data != "--") {
+        if (!!this.tableData[row]) {
+          tools.setDataForKey(this.tableData[row], key, data);
+          this.handleUpdataTable([[row, key, null, data]], "edit");
         } else {
-          this.tableData[row].infos = {}
-          if (key == 'Nameplate') {
-            this.tableData[row].infos[key] = {
-              "systemId": "dataPlatform",
-              "name": "铭牌照片",
-              "type": "image",
-              "key": data
-            }
-          } else {
-            this.tableData[row].infos[key] = data
-          }
+          this.tableData[row] = {};
+          tools.setDataForKey(this.tableData[row], key, data);
         }
       } else {
-        this.tableData[row].infos[key] = ''
+        tools.setDataForKey(this.tableData[row], key, "");
       }
     }
   },

+ 2 - 0
src/utils/handsontable/notShow.js

@@ -352,6 +352,7 @@ const showTools = {
     if (
       item.code == "installPic" ||
       item.code == "nameplate" ||
+      item.code == "systemChart" ||
       item.code == "pic"
     ) {
       return {
@@ -458,6 +459,7 @@ const showTools = {
     if (
       item.code == "installPic" ||
       item.code == "nameplate" ||
+      item.code == "systemChart" ||
       item.code == "pic"
     ) {
       return {

+ 29 - 2
src/views/ledger/system/addsystem.vue

@@ -24,7 +24,8 @@
     <el-row class="center">
       <el-button type="primary" size="medium" @click="handleCreateTableData" class="create_button" :disabled="createDisable">创建系统</el-button>
     </el-row>
-
+		<!-- 上传图片组件 -->
+		<upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr" firmDataType="row" :dialog="myDialog"></upload-img-dialog>
     <!-- 关联楼层 -->
     <editSysfloor ref="editFloor" @relateSuccess="relateSuccess" :isCreate="true"></editSysfloor>
   </div>
@@ -37,6 +38,7 @@ import text from "@/utils/handsontable/mainText";
 import session from "@/framework/utils/storage";
 
 import editSysfloor from "@/components/ledger/lib/editSysFloor";
+import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog"
 import handsonTable from "@/components/common/handsontable";
 import { getDataDictionary } from "@/api/dict";
 import {
@@ -51,7 +53,8 @@ import qrcode from "@/components/ledger/lib/qrcode";
 export default {
   components: {
     handsonTable,
-    editSysfloor
+    editSysfloor,
+		uploadImgDialog
   },
   data() {
     return {
@@ -365,6 +368,12 @@ export default {
             this.$refs.editFloor.showDialog(this.tableData[row.row]);
           }
           break;
+				//系统图(F2)
+        case "infos.systemChart":
+          let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
+          this.imgsArr = SSPPdata ? SSPPdata : [];
+          this.myDialog.uploadImgs = true;
+          return false;
         default:
           break;
       }
@@ -379,10 +388,28 @@ export default {
         });
       }
     },
+		//上传图片弹窗触发事件
+    imgChange(keys) {
+			this.setDataToMain(keys, this.messKey, this.row);
+    },
     //建筑楼层
     relateSuccess(data) {
       this.tableData[this.row].buildingFloorInfoList = data
       this.tableExample.render()
+    },
+		//判断是否有值,有值赋值
+    setDataToMain(data, key, row) {
+			if (!!data && data != "--") {
+        if (!!this.tableData[row]) {
+          tools.setDataForKey(this.tableData[row], key, data);
+          this.handleUpdataTable([[row, key, null, data]], "edit");
+        } else {
+          this.tableData[row] = {};
+          tools.setDataForKey(this.tableData[row], key, data);
+        }
+      } else {
+        tools.setDataForKey(this.tableData[row], key, "");
+      }
     }
   }
 };