From 772313f79294f87b99dc3de00961135fe1af57b9 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期六, 20 四月 2024 20:28:10 +0800
Subject: [PATCH] 更新效率
---
src/views/mdc/components/Shift.vue | 22 ++++++-
src/views/mdc/components/Time.vue | 118 ++++++++++++++++++++++----------------
2 files changed, 87 insertions(+), 53 deletions(-)
diff --git a/src/views/mdc/components/Shift.vue b/src/views/mdc/components/Shift.vue
index 9adc08a..a0a6a2e 100644
--- a/src/views/mdc/components/Shift.vue
+++ b/src/views/mdc/components/Shift.vue
@@ -1,15 +1,16 @@
<!--
* @Date: 2024-04-18 21:52:18
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-20 19:40:06
+ * @LastEditTime: 2024-04-20 19:51: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 @click="btnListActive = item.id" :type="btnListActive == item.id ? 'primary' : ''"
+ v-for="item in btnList" :key="item.id">{{
+ item.title }}</el-button>
</el-button-group>
</el-col>
<el-col style="margin-top: 12px;">
@@ -66,8 +67,23 @@
option2: null,
}
},
+ watch: {
+ btnListActive(val) {
+ this.query({
+ ...this.params,
+ startDate: val,
+ endDate: val
+ })
+ this.queryChart({
+ ...this.params,
+ startDate: val,
+ endDate: val
+ })
+ }
+ },
methods: {
init(params) {
+ this.params = params
this.getTime({
endDate: params.endDate,
startDate: params.startDate,
diff --git a/src/views/mdc/components/Time.vue b/src/views/mdc/components/Time.vue
index 607b5e9..30cccbf 100644
--- a/src/views/mdc/components/Time.vue
+++ b/src/views/mdc/components/Time.vue
@@ -1,15 +1,17 @@
<!--
* @Date: 2024-04-18 21:52:18
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-20 19:43:36
+ * @LastEditTime: 2024-04-20 20:26:30
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Time.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 @click="statisticalMethod = item.value"
+ :type="statisticalMethod == item.value ? 'primary' : ''" v-for="item in btnList"
+ :key="item.value">{{
+ item.label }}</el-button>
</el-button-group>
</el-col>
<el-col style="margin-top: 12px;">
@@ -24,26 +26,12 @@
<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">
+ <el-table-column prop="" :label="item" v-for="item in cols">
<template #default="scope">
- <span>{{ scope.row.nameData['1'] }}</span>
+ <span>{{ scope.row.data[item] }}</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>
@@ -59,15 +47,39 @@
return {
apiObj: '',
params: {},
- statisticalMethod: 'SHIFT',
- btnList: [],
- btnListActive: '',
+ statisticalMethod: 'DAY',
+ btnList: [
+ {
+ label: '鎸夋棩鏌ョ湅',
+ value: 'DAY',
+ },
+ {
+ label: '鎸夊懆鏌ョ湅',
+ value: 'WEEK',
+ },
+ {
+ label: '鎸夋湀鏌ョ湅',
+ value: 'MONTH',
+ },
+ ],
+ cols: [],
chartsData: [],
option2: null,
}
},
+ watch: {
+ statisticalMethod(val) {
+ this.query({
+ ...this.params,
+ })
+ this.queryChart({
+ ...this.params,
+ })
+ }
+ },
methods: {
init(params) {
+ this.params = params
this.getTime({
endDate: params.endDate,
startDate: params.startDate,
@@ -75,26 +87,24 @@
}).then(res => {
this.query({
...params,
- startDate: this.btnListActive,
- endDate: this.btnListActive
+ statisticalMethod: this.statisticalMethod
})
this.queryChart({
...params,
- startDate: this.btnListActive,
- endDate: this.btnListActive
+ statisticalMethod: this.statisticalMethod
})
})
},
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
- }
- })
+ return Promise.resolve()
+ // return this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', {
+ // ...data
+ // }).then(res => {
+ // if (res.code === 200) {
+ // this.btnList = res.data
+ // }
+ // })
},
queryChart(data) {
let params = {
@@ -108,9 +118,9 @@
return this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
this.chartsData = res.data.items.records
let option2 = {
- legend: {
- type: 'plain',
- },
+ // legend: {
+ // type: 'plain',
+ // },
title: {
text: '缁熻鍥捐〃',
subtext: '',
@@ -131,23 +141,28 @@
{ type: 'slider' }
],
dataset: {
- source: [
- ['product', '鐝1', '鐝2'],
-
- ]
+ source: []
},
- series: [{
- type: 'bar',
- },
- {
- type: 'bar',
- }]
+ series: []
}
- option2.dataset.source = [['product', '鐝1', '鐝2']]
+ let source1 = ['product']
+ let row = res.data.items.records[0]
+ Object.values(row.nameData).forEach(v => {
+ option2.series.push({
+ type: 'bar',
+ })
+ source1.push(v)
+ })
+ option2.dataset.source = [source1]
res.data.items.records.forEach(v => {
- option2.dataset.source.push([v.workstationName, v.data[1] === '-' ? 0 : v.data[1], v.data[2] === '-' ? 0 : v.data[1]])
+ let current = [v.id]
+ Object.keys(v.nameData).forEach(key => {
+ current.push(row.data[key] || 0)
+ })
+ option2.dataset.source.push(current)
});
this.option2 = option2
+ console.log(option2)
})
},
query(params) {
@@ -168,6 +183,9 @@
delete dataSend.order
delete dataSend.prop
return await this.$HTTP.post('/api/blade-mdc/efficiency-analysis', dataSend, { params }).then(res => {
+ let row = res.data.items?.records[0]?.data || {}
+ this.cols = Object.keys(row)
+ console.log(this.cols)
return {
...res,
data: res.data.items
--
Gitblit v1.9.3