Kaynağa Gözat

报表历史信息接口调整

fujunwen 4 yıl önce
ebeveyn
işleme
836f471240

+ 3 - 0
src/App.vue

@@ -249,5 +249,8 @@ body {
     line-height: 26px;
     width: 8%;
   }
+  .el-date-editor .el-range__close-icon{
+    line-height: 26px;
+  }
 }
 </style>

+ 20 - 3
src/api/coreDeviceReport.js

@@ -1,15 +1,32 @@
 // 核心设备报表 接口
 import httputils from "@/api/httputils";
 
-// 系统列表
+/**
+ * 系统列表
+ */
 export function querySystemList() {
   return httputils.getJson(`/data/v_glsms_systemcfg/querySmsxt`);
 }
-// 系统下的设备
+/**
+ * 系统下的设备
+ * @param { 接口地址 } url 
+ * @param { 接口参数 } getParams 
+ */
 export function queryEquipmentList(url, getParams) {
   return  httputils.getJson(url, getParams);
 }
-// 表数据
+/**
+ * 表数据
+ */
 export function queryTableData(url, postParams) {
   return httputils.postJson(url, postParams);
+}
+
+/**
+ * 设备台账下所有历史事项信息
+ * @param { 接口地址 } url 
+ * @param { 接口参数 } getParams 
+ */
+export function queryHistoryTableData(url, getParams) {
+  return  httputils.getJson(url, getParams);
 }

+ 1 - 1
src/api/httputils.js

@@ -27,7 +27,7 @@ axiosservice.interceptors.request.use(
                 'isPreview': false //默认false,当预览开启的时候是true
             }
         }
-        // if (config.url.indexOf('/data') > -1 && config.url !== '/data/auth/check') {
+        // if (config.url.indexOf('/data') > -1 && config.url !== '/data/data/auth/check') {
         if (config.url.indexOf('/data') > -1) {
             config.headers = {
                 'sso-token': 'admin:lengqiang',

+ 76 - 10
src/views/analysis/CoreDeviceReport.vue

@@ -42,7 +42,7 @@
         </el-table-column>
         <el-table-column prop="photos_num" label="照片">
           <template slot-scope="scope">
-            <span style="color: #025BAA">{{ scope.row.photos_num?scope.row.photos_num : 0 }}张</span>
+            <span style="color: #025BAA">{{ scope.row.photos_num?(scope.row.photos_num + '张') : '—' }}</span>
           </template>
         </el-table-column>
         <el-table-column prop="report" label="报告">
@@ -67,16 +67,17 @@
           v-model="dialogTime"
           type="daterange"
           range-separator="至"
+          @change="changeTime"
           start-placeholder="开始日期"
           end-placeholder="结束日期">
         </el-date-picker>
-        <el-table :data="tableData" style="margin-bottom: 55px">
-          <el-table-column property="serialNumber" label="日期"></el-table-column>
+        <el-table :data="historyTableData" style="margin-bottom: 55px">
+          <el-table-column property="finishDate" label="日期"></el-table-column>
           <el-table-column property="equipmentName" label="事项类型"></el-table-column>
           <el-table-column property="equipmentNumber" label="事项名称"></el-table-column>
           <el-table-column property="photos_num" label="照片">
             <template slot-scope="scope">
-              <span style="color: #025BAA">{{ scope.row.photos_num?scope.row.photos_num : 0 }}张</span>
+              <span style="color: #025BAA">{{ scope.row.photos_num?(scope.row.photos_num + '张') : '—' }}</span>
             </template>
           </el-table-column>
           <el-table-column property="report" label="报告">
@@ -89,7 +90,10 @@
           <el-pagination
             background
             layout="prev, pager, next"
-            :total="tatol">
+            :current-page="hisCurPage"
+            :page-size="hisPageSize"
+            :total="hisTotal"
+            @current-change="changeHisTablePage">
           </el-pagination>
         </div>
       </el-dialog>
@@ -99,8 +103,9 @@
 
 <script>
 import { Select, Input } from 'meri-design';
-import { querySystemList, queryEquipmentList, queryTableData } from '../../api/coreDeviceReport';
+import { querySystemList, queryEquipmentList, queryTableData, queryHistoryTableData } from '../../api/coreDeviceReport';
 import _ from 'lodash';
+import moment from 'moment';
 export default {
   data () {
     return {
@@ -123,7 +128,16 @@ export default {
       pageSize: 10, // 每页条数
       tatol: 0, // 总数据
       dialogTableVisible: false, // 弹窗显示状态
-      dialogTime: '', // 弹框内的时间
+
+      // 核心设备实例
+      assetnum: null, // 设备台账编码
+      historyTableData: [], // 核心设备实例的所有历史事项信息
+      dialogTime: null, // 弹框内的时间
+      hisCurPage: 1, // 当前页码
+      hisPageSize: 10, // 当前页码
+      hisTotal: 0, // 总条数
+      startTime: null, // 开始时间
+      endTime: null, // 结束事件
     }
   },
 
@@ -157,9 +171,7 @@ export default {
           })
           this.systemList = newData;
         }
-      }).catch((err) => {
-        console.err(err)
-      });
+      })
     },
     /**
      * 切换系统名称
@@ -221,6 +233,60 @@ export default {
      */
     showEquipmentStatus(row, column, e) {
       this.dialogTableVisible = true;
+      this.assetnum = row.assetnum;
+      this.initTimePicker();
+    },
+    /**
+     * 获取核心设备实例的所有历史事项信息
+     */
+    getEquipmentHistoryMsg() {
+      this.historyTableData = [];
+      let param = {
+        page: this.hisCurPage,
+        size: this.hisPageSize,
+        // assetnum: this.assetnum,
+        assetnum: 8952,
+        // startDate: this.startTime,
+        startDate: 20180101000000,
+        // endDate: this.endTime
+        endDate: 20180201000000
+      }
+      queryHistoryTableData('/data/base/queryDateByAssetNum', param).then((res) => {
+        const { result, data, count } = res;
+        if (result === 'success') {
+          this.historyTableData = data;
+          this.hisTotal = count;
+        }
+      })
+    },
+    /**
+     * 初始化时间选择器
+     */
+    initTimePicker() {
+      let endTime = new Date(),
+          startTime = new Date(endTime.getTime() - 1000*60*60*24*30);
+      this.dialogTime = [startTime, endTime];
+      this.changeTime();
+    },
+    /**
+     * 切换时间
+     */
+    changeTime() {
+      this.hisCurPage = 1;
+      if (this.dialogTime) {
+        this.startTime = moment.unix(new Date(this.dialogTime[0]).getTime() / 1000).format('YYYYMMDDHHmmss');
+        this.endTime = moment.unix(new Date(this.dialogTime[1]).getTime() / 1000).format('YYYYMMDDHHmmss');
+      } else {
+        this.initTimePicker();
+      }
+      this.getEquipmentHistoryMsg();
+    },
+    /**
+     * 切换设备台账下所有历史事项信息页码
+     */
+    changeHisTablePage(page) {
+      this.hisCurPage = page;
+      this.getEquipmentHistoryMsg();
     },
   }
 }

+ 35 - 10
src/views/analysis/SpecificationUpdateRecord.vue

@@ -8,7 +8,7 @@
         :isReadOnly="true" 
         tipPlace="top" 
         caption="事件类型:"
-        @change="testClick" 
+        @change="changeTablePage(1)"
         v-model="incidentType" 
         :selectdata="incidentList" 
         :placeholder="'请选择'"
@@ -18,14 +18,15 @@
         type="daterange"
         range-separator="至"
         start-placeholder="开始日期"
-        end-placeholder="结束日期">
+        end-placeholder="结束日期"
+        @change="changeTime">
       </el-date-picker>
     </div>
     <el-table :data="tableData" style="margin-bottom: 19px">
-      <el-table-column property="date" label="日期"></el-table-column>
+      <el-table-column property="time" label="日期"></el-table-column>
       <el-table-column property="evenType" label="事项类型"></el-table-column>
       <el-table-column property="serialNumber" label="编号"></el-table-column>
-      <el-table-column property="update" label="更新内容"></el-table-column>
+      <el-table-column property="content" label="更新内容"></el-table-column>
     </el-table>
     <div class="page">
       <el-pagination
@@ -43,6 +44,7 @@
 
 <script>
 import { getSpecificaltionData } from '../../api/specificationUpdateRecord';
+import moment from 'moment';
 import _ from 'lodash';
 export default {
   data () {
@@ -59,6 +61,8 @@ export default {
       curPage: 1, // 当前页码
       pageSize: 10, // 每页条数
       tatol: 0, // 数据总量
+      startTime: 20171027000000, // 开始时间
+      endTime: 20171028000000, // 结束事件
     }
   },
 
@@ -79,17 +83,27 @@ export default {
         page: this.curPage,
         size: this.pageSize,
         plazaId: 1000423,
-        changeDateStartDate: 20171027000000,
-        changeDateEndDate: 20171028000000,
+        // changeDateStartDate: 20171027000000,
+        // changeDateEndDate: 20171028000000,
+      }
+      if (this.startTime !== '') {
+        param.changeDateStartDate = this.startTime;
+      }
+      if (this.endTime !== '') {
+        param.changeDateEndDate = this.endTime;
+      }
+      if (this.incidentType !== '') {
+        param.objtype = this.incidentType;
       }
       getSpecificaltionData('/data/rpt_change_record/query', param).then((res) => {
-        console.log('res', res)
         const { result, data, count } = res;
         if (result === 'success') {
           this.tatol = count;
           _.map(data, (item) => {
             let text = _.find(this.incidentList, (o) => {return o.id === item.objtype}).name
-            return item.evenType = text;
+            item.evenType = text;
+            item.time = moment.unix(item.changedate / 1000).format('YYYY.MM.DD')
+            return
           })
           this.tableData = data;
         }
@@ -102,8 +116,19 @@ export default {
       this.curPage = page;
       this.getTableData();
     },
-    testClick() {
-
+    /**
+     * 切换时间
+     */
+    changeTime() {
+      this.curPage = 1;
+      if (this.timeVal) {
+        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.getTableData();
     }
   }
 }

+ 1 - 3
vue.config.js

@@ -7,9 +7,7 @@ module.exports = {
                 // target: 'http://localhost:6040/data/',
                 changeOrigin: true,
                 secure: false,
-                pathRewrite: {
-                    '^/data': '/data/data',
-                },
+                pathRewrite: {},
             },
             // // 工程信息化服务
             // '/data': {