From e3a482733c50dee14d7910da8dba3396790aebcf Mon Sep 17 00:00:00 2001 From: hzz Date: Sat, 9 Sep 2023 12:01:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=95=E4=BC=9A=E8=AE=BE=E5=A4=87=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/cisma/index.ts | 3 + src/store/module/MicroExhibition.ts | 123 ++-- .../MicroExhibition/components/BarChart.vue | 28 +- .../MicroExhibition/components/BoardBar.vue | 29 +- .../MicroExhibition/components/header2.vue | 554 ++++++++++++++++++ src/views/MicroExhibition/index.vue | 80 ++- 6 files changed, 741 insertions(+), 76 deletions(-) create mode 100644 src/views/MicroExhibition/components/header2.vue diff --git a/src/http/cisma/index.ts b/src/http/cisma/index.ts index aae60d0..e528287 100644 --- a/src/http/cisma/index.ts +++ b/src/http/cisma/index.ts @@ -7,4 +7,7 @@ export function getCismaList(){ export function getFiveList(){ return get('/cisma/getFiveList') +} +export function getTopDevice(){ + return get('/cisma/getTopDevice') } \ No newline at end of file diff --git a/src/store/module/MicroExhibition.ts b/src/store/module/MicroExhibition.ts index d31a3be..0d1d560 100644 --- a/src/store/module/MicroExhibition.ts +++ b/src/store/module/MicroExhibition.ts @@ -22,50 +22,40 @@ export const useMicroExhibitionStore = defineStore(Names.MicroExhibition, { devlist: [], devnum: { all: 17, wait: 7, off: 3, on: 7 }, caijian: { - 'value': [ //'设备名称', '设备编码', '稼动率', '状态' //0:停机 1:待机 2:工作 3:待机 - ['全自动针梭两用铺布机', '1050910', '95%', '0'], - ['全自动9公分电脑裁床', '1190269', '80%', '1'], - ], + 'value': [], 'chart': { - xData: ['1050910', '1050269'], - series: [ - { - name: '计划完成', - data: [120, 200], - type: 'bar', - barMaxWidth: 30, - }, - { - name: '实际完成', - data: [130, 180], - type: 'bar', - barMaxWidth: 30, - } - ] + xData: [], + series: [] } }, tuoxie: { - 'value': [ //'设备名称', '设备编码', '稼动率', '状态' //0:停机 1:待机 2:工作 3:待机 - ['1050910', '95%', '2'], - ], + 'value': [ ], 'chart': { - xData: ['1050910'], - series: [ - { - name: '计划完成', - data: [120], - type: 'bar', - barMaxWidth: 45, - }, - { - name: '实际完成', - data: [130], - type: 'bar', - barMaxWidth: 45, - } - ] + xData: [], + series: [] } - } + }, + "zuoyi": { + "value": [ ], + "chart": { + "series": [], + "xData": [] + } + }, + "fengzhong": { + "value": [ ], + "chart": { + "series": [], + "xData": [] + } + }, + "banfang": { + "value": [], + "chart": { + "series": [], + "xData": [] + } + }, }; }, //computed 修改一些值 @@ -79,6 +69,61 @@ export const useMicroExhibitionStore = defineStore(Names.MicroExhibition, { }, setDevnum(data) { this.devnum = data; - } + }, + setcaijian(data) { + + data.chart.series = data.chart.series.map((item) => { + item.type = 'bar' + item.barMaxWidth = 30 + return item + }) + this.caijian = data; + }, + settuoxie(data) { + + data.chart.series = data.chart.series.map((item) => { + item.type = 'bar' + item.barMaxWidth = 45 + return item + }) + this.tuoxie = data; + }, + setfengzhong(data) { + data.value = data.value.map((item,index) => { + item.unshift(index+1) + return item + }) + data.chart.series = data.chart.series.map((item) => { + item.type = 'bar' + item.barMaxWidth = 30 + return item + }) + this.fengzhong = data; + }, + setbanfang(data) { + data.value = data.value.map((item,index) => { + item.unshift(index+1) + return item + }) + data.chart.series = data.chart.series.map((item) => { + item.type = 'bar' + item.barMaxWidth = 30 + return item + }) + this.banfang = data; + }, + setzuoyi(data) { + data.value = data.value.map((item,index) => { + item.unshift(index+1) + + return item + }) + data.chart.series = data.chart.series.map((item) => { + item.type = 'bar' + item.barMaxWidth = 30 + return item + }) + this.zuoyi = data; + }, }, }); diff --git a/src/views/MicroExhibition/components/BarChart.vue b/src/views/MicroExhibition/components/BarChart.vue index 4c42d26..addb49d 100644 --- a/src/views/MicroExhibition/components/BarChart.vue +++ b/src/views/MicroExhibition/components/BarChart.vue @@ -13,20 +13,7 @@ const prop = defineProps({ }, seriesData: { type: Array, - default: [ - { - name:'计划完成', - data: [120, 200], - type: 'bar', - barMaxWidth: 30, - }, - { - name:'实际完成', - data: [130, 180], - type: 'bar', - barMaxWidth: 30, - } - ] + default: [ ] } }) @@ -66,6 +53,19 @@ watch(()=>prop.seriesData, (newVal, oldVal) => { series: newVal }); },{deep:true}) +watch(()=>prop.xData, (newVal, oldVal) => { + charts.setOption({ + + xAxis: { + type: 'category', + data: prop.xData, + // axisLabel: { + // interval: 0, //控制X轴刻度全部显示 + // rotate: 45, //倾斜角度 + // }, + }, + }); +},{deep:true}) onMounted(() => { setCharts() }) diff --git a/src/views/MicroExhibition/components/BoardBar.vue b/src/views/MicroExhibition/components/BoardBar.vue index 3440414..cfad563 100644 --- a/src/views/MicroExhibition/components/BoardBar.vue +++ b/src/views/MicroExhibition/components/BoardBar.vue @@ -8,7 +8,8 @@
- +
@@ -24,16 +25,15 @@ const devList = ref(null); const prop = defineProps({ data: { type: Array, - default: [[1, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '0'], - [2, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '1'], - [3, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '2'], - [4, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '1'], - [5, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '3'], - [6, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '1'], - [7, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '2'], - [8, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '1'], - [9, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '0'], - [10, '富怡全自动皮革缝纫机(任意转)整机', '10201421', '180分钟', '3'],] + default: [] + }, + xData: { + type: Array, + default: ['1050910', '1050269'] + }, + seriesData: { + type: Array, + default: [ ] } }) let header = ['序号', '设备名称', '设备编码', '稼动率', '状态'] @@ -52,7 +52,7 @@ let config = reactive({ columnWidth: [80, 290, 120, 120, 120, 120], align: ['center', 'center', 'center', 'center', 'center', 'center'], rowNum: 2, - waitTime: 300000, + waitTime: 3000, data: [ ] }) @@ -67,7 +67,10 @@ const handleData = () => { }) }) } - +watch(()=>prop.data, (newVal, oldVal) => { + handleData() +},{deep:true} +) const status_color = { '0': '#FF6E76', diff --git a/src/views/MicroExhibition/components/header2.vue b/src/views/MicroExhibition/components/header2.vue new file mode 100644 index 0000000..22c3317 --- /dev/null +++ b/src/views/MicroExhibition/components/header2.vue @@ -0,0 +1,554 @@ + + + + + + + diff --git a/src/views/MicroExhibition/index.vue b/src/views/MicroExhibition/index.vue index 5188e11..a8d167b 100644 --- a/src/views/MicroExhibition/index.vue +++ b/src/views/MicroExhibition/index.vue @@ -2,7 +2,7 @@
-
@@ -18,7 +18,8 @@
- +
@@ -48,7 +49,8 @@
- +
@@ -63,7 +65,8 @@
- +
@@ -92,31 +95,33 @@
离线
+