Browse Source

modify property interface and device

haojianlong 5 years ago
parent
commit
ebab8f44a9

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

@@ -934,6 +934,13 @@ export function createPropertyData(param, success) {
     http.postJson(url, data, success)
 }
 
+//查询资产
+export function queryProperty(param, success) {
+    let url = `${baseUrl}/datacenter/property/query`;
+    let data = param;
+    http.postJson(url, data, success)
+}
+
 //动态数据关联-冲突选择确认
 export function dynamicClashConfirm(param, success) {
     let url = `${baseUrl}/pointconfig/dynamic/clashconfirm`;

+ 49 - 159
src/components/dialogs/changeRea.vue

@@ -6,14 +6,8 @@
     <div>
       <div id="changeRea">
         <div class="title-search" style="margin-bottom: 10px;">
-          <el-input
-            placeholder="输入名称查询"
-            v-model="search"
-            size="small"
-            style="width:300px;"
-            clearable
-          ></el-input>
-          <el-button @click="getData" size="small">查找</el-button>
+          <el-input placeholder="输入名称或编码查询" v-model="search" size="small" style="width:300px;" clearable></el-input>
+          <el-button @click="getPropertyData" size="small">查找</el-button>
         </div>
         <div>
           <floor-cascader @change="changeFloor"></floor-cascader>
@@ -22,47 +16,39 @@
           <el-table :data="tableData" style="width: 100%" height="300px">
             <el-table-column label="资产名称">
               <template slot-scope="scope">
-                <el-radio
-                  v-model="radio"
-                  :label="scope.row.id"
-                >{{scope.row.infos.EquipLocalName || scope.row.infos.EquipName}}</el-radio>
+                <el-radio :label="scope.row.EquipID">{{scope.row.EquipLocalName || scope.row.EquipName}}</el-radio>
               </template>
             </el-table-column>
             <el-table-column label="本地编码">
-              <template
-                slot-scope="scope"
-              >{{scope.row.infos.EquipLocalID || scope.row.infos.EquipID}}</template>
+              <template slot-scope="scope">{{scope.row.EquipLocalID || scope.row.EquipID}}</template>
             </el-table-column>
             <el-table-column prop="name" label="所在楼层">
-              <template slot-scope="scope">{{getFloor(scope.row.relation)}}</template>
+              <template slot-scope="scope">{{getFloor(scope.row.FloorId)}}</template>
             </el-table-column>
             <el-table-column label="设备族">
-              <template slot-scope="scope">{{getFramily(scope.row.family)}}</template>
+              <span>{{this.category.assetName}}</span>
             </el-table-column>
             <el-table-column label="安装位置">
-              <template slot-scope="scope">{{scope.row.infos.InstallLocation || "--"}}</template>
+              <template slot-scope="scope">
+                {{scope.row.LedgerParam.Siteinstall?scope.row.LedgerParam.Siteinstall.InstallLocation:"--"}}
+              </template>
             </el-table-column>
           </el-table>
         </el-radio-group>
         <my-pagination :page="page" @change="changed" style="margin-top:10px;"></my-pagination>
         <div class="footer">
-          <el-button
-            type="primary"
-            @click="clickTrue"
-            style="display:block;margin: 10px auto 0;"
-          >确 定</el-button>
+          <el-button type="primary" @click="clickTrue" style="display:block;margin: 10px auto 0;">确 定</el-button>
         </div>
       </div>
     </div>
-    <param-details :isLoad="isLoad" :data="data"></param-details>
   </el-dialog>
 </template>
 <script>
 import myPagination from "@/components/ledger/lib/myPagination";
 import paramDetails from "@/components/dialogs/list/paramDetails"
-import { getBillPropList, getEquipmentFamily, getSpaceFloor, getBussines2, upDateTableMain } from "@/api/scan/request"
+import { getBillPropList, getEquipmentFamily, getSpaceFloor, getBussines2, upDateTableMain, queryProperty } from "@/api/scan/request"
 import floorCascader from "@/components/ledger/lib/floorCascader";
-import {mapGetters, mapActions} from "vuex"
+import { mapGetters, mapActions } from "vuex"
 export default {
   components: {
     myPagination,
@@ -89,12 +75,7 @@ export default {
     return {
       search: "", //搜索文案
       radio: "",
-      tableData: [
-      ],
-      data: {},
-      isLoad: {
-        paramShow: false
-      },
+      tableData: [],
       page: {
         size: 50,
         sizes: [10, 30, 50, 100, 150, 200],
@@ -107,17 +88,14 @@ export default {
     };
   },
   created() {
-    this.getCode()
+    this.getFloorList();
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ])
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   mounted() { },
   methods: {
+    //根据楼层id对应楼层
     getFloor(relation) {
       let floor = !!relation ? relation.floor || "" : ""
       if (!!floor) {
@@ -137,45 +115,16 @@ export default {
         return "--"
       }
     },
-
+    //确认选择
     clickTrue() {
-      if (!!this.radio) {
-        let param = {
-          UserId: this.userId,
-          ProjId: this.projectId
-        }
-        let paramList = [{
-          EquipmentId: this.category.id,
-          FmId: this.radio
-        }]
-        console.log(param, paramList)
-        upDateTableMain(param, paramList).then(res => {
-          this.$emit("close")
-          this.dialog.changeRea = false
-        })
-        // upDateTableMain(param, res => {
-        // })
+      if (this.radio) {
+        this.$emit('changeProperty', this.radio);
+        this.dialog.changeRea = false;
       } else {
         this.$message("请先选择资产")
       }
     },
-
-    getFramily(code) {
-      console.log(code)
-      let name = ""
-      this.codeListCode.map(item => {
-        if (item.code == code) {
-          name = item.name
-        }
-      })
-      return name || "--"
-    },
-    getCode() {
-      getEquipmentFamily(res => {
-        this.codeListCode = res.Content
-        this.getFloorList()
-      })
-    },
+    //查询条件-所在建筑楼层
     getFloorList() {
       let param = {
         secret: this.secret,
@@ -191,114 +140,55 @@ export default {
         this.$message.error("请求错误")
       })
     },
+    //所在建筑楼层修改
     changeFloor(val) {
       this.mess = {
         buildId: val[0] || "",
         floorId: val[1] || ""
       }
-      this.getData()
-      console.log(val)
+      this.getPropertyData()
     },
+    //分页修改
     changed() {
-      this.getData()
-    },
-    //查询技术参数
-    lookParam(data) {
-      this.data = data
-      this.isLoad.paramShow = true
-    },
-    getChange() {
-      if (!!this.radio) {
-        this.$emit("changechangeRea", this.radio)
-        this.dialog.changeRea = false
-      } else {
-        this.$message("请选择型号")
-      }
-    },
-    searchKey() {
-      this.changePage()
+      this.getPropertyData()
     },
+    //弹窗显示时
     changePage() {
       this.page = {
         size: 50,
-        sizes: [10, 30, 50, 100, 150, 200],
+        sizes: [10, 30, 50, 100],
         total: 0,
         currentPage: 1
       }
-      this.getData()
+      this.getPropertyData()
     },
-    getData() {
-      // let param = {
-      //   data: {
-      //     filter: {
-      //       EquipLocalName: this.search
-      //     },
-      //     directOnly: false,
-      //     criteria: {
-      //       id: "",
-      //       graphType: "Pe2Eq",
-      //       side: -1,
-      //       type: ""
-      //     }
-      //   },
-      //   secret: this.secret,
-      //   ProjId: this.projectId
-      // }
+    //查询表数据
+    getPropertyData() {
       let param = {
-        data: {
-          directOnly: false,
-          criteria: {
-            EquipLocalName: [this.search == ""? null: this.search],
-            id: "",
-            type: [],
-            exclude: [{
-              graphType: "Pe2Eq",
-              side: "fromId",
-            }]
-          }
-        },
-        secret: this.secret,
-        ProjId: this.projectId
+        Filters: `EquipmentId isNull;Family="${this.category.assetType}"`,
+        PageNumber: 1,
+        PageSize: 50
       }
-      if (this.mess.buildId == "all") {
-        param.data.criteria.id = this.mess.ProjId
+      //建筑id
+      if (this.mess.buildId && this.mess.buildId != "all") {
+        param.Filters += `;buildingId='${this.mess.buildId}'`
       } else if (this.mess.buildId == "noKnow") {
-        param.data.criteria.id = this.mess.ProjId
-        param.data.directOnly = true
+        param.Filters += `;buildingId isNull`
+      }
+      //楼层id
+      if (this.mess.floorId && this.mess.floorId != "all") {
+        param.Filters += `;floorId='${this.mess.floorId}'`
       } else if (this.mess.floorId == "noKnow") {
-        param.data.criteria.id = this.mess.buildId
-        param.data.directOnly = true
-      } else if (this.mess.floorId && this.mess.floorId != "all") {
-        param.data.criteria.id = this.mess.floorId
-      } else if (this.mess.floorId == 'all') {
-        param.data.criteria.id = this.mess.buildId
-      } else {
-        param.data.criteria.id = this.projectId
+        param.Filters += `;floorId isNull`
       }
-      param.data.criteria.type = [this.getType(this.category.category)]
-      console.log(param)
-      getBussines2(param).then(res => {
-        this.tableData = res.data.Content
-        console.log(this.tableData, "this.tableData")
-        this.page.total = res.data.Count
-      })
-    },
-
-    getType(code) {
-      console.log(code, "code")
-      console.log(code.substring(2, 6))
-      let system = code.substring(2, 6), myCode = ""
-      this.codeListCode.map(item => {
-        if (!!item.content && item.content.length) {
-          item.content.map(child => {
-            if (child.code == system) {
-              myCode = item.code
-            }
-          })
-        }
+      //名称和编码
+      if (this.search) {
+        param.Filters += `;floorId='${this.mess.floorId}'`
+      }
+      queryProperty(param, res => {
+        this.tableData = res.Content
+        this.page.total = res.Total
       })
-      console.log(myCode)
-      return myCode
     }
   },
   watch: {

+ 15 - 8
src/components/ledger/handsontables/device.vue

@@ -64,7 +64,7 @@
       <my-pagination @change="getTableData" :page="page"></my-pagination>
     </div>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
-    <change-rea @close="reset" :dialog="myDialog" :category="category"></change-rea>
+    <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
     <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
     <!-- 新增设备 -->
     <el-dialog title="确定新增设备的类型" :visible.sync="myDialog.addDevice" width="30%">
@@ -175,10 +175,10 @@ export default {
         uploadFiles: false,//上传文件
         uploadImgs: false,//上传单个图片
         pic: false, //多个图片
-        addDevice: false,
-        systemType: false,
+        addDevice: false,//添加设备
+        systemType: false,//关联系统
         details: false,//详情页
-        changeRea: false,
+        changeRea: false,//关联资产
         lookPic: false,//图片查看
       },
       row: null,//被修改的row
@@ -194,7 +194,6 @@ export default {
       iframeSrc: "",
       id: 0,
       isWatch: true,
-      category: {},
       onlyRead: true,
       allMess: true,
       linkNameFalg: false,
@@ -204,9 +203,7 @@ export default {
       floorData: []
     };
   },
-  created() {
-    this.getFloorData()
-  },
+  created() { },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
@@ -621,6 +618,12 @@ export default {
           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) {
@@ -813,6 +816,10 @@ export default {
         }
       }
     },
+    //修改关联的资产
+    changeProperty(val) {
+      this.setDataToMain(val, 'PropertyId', this.row);
+    },
     //上传文件弹窗触发事件
     fileChange(keys) {
       this.setDataToMain(keys, this.messKey, this.row);