From e28dcf85c227f3df8f72ec0e436a89233e9d8e0b Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期四, 18 四月 2024 23:57:44 +0800
Subject: [PATCH] Merge branch 'master' of http://www.beijingsoft.cn:9090/r/smart-web

---
 src/views/mdc/components/Shift.vue    |  168 +++++++++++++++++++++++++++++++++
 src/views/mdc/components/Time.vue     |   19 +++
 package.json                          |    1 
 src/views/mdc/MYTree.vue              |   16 ++
 src/views/mdc/efficiency-analysis.vue |   89 +++++++++++++++--
 5 files changed, 279 insertions(+), 14 deletions(-)

diff --git a/package.json b/package.json
index ad9998c..761103b 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
 		"deepmerge": "^1.5.2",
 		"echarts": "5.4.1",
 		"element-plus": "2.2.32",
+		"moment": "^2.30.1",
 		"nprogress": "0.2.0",
 		"qrcodejs2": "0.0.2",
 		"qs": "6.7.0",
diff --git a/src/views/mdc/MYTree.vue b/src/views/mdc/MYTree.vue
index c54ec8f..0d290aa 100644
--- a/src/views/mdc/MYTree.vue
+++ b/src/views/mdc/MYTree.vue
@@ -1,16 +1,17 @@
 <!--
  * @Date: 2024-04-18 19:53:35
  * @LastEditors: Sneed
- * @LastEditTime: 2024-04-18 20:56:37
+ * @LastEditTime: 2024-04-18 21:30:19
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/MYTree.vue
 -->
 <template>
     <el-tree ref="treeRef" v-bind="$attrs" :show-checkbox="showCheckbox" :current-node-key="currentNodeKey"
         node-key="id" :props="defalutProps" :data="data" @check-change="checkChange" @node-click="handleNodeClick"
-        highlight-current default-expand-all></el-tree>
+        highlight-current default-expand-all :render-content="renderContent"></el-tree>
 </template>
 
 <script>
+import pmsPng from '@/assets/pms.png'
 export default {
     props: {
         showCheckbox: {
@@ -20,6 +21,7 @@
     },
     data() {
         return {
+            pmsPng,
             firstWorkKey: '',
             currentNodeKey: '',
             defalutProps: {
@@ -44,6 +46,16 @@
         this.getList()
     },
     methods: {
+        renderContent(h, { data }) {
+            let img = data.groupTag == 'fms_beltline'
+            return h('span', {
+
+            },
+                img ? h('img', {
+                    src: pmsPng
+                }, '') : '',
+                data.title)
+        },
         getList() {
             this.$HTTP.post('/api/blade-cps/group/groupWorkstation/type', {
                 groupCategory: 1,
diff --git a/src/views/mdc/components/Shift.vue b/src/views/mdc/components/Shift.vue
new file mode 100644
index 0000000..0570c69
--- /dev/null
+++ b/src/views/mdc/components/Shift.vue
@@ -0,0 +1,168 @@
+<!--
+ * @Date: 2024-04-18 21:52:18
+ * @LastEditors: Sneed
+ * @LastEditTime: 2024-04-18 23:43:13
+ * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Shift.vue
+-->
+<template>
+    <el-row>
+        <el-col>
+            <el-button-group>
+                <el-button :type="btnListActive == item.id ? 'primary' : ''" v-for="item in btnList" :key="item.id">{{
+                    item.title }}</el-button>
+            </el-button-group>
+        </el-col>
+        <el-col>
+            <el-card shadow="never">
+                <scEcharts height="300px" :option="option2"></scEcharts>
+            </el-card>
+        </el-col>
+        <el-col>
+            缁熻鏁版嵁
+        </el-col>
+        <el-col>
+            <scTable ref="table" row-key="id" border :params="params" :apiObj="apiObj" stripe>
+                <el-table-column prop="workstationCode" label="宸ヤ綅缂栫爜" />
+                <el-table-column prop="workstationName" label="宸ヤ綅鍚嶇О" />
+                <el-table-column prop="" label="鐝1">
+                    <template #default="scope">
+                        <span>{{ scope.row.nameData['1'] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="" label="鏁堢巼">
+                    <template #default="scope">
+                        <span>{{ scope.row.data['1'] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="" label="鐝2">
+                    <template #default="scope">
+                        <span>{{ scope.row.nameData['2'] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="" label="鏁堢巼">
+                    <template #default="scope">
+                        <span>{{ scope.row.data['2'] }}</span>
+                    </template>
+                </el-table-column>
+            </scTable>
+        </el-col>
+    </el-row>
+</template>
+
+<script>
+import scEcharts from '@/components/scEcharts';
+export default {
+    components: {
+        scEcharts
+    },
+    data() {
+        return {
+            apiObj: '',
+            params: {},
+            statisticalMethod: 'SHIFT',
+            btnList: [],
+            btnListActive: '',
+            chartsData: [],
+            option2: {
+                title: {
+                    text: '缁熻鍥捐〃',
+                    subtext: '鍩虹鎶樼嚎鍥�',
+                },
+                grid: {
+                    top: '80px'
+                },
+                tooltip: {
+                    trigger: 'axis'
+                },
+                xAxis: {
+                    type: 'category',
+                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+                },
+                yAxis: {
+                    type: 'value'
+                },
+                series: [{
+                    data: [120, 200, 150, 80, 70, 110, 130],
+                    type: 'line',
+                },
+                {
+                    data: [110, 180, 120, 120, 60, 90, 110],
+                    type: 'line',
+                }]
+            },
+        }
+    },
+    methods: {
+        init(params) {
+            this.getTime({
+                endDate: params.endDate,
+                startDate: params.startDate,
+                statisticalMethod: this.statisticalMethod
+            }).then(res => {
+                this.query({
+                    ...params,
+                    startDate: this.btnListActive,
+                    endDate: this.btnListActive
+                })
+                this.queryChart({
+                    ...params,
+                    startDate: this.btnListActive,
+                    endDate: this.btnListActive
+                })
+            })
+
+        },
+        getTime(data) {
+            return this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', {
+                ...data
+            }).then(res => {
+                if (res.code === 200) {
+                    this.btnList = res.data
+                    this.btnListActive = res?.data?.[0]?.id
+                }
+            })
+        },
+        queryChart(data) {
+            let params = {
+                size: -1
+            }
+            let dataSend = {
+                ...data,
+                queryType: 0,
+                statisticalMethod: this.statisticalMethod
+            }
+            return this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
+                this.chartsData = res.data.items.records
+            })
+        },
+        query(params) {
+            this.params = params
+            this.apiObj = {
+                get: async (data) => {
+                    let params = {
+                        current: data.current,
+                        size: data.size
+                    }
+                    let dataSend = {
+                        ...data,
+                        queryType: 1,
+                        statisticalMethod: this.statisticalMethod
+                    }
+                    delete dataSend.current
+                    delete dataSend.size
+                    delete dataSend.order
+                    delete dataSend.prop
+                    return await this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
+                        return {
+                            ...res,
+                            data: res.data.items
+                        }
+                    })
+                }
+            }
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/src/views/mdc/components/Time.vue b/src/views/mdc/components/Time.vue
new file mode 100644
index 0000000..6578296
--- /dev/null
+++ b/src/views/mdc/components/Time.vue
@@ -0,0 +1,19 @@
+<!--
+ * @Date: 2024-04-18 21:52:28
+ * @LastEditors: Sneed
+ * @LastEditTime: 2024-04-18 21:54:53
+ * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Time.vue
+-->
+<template>
+    <div>
+
+    </div>
+</template>
+
+<script>
+export default {
+
+}
+</script>
+
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/src/views/mdc/efficiency-analysis.vue b/src/views/mdc/efficiency-analysis.vue
index 9160c0e..a8ebf55 100644
--- a/src/views/mdc/efficiency-analysis.vue
+++ b/src/views/mdc/efficiency-analysis.vue
@@ -1,55 +1,120 @@
 <!--
  * @Date: 2024-04-09 22:11:21
  * @LastEditors: Sneed
- * @LastEditTime: 2024-04-18 20:57:46
+ * @LastEditTime: 2024-04-18 22:47:36
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/efficiency-analysis.vue
  * 鏁堢巼鍒嗘瀽
 -->
 <template>
-    <el-main>
-        <el-card shadow="never">
-            <el-container>
-                <el-aside width="200px" v-loading="showGrouploading">
+    <el-main style="height: 100%;">
+        <el-card shadow="never" style="height: 100%;" body-style="height: 100%">
+            <el-container style="height: 100%;">
+                <el-aside width="300px" style="height: 100%;">
                     <el-container>
                         <el-main class="nopadding">
                             <el-row>
                                 <el-col>缁熻鏁版嵁</el-col>
                                 <el-col>
-                                    <el-select></el-select>
+                                    <el-select style="width: 250px" v-model="productivityType">
+                                        <el-option v-for="(item, index) in options" :key="index" :label="item.label"
+                                            :value="item.value"></el-option>
+                                    </el-select>
                                 </el-col>
-                                <el-col>鏃ユ湡</el-col>
+                                <el-col style="margin-top: 14px;">鏃ユ湡</el-col>
                                 <el-col>
-                                    <el-select></el-select>
+                                    <el-date-picker value-format="YYYY-MM-DD" style="width: 250px" v-model="time"
+                                        type="daterange" range-separator="-" start-placeholder="" end-placeholder="" />
                                 </el-col>
+                            </el-row>
+                            <el-row style="margin-top: 14px;">
+                                宸ヤ綅
                             </el-row>
                             <MYTree v-model="treeChecked" show-checkbox></MYTree>
                         </el-main>
+                        <el-footer>
+                            <el-button @click="query">鏌ヨ</el-button>
+                            <el-button>瀵煎嚭</el-button>
+                        </el-footer>
                     </el-container>
                 </el-aside>
+                <el-container>
+                    <el-main>
+                        <el-tabs tab-position="top" v-model="activeName" type="card">
+                            <el-tab-pane label="鎸夌彮娆$粺璁�" name="shift">
+                                <Shift ref="shift" v-if="activeName == 'shift'" />
+                            </el-tab-pane>
+                            <el-tab-pane label="鎸夋椂闂村懆鏈熺粺璁�" name="time">
+                                <Time ref="time" v-if="activeName == 'time'" />
+                            </el-tab-pane>
+                        </el-tabs>
+                    </el-main>
+                </el-container>
             </el-container>
         </el-card>
     </el-main>
 </template>
 
 <script>
+import moment from 'moment';
 import MYTree from './MYTree.vue'
+import Shift from './components/Shift.vue'
+import Time from './components/Time.vue'
+
 export default {
     components: {
         MYTree,
+        Shift,
+        Time
     },
     watch: {
         treeChecked(value) {
-            this.query(value)
+            // this.query(value)
         }
     },
     data() {
         return {
-            treeChecked: []
+            activeName: 'shift',
+            productivityType: 'OEE',
+            time: [],
+            treeChecked: [],
+            options: [
+                {
+                    label: '绋煎姩鐜�',
+                    value: 'OEE',
+                },
+                {
+                    label: '鎶ヨ鐜�',
+                    value: 'ALARM',
+                },
+                {
+                    label: '杩愯鐜�',
+                    value: 'RUNNING',
+                },
+            ]
         }
     },
+    created() {
+        this.time = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]
+    },
+    mounted() {
+        this.query()
+    },
     methods: {
-        query(vals) {
-            console.log([...vals])
+        query() {
+            this.$refs[this.activeName].init({
+                endDate: this.time[1],
+                startDate: this.time[0],
+                productivityType: this.productivityType,
+                shiftIndexList: [1, 2],
+                workStationIdList: [...this.treeChecked]
+            })
+            // this.$HTTP.post('/api/blade-mdc/efficiency-analysis?size=-1', {
+
+            // })
+            // this.$HTTP.post('/api/blade-mdc/efficiency-analysis?current=1&size=15', {
+
+            // })
+            // this.$HTTP.post('/api/blade-cps/workstation-wcs-feedback/feedback-status', [...vals])
         }
     }
 }

--
Gitblit v1.9.3