From 5330eb812cdcc02cace0648b008092b24c6e2236 Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期三, 06 十二月 2023 17:44:50 +0800
Subject: [PATCH] 1、利用率走势分析和利用率分段分析页面优化表格数据加载方式,实现滚动条触底加载,解决数据量较大时网页请求速度慢问题 2、报警分析页面调整图表样式,更换表格组件为ant-design表格 3、登录页面登录后若用户密码为初始密码或密码已过期则出现修改密码弹窗

---
 src/views/mdc/base/modules/openRateTrendAnalysis/openRateTrendAnalysisMain.vue       |   61 +++++++
 src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue |   67 +++++++
 src/views/user/Login.vue                                                             |   29 ++-
 src/components/tools/UserPassword.vue                                                |   63 +++++--
 src/views/user/LoginAccount.vue                                                      |    2 
 src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue                       |  232 ++++++++++++++++++++++------
 6 files changed, 366 insertions(+), 88 deletions(-)

diff --git a/src/components/tools/UserPassword.vue b/src/components/tools/UserPassword.vue
index ff16648..e15b51d 100644
--- a/src/components/tools/UserPassword.vue
+++ b/src/components/tools/UserPassword.vue
@@ -31,14 +31,13 @@
           label="纭鏂板瘑鐮�">
           <a-input type="password" @blur="handleConfirmBlur" placeholder="璇风‘璁ゆ柊瀵嗙爜" v-decorator="[ 'confirmpassword', validatorRules.confirmpassword]"/>
         </a-form-item>
-
       </a-form>
     </a-spin>
   </a-modal>
 </template>
 
 <script>
-
+  import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
   import { putAction } from '@/api/manage'
 
   export default {
@@ -57,10 +56,14 @@
           },
           password:{
             rules: [{
-              required: true, message: '璇疯緭鍏ユ柊瀵嗙爜!',
+              required: true, message: '璇疯緭鍏ユ柊瀵嗙爜!',trigger:'blur'
             }, {
               validator: this.validateToNextPassword,
-            }],
+            },
+              {
+                pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
+                message: '瀵嗙爜鐢�8浣嶆暟瀛椼�佸ぇ灏忓啓瀛楁瘝鍜岀壒娈婄鍙风粍鎴�!',
+              }],
           },
           confirmpassword:{
             rules: [{
@@ -85,6 +88,9 @@
         username:"",
       }
     },
+    created(){
+      // this.initDictData('password_length')
+    },
     methods: {
       show(uname){
         if(!uname){
@@ -95,6 +101,23 @@
           this.form.resetFields();
           this.visible = true;
         }
+      },
+      initDictData(dictCode) {
+        //浼樺厛浠庣紦瀛樹腑璇诲彇瀛楀吀閰嶇疆
+        if (getDictItemsFromCache(dictCode)) {
+          return getDictItemsFromCache(dictCode);
+        }
+        //鏍规嵁瀛楀吀Code, 鍒濆鍖栧瓧鍏告暟缁�
+        ajaxGetDictItems(dictCode, null).then((res) => {
+          if (res.success) {
+            const regx = new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{12,}$/);
+            this.validatorRules.password.rules[2]={
+              pattern: regx,
+              message: '瀵嗙爜鐢�8浣嶆暟瀛椼�佸ぇ灏忓啓瀛楁瘝鍜岀壒娈婄鍙风粍鎴�!',
+            }
+            return res.result
+          }
+        })
       },
       handleCancel () {
         this.close()
@@ -110,20 +133,24 @@
         // 瑙﹀彂琛ㄥ崟楠岃瘉
         this.form.validateFields((err, values) => {
           if (!err) {
-            that.confirmLoading = true;
-            let params = Object.assign({username:this.username},values)
-            console.log("淇敼瀵嗙爜鎻愪氦鏁版嵁",params)
-            putAction(this.url,params).then((res)=>{
-              if(res.success){
-                console.log(res)
-                that.$message.success(res.message);
-                that.close();
-              }else{
-                that.$message.warning(res.message);
-              }
-            }).finally(() => {
-              that.confirmLoading = false;
-            })
+            if(values.oldpassword!==values.confirmpassword){
+              that.confirmLoading = true;
+              let params = Object.assign({username:this.username},values)
+              console.log("淇敼瀵嗙爜鎻愪氦鏁版嵁",params)
+              putAction(this.url,params).then((res)=>{
+                if(res.success){
+                  console.log(res)
+                  that.$message.success(res.message);
+                  that.close();
+                }else{
+                  that.$message.warning(res.message);
+                }
+              }).finally(() => {
+                that.confirmLoading = false;
+              })
+            }else{
+              that.$message.warning('鏂板瘑鐮佷笌鏃у瘑鐮佷笉鑳界浉鍚�');
+            }
           }
         })
       },
diff --git a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
index cbb9217..479b163 100644
--- a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
+++ b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
@@ -19,43 +19,57 @@
       </div>
       <div id="DeviceList">
         <div class="openRateTrendDg">
-          <div id="Efficiency" class="container">
-            <div class="table2">
-              <table class="dataContent table" border="1" cellspacing="0" cellpadding="0"
-                     style="white-space: nowrap;text-align: left;">
-                <thead>
-                <tr class="thead fixed equipname">
-                  <th class="thgu dong1 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">鎶ヨ鍙�
-                  </th>
-                  <th class="thgu dong2 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">
-                    鍑虹幇娆℃暟
-                  </th>
-                  <th class="thgu dong3 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">
-                    鍚堣鎸佺画鏃堕棿
-                  </th>
-                  <th class="thgu dong4 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">
-                    鎶ヨ淇℃伅
-                  </th>
-                  <!--<template v-for="(tableHead, index) in tableHeads">-->
-                  <!--<th class="timeth" :colspan="checkedList.length">{{tableHead}}</th>-->
-                  <!--</template>-->
-                </tr>
-                </thead>
-                <tbody>
-                <tr class="mathData" v-for="(item, index) in dataList" @click="TableDraw(index,item)">
-                  <td class="tdgu  kaitou">{{item.alarmCode}}</td>
-                  <td class="tdgu1  kaitou">{{item.count}}</td>
-                  <td class="tdgu2 kaitou">{{getFormattedTime(item.timeCount)}}
-                  <!--<td class="tdgu2 kaitou">{{item.timeCount}}</td>-->
-                  <td class="tdgu3 kaitou">{{item.alarmContent}}</td>
-                  <!--<template v-for="(tableHead, index) in item.dataList">-->
-                  <!--<td :style="{background:tableHead.color }">{{tableHead.utilizationRate | numFilter}}</td>-->
-                  <!--</template>-->
-                </tr>
-                </tbody>
-              </table>
-            </div>
-          </div>
+          <!--<div id="Efficiency" class="container">-->
+          <!--<div class="table2">-->
+          <!--<table class="dataContent table" border="1" cellspacing="0" cellpadding="0"-->
+          <!--style="white-space: nowrap;text-align: left;">-->
+          <!--<thead>-->
+          <!--<tr class="thead fixed equipname">-->
+          <!--<th class="thgu dong1 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">鎶ヨ鍙�-->
+          <!--</th>-->
+          <!--<th class="thgu dong2 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">-->
+          <!--鍑虹幇娆℃暟-->
+          <!--</th>-->
+          <!--<th class="thgu dong3 name" rowspan="2" style="min-width: 150px; max-width: 150px;width: 150px;">-->
+          <!--鍚堣鎸佺画鏃堕棿-->
+          <!--</th>-->
+          <!--<th class="thgu dong4 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">-->
+          <!--鎶ヨ淇℃伅-->
+          <!--</th>-->
+          <!--&lt;!&ndash;<template v-for="(tableHead, index) in tableHeads">&ndash;&gt;-->
+          <!--&lt;!&ndash;<th class="timeth" :colspan="checkedList.length">{{tableHead}}</th>&ndash;&gt;-->
+          <!--&lt;!&ndash;</template>&ndash;&gt;-->
+          <!--</tr>-->
+          <!--</thead>-->
+          <!--<tbody>-->
+          <!--<tr class="mathData" v-for="(item, index) in dataList" @click="TableDraw(index,item)">-->
+          <!--<td class="tdgu  kaitou">{{item.alarmCode}}</td>-->
+          <!--<td class="tdgu1  kaitou">{{item.count}}</td>-->
+          <!--<td class="tdgu2 kaitou">{{getFormattedTime(item.timeCount)}}-->
+          <!--&lt;!&ndash;<td class="tdgu2 kaitou">{{item.timeCount}}</td>&ndash;&gt;-->
+          <!--<td class="tdgu3 kaitou">{{item.alarmContent}}</td>-->
+          <!--&lt;!&ndash;<template v-for="(tableHead, index) in item.dataList">&ndash;&gt;-->
+          <!--&lt;!&ndash;<td :style="{background:tableHead.color }">{{tableHead.utilizationRate | numFilter}}</td>&ndash;&gt;-->
+          <!--&lt;!&ndash;</template>&ndash;&gt;-->
+          <!--</tr>-->
+          <!--</tbody>-->
+          <!--</table>-->
+          <!--</div>-->
+          <!--</div>-->
+          <a-table :columns="columns" :data-source="dataList" bordered :pagination="false" :scroll="{y:168}"
+                   :customRow="customRow"
+                   rowKey="alarmCode">
+            <span slot="timeCount" slot-scope="text">{{getFormattedTime(text)}}</span>
+            <!--<a-table-->
+              <!--slot="expandedRowRender"-->
+              <!--slot-scope="row"-->
+              <!--:columns="innerColumns"-->
+              <!--:data-source="row.innerDataList"-->
+              <!--:pagination="false"-->
+            <!--&gt;-->
+              <!--<span slot="duration" slot-scope="text">{{getFormattedTime(text)}}</span>-->
+            <!--</a-table>-->
+          </a-table>
         </div>
         <div style="width: 100%;height: 55%;display: flex;">
           <div id="MdcEquipmentWarningPie" style="height: 100%;width: 35%;"></div>
@@ -75,6 +89,33 @@
   import {
     JeecgListMixin
   } from '@/mixins/JeecgListMixin'
+
+  const columns = [
+    { title: '鎶ヨ鍙�', dataIndex: 'alarmCode', key: 'alarmCode', align: 'center' },
+    { title: '鍑虹幇娆℃暟', dataIndex: 'count', key: 'count', align: 'center' },
+    {
+      title: '鍚堣鎸佺画鏃堕棿',
+      dataIndex: 'timeCount',
+      key: 'timeCount',
+      scopedSlots: { customRender: 'timeCount' },
+      align: 'center'
+    },
+    { title: '鎶ヨ淇℃伅', dataIndex: 'alarmContent', key: 'alarmContent', align: 'center' }
+  ]
+
+  const innerColumns = [
+    { title: '璁惧缂栧彿', dataIndex: 'equipmentId', key: 'equipmentId', align: 'center' },
+    { title: '璁惧鍚嶇О', dataIndex: 'equipmentName', key: 'equipmentName', align: 'center' },
+    { title: '鎶ヨ鏃堕棿', dataIndex: 'alarmTime', key: 'alarmTime', align: 'center' },
+    { title: '缁撴潫鏃堕棿', dataIndex: 'endTime', key: 'endTime', align: 'center' },
+    {
+      title: '鎸佺画鏃堕棿',
+      dataIndex: 'duration',
+      key: 'duration',
+      scopedSlots: { customRender: 'duration' },
+      align: 'center'
+    }
+  ]
 
   export default {
     // mixins: [JeecgListMixin],
@@ -115,7 +156,9 @@
         tableHeads: [],
         pieDate: [0],
         XData: [0],
-        YData: [0]
+        YData: [0],
+        columns,
+        innerColumns
       }
     },
     props: { nodeTree: '', Type: '', nodePeople: '' },
@@ -344,6 +387,15 @@
           if (res.success) {
             // this.tableHeads = res.result.dates
             this.dataList = res.result
+            this.dataList.forEach(item => item.innerDataList = [
+              {
+                equipmentId: '11234',
+                equipmentName: '绔嬩綋鏈哄簥',
+                alarmTime: 20,
+                endTime: 20,
+                duration: 123
+              }
+            ])
             // this.draw()
             // this.checkSameData(this.dataList)
             // this.checkSameData1(this.dataList)
@@ -360,7 +412,10 @@
           title: {
             text: '鍚勮澶囧嚭鐜版鎶ヨ鐨勬瘮渚�',
             x: 'center',
-            y: 'bottom'
+            y: 'bottom',
+            textStyle: {
+              color: '#4FAEDC'
+            }
           },
           tooltip: {
             trigger: 'item',
@@ -372,14 +427,18 @@
             radius: '60%',
             itemStyle: {
               normal: {
-                /*color: function (params) {
-                    var colorList = ['#4169E1', '#A8A8A8'];
-                    return colorList[params.dataIndex]
-                },*/
+                color: function(params) {
+                  var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
+                  return colorList[params.dataIndex]
+                },
                 label: {
                   show: true,
-                  position: 'top',
-                  formatter: '{b}\n{c}'
+                  // position: 'top',
+                  formatter: '{b}\n{c}',
+                  color: function(params) {
+                    var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
+                    return colorList[params.dataIndex]
+                  }
                 }
               }
             },
@@ -393,7 +452,10 @@
           title: {
             text: '姣忓ぉ鍑虹幇姝ゆ姤璀︾殑鏁伴噺璧板娍',
             x: 'center',
-            y: 'bottom'
+            y: 'bottom',
+            textStyle: {
+              color: '#4FAEDC'
+            }
           },
           tooltip: {
             trigger: 'axis'
@@ -406,13 +468,29 @@
               data: this.XData
               /*axisLabel :{
                   interval:0
-              }*/
+              }*/,
+              axisLine: {
+                //x杞寸嚎鐨勯鑹蹭互鍙婂搴�
+                show: true,
+                lineStyle: {
+                  width: 2,
+                  color: '#4FAEDC'
+                }
+              }
             }
           ],
           yAxis: [
             {
               type: 'value',
-              name: '娆℃暟'
+              name: '娆℃暟',
+              axisLine: {
+                //x杞寸嚎鐨勯鑹蹭互鍙婂搴�
+                show: true,
+                lineStyle: {
+                  width: 2,
+                  color: '#4FAEDC'
+                }
+              }
             }
           ],
           series: [
@@ -424,7 +502,15 @@
                 data: [
                   { type: 'max', name: '鏈�澶у��' },
                   { type: 'min', name: '鏈�灏忓��' }
-                ]
+                ],
+                label: {
+                  color: '#fff'
+                }
+              },
+              itemStyle: {
+                normal: {
+                  color: '#2EC7C9'
+                }
               }
             }
           ]
@@ -432,12 +518,46 @@
         equipmentWarningLine.setOption(equipmentWarningLineOption, true)
       },
 
-      getFormattedTime(seconds){
-        var hours = Math.floor(seconds / 3600);
-        var minutes = Math.floor((seconds % 3600) / 60);
-        var secs = seconds % 60;
+      /**
+       * 鏍煎紡鍖栨椂闂�
+       * @param seconds 绉掓暟
+       * @returns 鏍煎紡鍖栧悗鏃堕棿瀛楃涓�
+       */
+      getFormattedTime(seconds) {
+        var hours = Math.floor(seconds / 3600)
+        var minutes = Math.floor((seconds % 3600) / 60)
+        var secs = seconds % 60
 
+        if (hours == 0) {
+          if (minutes == 0) {
+            return `${secs}绉抈
+          } else {
+            return `${minutes}鍒� ${secs}绉抈
+          }
+        } else {
+          if (minutes == 0 && secs == 0) {
+            return `${hours}灏忔椂`
+          } else if (minutes != 0 && secs == 0) {
+            return `${hours}灏忔椂 ${minutes}鍒哷
+          }
+        }
         return `${hours}灏忔椂 ${minutes}鍒� ${secs}绉抈
+      },
+
+      /**
+       * 鑷畾涔夎〃鏍艰瑙﹀彂
+       * @param record 褰撳墠琛屼俊鎭�
+       * @param index 褰撳墠琛屼笅鏍�
+       * @returns {{on: {click: on.click}}} 杩斿洖瀵硅薄
+       */
+      customRow(record, index) {
+        return {
+          on: {
+            click: () => {
+              this.TableDraw(index, record)
+            }
+          }
+        }
       }
     }
   }
@@ -655,4 +775,10 @@
   .efficiency_list #DeviceList {
     height: 90% !important;
   }
+
+  /deep/ .ant-table-body .ant-table-row td {
+    padding-top: 10px;
+    padding-bottom: 10px;
+    cursor: pointer;
+  }
 </style>
\ No newline at end of file
diff --git a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue
index c8900d9..4c809b1 100644
--- a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue
+++ b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue
@@ -115,7 +115,10 @@
         },
         tableHeads: [],
         XData: [0],
-        YData: [0]
+        YData: [0],
+        isLazyRequest: '',// 鏄惁寮�鍚噿鍔犺浇
+        requestAlldataSize: 8,// 鎬诲叡璇锋眰鐨勫垪琛ㄩ」鏁扮洰
+        everyRequestDataSize: 15// 姣忔璇锋眰鐨勫垪琛ㄩ」鏁扮洰
       }
     },
     props: { nodeTree: '', Type: '', nodePeople: '' },
@@ -131,6 +134,12 @@
       this.queryParam.typeTree = '1'
       this.loadData1()
 
+    },
+    mounted() {
+      this.tableScroll = document.querySelector('.table2')
+    },
+    beforeDestroy() {
+      this.tableScroll.removeEventListener('scroll', this.tableScrollX)
     },
     watch: {
       Type(valmath) {
@@ -213,9 +222,12 @@
       dateParamChange(v1, v2) {
         this.queryParam.startDate = v2[0]
         this.queryParam.endDate = v2[1]
+        this.dates = [v1[0], v1[1]]
       },
       searchQuery() {
-        if (this.queryParam.startTime && this.queryParam.endTime && this.dates && this.dates.length > 0) {
+        this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD')
+        this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
+        if (this.queryParam.startTime && this.queryParam.endTime && this.dates[0] && this.dates[1]) {
           if (this.queryParam.typeTree == '1') {
             this.queryParam.parentId = this.queryParamEquip.parentId
             this.queryParam.equipmentId = this.queryParamEquip.equipmentId
@@ -223,6 +235,7 @@
             this.queryParam.parentId = this.queryParamPeople.parentId
             this.queryParam.equipmentId = ''
           }
+          this.requestAlldataSize = moment.duration(moment(this.queryParam.endDate) - moment(this.queryParam.startDate), 'millisecond').asDays() + 1
           this.loadData1()
         } else {
           this.$notification.warning({
@@ -303,9 +316,16 @@
       //     }
       //   }
       loadData1() {
-        this.loading=true
+        this.loading = true
         this.tableHeads = []
         this.dataList = []
+        // 鑻ユ棩鏈熼�夋嫨鍣ㄨ缃殑鏌ヨ璇锋眰鏁伴噺瓒呰繃15鏉″垯寮�鍚噿鍔犺浇
+        if (this.requestAlldataSize > 15) {
+          // 寮�鍚噿鍔犺浇鍚庡皢缁撴潫鏃ユ湡璁剧疆涓哄紑濮嬫棩鏈熶箣鍚庣殑14澶╋紝鍗冲厛鏌ヨ15澶╁唴鐨勬暟鎹�
+          this.queryParam.endDate = moment(this.queryParam.startDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD')
+          this.isLazyRequest = true
+          this.tableScroll.removeEventListener('scroll', this.tableScrollX) // 涓洪伩鍏嶆粴鍔ㄦ潯鏈夋粴鍔ㄨ窛绂诲悗鍚庣偣鍑绘煡璇㈡寜閽Е鍙戞粴鍔ㄤ簨浠讹紝鍥犳鍦ㄨЕ鍙戜簨浠跺墠绉婚櫎浜嬩欢
+        }
         getAction(this.url.efficiencyList, this.queryParam).then(res => {
           if (res.success) {
             this.tableHeads = res.result.dates
@@ -316,10 +336,10 @@
             // this.checkSameData2(this.dataList)
             // this.combineCell();
             // this.initDeviceType(this.dataList)
-
+            this.tableScroll.addEventListener('scroll', this.tableScrollX)
           }
-        }).finally(()=>{
-          this.loading=false
+        }).finally(() => {
+          this.loading = false
         })
       },
       draw() {
@@ -379,6 +399,41 @@
           ]
         }
         openRateTrendAnalysisChart.setOption(openRateTrendChartOptions, true)
+      },
+
+      /**
+       * 婊氬姩鏉¤Е搴曞埛鏂拌〃鏍兼暟鎹�
+       */
+      tableScrollX() {
+        // 褰撴粴鍔ㄦ潯瑙﹀簳涓旀噿鍔犺浇寮�鍚椂瑙﹀彂婊氬姩鏉¤Е搴曞埛鏂�
+        if (Math.ceil(this.tableScroll.scrollLeft + this.tableScroll.clientWidth) + 1 >= this.tableScroll.scrollWidth && this.isLazyRequest) {
+          this.loading = true
+          this.queryParam.startDate = moment(this.queryParam.endDate).add(1, 'days').format('YYYYMMDD')
+          // 鍒ゆ柇璁剧疆鎳掑姞杞藉悗鐨勭粨鏉熸椂闂存槸鍚﹁秴杩囨椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂�
+          if (moment(this.queryParam.endDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD') - moment(this.dates[1]).format('YYYYMMDD') < 0) {
+            //鍐嶆鏌ヨ鍚�15澶╁唴鐨勬暟鎹�
+            this.queryParam.endDate = moment(this.queryParam.endDate).add(this.everyRequestDataSize, 'days').format('YYYYMMDD')
+          } else {
+            // 濡傛灉涓嶅皬浜庢椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勬椂闂村垯璁剧疆璇锋眰缁撴潫鏃ユ湡涓烘椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂村苟涓斿叧闂噿鍔犺浇锛堟剰鍛崇潃鏈�鍚庝竴娆¤Е搴曞埛鏂帮級
+            this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
+            this.isLazyRequest = false
+          }
+          getAction(this.url.efficiencyList, this.queryParam).then(res => {
+            if (res.success) {
+              this.tableHeads = [...this.tableHeads, ...res.result.dates]
+              this.dataList.forEach(item1 => {
+                res.result.mdcEfficiencyList.forEach(item2 => {
+                  if (item1.equipmentId === item2.equipmentId) {
+                    item1.dataList = [...item1.dataList, ...item2.dataList]
+                  }
+                })
+              })
+              this.draw()
+            }
+          }).finally(() => {
+            this.loading = false
+          })
+        }
       }
     }
   }
diff --git a/src/views/mdc/base/modules/openRateTrendAnalysis/openRateTrendAnalysisMain.vue b/src/views/mdc/base/modules/openRateTrendAnalysis/openRateTrendAnalysisMain.vue
index 6056ac3..fadbf53 100644
--- a/src/views/mdc/base/modules/openRateTrendAnalysis/openRateTrendAnalysisMain.vue
+++ b/src/views/mdc/base/modules/openRateTrendAnalysis/openRateTrendAnalysisMain.vue
@@ -108,7 +108,10 @@
         },
         tableHeads: [],
         XData: [0],
-        YData: [0]
+        YData: [0],
+        isLazyRequest: '',// 鏄惁寮�鍚噿鍔犺浇
+        requestAlldataSize: 8,// 鎬诲叡璇锋眰鐨勫垪琛ㄩ」鏁扮洰
+        everyRequestDataSize: 15// 姣忔璇锋眰鐨勫垪琛ㄩ」鏁扮洰
       }
     },
     props: { nodeTree: '', Type: '', nodePeople: '' },
@@ -121,6 +124,12 @@
       this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
       this.queryParam.typeTree = '1'
       this.loadData1()
+    },
+    mounted() {
+      this.tableScroll = document.querySelector('.table2')
+    },
+    beforeDestroy() {
+      this.tableScroll.removeEventListener('scroll', this.tableScrollX)
     },
     watch: {
       Type(valmath) {
@@ -221,9 +230,13 @@
       dateParamChange(v1, v2) {
         this.queryParam.startDate = v2[0]
         this.queryParam.endDate = v2[1]
+        this.dates = [v1[0], v1[1]]
       },
       searchQuery() {
-        if (this.dates && this.dates.length > 0) {
+        console.log('dates', this.dates)
+        this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD')
+        this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
+        if (this.dates[0] && this.dates[1]) {
           if (this.queryParam.typeTree == '1') {
             this.queryParam.parentId = this.queryParamEquip.parentId
             this.queryParam.equipmentId = this.queryParamEquip.equipmentId
@@ -231,6 +244,7 @@
             this.queryParam.parentId = this.queryParamPeople.parentId
             this.queryParam.equipmentId = ''
           }
+          this.requestAlldataSize = moment.duration(moment(this.queryParam.endDate) - moment(this.queryParam.startDate), 'millisecond').asDays() + 1
           this.loadData1()
         } else {
           this.$notification.warning({
@@ -313,6 +327,13 @@
         this.loading = true
         this.tableHeads = []
         this.dataList = []
+        // 鑻ユ棩鏈熼�夋嫨鍣ㄨ缃殑鏌ヨ璇锋眰鏁伴噺瓒呰繃15鏉″垯寮�鍚噿鍔犺浇
+        if (this.requestAlldataSize > 15) {
+          // 寮�鍚噿鍔犺浇鍚庡皢缁撴潫鏃ユ湡璁剧疆涓哄紑濮嬫棩鏈熶箣鍚庣殑14澶╋紝鍗冲厛鏌ヨ15澶╁唴鐨勬暟鎹�
+          this.queryParam.endDate = moment(this.queryParam.startDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD')
+          this.isLazyRequest = true
+          this.tableScroll.removeEventListener('scroll', this.tableScrollX) // 涓洪伩鍏嶆粴鍔ㄦ潯鏈夋粴鍔ㄨ窛绂诲悗鍚庣偣鍑绘煡璇㈡寜閽Е鍙戞粴鍔ㄤ簨浠讹紝鍥犳鍦ㄨЕ鍙戜簨浠跺墠绉婚櫎浜嬩欢
+        }
         getAction(this.url.efficiencyList, this.queryParam).then(res => {
           if (res.success) {
             this.tableHeads = res.result.dates
@@ -323,6 +344,7 @@
             // this.checkSameData2(this.dataList)
             // this.combineCell();
             // this.initDeviceType(this.dataList)
+            this.tableScroll.addEventListener('scroll', this.tableScrollX)
           }
         }).finally(() => {
           this.loading = false
@@ -385,6 +407,41 @@
           ]
         }
         openRateTrendAnalysisChart.setOption(openRateTrendChartOptions, true)
+      },
+
+      /**
+       * 婊氬姩鏉¤Е搴曞埛鏂拌〃鏍兼暟鎹�
+       */
+      tableScrollX() {
+        // 褰撴粴鍔ㄦ潯瑙﹀簳涓旀噿鍔犺浇寮�鍚椂瑙﹀彂婊氬姩鏉¤Е搴曞埛鏂�
+        if (Math.ceil(this.tableScroll.scrollLeft + this.tableScroll.clientWidth) + 1 >= this.tableScroll.scrollWidth && this.isLazyRequest) {
+          this.loading = true
+          this.queryParam.startDate = moment(this.queryParam.endDate).add(1, 'days').format('YYYYMMDD')
+          // 鍒ゆ柇璁剧疆鎳掑姞杞藉悗鐨勭粨鏉熸椂闂存槸鍚﹁秴杩囨椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂�
+          if (moment(this.queryParam.endDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD') - moment(this.dates[1]).format('YYYYMMDD') < 0) {
+            //鍐嶆鏌ヨ鍚�15澶╁唴鐨勬暟鎹�
+            this.queryParam.endDate = moment(this.queryParam.endDate).add(this.everyRequestDataSize, 'days').format('YYYYMMDD')
+          } else {
+            // 濡傛灉涓嶅皬浜庢椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勬椂闂村垯璁剧疆璇锋眰缁撴潫鏃ユ湡涓烘椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂村苟涓斿叧闂噿鍔犺浇锛堟剰鍛崇潃鏈�鍚庝竴娆¤Е搴曞埛鏂帮級
+            this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
+            this.isLazyRequest = false
+          }
+          getAction(this.url.efficiencyList, this.queryParam).then(res => {
+            if (res.success) {
+              this.tableHeads = [...this.tableHeads, ...res.result.dates]
+              this.dataList.forEach(item1 => {
+                res.result.mdcEfficiencyList.forEach(item2 => {
+                  if (item1.equipmentId === item2.equipmentId) {
+                    item1.dataList = [...item1.dataList, ...item2.dataList]
+                  }
+                })
+              })
+              this.draw()
+            }
+          }).finally(() => {
+            this.loading = false
+          })
+        }
       }
     }
   }
diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue
index f2003cf..22d89e3 100644
--- a/src/views/user/Login.vue
+++ b/src/views/user/Login.vue
@@ -61,6 +61,7 @@
       @success="loginSelectOk"
     ></login-select-tenant>
     <!--<third-login ref="thirdLogin"></third-login>-->
+    <user-password ref="userPassword"/>
   </div>
 </template>
 
@@ -77,11 +78,11 @@
 import LoginPhone from './LoginPhone'
 import store from '@/store'
 import { getAction } from '../../api/manage'
-import AFormModelItem from 'ant-design-vue/es/form-model/FormItem'
+import UserPassword from '../../components/tools/UserPassword'
 
 export default {
   components: {
-    AFormModelItem,
+    UserPassword,
     LoginSelectTenant,
     TwoStepCaptcha,
     // ThirdLogin,
@@ -171,13 +172,25 @@
       // this.$refs.loginSelect.show(loginResult)
     },
     //鐧诲綍鍚庡彴澶辫触
-    requestFailed(err) {
+    requestFailed(err,username) {
       let description = ((err.response || {}).data || {}).message || err.message || "璇锋眰鍑虹幇閿欒锛岃绋嶅悗鍐嶈瘯"
-      this.$notification['error']({
-        message: '鐧诲綍澶辫触',
-        description: description,
-        duration: 4,
-      });
+      if(err.code!==5001&&err.code!==5002){
+        this.$notification['error']({
+          message: '鐧诲綍澶辫触',
+          description: description,
+          duration: 4,
+        });
+      }else{
+        this.$notification['warning']({
+          message: '鎻愮ず',
+          description: description,
+          duration:1,
+          onClose:()=>{
+            console.log('err',err)
+            this.$refs.userPassword.show(username)
+          }
+        });
+      }
       //璐︽埛瀵嗙爜鐧诲綍閿欒鍚庢洿鏂伴獙璇佺爜
       // if (this.customActiveKey === 'tab1' && description.indexOf('瀵嗙爜閿欒') > 0) {
       //   this.$refs.alogin.handleChangeCheckCode()
diff --git a/src/views/user/LoginAccount.vue b/src/views/user/LoginAccount.vue
index 28449db..2ebd8e0 100644
--- a/src/views/user/LoginAccount.vue
+++ b/src/views/user/LoginAccount.vue
@@ -136,7 +136,7 @@
             this.Login(loginParams).then((res) => {
               this.$emit('success', res.result)
             }).catch((err) => {
-              this.$emit('fail', err)
+              this.$emit('fail', err,loginParams.username)
             });
           }else{
             this.$emit('validateFail')

--
Gitblit v1.9.3