From 41d50b20c975faeaa9e5277bdcff13b5acecb575 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期三, 13 十二月 2023 16:57:37 +0800
Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/vue_mdc_430 into develop

---
 src/views/mdc/base/modules/comparativeAnalysis/comparativeAnalysismain.vue |  358 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 201 insertions(+), 157 deletions(-)

diff --git a/src/views/mdc/base/modules/comparativeAnalysis/comparativeAnalysismain.vue b/src/views/mdc/base/modules/comparativeAnalysis/comparativeAnalysismain.vue
index 9f19ba1..a3a6eed 100644
--- a/src/views/mdc/base/modules/comparativeAnalysis/comparativeAnalysismain.vue
+++ b/src/views/mdc/base/modules/comparativeAnalysis/comparativeAnalysismain.vue
@@ -1,58 +1,67 @@
 <template>
   <div :bordered="false" class="device_list">
     <div class="com_box">
-    <!-- 鏌ヨ鍖哄煙 -->
-    <div style="width: 100%; background-color: #fff" class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="searchQuery">
-        <a-row :gutter="24">
-          <!--<a-col :md="5" :sm="5">-->
+      <!-- 鏌ヨ鍖哄煙 -->
+      <div style="width: 100%; background-color: #fff" class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="searchQuery">
+          <a-row :gutter="24">
+            <!--<a-col :md="5" :sm="5">-->
             <!--<a-form-item label="鍚嶇О">-->
-              <!--<a-input placeholder="杈撳叆璁惧鍚嶇О鏌ヨ" :readOnly="readOnly" v-model="queryParam.tierName"></a-input>-->
+            <!--<a-input placeholder="杈撳叆璁惧鍚嶇О鏌ヨ" :readOnly="readOnly" v-model="queryParam.tierName"></a-input>-->
             <!--</a-form-item>-->
-          <!--</a-col>-->
-          <a-col :md="5" :sm="5">
-            <a-form-item label="椹卞姩绫诲瀷">
-              <!--<j-dict-select-tag placeholder="璇烽�夋嫨椹卞姩绫诲瀷"-->
-                                 <!--:triggerChange="true" dictCode="mdc_driveType"-->
-                                 <!--v-model="queryParam.driveType" allow-clear/>-->
-              <a-auto-complete
-                v-model="queryParam.driveType"
-                :data-source="driveTypeList"
-                placeholder="椹卞姩绫诲瀷"
-                :filter-option="filterOption"
-              />
-            </a-form-item>
-          </a-col>
-          <a-col :md="9" :sm="9" :xs="4">
-            <a-form-item label="鏃堕棿">
-              <a-range-picker @change="dateParamChange" v-model="dates"  format="YYYYMMDD"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="2" :sm="3" :xs="3">
-            <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
-          </a-col>
-          <a-col :md="2" :sm="2" :xs="2">
-            <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
+            <!--</a-col>-->
+            <a-col :md="5" :sm="5">
+              <a-form-item label="璁惧">
+                <a-input-search :readOnly="true" v-model="queryParam.equipmentId" @search="deviceSearch"
+                                placeholder='璇烽�夋嫨璁惧'/>
+              </a-form-item>
+            </a-col>
+
+            <a-col :md="5" :sm="5">
+              <a-form-item label="椹卞姩绫诲瀷">
+                <!--<j-dict-select-tag placeholder="璇烽�夋嫨椹卞姩绫诲瀷"-->
+                <!--:triggerChange="true" dictCode="mdc_driveType"-->
+                <!--v-model="queryParam.driveType" allow-clear/>-->
+                <a-auto-complete
+                  v-model="queryParam.driveType"
+                  :data-source="driveTypeList"
+                  placeholder="椹卞姩绫诲瀷"
+                  :filter-option="filterOption"
+                />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="6" :xs="6">
+              <a-form-item label="鏃堕棿">
+                <a-range-picker @change="dateParamChange" v-model="dates" format="YYYYMMDD"/>
+              </a-form-item>
+            </a-col>
+            <a-col>
+              <a-space>
+                <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
+                <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button>
+              </a-space>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- table鍖哄煙-begin -->
+      <div id="DeviceList">
+        <a-tabs :activeKey="activeKey" @change="tabChange" tabPosition="top">
+          <a-tab-pane key="1" tab="鍥惧舰">
+            <comparative-analysis-bar ref="AnalysisBar" :dataList='AnalysisBarList'></comparative-analysis-bar>
+          </a-tab-pane>
+          <a-tab-pane key="2" tab="浠〃" forceRender>
+            <comparative-analysis-gauge ref="AnalysisGauge" :dataList="AnalysisGauge"></comparative-analysis-gauge>
+          </a-tab-pane>
+          <a-tab-pane key="3" tab="楗煎浘" forceRender>
+            <conparative-analysis-pie ref="AnalysisPie" :dataList="AnalysisPie"></conparative-analysis-pie>
+          </a-tab-pane>
+        </a-tabs>
+      </div>
+      <!-- table鍖哄煙-end -->
     </div>
-    <!-- table鍖哄煙-begin -->
-    <div id="DeviceList">
-      <a-tabs :activeKey="activeKey" @change="tabChange" tabPosition="top">
-        <a-tab-pane key="1" tab="鍥惧舰">
-          <comparative-analysis-bar ref="AnalysisBar" :dataList='AnalysisBarList'></comparative-analysis-bar>
-        </a-tab-pane>
-        <a-tab-pane key="2" tab="浠〃" forceRender>
-          <comparative-analysis-gauge ref="AnalysisGauge" :dataList="AnalysisGauge"></comparative-analysis-gauge>
-        </a-tab-pane>
-        <a-tab-pane key="3" tab="楗煎浘" forceRender>
-          <conparative-analysis-pie ref="AnalysisPie" :dataList="AnalysisPie"></conparative-analysis-pie>
-        </a-tab-pane>
-      </a-tabs>
-    </div>
-    <!-- table鍖哄煙-end -->
-    </div>
+
+    <selectDeviceModal ref="selectDeviceModal" @selectFinished="selectOK" :title="'閫夋嫨璁惧'"></selectDeviceModal>
   </div>
 </template>
 
@@ -67,7 +76,7 @@
     getAction
   } from '@/api/manage'
   import comparativeAnalysisBar from './comparativeAnalysisBar'
-  import comparativeAnalysisGauge from'./comparativeAnalysisGauge'
+  import comparativeAnalysisGauge from './comparativeAnalysisGauge'
   import conparativeAnalysisPie from './conparativeAnalysisPie'
   import '@/components/table2excel/table2excel'
   import JInput from '@/components/jeecg/JInput'
@@ -75,6 +84,8 @@
   import Tooltip from 'ant-design-vue/es/tooltip'
   import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
   import api from '@/api/mdc'
+  import selectDeviceModal from '../../../../system/modules/SelectDeviceModal.vue'
+
   export default {
     name: 'comparativeAnalysismain',
     // mixins: [JeecgListMixin],
@@ -86,36 +97,39 @@
       JDictSelectTag,
       JInput,
       JDate,
-      JEllipsis
+      JEllipsis,
+      selectDeviceModal
     },
-    props: {  nodeTree: '', Type:'',nodePeople: '' },
+    props: { nodeTree: '', Type: '', nodePeople: '' },
     data() {
       return {
         activeKey: '1',
-        typeTree:"",
-        typeParent:1,
-        typeEquipment:1,
-        AnalysisBarList:[],
-        AnalysisGauge:[],
-        AnalysisPie:[],
+        typeTree: '',
+        typeParent: 1,
+        typeEquipment: 1,
+        AnalysisBarList: [],
+        AnalysisGauge: [],
+        AnalysisPie: [],
         dates: [],
-        xianshi:"",
-        readOnly:true,
-        queryParam: {},
-        queryParams:{},
-        queryParamEquip:{},
-        queryParamPeople:{},
-        dataStartsoucre:[],
-        url: {
-          comparativeAnalysis:'/mdc/efficiencyReport/comparativeAnalysis'
+        xianshi: '',
+        readOnly: true,
+        queryParam: {
+          equipmentId: ''
         },
-        AnalysisList:{},
-        driveTypeList:[]
+        queryParams: {},
+        queryParamEquip: {},
+        queryParamPeople: {},
+        dataStartsoucre: [],
+        url: {
+          comparativeAnalysis: '/mdc/efficiencyReport/comparativeAnalysis'
+        },
+        AnalysisList: {},
+        driveTypeList: []
       }
     },
-    watch:{
-      Type(valmath){
-        this.dataList = [];
+    watch: {
+      Type(valmath) {
+        this.dataList = []
         this.queryParams.typeTree = valmath
         // console.log(this.queryParams.typeTree)
       },
@@ -123,8 +137,9 @@
         if (JSON.stringify(val) != '{}') {
           if (val.equipmentId) {
             // this.$set(this.queryParam, 'tierName', val.title)
-            this.queryParamEquip.parentId =  ""
-            this.queryParams.equipmentId = val.equipmentId
+            this.queryParamEquip.parentId = ''
+            // this.queryParams.equipmentId = val.equipmentId
+            this.queryParam.equipmentId = val.equipmentId
             this.queryParamEquip.equipmentId = val.equipmentId
           } else {
             // this.$set(this.queryParam, 'tierName', val.title)
@@ -132,14 +147,13 @@
             this.queryParams.equipmentId = ''
           }
           this.searchQuery()
-
         }
       },
-      nodePeople(val){
+      nodePeople(val) {
         if (JSON.stringify(val) != '{}') {
           if (val.equipmentId) {
             // this.$set(this.queryParam, 'tierName', val.title)
-            this.queryParamEquip.parentId =  ""
+            this.queryParamEquip.parentId = ''
             this.queryParams.equipmentId = val.equipmentId
             this.queryParamEquip.equipmentId = val.equipmentId
           } else {
@@ -159,10 +173,10 @@
         // console.log(v1,v2)
         this.queryParam.startTime = v2[0]
         this.queryParam.endTime = v2[1]
-        console.log(v2[0],v2[1])
+        console.log(v2[0], v2[1])
       },
-      loadAnalysis(){
-        getAction(this.url.comparativeAnalysis,this.queryParam).then(res => {
+      loadAnalysis() {
+        getAction(this.url.comparativeAnalysis, this.queryParam).then(res => {
           if (res.success) {
             this.AnalysisList = res.result
             this.AnalysisBarList = res.result.graphics
@@ -175,44 +189,44 @@
           this.loading = false
         })
       },
-      searchQuery(){
-        if(this.dates&&this.dates.length>0){
+      searchQuery() {
+        if (this.dates && this.dates.length > 0) {
           this.AnalysisList = []
           this.AnalysisBarList = []
           this.AnalysisGauge = []
           this.AnalysisPie = []
-          if(this.queryParams.typeTree == "1"){
-            this.queryParams.parentId =  this.queryParamEquip.parentId
+          if (this.queryParams.typeTree == '1') {
+            this.queryParams.parentId = this.queryParamEquip.parentId
             // this.queryParams.equipmentId =  this.queryParamEquip.equipmentId
-          }else{
+          } else {
             this.queryParams.parentId = this.queryParamEquip.parentId
             // this.queryParams.equipmentId = ""
           }
           this.AnalysisList = []
           //鑾峰彇鏌ヨ鏉′欢
-          this.queryParam.parentId = this.queryParams.parentId;
-          this.queryParam.equipmentId = this.queryParams.equipmentId;
+          this.queryParam.parentId = this.queryParams.parentId
+          // this.queryParam.equipmentId = this.queryParams.equipmentId
           this.queryParam.typeTree = this.queryParams.typeTree
-          getAction(this.url.comparativeAnalysis,this.queryParam).then((res) => {
-            if(res.success){
+          getAction(this.url.comparativeAnalysis, this.queryParam).then((res) => {
+            if (res.success) {
               this.AnalysisList = res.result
               this.AnalysisBarList = res.result.graphics
               this.AnalysisGauge = res.result.meters
               this.AnalysisPie.push(res.result.pieCharts)
-            }else{
+            } else {
               // this.$message.warning(res.message)
               this.$notification.warning({
-                message:'娑堟伅',
-                description:res.message
-              });
+                message: '娑堟伅',
+                description: res.message
+              })
             }
           }).finally(() => {
             this.loading = false
           })
-        }else{
+        } else {
           this.$notification.warning({
-            message:'鎻愮ず' ,
-            description:'璇烽�夋嫨鏃堕棿'
+            message: '鎻愮ず',
+            description: '璇烽�夋嫨鏃堕棿'
           })
         }
 
@@ -222,70 +236,70 @@
         this.AnalysisBarList = []
         this.AnalysisGauge = []
         this.AnalysisPie = []
-        if(this.queryParams.typeTree == "1"){
+        if (this.queryParams.typeTree == '1') {
           this.typeTree = this.queryParams.typeTree
-          this.typeParent =  this.queryParams.parentId
+          this.typeParent = this.queryParams.parentId
           this.typeEquipment = this.queryParams.equipmentId
           this.queryParams = {}
           this.queryParam = {}
           this.dates = []
           this.queryParams.typeTree = this.typeTree
           this.queryParams.parentId = this.typeParent
-          if(this.queryParams.parentId !=  ""){
-            this.queryParams.equipmentId =  ""
-          }else{
-            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
-              this.queryParams.equipmentId =  this.typeEquipment
-            }else{
+          if (this.queryParams.parentId != '') {
+            this.queryParams.equipmentId = ''
+          } else {
+            if (this.queryParams.equipmentId == this.queryParamEquip.equipmentId) {
+              this.queryParams.equipmentId = this.typeEquipment
+            } else {
               this.queryParams.equipmentId = this.queryParamEquip.equipmentId
             }
           }
-          getAction(this.url.comparativeAnalysis,this.queryParams).then((res) => {
-            if(res.success){
+          getAction(this.url.comparativeAnalysis, this.queryParams).then((res) => {
+            if (res.success) {
               this.AnalysisList = res.result
               this.AnalysisBarList = res.result.graphics
               this.AnalysisGauge = res.result.meters
               this.AnalysisPie.push(res.result.pieCharts)
-            }else{
+            } else {
               // this.$message.warning(res.message)
               this.$notification.warning({
-                message:'娑堟伅',
-                description:res.message
-              });
+                message: '娑堟伅',
+                description: res.message
+              })
             }
           }).finally(() => {
             this.loading = false
           })
-        }else{
+        } else {
           this.typeTree = this.queryParams.typeTree
-          this.typeParent =  this.queryParams.parentId
+          this.typeParent = this.queryParams.parentId
           this.typeEquipment = this.queryParams.equipmentId
           this.queryParams = {}
           this.queryParam = {}
           this.dates = []
           this.queryParams.typeTree = this.typeTree
           this.queryParams.parentId = this.typeParent
-          if(this.queryParams.parentId !=  ""){
-            this.queryParams.equipmentId =  ""
-          }else{
-            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
-              this.queryParams.equipmentId =  this.typeEquipment
-            }else{
+          if (this.queryParams.parentId != '') {
+            this.queryParams.equipmentId = ''
+          } else {
+            if (this.queryParams.equipmentId == this.queryParamEquip.equipmentId) {
+              this.queryParams.equipmentId = this.typeEquipment
+            } else {
               this.queryParams.equipmentId = this.queryParamEquip.equipmentId
             }
           }
-          getAction(this.url.comparativeAnalysis,this.queryParams).then((res) => {
-            if(res.success){
+          getAction(this.url.comparativeAnalysis, this.queryParams).then((res) => {
+            if (res.success) {
               this.AnalysisList = res.result
               this.AnalysisBarList = res.result.graphics
               this.AnalysisGauge = res.result.meters
               this.AnalysisPie.push(res.result.pieCharts)
-            }else{
+            } else {
               // this.$message.warning(res.message)
               this.$notification.warning({
-                message:'娑堟伅',
-                description:res.message
-              });
+                message: '娑堟伅',
+                description: res.message
+              })
             }
           }).finally(() => {
             this.loading = false
@@ -295,9 +309,9 @@
       /**
        * 璋冪敤鎺ュ彛鑾峰彇鎺у埗绯荤粺绫诲瀷
        */
-      getDriveTypeByApi(){
-        api.getDriveTypeApi().then((res)=>{
-          this.driveTypeList=res.result.map(item=>item.value)
+      getDriveTypeByApi() {
+        api.getDriveTypeApi().then((res) => {
+          this.driveTypeList = res.result.map(item => item.value)
         })
       },
       /**
@@ -309,7 +323,7 @@
       filterOption(input, option) {
         return (
           option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
-        );
+        )
       },
       // onChange(value, dateString) {
       //   // console.log('Selected Time: ', value);
@@ -422,13 +436,35 @@
       //     this.loading = false
       //   })
       // },
+      deviceSearch() {
+        console.log('瑙﹀彂')
+        this.$refs.selectDeviceModal.visible = true
+        this.$refs.selectDeviceModal.selectedRowKeys = []
+        this.$refs.selectDeviceModal.selectedRows = []
+        this.$refs.selectDeviceModal.checkedKeys = this.queryParam.equipmentId.split(',')
+      },
+
+      /**
+       * 閫夋嫨宸叉湁璁惧鍚庣偣鍑荤‘瀹氭椂瑙﹀彂
+       * @param data 宸查�夋嫨鐨勮澶�
+       */
+      selectOK(data) {
+        // let params = {}
+        // params.equipmentIdList = []
+        // for (var a = 0; a < data.length; a++) {
+        //   params.equipmentIdList.push(data[a])
+        // }
+        console.log('data=', data)
+        this.queryParam.equipmentId = data.join(',')
+        console.log('queryParam', this.queryParam.equipmentId)
+      }
     },
     created() {
       this.dates = [moment().subtract('days', 7), moment().subtract('days', 0)]
       this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD')
       this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD')
-      this.queryParam.typeTree = "1";
-      this.loadAnalysis();
+      this.queryParam.typeTree = '1'
+      this.loadAnalysis()
       this.getDriveTypeByApi()
     }
   }
@@ -437,54 +473,62 @@
 <style lang="less" scoped>
   /*@import '~@assets/less/common.less';*/
 
-  @media screen and (min-width: 1920px){
-    .device_list{
-      height: 811px!important;
+  @media screen and (min-width: 1920px) {
+    .device_list {
+      height: 811px !important;
       overflow: scroll;
     }
   }
-  @media screen and (min-width: 1680px) and (max-width: 1920px){
-    .device_list{
-      height: 811px!important;
+
+  @media screen and (min-width: 1680px) and (max-width: 1920px) {
+    .device_list {
+      height: 811px !important;
       overflow: scroll;
     }
   }
-  @media screen and (min-width: 1400px) and (max-width: 1680px){
-    .device_list{
-      height: 663px!important;
+
+  @media screen and (min-width: 1400px) and (max-width: 1680px) {
+    .device_list {
+      height: 663px !important;
       overflow: scroll;
     }
   }
-  @media screen and (min-width: 1280px) and (max-width: 1400px){
-    .device_list{
-      height: 564px!important;
+
+  @media screen and (min-width: 1280px) and (max-width: 1400px) {
+    .device_list {
+      height: 564px !important;
       overflow: scroll;
     }
   }
-  @media screen and (max-width: 1280px){
-    .device_list{
-      height: 564px!important;
+
+  @media screen and (max-width: 1280px) {
+    .device_list {
+      height: 564px !important;
       overflow: scroll;
     }
   }
+
   /*.device_list{*/
-    /*display: flex;*/
+  /*display: flex;*/
   /*}*/
   /*.device_list .table-page-search-wrapper{*/
-    /**/
+  /**/
   /*}*/
-  /deep/ .ant-card-body{
-    height: 100%!important;
+  /deep/ .ant-card-body {
+    height: 100% !important;
   }
-   .device_list .com_box{
-    display: flex!important;
-    height: 100%!important;
-    flex-direction: column!important;
+
+  .device_list .com_box {
+    display: flex !important;
+    height: 100% !important;
+    flex-direction: column !important;
   }
-  .device_list .table-page-search-wrapper{
-    height: 6%!important;
+
+  .device_list .table-page-search-wrapper {
+    height: 6% !important;
   }
-  .device_list #DeviceList{
-   height: 90%!important;
+
+  .device_list #DeviceList {
+    height: 90% !important;
   }
 </style>

--
Gitblit v1.9.3