From baf140f1668a508a566f8ee04077ea5900090a66 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 21 一月 2025 09:59:49 +0800
Subject: [PATCH] OEE页面新增计算OEE功能

---
 src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue |   14 ++++++
 src/api/mdc.js                                             |    5 ++
 src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue |   88 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/src/api/mdc.js b/src/api/mdc.js
index c1d0fd0..587c235 100644
--- a/src/api/mdc.js
+++ b/src/api/mdc.js
@@ -40,5 +40,8 @@
   // 鍒犻櫎璁惧鍙傛暟闃堝��
   deleteParamThresholdApi: id => deleteAction('/mdc/mdcEquipmentThreshold/delete', { id }),
   // 鍒犻櫎璁惧鍙傛暟闃堝��
-  deleteBatchParamThresholdApi: ids => deleteAction('/mdc/mdcEquipmentThreshold/deleteBatch', { ids })
+  deleteBatchParamThresholdApi: ids => deleteAction('/mdc/mdcEquipmentThreshold/deleteBatch', { ids }),
+  // -------------------------------------OEE椤甸潰--------------------------------------------
+  // 璁$畻OEE
+  computeOeeApi: params => postAction('/mdc/mdcOeeInfo/computeOee', params)
 }
\ No newline at end of file
diff --git a/src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue b/src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue
new file mode 100644
index 0000000..1445eee
--- /dev/null
+++ b/src/views/mdc/base/modules/OEEAnalysis/ComputeOeeModal.vue
@@ -0,0 +1,88 @@
+<template>
+  <a-modal title="璁$畻OEE" :visible="visible" :width="550" @cancel="handleModalClose" @ok="handleComputeOee"
+           :maskClosable="false">
+    <a-form-model :model="model" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
+      <a-row>
+        <a-col :span="24">
+          <a-form-model-item label="鏃ユ湡">
+            <a-range-picker v-model="dates" style="width: 100%" value-format="YYYY-MM-DD"
+                            @change="dateParamChange"></a-range-picker>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+    </a-form-model>
+  </a-modal>
+</template>
+
+<script>
+  import mdcApi from '@/api/mdc'
+
+  export default {
+    name: 'ComputeOeeModal',
+    components: {},
+    data() {
+      return {
+        visible: false,
+        model: {},
+        dates: [],
+        labelColLong: {
+          xs: { span: 24 },
+          sm: { span: 3 }
+        },
+        wrapperColLong: {
+          xs: { span: 24 },
+          sm: { span: 21 }
+        }
+      }
+    },
+    methods: {
+      handleComputeOee() {
+        console.log('model', this.model)
+        if (this.dates.length === 0) {
+          this.$notification.warning({
+            message: '娑堟伅',
+            description: '璇烽�夋嫨鏃堕棿'
+          })
+          return
+        }
+
+        mdcApi.computeOeeApi(this.model)
+          .then(res => {
+            if (res.success) {
+              this.$notification.success({
+                message: '娑堟伅',
+                description: res.message
+              })
+              this.visible = false
+            } else {
+              this.$notification.error({
+                message: '娑堟伅',
+                description: '璁$畻澶辫触'
+              })
+            }
+          })
+          .catch(err => {
+            this.$notification.error({
+              message: '娑堟伅',
+              description: '璁$畻澶辫触'
+            })
+          })
+      },
+
+      dateParamChange(value1, value2) {
+        this.model.startTime = value2[0]
+        this.model.endTime = value2[1]
+      },
+
+      handleModalClose() {
+        this.visible = false
+        this.model = {}
+        this.dates = []
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue b/src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue
index 5f19c98..ebcf65f 100644
--- a/src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue
+++ b/src/views/mdc/base/modules/OEEAnalysis/OEEAnalysisList.vue
@@ -28,6 +28,7 @@
     <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
     <div class="table-operator">
       <a-button type="primary" icon="download" @click="handleExportXls('OEE')">瀵煎嚭</a-button>
+      <a-button type="primary" icon="edit" @click="handleComputeModalOpen">璁$畻</a-button>
     </div>
 
     <!-- table鍖哄煙-begin -->
@@ -47,17 +48,20 @@
         </template>
       </a-table>
     </div>
+
+    <ComputeOeeModal ref="computeOeeModalRef"/>
   </div>
 </template>
 
 <script>
   import moment from 'moment'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import ComputeOeeModal from './ComputeOeeModal'
 
   export default {
     name: 'OEEAnalysisList',
     mixins: [JeecgListMixin],
-    components: {},
+    components: { ComputeOeeModal },
     props: { nodeTree: '', Type: '', nodePeople: '' },
     data() {
       return {
@@ -217,11 +221,18 @@
       }
     },
     methods: {
+      handleComputeModalOpen() {
+        console.log('瑙﹀彂杩涘叆open')
+        const { $refs } = this
+        $refs.computeOeeModalRef.visible = true
+      },
+
       dateParamChange(v1, v2) {
         this.queryParam.startTime = v2[0]
         this.queryParam.endTime = v2[1]
         this.dates = [v1[0], v1[1]]
       },
+
       searchReset() {
         this.dates = [moment().subtract(1, 'day'), moment()]
         this.queryParam = {
@@ -230,6 +241,7 @@
         }
         this.loadData(1)
       },
+
       /**
        * 褰撴祻瑙堝櫒鍙绐楀彛灏哄鍙戠敓鏀瑰彉鏃惰Е鍙�
        */

--
Gitblit v1.9.3