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

---
 src/views/mdc/base/modules/ProblemFeedbackList/ProblemFeedbackModal.vue |   98 ++++++++++++++
 src/views/dashboard/BranchFactorySignage.vue                            |   36 ++--
 src/views/dashboard/IndexSignage.vue                                    |   34 ++--
 src/views/mdc/base/ProblemFeedbackList.vue                              |  209 +++++++++++++++++++++++++++++
 src/api/signage.js                                                      |    2 
 5 files changed, 344 insertions(+), 35 deletions(-)

diff --git a/src/api/signage.js b/src/api/signage.js
index 84c5053..77d24c7 100644
--- a/src/api/signage.js
+++ b/src/api/signage.js
@@ -25,6 +25,8 @@
   getEquipmentOEEStatistics: productionCode => getAction('/mdc/home/equipmentOEEStatistics', { productionCode }),
   // 璁惧OEE鍜屽埄鐢ㄧ巼瀵规瘮
   getEquipmentMonthStatisticsApi: productionCode => getAction('/mdc/home/equipmentMonthStatistics', { productionCode }),
+  // 闂鍒楄〃
+  getWorkshopProblemListApi: productionCode => getAction('/mdc/home/feedbackList', { productionCode }),
   // 宸ユ绾у墠7澶╁埄鐢ㄧ巼鎶樼嚎鍥�
   getEquipmentDayUtilizationStatisticsApi: productionCode => getAction('/mdc/home/equipmentDayUtilizationStatistics', { productionCode }),
   // 涓婁釜鏈堝悇璁惧OEE缁熻
diff --git a/src/views/dashboard/BranchFactorySignage.vue b/src/views/dashboard/BranchFactorySignage.vue
index 2fc68ac..7cdc7b9 100644
--- a/src/views/dashboard/BranchFactorySignage.vue
+++ b/src/views/dashboard/BranchFactorySignage.vue
@@ -108,11 +108,12 @@
         thisMonthMaintenanceRealNum: 0,
         nextMonthMaintenancePlanNum: 0,
         nextNextMonthMaintenancePlanNum: 0,
-        twoMaintenanceChartData: [['-', '-', '-']],
+        twoMaintenanceChartData: [],
         barChart: '',
         barChartData: [],
         doubleBarChart: '',
         doubleBarChartData: {},
+        workshopProblemChartData: [],
         maintenanceConfig: {},
         problemConfig: {}
       }
@@ -120,7 +121,6 @@
     mounted() {
       window.addEventListener('resize', this.handleWindowResize)
       this.getChartDataByApi()
-      this.drawProblemChart()
     },
     beforeDestroy() {
       window.removeEventListener('resize', this.handleWindowResize)
@@ -136,6 +136,7 @@
         this.getTwoMaintenanceChartDataByApi()
         this.getBarChartDataByApi()
         this.getDoubleBarChartDataByApi()
+        this.getWorkshopProblemChartDataByApi()
       },
 
       /* 璋冪敤鎺ュ彛鑾峰彇璁惧杩愯鐘舵�� */
@@ -238,7 +239,7 @@
       getTwoMaintenanceChartDataByApi() {
         signageApi.getTwoMaintenancePlanListApi(this.productionCode)
           .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()
           })
       },
@@ -274,6 +275,16 @@
             this.drawDoubleBarChart()
           })
       },
+
+      /* 璋冪敤鎺ュ彛鑾峰彇杞﹂棿闂鍒楄〃*/
+      getWorkshopProblemChartDataByApi() {
+        signageApi.getWorkshopProblemListApi(this.productionCode)
+          .then(res => {
+            if (res.success && res.result.length > 0) this.workshopProblemChartData = res.result.map(item => [item.content, item.createTime])
+            this.drawWorkshopProblemChart()
+          })
+      },
+
 
       /* 缁樺埗璁惧杩愯鐘舵�佺帿鐟伴ゼ鍥� */
       drawRunningStateChart(productionId) {
@@ -1055,27 +1066,16 @@
       },
 
       /* 缁樺埗闂婊氬姩琛� */
-      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']
         }
       },
diff --git a/src/views/dashboard/IndexSignage.vue b/src/views/dashboard/IndexSignage.vue
index 8681db6..cd50929 100644
--- a/src/views/dashboard/IndexSignage.vue
+++ b/src/views/dashboard/IndexSignage.vue
@@ -109,6 +109,7 @@
         barChartData: [],
         doubleBarChart: '',
         doubleBarChartData: {},
+        workshopProblemChartData: [['-', '-', '-']],
         efficiencyChartConfig: {},
         maintenanceConfig: {},
         problemConfig: {},
@@ -121,7 +122,6 @@
     mounted() {
       window.addEventListener('resize', this.handleWindowResize)
       this.getChartDataByApi()
-      this.drawProblemChart()
     },
     beforeDestroy() {
       window.removeEventListener('resize', this.handleWindowResize)
@@ -137,6 +137,7 @@
         this.getTwoMaintenanceChartDataByApi()
         this.getBarChartDataByApi()
         this.getDoubleBarChartDataByApi()
+        this.getWorkshopProblemChartDataByApi()
       },
 
       /* 璋冪敤鎺ュ彛鑾峰彇璁惧杩愯鐘舵�� */
@@ -239,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()
           })
       },
@@ -273,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()
           })
       },
 
@@ -1144,27 +1155,16 @@
       },
 
       /* 缁樺埗闂婊氬姩琛� */
-      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']
         }
       },
diff --git a/src/views/mdc/base/ProblemFeedbackList.vue b/src/views/mdc/base/ProblemFeedbackList.vue
new file mode 100644
index 0000000..5565202
--- /dev/null
+++ b/src/views/mdc/base/ProblemFeedbackList.vue
@@ -0,0 +1,209 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="杞﹂棿鍚嶇О">
+              <a-tree-select v-model="queryParam.productionId" :treeData="workshopTreeData" placeholder="璇烽�夋嫨杞﹂棿"
+                             :treeDefaultExpandedKeys="treeDefaultExpandedKeys"></a-tree-select>
+            </a-form-item>
+          </a-col>
+          <a-col :md="2" :sm="2" :xs="2">
+            <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>
+    <!-- 鏌ヨ鍖哄煙-END -->
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel">
+            <a-icon type="delete"/>
+            鍒犻櫎
+          </a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔
+          <a-icon type="down"/>
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- table鍖哄煙-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i>
+        宸查�夋嫨
+        <a style="font-weight: 600">
+          {{selectedRowKeys.length }}
+        </a>椤�
+        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{x:'max-content',y:465}"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        @change="handleTableChange"
+      >
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">缂栬緫</a>
+
+          <a-divider type="vertical"/>
+
+          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+            <a>鍒犻櫎</a>
+          </a-popconfirm>
+        </span>
+
+      </a-table>
+    </div>
+
+    <ProblemFeedbackModal ref="modalRef" :visible="modalVisible" :title="modalTitle"
+                          :workshopTreeData="workshopTreeData" :treeDefaultExpandedKeys="treeDefaultExpandedKeys"
+                          @handleCloseModal="handleCloseModal" @modalFormOk="modalFormOk"/>
+  </a-card>
+</template>
+
+<script>
+
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import { queryProductionTreeList } from '@/api/api'
+  import ProblemFeedbackModal from './modules/ProblemFeedbackList/ProblemFeedbackModal'
+
+  export default {
+    name: 'ProblemFeedbackList',
+    mixins: [JeecgListMixin],
+    components: {
+      ProblemFeedbackModal
+    },
+    data() {
+      return {
+        description: '闂鍙嶉',
+        /* 鍒嗛〉鍙傛暟 */
+        ipagination: {
+          current: 1,
+          pageSize: 30,
+          pageSizeOptions: ['30', '50', '100'],
+          showTotal: (total, range) => {
+            return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�'
+          },
+          showQuickJumper: true,
+          showSizeChanger: true,
+          total: 0
+        },
+        // 琛ㄥご
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key: 'rowIndex',
+            width: 60,
+            align: 'center',
+            customRender: function(t, r, index) {
+              return parseInt(index) + 1
+            }
+          },
+          {
+            title: '杞﹂棿',
+            align: 'center',
+            dataIndex: 'productionId_dictText',
+            width: 450
+          },
+          {
+            title: '闂鍐呭',
+            align: 'center',
+            dataIndex: 'content',
+            width: 660,
+            ellipsis: true,
+          },
+          {
+            title: '鏃堕棿',
+            align: 'center',
+            dataIndex: 'createTime',
+            width: 450
+          },
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align: 'center',
+            width: 150,
+            fixed: 'right',
+            scopedSlots: { customRender: 'action' }
+          }
+        ],
+        url: {
+          list: '/mdc/mdcFeedback/list',
+          delete: '/mdc/mdcFeedback/delete',
+          deleteBatch: '/mdc/mdcFeedback/deleteBatch'
+        },
+        workshopTreeData: [],
+        treeDefaultExpandedKeys: [],
+        modalVisible: false,
+        modalTitle: ''
+      }
+    },
+    created() {
+      this.getWorkshopListByApi()
+    },
+    methods: {
+      /**
+       * 璋冪敤鎺ュ彛鑾峰彇鏌ヨ鍖哄煙杞﹂棿鏍戝垪琛�
+       */
+      getWorkshopListByApi() {
+        queryProductionTreeList().then(res => {
+          if (res.success) {
+            this.workshopTreeData = res.result
+            this.treeDefaultExpandedKeys = [...res.result].map(item => item.key)
+          }
+        })
+      },
+
+      handleAdd() {
+        this.modalTitle = '鏂板'
+        this.$refs.modalRef.model = {}
+        this.modalVisible = true
+      },
+
+      /**
+       * 鐐瑰嚮缂栬緫鎸夐挳鎵撳紑缂栬緫绐楀彛
+       * @param record 鐐瑰嚮琛ㄦ牸琛屼俊鎭�
+       */
+      handleEdit(record) {
+        this.modalTitle = '缂栬緫'
+        this.$refs.modalRef.model = Object.assign({}, record)
+        this.modalVisible = true
+      },
+
+      modalFormOk() {
+        // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
+        this.loadData()
+        //娓呯┖鍒楄〃閫変腑
+        this.onClearSelected()
+        this.handleCloseModal()
+      },
+
+      handleCloseModal() {
+        this.modalVisible = false
+      }
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less';
+</style>
\ No newline at end of file
diff --git a/src/views/mdc/base/modules/ProblemFeedbackList/ProblemFeedbackModal.vue b/src/views/mdc/base/modules/ProblemFeedbackList/ProblemFeedbackModal.vue
new file mode 100644
index 0000000..be7e1ee
--- /dev/null
+++ b/src/views/mdc/base/modules/ProblemFeedbackList/ProblemFeedbackModal.vue
@@ -0,0 +1,98 @@
+<template>
+  <a-modal :visible="visible" :title="title" @cancel="$emit('handleCloseModal')" @ok="handleSubmit">
+    <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
+      <a-row>
+        <a-col :span="24">
+          <a-form-model-item label="杞﹂棿" prop="productionId">
+            <a-tree-select v-model="model.productionId" :treeData="workshopTreeData" placeholder="璇烽�夋嫨杞﹂棿"
+                           :treeDefaultExpandedKeys="treeDefaultExpandedKeys"/>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-model-item label="闂鍐呭" prop="content">
+            <a-input v-model="model.content" placeholder="璇疯緭鍏ュ唴瀹�"/>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+    </a-form-model>
+  </a-modal>
+</template>
+
+<script>
+  import { httpAction, getAction } from '@/api/manage'
+
+  export default {
+    name: 'ProblemFeedbackModal',
+    components: {},
+    props: {
+      visible: {
+        type: Boolean,
+        default: false
+      },
+      title: {
+        type: String
+      },
+      workshopTreeData: {
+        type: Array
+      },
+      treeDefaultExpandedKeys: {
+        type: Array
+      }
+    },
+    data() {
+      return {
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 }
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 }
+        },
+        validatorRules: {
+          productionId: [
+            { required: true, message: '璇烽�夋嫨杞﹂棿鍚嶇О!' }
+          ]
+        },
+        url: {
+          add: '/mdc/mdcFeedback/add',
+          edit: '/mdc/mdcFeedback/edit'
+        }
+      }
+    },
+    methods: {
+      handleSubmit() {
+        const that = this
+        // 瑙﹀彂琛ㄥ崟楠岃瘉
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            let apiUrl = ''
+            let method = ''
+            if (!this.model.id) {
+              apiUrl += this.url.add
+              method = 'post'
+            } else {
+              apiUrl += this.url.edit
+              method = 'put'
+            }
+            httpAction(apiUrl, this.model, method).then((res) => {
+              if (res.success) {
+                that.$notification.success({
+                  message: '娑堟伅',
+                  description: res.message
+                })
+                that.$emit('modalFormOk')
+              } else {
+                that.$notification.warning({
+                  message: '娑堟伅',
+                  description: res.message
+                })
+              }
+            })
+          }
+        })
+      }
+    }
+  }
+</script>

--
Gitblit v1.9.3