Browse Source

接口调整

fujunwen 4 years ago
parent
commit
84c772c746

+ 10 - 1
src/api/specificationUpdateRecord.js

@@ -1,6 +1,15 @@
 // 说明说更新记录 接口
 import httputils from "@/api/httputils";
 
+export function queryEventypes(url, param) {
+  return httputils.postJson(url, param);
+}
+
+/**
+ * 获取表数据
+ * @param {*} url 
+ * @param {*} param 
+ */
 export function getSpecificaltionData(url, param) {
   return httputils.getJson(url, param);
-}
+}

+ 38 - 12
src/views/analysis/CoreDeviceReport.vue

@@ -28,12 +28,12 @@
     </div>
     <div class="main-right">
       <div class="search-container">
-        <Input iconType="search" v-model="searchKey" placeholder="搜索" width="192"/>
+        <Input iconType="search" v-model="searchKey" placeholder="搜索" width="192" @pressEnter="getTableData" @clear="getTableData"/>
       </div>
       <el-table :data="tableData" style="width: 100%;margin-bottom: 63px;" @row-click="showEquipmentStatus">
         <el-table-column label="序号" type="index" :index="indexMethod"></el-table-column>
         <el-table-column prop="sbjc" label="设备简称"></el-table-column>
-        <el-table-column prop="assetnum" label="设备编号"></el-table-column>
+        <el-table-column prop="sbjbm" label="设备编号"></el-table-column>
         <el-table-column prop="is_exception" label="状态">
           <template slot-scope="scope">
             <span style="display: inline-block;width: 6px;height:6px;border-radius: 3px;background: #0091FF;" :style="{'background': !scope.row.is_exception?'#0091FF' : '#F54E45'}"></span>
@@ -121,11 +121,11 @@ export default {
       systemId: '', // 当前系统Id
       systemList: [], // 系统
       systemContentData: [
-        {id: 1, name: '高压配电柜', isMaintenance: true, num: 95, statusNum: 0, abnormal: false, isActive: true},
-        {id: 2, name: '变压器', isMaintenance: false, num: 256, statusNum: 12, abnormal: true, isActive: false},
-        {id: 3, name: '低压配电柜', isMaintenance: false, num: 354, statusNum: 0, abnormal: false, isActive: false},
-        {id: 4, name: '直流屏', isMaintenance: false, num: 175, statusNum: 0, abnormal: false, isActive: false},
-        {id: 5, name: '柴油发电机组', isMaintenance: false, num: 186, status: 0, abnormal: false, isActive: false},
+        // {id: 1, name: '高压配电柜', isMaintenance: true, num: 95, statusNum: 0, abnormal: false, isActive: true},
+        // {id: 2, name: '变压器', isMaintenance: false, num: 256, statusNum: 12, abnormal: true, isActive: false},
+        // {id: 3, name: '低压配电柜', isMaintenance: false, num: 354, statusNum: 0, abnormal: false, isActive: false},
+        // {id: 4, name: '直流屏', isMaintenance: false, num: 175, statusNum: 0, abnormal: false, isActive: false},
+        // {id: 5, name: '柴油发电机组', isMaintenance: false, num: 186, status: 0, abnormal: false, isActive: false},
       ], // 系统下的各种组成
       searchKey: '', // 搜索关键字
       tableData: [
@@ -163,7 +163,7 @@ export default {
   mounted() {
     this.getSystemList();
     // this.getEquipmentOfSystem();
-    this.getTableData();
+    
   },
 
   methods: {
@@ -210,23 +210,49 @@ export default {
         smsxt: this.systemId
       }
       queryEquipmentList('/data/home/querySystemCard', param).then((res) => {
-        console.log('res', res)
+        const { result, data } = res;
+        if (result === 'success') {
+          let newData = [];
+          _.forEach(data[0].assetTypeList, (item, index) => {
+            newData.push({
+              id: item.id,
+              name: item.category_name,
+              isMaintenance: item.is_detecting,
+              statusNum: item.is_exception_num,
+              num: item.asset_num,
+              abnormal: item.is_exception_num !== 0,
+              isActive: index === 0,
+              category_code: item.category_code
+            })
+          })
+          this.systemContentData = newData;
+          const { query } = this.$route;
+          if (!_.isEmpty(query) && query.equipId) {
+            _.map(this.systemContentData, (o) => {return o.isActive = o.id == query.equipId});
+          }
+          this.getTableData();
+        }
       })
     },
     /**
      * 切换系统下的设备
      */
     changeEquipment(id) {
-      _.map(this.systemContentData, (o) => {return o.isActive = o.id === id})
+      _.map(this.systemContentData, (o) => {return o.isActive = o.id === id});
+      this.getTableData();
     },
     /**
      * 获取表数据
      */
     getTableData() {
       let query = {
-        category_code: 'gdc'
+        category_code: _.find(this.systemContentData, (o) => {return o.isActive}).category_code
+      }
+      let url = `/data/glsms_asset/query?plazaId=1000423&page=${this.curPage}&size=${this.pageSize}`;
+      if (_.trim(this.searchKey) !== '') {
+        url = `${url}&keyword=${this.searchKey}`
       }
-      queryTableData(`/data/glsms_asset/query?plazaId=1000423&page=${this.curPage}&size=${this.pageSize}`, query).then((res) => {
+      queryTableData(url, query).then((res) => {
         const { result, count, data } = res;
         if (result === 'success') {
           this.tatol = count;

+ 41 - 7
src/views/analysis/SpecificationUpdateRecord.vue

@@ -43,21 +43,22 @@
 </template>
 
 <script>
-import { getSpecificaltionData } from '../../api/specificationUpdateRecord';
+import { getSpecificaltionData, queryEventypes } from '../../api/specificationUpdateRecord';
 import moment from 'moment';
 import _ from 'lodash';
 export default {
   data () {
     return {
-      incidentList: [
+      incidentList: [], // 事件列表
+      oraginIncidentList: [
         {id: 'all', name: '全部'},
         {id: 0, name: '专维'},
         {id: 1, name: '维保'},
         {id: 2, name: '第三方检测'},
         {id: 3, name: '重点关注'},
-      ], // 事件列表
+      ], // 事件列表字典表
       incidentType: 'all', // 事件类型
-      timeVal: '', // 时间
+      timeVal: null, // 时间
       tableData: [], // 表数据
       curPage: 1, // 当前页码
       pageSize: 10, // 每页条数
@@ -72,11 +73,45 @@ export default {
   computed: {},
 
   mounted() {
-    this.getTableData();
+    this.initTimePicker();
+    this.getEvenType();
   },
 
   methods: {
     /**
+     * 初始化时间
+     */
+    initTimePicker() {
+      let endTime = new Date(),
+          startTime = new Date(endTime.getTime() - 1000*60*60*24*30);
+      this.timeVal = [startTime, endTime];
+    },
+    /**
+     * 获取事件类型
+     */
+    getEvenType() {
+      let query = {
+        tableName: 'rpt_change_record',
+        columnName: {
+          objtype: 'objtype'
+        }
+      }
+      queryEventypes(`/data/base/queryOptions?plazaId=1000423`, [query]).then((res) => {
+        const { result, data } = res;
+        if (result === 'success') {
+          let newData = [this.oraginIncidentList[0]];
+          _.forEach(data.rpt_change_record.objtype, (item) => {
+            newData.push({
+              id: item.key,
+              name: _.find(this.oraginIncidentList, (o) => {return item.key === o.id}).name
+            })
+          })
+          this.incidentList = newData;
+          this.getTableData();
+        }
+      })
+    },
+    /**
      * 获取表数据
      */
     getTableData() {
@@ -126,8 +161,7 @@ export default {
         this.startTime = moment.unix(new Date(this.timeVal[0]).getTime() / 1000).format('YYYYMMDDHHmmss');
         this.endTime = moment.unix(new Date(this.timeVal[1]).getTime() / 1000).format('YYYYMMDDHHmmss');
       } else {
-        this.startTime = 20171027000000;
-        this.endTime = 20171028000000;
+        this.initTimePicker();
       }
       this.getTableData();
     }