Ver código fonte

设备清单接口替换

zhangyu 5 anos atrás
pai
commit
ecdd6de60d

+ 39 - 39
src/components/ledger/handsontables/assets.vue

@@ -2,9 +2,9 @@
   <div style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;">
     <div class="hanson-bar">
       <div style="float:right;overflow:hidden;">
-        <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
+        <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
           <i v-if="!onlyRead" class="el-icon-fa  el-icon-fa-eye"></i>
-        </span>
+        </span> -->
         <span>当前筛选条件下共{{page.total || '--'}}设备</span>
       </div>
       <el-select v-model="onlyRead" @change="getHeaderData(mess)" style="width:100px;margin-right:20px;vertical-align:bottom;">
@@ -115,7 +115,7 @@ export default {
     showTypes() {
       return this.onlyRead ?
         [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }] :
-        [{ value: "Visible", label: '只看采集信息' }, { value: "partInfo", label: '隐藏信息点' }, { value: "all", label: '全部' }]
+        [{ value: "partInfo", label: '隐藏信息点' }, { value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }]
     }
   },
   data() {
@@ -171,8 +171,7 @@ export default {
       deviceType: {}, //族3位编码及名称
       floorData: [],
       curDevice: '',//当前点击的资产id
-      addData: {}, //添加资产选择的资产类型
-      showFlowBuild: false //是否显示建筑楼层
+      addData: {} //添加资产选择的资产类型
     };
   },
   methods: {
@@ -299,25 +298,25 @@ export default {
       }
     },
     //显示楼层信息
-    changeAssetsFalg() {
-      if (this.showFlowBuild) {
-        this.showFlowBuild = false
-        this.getTableData()
-      } else {
-        this.$confirm('<p>维护资产所在建筑楼层后,对后续数据影响较大,如业务空间中的所在关系or其他?暂未梳理明白……</p><p>后续要修改设备所属建筑楼层,只能通过模型中的待建模清单操作</p>', '提示', {
-          dangerouslyUseHTMLString: true,
-          confirmButtonText: '就要维护资产所属建筑楼层',
-          cancelButtonText: '暂时不搞了',
-          confirmButtonClass: 'confirmButtonClass',
-          cancelButtonClass: 'cancelButtonClass'
-        }).then(_ => {
-          this.showFlowBuild = true
-          this.initTable()
-        }).catch(_ => {
-          this.$message("取消")
-        })
-      }
-    },
+    // changeAssetsFalg() {
+    //   if (this.showFlowBuild) {
+    //     this.showFlowBuild = false
+    //     this.getTableData()
+    //   } else {
+    //     this.$confirm('<p>维护资产所在建筑楼层后,对后续数据影响较大,如业务空间中的所在关系or其他?暂未梳理明白……</p><p>后续要修改设备所属建筑楼层,只能通过模型中的待建模清单操作</p>', '提示', {
+    //       dangerouslyUseHTMLString: true,
+    //       confirmButtonText: '就要维护资产所属建筑楼层',
+    //       cancelButtonText: '暂时不搞了',
+    //       confirmButtonClass: 'confirmButtonClass',
+    //       cancelButtonClass: 'cancelButtonClass'
+    //     }).then(_ => {
+    //       this.showFlowBuild = true
+    //       this.initTable()
+    //     }).catch(_ => {
+    //       this.$message("取消")
+    //     })
+    //   }
+    // },
     //撤回
     undo() {
       this.hot.undo();
@@ -337,16 +336,16 @@ export default {
     },
     //下一步
     toAddDevice() {
-      if (this.addData.deviceId) {
+      if (this.addData.Family) {
         this.$router.push({
-          path: "/ledger/addproperty",
+          path: "/ledger/propertyadd",
           query: this.addData
         });
       }
     },
     //选择设备类型-添加资产
     changeCader(val) {
-      this.addData.deviceId = val.code;
+      this.addData.Family = val.code;
       this.addData.name = val.facility;
     },
     //下载
@@ -367,8 +366,8 @@ export default {
       let arr = tools.copyArr(list)
       let data = showTools.headerTextFilter(arr, 'property', this.onlyRead, this.showType, true)
       data.unshift("操作", "当前关联的设备")
-      if (this.showFlowBuild) {
-        data.splice(2, 0, "所属建筑楼层")
+      if (this.showType == "all") {
+        data.splice(4, 0, "所属建筑楼层")
       }
       return data
     },
@@ -385,14 +384,15 @@ export default {
           readOnly: true
         }
       )
-      if (this.showFlowBuild) {
-        data.splice(2, 0, {
+      if (this.showType == "all") {
+        data.splice(4, 0, {
           data: "flowBuild",
           renderer: tools.customDropdownRenderer,
           editor: "chosen",
           chosenOptions: {
             data: buildFloorData.data
-          }
+          },
+          readOnly: this.onlyRead
         })
       }
       return data
@@ -403,7 +403,7 @@ export default {
       let winHeight = document.documentElement.clientHeight;
       this.hot = new Handsontable(container, {
         data: this.tableData,
-        fixedColumnsLeft: this.showFlowBuild?5:4,
+        fixedColumnsLeft: 4,
         colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
         columns: this.formatHeaderType(this.tableHeader), //数据显示格式
         filters: true,
@@ -829,12 +829,12 @@ export default {
     },
   },
   watch: {      
-      projectId(){
-          this.main = []
-          this.mess.deviceId = null
-          this.page.total = 0
-      },
-      showTypes: {
+    projectId(){
+        this.main = []
+        this.mess.deviceId = null
+        this.page.total = 0
+    },
+    showTypes: {
       handler(newName, oldName) {
         if (newName && newName[0] && newName[0].value) {
           this.showType = newName[0].value

+ 1 - 1
src/components/ledger/handsontables/device.vue

@@ -365,7 +365,7 @@ export default {
     toAddDevice() {
       if (this.addData.deviceId) {
         this.$router.push({
-          path: "/ledger/addevice",
+          path: "/ledger/deviceadd",
           query: this.addData
         });
       }

+ 8 - 8
src/router/system.js

@@ -39,8 +39,8 @@ import facilityLedger from '@/views/ledger/facility/index'
 import partsLedger from '@/views/ledger/facility/parts/index'
 import partsmanageLedger from '@/views/ledger/facility/partsmanage/index'
 import addparts from '@/views/ledger/facility/partsmanage/addparts/index'
-import addevice from '@/views/ledger/facility/addfacility'
-import addproperty from '@/views/ledger/property/addproperty'
+import deviceadd from '@/views/ledger/facility/addfacility'
+import propertyadd from '@/views/ledger/property/addproperty'
 import propertyLedger from '@/views/ledger/property/index'
 import dialogSystem from '@/views/ledger/property/addproperty'
 import cenotelist from '@/views/ledger/cenotelist/index' //竖井清单
@@ -179,9 +179,9 @@ export default [
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '设备清单', path: '/ledger/facility' }, { label: '添加部件' }] },
             },
             {
-                path: 'addevice',
-                name: 'addevice',
-                component: addevice,
+                path: 'deviceadd',
+                name: 'deviceadd',
+                component: deviceadd,
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '设备清单', path: '/ledger/facility' }, { label: '添加设备' }] }
             },
             {
@@ -191,9 +191,9 @@ export default [
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '资产清单' }] }
             },
             {
-                path: 'addproperty',
-                name: 'addproperty',
-                component: addproperty,
+                path: 'propertyadd',
+                name: 'propertyadd',
+                component: propertyadd,
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '资产清单', path: '/ledger/property' }, { label: '添加资产' }] }
             },
             {

+ 3 - 1
src/utils/authutils.js

@@ -56,7 +56,9 @@ export default {
                 }
                 if(
                     (from.path == "/rent/rentadd" && session.get("rentAddData") && session.get("rentAddData").length) ||
-                    (from.path == "/ledger/cenoteadd" && session.get("cenoteAddData") && session.get("cenoteAddData").length)
+                    (from.path == "/ledger/cenoteadd" && session.get("cenoteAddData") && session.get("cenoteAddData").length) ||
+                    (from.path == "/ledger/deviceadd" && session.get("deviceAddData") && session.get("deviceAddData").length) ||
+                    (from.path == "/ledger/propertyadd" && session.get("propertyAddData") && session.get("propertyAddData").length)
                 ) { //判断新增信息是否保存
                     MessageBox.confirm("新增信息未保存,离开将丢失新增信息,是否继续?", "提示", {
                         confirmButtonText: '确定',

+ 50 - 200
src/views/ledger/property/addproperty.vue

@@ -25,22 +25,18 @@
     <el-row class="center">
       <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>
+    <firm :mess="{deviceId: category.Family}" 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-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" :type="'edit'" @change="changeSystemType"></system-type>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
   </div>
 </template>
@@ -53,10 +49,9 @@ import session from "@/framework/utils/storage"
 import buildFloorData from '@/utils/handsontable/buildFloorData'
 
 import handsonTable from "@/components/common/handsontable"
-import { getDataDictionary, createEquip, createPropertyData, getEquipBelongs, getSpaceFloor } from "@/api/scan/request"
+import { getDataDictionary, 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"
@@ -66,10 +61,8 @@ 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,
@@ -79,7 +72,6 @@ export default {
     uploadFilesDialog,
     uploadImgDialog,
     picDialog,
-    systemType,
     handsonTable
   },
   data() {
@@ -87,15 +79,14 @@ export default {
       addNum: 1,
       onlyRead: false,
       tableHeader: [],
-      tableData: session.get("deviceAddData")
-        ? session.get("deviceAddData").length
-          ? session.get("deviceAddData")
-          : [{ Checked: 1 }]
-        : [{ Checked: 1 }],
+      tableData: session.get("propertyAddData")
+        ? session.get("propertyAddData").length
+          ? session.get("propertyAddData")
+          : [{}]
+        : [{}],
       copyTableData: [],
       category: "", //当前设备类
       myDialog: {
-        qrcode: false, //二维码弹窗
         firm: false, //厂商弹窗
         supply: false, //选择供应合同
         supplier: false, //供应商选择
@@ -108,7 +99,6 @@ export default {
         addDevice: false,
         systemType: false,
         details: false, //详情页
-        changeRea: false,
         lookPic: false //图片查看
       },
       qrcodeUrl: "", //二维码图片地址
@@ -119,93 +109,17 @@ export default {
       graphyId: null,
       id: 0,
       showTypeFlag: true,
-      EquipmentList: [],
-      firmId: "" //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
+      EquipmentList: []
     };
   },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
-    this.category = this.$route.query;
-    this.getBelongs();
-    this.getFloorData();
+		this.category = this.$route.query;
     this.getTableHeader();
   },
   methods: {
-    //查询设备类对应的 族
-    getBelongs() {
-      let params = {
-        data: {
-          Filters: `EquipCode='${this.category.deviceId}'`,
-          PageNumber: 1,
-          PageSize: 50
-        }
-      }
-      getEquipBelongs(params, res => {
-        this.firmId = res.Content[0].Family;
-      })
-    },
-    //获取楼层数据
-    getFloorData() {
-      let param = {
-        ProjId: this.projectId,
-        secret: this.secret
-      }
-      getSpaceFloor(param).then(res => {
-        if (res.data.Result == 'success') {
-          let data = this.changeArr(res.data.Content), floorData = []
-          data.map(item => {
-            if (!!item.children) {
-              item.children.unshift({
-                value: '',
-                label: "未明确楼层"
-              })
-            }
-            return item
-          })
-          data.map(item => {
-            if (!!item.children && item.children.length) {
-              item.children.map(child => {
-                floorData.push({
-                  Code: item.value + "-" + child.value,
-                  Name: item.label + "-" + child.label
-                })
-              })
-            }
-          })
-          this.floorData = floorData
-        } else {
-          this.$message.error(res.data.ResultMsg)
-        }
-      }).catch(() => {
-        this.$message.error("请求出错")
-      })
-    },
-    //将数组转换成optiosn格式
-    changeArr(arr) {
-      return arr.map(item => {
-        if (item.floors && item.floors.length) {
-          return {
-            value: item.id,
-            label: item.infos.BuildLocalName,
-            children: item.floors.map(i => {
-              return {
-                value: i.id,
-                label: i.infos.FloorLocalName || "未知",
-              }
-            })
-          }
-        } else {
-          return {
-            value: item.id,
-            label: item.infos.BuildLocalName,
-            children: null,
-            isChilren: 1,
-          }
-        }
-      })
-    },
     // 获取表头数据(初始化表格)
     async getTableHeader() {
       let params = {
@@ -213,17 +127,17 @@ export default {
           PageNumber: 1,
           PageSize: 500
         },
-        type: this.category.deviceId
+        type: this.category.Family
       };
       await getDataDictionary(params, res => {
         this.tableHeader = res.Content;
         this.initTable();
       });
     },
-    // 创建设备数据
+    // 创建资产数据
     async handleCreateTableData() {
       let newData = this.tableData.filter(item => {
-        let keys = Object.keys(item);
+        let keys = Object.keys(item)
         keys.map(key => {
           //将值为空字符串的属性删除
           if (item[key] == "") {
@@ -231,100 +145,75 @@ export default {
           }
         });
         let newK = Object.keys(item)
-        if ((item.Checked && newK.length > 1) || (!item.Checked && newK.length)) {
+        if (keys.length && newK.length) {
           return item;
         }
-      });
+      })
       if (!newData.length) {
         this.$message("创建信息为空,请录入信息后再创建!");
         return;
       }
       let flag = false;
       newData.map(item => {
-        if (item.Checked && !item.EquipLocalName) {
-          flag = true;
+				item.Family = this.category.Family
+        if (!item.EquipLocalName) {
+          flag = true
         }
         // 处理建筑-楼层
         if (item.flowBuild) {
-          item.BuildingId = item.flowBuild.split("-")[0]
-          item.FloorId = item.flowBuild.split("-")[1]
-        }
-        //处理管理的系统
-        if (item.LinkSystem && item.LinkSystem.length) {
-          item.SystemList = []
-          item.LinkSystem.map(t => {
-            item.SystemList.push(t.id)
-          })
-        }
+					let BuildingId = item.flowBuild.split("-")[0]
+					let FloorId = item.flowBuild.split("-")[1]
+					if (BuildingId && FloorId) {
+						item.BuildingId = BuildingId
+          	item.FloorId = FloorId
+					} else if (BuildingId && !FloorId) {
+						item.BuildingId = BuildingId
+					}
+				}
       })
       if (flag) {
         this.$message.info("存在设备的本地名称为空,请检查")
         return;
-      }
-
-      for (let i = 0; i < newData.length; i++) {
-        let params = newData[i]
-        params.Family = this.firmId;
-        params.Category = this.category.deviceId;
-        if (newData[i].Checked) {//同时创建资产
-          await createPropertyData([params], async res => {
-            params.PropertyId = res.EntityList[0].EquipID
-            await createEquip([params], res => {
-              if (i == newData.length - 1) {
-                this.$router.push({
-                  path: "/ledger/facility",
-                  query: { deviceId: this.category.deviceId }
-                });
-                session.remove("deviceAddData")
-              }
-            })
-          })
-        } else {
-          await createEquip([params], res => {
-            if (i == newData.length - 1) {
-              this.$router.push({
-                path: "/ledger/facility",
-                query: { deviceId: this.category.deviceId }
-              });
-              session.remove("deviceAddData")
-            }
-          });
-        }
-      }
+			}
+			
+			await createPropertyData(newData, res => {
+				this.$router.push({
+					path: "/ledger/property",
+					query: { Family: this.category.Family }
+				})
+				session.remove("propertyAddData")
+			})
     },
     // 删除表格行
     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({ Checked: 1 });
-      }
-      this.initTable();
-      this.formaTableData();
+      let addRowLength = this.addNum
+      this.initTable()
+      this.formaTableData()
     },
     //修改
     handleUpdataTable(changeData, source) {
-      this.formaTableData();
+      this.formaTableData()
     },
     //保存去掉空字段的新增数据
     formaTableData() {
       let newData = this.tableData.filter(item => {
-        let keys = Object.keys(item);
+        let keys = Object.keys(item)
         keys.map(key => {
           //将值为空字符串的属性删除
           if (item[key] == "") {
-            delete item[key];
+            delete item[key]
           }
-        });
+        })
         if (keys.length && Object.keys(item).length) {
           return item;
         }
-      });
-      session.set("deviceAddData", newData);
+      })
+      session.set("propertyAddData", newData);
     },
     //格式化表头显示的数据
     formatHeaderData(list) {
@@ -334,8 +223,8 @@ export default {
       data.unshift("所属建筑楼层")
       return data
     },
+    //格式化表头头映射的数据
     formatHeaderType(list) {
-      //格式化表头头映射的数据
       let arr = tools.copyArr(list)
       let showType = this.showTypeFlag?'partInfo':'all'
       let data = showTools.headerTypeFilter(arr, 'property', this.onlyRead, showType, true)
@@ -344,7 +233,7 @@ export default {
         renderer: tools.customDropdownRenderer,
         editor: "chosen",
         chosenOptions: {
-        data: buildFloorData.data
+            data: buildFloorData.data
         }
       })
       return data
@@ -360,7 +249,7 @@ export default {
         contextMenu: {
           items: {
             remove_row: {
-              name: "删除设备"
+              name: "删除资产"
             }
           }
         },
@@ -435,10 +324,6 @@ export default {
     changePics(keys) {
       this.setDataToMain(keys, this.messKey, this.row);
     },
-    //关联系统变更
-    changeSystemType(data) {
-      tools.setDataForKey(this.tableData[this.row], "LinkSystem", data)
-    },
     //表格点击事件
     handleTdClick(el, rowArr) {
       //点击的是表头
@@ -486,33 +371,6 @@ export default {
     getInfors(infos, row) {
       let val = this.tableExample.colToProp(row.col);
       switch (val) {
-        //操作
-        case 'caozuo':
-          // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
-          this.$message("开发中...")
-          break;
-        //设备二维码图片
-        case 'EquipQRCode':
-          this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
-          if (!!this.qrcodeUrl) {
-            this.myDialog.qrcode = true;
-          } else {
-            this.$message("此设备没有设备二维码");
-          }
-          break;
-        //关联系统
-        case 'linkSystem':
-          if (!this.onlyRead) {
-            this.systemList = this.tableData[row.row].LinkSystem || [];
-            this.myDialog.systemType = true;
-          }
-          break;
-        //关联资产
-        case 'LinkEquipLocalName':
-          if (this.linkNameFalg) {
-            this.myDialog.changeRea = true;
-          }
-          break;
         //品牌型号弹窗
         case 'DPManufacturerID':
           if (!this.onlyRead) {
@@ -592,14 +450,6 @@ export default {
           this.picsArr = Pdata ? Pdata : [];
           this.myDialog.pic = true;
           break;
-        //包含的部件字段
-        case 'Count':
-          if (this.onlyRead) {
-            this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
-          } else {
-            this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.EquipID, typeId: this.mess.deviceId } });
-          }
-          break;
         default:
           break;
       }

+ 10 - 3
src/views/ledger/property/index.vue

@@ -65,15 +65,23 @@ export default {
     };
   },
   created() {
-      this.param.ProjId = this.projectId
-      this.param.secret = this.secret
+    this.param.ProjId = this.projectId
+    this.param.secret = this.secret
     this.getProjName()
+    this.getNumber()
+    let Family = this.$route.query.Family;
+    if (Family) {
+      this.$nextTick(() => {
+        this.$refs.cascader.changeVal([Family])
+      })
+    }
   },
   watch: {
     projectId() {
         this.param.ProjId = this.projectId
         this.param.secret = this.secret
         this.getProjName()
+        this.getNumber()
     }
   },
   methods: {
@@ -82,7 +90,6 @@ export default {
         if(item.id == this.projectId) 
         this.mess.perjectName = item.name
       })
-      this.getNumber()
     },
     getFamilyList() {
       let param = {