From 76a9e755ef42b12cfcf16ac9f293322a34d348bd Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期四, 16 五月 2024 16:58:00 +0800
Subject: [PATCH] 1、首页公司级和分厂级看板中的问题列表接口完成与后端数据联调 2、问题反馈页面完成所有布局及相关功能

---
 src/views/dashboard/IndexSignage.vue |  240 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 185 insertions(+), 55 deletions(-)

diff --git a/src/views/dashboard/IndexSignage.vue b/src/views/dashboard/IndexSignage.vue
index 334ba0d..cd50929 100644
--- a/src/views/dashboard/IndexSignage.vue
+++ b/src/views/dashboard/IndexSignage.vue
@@ -15,39 +15,11 @@
             <div id="warranty_malfunction_chart" style="width:50%;height: 340px;"></div>
           </div>
           <div class="support-plan-container">
-            <!--<div v-for="item in supportPlanList" class="support-plan-item"-->
-            <!--:style="{background:item.background}">-->
-            <!--<div>{{item.label}}</div>-->
-            <!--<div class="plan-value-container">-->
-            <!--<div class="plan-value">{{item.value}}</div>-->
-            <!--<div>鍙�</div>-->
-            <!--</div>-->
-            <!--</div>-->
-            <div class="support-plan-item" style="background:#5FE0AF">
-              <div>鏈湀涓変繚璁″垝</div>
+            <div v-for="(item,index) in supportPlanList" :key="index" class="support-plan-item"
+                 :style="{background:item.backgroundColor}" @click="openMaintenanceModal(item)">
+              <div>{{item.planTime}}</div>
               <div class="plan-value-container">
-                <div class="plan-value">{{thisMonthMaintenancePlanNum}}</div>
-                <div>鍙�</div>
-              </div>
-            </div>
-            <div class="support-plan-item" style="background:#409EFF">
-              <div>鏈湀瀹屾垚</div>
-              <div class="plan-value-container">
-                <div class="plan-value">{{thisMonthMaintenanceRealNum}}</div>
-                <div>鍙�</div>
-              </div>
-            </div>
-            <div class="support-plan-item" style="background:#D6BC52">
-              <div>涓嬫湀涓変繚璁″垝</div>
-              <div class="plan-value-container">
-                <div class="plan-value">{{nextMonthMaintenancePlanNum}}</div>
-                <div>鍙�</div>
-              </div>
-            </div>
-            <div class="support-plan-item" style="background:#58D9F9">
-              <div>涓嬩笅鏈堜笁淇濊鍒�</div>
-              <div class="plan-value-container">
-                <div class="plan-value">{{nextNextMonthMaintenancePlanNum}}</div>
+                <div class="plan-value">{{$data[item.planValueLabel]}}</div>
                 <div>鍙�</div>
               </div>
             </div>
@@ -68,15 +40,21 @@
         </dv-border-box-9>
       </div>
     </div>
+
+    <SignageModal :modalVisible="modalVisible" :modalTitle=modalTitle :modalDataApiUrl="modalDataApiUrl"
+                  :modalTableColumns="modalTableColumns"
+                  @closeModal="modalVisible=false"/>
   </div>
 </template>
 
 <script>
   import signageApi from '@/api/signage'
   import moment from 'moment'
+  import SignageModal from './modules/SignageModal'
 
   export default {
     name: 'IndexSignage',
+    components: { SignageModal },
     data() {
       return {
         runningStateChart: '',
@@ -100,6 +78,28 @@
           { value: '10', name: '鍋滄満' },
           { value: '8', name: '杩愯' }
         ],
+        supportPlanList: [
+          {
+            planTime: '鏈湀涓変繚璁″垝',
+            planValueLabel: 'thisMonthMaintenancePlanNum',
+            backgroundColor: '#5FE0AF'
+          },
+          {
+            planTime: '鏈湀瀹屾垚',
+            planValueLabel: 'thisMonthMaintenanceRealNum',
+            backgroundColor: '#409EFF'
+          },
+          {
+            planTime: '涓嬫湀涓変繚璁″垝',
+            planValueLabel: 'nextMonthMaintenancePlanNum',
+            backgroundColor: '#D6BC52'
+          },
+          {
+            planTime: '涓嬩笅鏈堜笁淇濊鍒�',
+            planValueLabel: 'nextNextMonthMaintenancePlanNum',
+            backgroundColor: '#58D9F9'
+          }
+        ],
         thisMonthMaintenancePlanNum: 0,
         thisMonthMaintenanceRealNum: 0,
         nextMonthMaintenancePlanNum: 0,
@@ -109,15 +109,19 @@
         barChartData: [],
         doubleBarChart: '',
         doubleBarChartData: {},
+        workshopProblemChartData: [['-', '-', '-']],
         efficiencyChartConfig: {},
         maintenanceConfig: {},
-        problemConfig: {}
+        problemConfig: {},
+        modalVisible: false,
+        modalTitle: '',
+        modalDataApiUrl: '',
+        modalTableColumns: []
       }
     },
     mounted() {
       window.addEventListener('resize', this.handleWindowResize)
       this.getChartDataByApi()
-      this.drawProblemChart()
     },
     beforeDestroy() {
       window.removeEventListener('resize', this.handleWindowResize)
@@ -133,6 +137,7 @@
         this.getTwoMaintenanceChartDataByApi()
         this.getBarChartDataByApi()
         this.getDoubleBarChartDataByApi()
+        this.getWorkshopProblemChartDataByApi()
       },
 
       /* 璋冪敤鎺ュ彛鑾峰彇璁惧杩愯鐘舵�� */
@@ -235,7 +240,7 @@
       getTwoMaintenanceChartDataByApi() {
         signageApi.getTwoMaintenancePlanListApi()
           .then(res => {
-            if (res.success && res.result) this.twoMaintenanceChartData = res.result.map(item => [item.centerName, item.maintenanceDate, item.content])
+            if (res.success && res.result.length > 0) this.twoMaintenanceChartData = res.result.map(item => [item.centerName, item.maintenanceDate, item.content])
             this.drawMaintenanceChart()
           })
       },
@@ -269,6 +274,16 @@
           .then(res => {
             if (res.success) this.doubleBarChartData = res.result
             this.drawDoubleBarChart()
+          })
+      },
+
+      /* 璋冪敤鎺ュ彛鑾峰彇杞﹂棿闂鍒楄〃*/
+      getWorkshopProblemChartDataByApi() {
+        signageApi.getWorkshopProblemListApi()
+          .then(res => {
+            console.log('res', res.result)
+            if (res.success && res.result.length > 0) this.workshopProblemChartData = res.result.map(item => [item.content, item.createTime])
+            this.drawWorkshopProblemChart()
           })
       },
 
@@ -431,7 +446,7 @@
             }
           },
           xAxis: {
-            name: '鍗曚綅',
+            name: '',
             nameTextStyle: {
               color: '#fff'
             },
@@ -558,7 +573,7 @@
             }
           ]
         }
-        option.title.text = `${moment().format('M鏈圖鏃�')}鍒╃敤鐜嘸
+        option.title.text = `${moment().subtract(1, 'days').format('M鏈圖鏃�')}鍒╃敤鐜嘸
         this.efficiencyChart.setOption(option, true)
         this.efficiencyChart.hideLoading()
         this.efficiencyChart.on('click', params => {
@@ -638,7 +653,7 @@
               center: ['45%', '60%'],
               color: [
                 '#0FC61A',
-                '#0DAF15',
+                '#F56436',
                 '#8B8B8B'
               ],
               label: {
@@ -665,6 +680,50 @@
         }
         this.techConditionChart.setOption(option, true)
         this.techConditionChart.hideLoading()
+
+        // this.techConditionChart.on('click', params => {
+        //   console.log('params', params)
+        //   this.modalTitle = '鎶�鏈姸鎬�'
+        //   this.modalTableColumns = [
+        //     {
+        //       title: '#',
+        //       dataIndex: '',
+        //       key: 'rowIndex',
+        //       width: 60,
+        //       align: 'center',
+        //       customRender: function(t, r, index) {
+        //         return parseInt(index) + 1
+        //       }
+        //     },
+        //     {
+        //       title: '璁惧缂栧彿',
+        //       dataIndex: 'equipmentId',
+        //       key: 'equipmentId'
+        //     },
+        //     {
+        //       title: '璁惧鍚嶇О',
+        //       dataIndex: 'equipmentName',
+        //       key: 'equipmentName'
+        //     },
+        //     {
+        //       title: '璁惧鍨嬪彿',
+        //       dataIndex: 'equipmentModel',
+        //       key: 'equipmentModel'
+        //     },
+        //     {
+        //       title: '璁惧绫诲瀷',
+        //       key: 'equipmentType',
+        //       dataIndex: 'equipmentType'
+        //     },
+        //     {
+        //       title: '椹卞姩绫诲瀷',
+        //       key: 'driveType',
+        //       dataIndex: 'driveType'
+        //     }
+        //   ]
+        //   this.modalDataApiUrl = '/mdc/mdcEquipment/list'
+        //   this.modalVisible = true
+        // })
       },
 
       /* 缁樺埗璁惧鎶ヤ慨鏁呴殰楗煎浘 */
@@ -744,6 +803,45 @@
         }
         this.warrantyMalfunctionChart.setOption(option, true)
         this.warrantyMalfunctionChart.hideLoading()
+
+        // this.warrantyMalfunctionChart.on('click', params => {
+        //   console.log('params', params)
+        //   this.modalTitle = '鎶ヤ慨鏁呴殰'
+        //   this.modalTableColumns = [
+        //     {
+        //       title: '#',
+        //       dataIndex: '',
+        //       key: 'rowIndex',
+        //       width: 60,
+        //       align: 'center',
+        //       customRender: function(t, r, index) {
+        //         return parseInt(index) + 1
+        //       }
+        //     },
+        //     {
+        //       title: '绫诲瀷',
+        //       align: 'center',
+        //       dataIndex: 'planCloseType'
+        //     },
+        //     {
+        //       title: '鏃堕棿绫诲瀷',
+        //       align: 'center',
+        //       dataIndex: 'planCloseTimeType'
+        //     },
+        //     {
+        //       title: '鏃堕暱锛堝垎閽燂級',
+        //       align: 'center',
+        //       dataIndex: 'planCloseTimeLong'
+        //     },
+        //     {
+        //       title: '澶囨敞',
+        //       align: 'center',
+        //       dataIndex: 'remark'
+        //     }
+        //   ]
+        //   this.modalDataApiUrl = '/mdc/mdcPlanClose/list'
+        //   this.modalVisible = true
+        // })
       },
 
       /* 缁樺埗杞﹂棿淇濆吇婊氬姩琛� */
@@ -756,7 +854,7 @@
           evenRowBGC: '#295562',
           data: this.twoMaintenanceChartData,
           index: true,
-          columnWidth: [100],
+          columnWidth: [100, 300, 300, 300],
           align: ['center', 'center', 'center', 'center']
         }
       },
@@ -836,7 +934,7 @@
             interval: yAxisInterval,
             axisLabel: {
               formatter: '{value}',
-              color: '#e2e9ff'
+              color: '#fff'
             },
             axisTick: {
               show: false
@@ -1057,29 +1155,60 @@
       },
 
       /* 缁樺埗闂婊氬姩琛� */
-      drawProblemChart() {
+      drawWorkshopProblemChart() {
         this.problemConfig = {
           indexHeader: '搴忓彿',
-          header: ['鏃堕棿', '闂鍐呭'],
+          header: [ '闂鍐呭', '鏃堕棿'],
           headerBGC: '#86D186',
           oddRowBGC: '#7CBF7C',
           evenRowBGC: '#7CBF7C',
-          data: [
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂'],
-            // ['2024骞�3鏈�23鍙�', '澶у娉ㄦ剰瀹夊叏闂']
-          ],
+          data: this.workshopProblemChartData,
           index: true,
-          columnWidth: [100, 300, 300],
+          columnWidth: [100, 300, 150],
           align: ['center']
         }
+      },
+
+      /**
+       * 鐐瑰嚮涓変繚灞曠ず鏍忓悗鎵撳紑寮圭獥
+       * @param record 鐐瑰嚮褰撳墠涓変繚淇℃伅
+       */
+      openMaintenanceModal(record) {
+        this.modalTitle = record.planTime
+        this.modalTableColumns = [
+          {
+            title: '#',
+            dataIndex: '',
+            key: 'rowIndex',
+            width: 60,
+            align: 'center',
+            customRender: function(t, r, index) {
+              return parseInt(index) + 1
+            }
+          },
+          {
+            title: '绫诲瀷',
+            align: 'center',
+            dataIndex: 'planCloseType'
+          },
+          {
+            title: '鏃堕棿绫诲瀷',
+            align: 'center',
+            dataIndex: 'planCloseTimeType'
+          },
+          {
+            title: '鏃堕暱锛堝垎閽燂級',
+            align: 'center',
+            dataIndex: 'planCloseTimeLong'
+          },
+          {
+            title: '澶囨敞',
+            align: 'center',
+            dataIndex: 'remark'
+          }
+        ]
+        this.modalDataApiUrl = '/mdc/mdcPlanClose/list'
+        // this.modalVisible = true
       },
 
       /**
@@ -1127,6 +1256,7 @@
             padding: 5px 20px;
             font-size: 20px;
             margin-bottom: 10px;
+            cursor: pointer;
 
             .plan-value-container {
               display: flex;

--
Gitblit v1.9.3