diff --git a/src/api/analysis/energyAnalysis.js b/src/api/analysis/energyAnalysis.js index 16e466bd..204f5137 100644 --- a/src/api/analysis/energyAnalysis.js +++ b/src/api/analysis/energyAnalysis.js @@ -8,7 +8,15 @@ export function getEnergyTrend(data) { data: data }) } - +// 导出走势分析数据 +export function exportTrend(data) { + return request({ + url: '/analysis/energy-analysis/exportTrend', + method: 'post', + data: data, + responseType: 'blob' + }) +} // 获取对比分析数据 export function getCompare(data) { return request({ @@ -34,4 +42,4 @@ export function getQoq(data) { method: 'post', data: data }) -} \ No newline at end of file +} diff --git a/src/api/home.js b/src/api/home.js new file mode 100644 index 00000000..666207a5 --- /dev/null +++ b/src/api/home.js @@ -0,0 +1,54 @@ +/* + * @Author: zwq + * @Date: 2024-09-12 13:38:33 + * @LastEditors: zwq + * @LastEditTime: 2024-09-13 15:25:07 + * @Description: + */ +import request from '@/utils/request' +// 获得首页生产总览以及工单监控 +export function getHomeOrder(data) { + return request({ + url: '/base/core-work-order/homeOrder', + method: 'post', + data: data + }) +} +// 获得首页生产总览-完成订单数量 +export function getHomeOrderNum(data) { + return request({ + url: '/base/order/homeOrder', + method: 'post', + data: data + }) +} +// 首页设备总览 +export function getHomeEquipment() { + return request({ + url: '/monitoring/equipment-monitor/homeEquipment', + method: 'get' + }) +} + +// 首页设备报警信息 +export function getHomeEquipmentAlarmList() { + return request({ + url: '/base/equipment-alarm-realtime/homeEquipmentAlarmList', + method: 'get' + }) +} +// 获取是否存在报警(右上角红点) +export function getHomeGetAlarm() { + return request({ + url: '/base/core-alarm-log/homeGetAlarm', + method: 'get' + }) +} +// 条件查询获得异常警告列表 +export function getHomeAlarmList(query) { + return request({ + url: '/base/core-alarm-log/listbyfilter', + method: 'get', + params: query + }) +} diff --git a/src/assets/icons/svg/home-alarm-white-circle.svg b/src/assets/icons/svg/home-alarm-white-circle.svg new file mode 100644 index 00000000..ee493e91 --- /dev/null +++ b/src/assets/icons/svg/home-alarm-white-circle.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/assets/icons/svg/home-alarm-white.svg b/src/assets/icons/svg/home-alarm-white.svg index f1eb9020..cd0baab3 100644 --- a/src/assets/icons/svg/home-alarm-white.svg +++ b/src/assets/icons/svg/home-alarm-white.svg @@ -8,8 +8,7 @@ - - \ No newline at end of file + diff --git a/src/components/ButtonNav/index.vue b/src/components/ButtonNav/index.vue new file mode 100644 index 00000000..c3bc57aa --- /dev/null +++ b/src/components/ButtonNav/index.vue @@ -0,0 +1,132 @@ + + + + + + + + + diff --git a/src/views/abnormalWarning/alarmGrade.vue b/src/views/abnormalWarning/alarmGrade.vue new file mode 100644 index 00000000..62ffe645 --- /dev/null +++ b/src/views/abnormalWarning/alarmGrade.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/views/abnormalWarning/index.vue b/src/views/abnormalWarning/index.vue index 302512e0..b0e75bf2 100644 --- a/src/views/abnormalWarning/index.vue +++ b/src/views/abnormalWarning/index.vue @@ -34,6 +34,12 @@ import Navbar from './components/Navbar'; import moment from 'moment'; import tableHeightMixin from '@/mixins/tableHeightMixin'; +import { listData } from '@/api/system/dict/data'; +import alarmGrade from './alarmGrade.vue' +import { + getHomeAlarmList +} from '@/api/home'; + export default { name: 'AbnormalWarning', mixins: [tableHeightMixin], @@ -45,25 +51,28 @@ export default { type: 'input', label: '报警来源', placeholder: '报警来源', - param: 'content', + param: 'alarmSource', }, { - type: 'select', + type: 'datePicker', label: '时间段', - selectOptions: [], - labelField: 'name', - valueField: 'id', - param: 'typeId', - filterable: true, + dateType: 'daterange', + format: 'yyyy-MM-dd', + valueFormat: 'timestamp', + rangeSeparator: '-', + startPlaceholder: '开始时间', + endPlaceholder: '结束时间', + param: 'alarmTime', }, { type: 'select', label: '报警级别', selectOptions: [], - labelField: 'name', - valueField: 'id', - param: 'typeId', + param: 'alarmGrade', + defaultSelect: '', filterable: true, + labelField: 'label', + valueField: 'value', }, { type: 'button', @@ -75,60 +84,79 @@ export default { heightNum: 280, tableProps: [ { - prop: 'createTime', + prop: 'alarmTime', label: '报警时间', width: 180, filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), }, { - prop: 'productionLineName1', + prop: 'alarmSource', label: '报警来源', showOverflowtooltip: true, }, { - prop: 'productionLineName2', + prop: 'alarmType', label: '报警类型', showOverflowtooltip: true, }, { - prop: 'productionLineName3', + prop: 'alarmGrade', label: '报警级别', showOverflowtooltip: true, + subcomponent: alarmGrade }, { - prop: 'productionLineName4', + prop: 'alarmReason', label: '报警原因', showOverflowtooltip: true, }, { - prop: 'sectionName5', + prop: 'alarmContent', label: '报警详情', showOverflowtooltip: true, }, ], - list: [ - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - ], + list: [], + listQuery: { + alarmSource: undefined, + alarmTime: undefined, + alarmGrade: undefined, + } }; }, - created() {}, + created() { + const queryParams = { + pageNo: 1, + pageSize: 99, + dictType: 'equ_alarm_level', + }; + listData(queryParams).then((response) => { + this.formConfig[2].selectOptions = response.data.list; + }); + this.getDataList() + }, methods: { - buttonClick(val) {}, + buttonClick(val) { + switch (val.btnName) { + case 'search': + this.listQuery.alarmSource = val.alarmSource; + this.listQuery.alarmGrade = val.alarmGrade; + this.listQuery.alarmTime = val.alarmTime ? val.alarmTime : null; + this.getDataList(); + break; + default: + console.log(val); + } + }, + getDataList(){ + getHomeAlarmList(this.listQuery).then(response => { + if(response.hasOwnProperty('data')){ + this.list = response.data; + }else{ + this.list = [] + } + }); + }, toHome() { this.$router.push({ path: '/' }); }, diff --git a/src/views/devConfig/base/coreEquipment/components/AssetsUpload.vue b/src/views/devConfig/base/coreEquipment/components/AssetsUpload.vue new file mode 100644 index 00000000..b693a442 --- /dev/null +++ b/src/views/devConfig/base/coreEquipment/components/AssetsUpload.vue @@ -0,0 +1,399 @@ + + + + + + + diff --git a/src/views/devConfig/base/coreEquipment/components/DialogForm.vue b/src/views/devConfig/base/coreEquipment/components/DialogForm.vue new file mode 100644 index 00000000..39c16824 --- /dev/null +++ b/src/views/devConfig/base/coreEquipment/components/DialogForm.vue @@ -0,0 +1,313 @@ + + + + + + + diff --git a/src/views/devConfig/base/coreEquipment/components/EquipmentDrawer.vue b/src/views/devConfig/base/coreEquipment/components/EquipmentDrawer.vue new file mode 100644 index 00000000..3c58a5c9 --- /dev/null +++ b/src/views/devConfig/base/coreEquipment/components/EquipmentDrawer.vue @@ -0,0 +1,550 @@ + + + + + + + diff --git a/src/views/devConfig/base/coreEquipment/components/EquipmentInfoForm.vue b/src/views/devConfig/base/coreEquipment/components/EquipmentInfoForm.vue new file mode 100644 index 00000000..926c850a --- /dev/null +++ b/src/views/devConfig/base/coreEquipment/components/EquipmentInfoForm.vue @@ -0,0 +1,288 @@ + + + + + + + diff --git a/src/views/devConfig/base/coreEquipment/index.vue b/src/views/devConfig/base/coreEquipment/index.vue new file mode 100644 index 00000000..fbf9c10a --- /dev/null +++ b/src/views/devConfig/base/coreEquipment/index.vue @@ -0,0 +1,689 @@ + + + diff --git a/src/views/devConfig/base/coreEquipmentLineBind/index.vue b/src/views/devConfig/base/coreEquipmentLineBind/index.vue new file mode 100644 index 00000000..5aba7c9c --- /dev/null +++ b/src/views/devConfig/base/coreEquipmentLineBind/index.vue @@ -0,0 +1,370 @@ + + + diff --git a/src/views/devConfig/base/coreEquipmentType/index.vue b/src/views/devConfig/base/coreEquipmentType/index.vue new file mode 100644 index 00000000..60e9e1b2 --- /dev/null +++ b/src/views/devConfig/base/coreEquipmentType/index.vue @@ -0,0 +1,312 @@ + + + diff --git a/src/views/devConfig/base/coreProductionLine/add-or-updata.vue b/src/views/devConfig/base/coreProductionLine/add-or-updata.vue new file mode 100644 index 00000000..c9f85e26 --- /dev/null +++ b/src/views/devConfig/base/coreProductionLine/add-or-updata.vue @@ -0,0 +1,163 @@ + + + + diff --git a/src/views/devConfig/base/coreProductionLine/index.vue b/src/views/devConfig/base/coreProductionLine/index.vue new file mode 100644 index 00000000..d041ac36 --- /dev/null +++ b/src/views/devConfig/base/coreProductionLine/index.vue @@ -0,0 +1,204 @@ + + + diff --git a/src/views/devConfig/base/coreWorkshopSection/add-or-updata.vue b/src/views/devConfig/base/coreWorkshopSection/add-or-updata.vue new file mode 100644 index 00000000..546b50b7 --- /dev/null +++ b/src/views/devConfig/base/coreWorkshopSection/add-or-updata.vue @@ -0,0 +1,105 @@ + + + + diff --git a/src/views/devConfig/base/coreWorkshopSection/index.vue b/src/views/devConfig/base/coreWorkshopSection/index.vue new file mode 100644 index 00000000..5e65880f --- /dev/null +++ b/src/views/devConfig/base/coreWorkshopSection/index.vue @@ -0,0 +1,165 @@ + + + diff --git a/src/views/devConfig/base/factory/add-or-updata.vue b/src/views/devConfig/base/factory/add-or-updata.vue new file mode 100644 index 00000000..798c5bd3 --- /dev/null +++ b/src/views/devConfig/base/factory/add-or-updata.vue @@ -0,0 +1,90 @@ + + + + diff --git a/src/views/devConfig/base/factory/index.vue b/src/views/devConfig/base/factory/index.vue new file mode 100644 index 00000000..59ced405 --- /dev/null +++ b/src/views/devConfig/base/factory/index.vue @@ -0,0 +1,184 @@ + + + diff --git a/src/views/devConfig/energy/energyLimit/index.vue b/src/views/devConfig/energy/energyLimit/index.vue index 1b82ab8b..841ae375 100644 --- a/src/views/devConfig/energy/energyLimit/index.vue +++ b/src/views/devConfig/energy/energyLimit/index.vue @@ -241,7 +241,9 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$modal.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?').then(function() { + this.$modal + .delConfirm(row.objName) + .then(function() { return deleteEnergyLimit(row.id); }).then(() => { this.queryParams.pageNo = 1; diff --git a/src/views/devConfig/energy/energyPlcConnect/index.vue b/src/views/devConfig/energy/energyPlcConnect/index.vue index c5b679ef..672ce11b 100644 --- a/src/views/devConfig/energy/energyPlcConnect/index.vue +++ b/src/views/devConfig/energy/energyPlcConnect/index.vue @@ -63,7 +63,7 @@ const tableProps = [ label: '对象编码' }, { - prop: 'plcTableName', + prop: 'plcTableName', label: '关联表名' }, { @@ -230,7 +230,9 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$modal.confirm('是否确认删除对象为"' + row.objName + '"的数据项?').then(function() { + this.$modal + .delConfirm(row.objName) + .then(function() { return deleteEnergyPlcConnect(row.id); }).then(() => { this.queryParams.pageNo = 1; diff --git a/src/views/devConfig/energy/energyStatistics/index.vue b/src/views/devConfig/energy/energyStatistics/index.vue index 87f6aa54..ef5e9fd3 100644 --- a/src/views/devConfig/energy/energyStatistics/index.vue +++ b/src/views/devConfig/energy/energyStatistics/index.vue @@ -63,7 +63,7 @@ const tableProps = [ showOverflowtooltip: true }, { - prop: 'type', + prop: 'type', label: '统计类型', filter: publicFormatter('statistic_type') }, @@ -224,7 +224,9 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function() { + this.$modal + .delConfirm(row.name) + .then(function() { return deleteEnergyStatistics(row.id); }).then(() => { this.queryParams.pageNo = 1; diff --git a/src/views/devConfig/energy/energyType/index.vue b/src/views/devConfig/energy/energyType/index.vue index 57fa05f1..8a064199 100644 --- a/src/views/devConfig/energy/energyType/index.vue +++ b/src/views/devConfig/energy/energyType/index.vue @@ -205,7 +205,9 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() { + this.$modal + .delConfirm(row.name) + .then(function() { return deleteEnergyType(row.id); }).then(() => { this.queryParams.pageNo = 1; diff --git a/src/views/energy/analysis/contrastAnalysis/index.vue b/src/views/energy/analysis/contrastAnalysis/index.vue index f7efef08..259c3619 100644 --- a/src/views/energy/analysis/contrastAnalysis/index.vue +++ b/src/views/energy/analysis/contrastAnalysis/index.vue @@ -2,14 +2,17 @@
- - - - - - - - +
+ + +
@@ -18,50 +21,96 @@ import { getCompare } from "@/api/analysis/energyAnalysis" import SearchArea from "./components/searchArea" import BarChart from "./components/barChart" -import LineChart from "./components/lineChart" +import tableHeightMixin from '@/mixins/tableHeightMixin'; +import FileSaver from 'file-saver'; +import * as XLSX from 'xlsx/xlsx.mjs'; // import moment from 'moment' export default { name: 'ContrastAnalysis', - components: { SearchArea, BarChart, LineChart }, + components: { SearchArea, BarChart }, + mixins: [tableHeightMixin], data() { return { isFold: false, - activeName: 'bar', - chartData: [], - timeDim: '' + chartData: [], + timeDim: '', + tableProps: [], + list: [], + tableH: this.tableHeight(250) / 2, } }, mounted() { window.addEventListener('resize', () => { this.tableH = this.tableHeight(260) - this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437) + this.isFold = this.searchBarWidth('contrastAnalysisBox', 1310) // console.log(document.getElementById("contrastAnalysisBox").offsetWidth) }) - this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437) + this.isFold = this.searchBarWidth('contrastAnalysisBox', 1310) }, methods: { + _setTableHeight() { + this.tableH = this.tableHeight(250) / 2; + }, getList(params) { this.timeDim = params.timeDim getCompare({ ...params }).then((res) => { - console.log(res) - if (res.code === 0) { - this.chartData = res.data || [] + if (res.code === 0) { + this.getTableList(res.data || []); + this.chartData = res.data || []; } else { this.chartData = [] } }) }, - switchChart() { - if (this.activeName === 'bar') { - this.$nextTick((res) => { - this.$refs.analysisBarChart.getChart() - }) - } else { - this.$nextTick((res) => { - this.$refs.analysisLineChart.getChart() - }) - } - } + getTableList(arr) { + this.tableProps = []; + this.list = []; + let tempX = []; + let timeArr = arr[0].trendRespVOList || []; + this.list = timeArr.map((item) => { + return { time: item.time }; + }); + for (let i = 0; i < arr.length; i++) { + let obj = {}; + obj.prop = arr[i].objId; + obj.label = arr[i].objName; + obj.minWidth = 100; + tempX.push(obj); + let tiemList = arr[i].trendRespVOList; + for (let j = 0; j < tiemList.length; j++) { + this.list[j][arr[i].objId] = tiemList[j].useNum + ? tiemList[j].useNum.toFixed(2) + : null; + } + } + this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX); + }, + // 导出 + exportExl() { + if (this.list.length > 0) { + var wb = XLSX.utils.table_to_book( + document.querySelector('.contrast-out-table') + ); + let fileName = '对比分析.xlsx'; + var wbout = XLSX.write(wb, { + bookType: 'xlsx', + bookSST: true, + type: 'array', + }); + try { + FileSaver.saveAs( + new Blob([wbout], { type: 'application/octet-stream' }), + fileName + ); + this.$message.success('导出成功'); + } catch (e) { + if (typeof console !== 'undefined') console.log(e, wbout); + } + return wbout; + } else { + this.$modal.msgWarning('暂无数据导出'); + } + }, } } @@ -93,4 +142,4 @@ export default { color: rgba(0, 0, 0, 0.45); } } - \ No newline at end of file + diff --git a/src/views/energy/analysis/index.vue b/src/views/energy/analysis/index.vue new file mode 100644 index 00000000..a74f898c --- /dev/null +++ b/src/views/energy/analysis/index.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/views/energy/analysis/trendAnalysis/components/searchArea.vue b/src/views/energy/analysis/trendAnalysis/components/searchArea.vue index b563296e..b639b608 100644 --- a/src/views/energy/analysis/trendAnalysis/components/searchArea.vue +++ b/src/views/energy/analysis/trendAnalysis/components/searchArea.vue @@ -1,456 +1,489 @@ - \ No newline at end of file + diff --git a/src/views/energy/analysis/trendAnalysis/index.vue b/src/views/energy/analysis/trendAnalysis/index.vue index 20b5402c..91c06a6a 100644 --- a/src/views/energy/analysis/trendAnalysis/index.vue +++ b/src/views/energy/analysis/trendAnalysis/index.vue @@ -1,94 +1,104 @@ + \ No newline at end of file + diff --git a/src/views/home/components/NavbarRight.vue b/src/views/home/components/NavbarRight.vue index 9118446a..d9578af9 100644 --- a/src/views/home/components/NavbarRight.vue +++ b/src/views/home/components/NavbarRight.vue @@ -6,7 +6,7 @@ style="font-size: 24px; cursor: pointer" @click="toHome" /> --> @@ -46,16 +46,15 @@ import moment from 'moment'; import { getUser } from '@/api/system/user.js'; import { getPath } from '@/utils/ruoyi'; +import { getHomeGetAlarm } from '@/api/home'; export default { name: 'navRight', data() { return { - // topDate: '', - // topTime: '', - // timeZone: '', timer: '', dept: ' ', nickname: this.$store.getters.nickname, + isAlarm: false, }; }, props: { @@ -68,21 +67,18 @@ export default { }, created() { this.getUserMsg(); - // this.getTime(); + this.getHomeGetAlarm(); + this.timer = setInterval(this.getHomeGetAlarm(), 3600000); + }, + beforeDestroy() { + clearInterval(this.timer); }, - // beforeDestroy() { - // clearInterval(this.timer); - // }, methods: { - // getTime() { - // let _this = this; - // this.timer = setInterval(function () { - // _this.topDate = moment().format('YYYY/MM/DD'); - // let temp = moment().format('A-hh:mm').split('-'); - // _this.timeZone = temp[0]; - // _this.topTime = temp[1]; - // }, 1000); - // }, + getHomeGetAlarm() { + getHomeGetAlarm().then((response) => { + this.isAlarm = response.data || false; + }); + }, getUserMsg() { let id = this.$store.getters.userId; getUser(id).then((res) => { diff --git a/src/views/home/index.vue b/src/views/home/index.vue index af987e32..ec1d4937 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -3,50 +3,47 @@
-
- - - - - - -
(6.13-6.20)
-
- - {{ topTime + timeZone }} - - {{ topDate }} -
-
生产总览 +
+ + + + + + +
+
( {{ showTime }} )
-
9,301.01
+
{{ homeProduce.quantity }}
产量/千片
-
94.34
+
{{ homeProduce.yieldRate }}
良品率/%
-
29,301.01
+
{{ homeProduce.endWorkOrderQuantity }}
完成工单数量/千片
-
1,340
+
{{ homeProduce.endOrderQuantity }}
完成订单数量/个
@@ -55,22 +52,29 @@
设备总览 +
-
2,931
+
{{ homeDevice.allEquipment }}
设备总数/台
-
931
+
{{ homeDevice.onlineEquipment }}
在线设备总数/台
-
7
+
{{ homeDevice.errorEquipment }}
故障设备总数/台
-
0
+
{{ homeDevice.stopEquipment }}
停机设备总数/台
@@ -81,6 +85,7 @@ class="item" :class="{ shadow: index !== middleMenu.length - 1 }" v-for="(item, index) in middleMenu" + @click="goPage(item)" :key="index">
@@ -105,14 +110,14 @@
- {{ item.name }} - {{ item.value }}% + {{ item.orderName }} + {{ item.completeRate * 100 }}%
@@ -130,7 +135,7 @@ :page="1" :limit="100000" :table-props="tableProps" - :table-data="list" + :table-data="homeDevice.list" :max-height="tableH" />
@@ -155,6 +160,13 @@ import Navbar from './components/Navbar'; import moment from 'moment'; import tableHeightMixin from '@/mixins/tableHeightMixin'; +import { + getHomeOrder, + getHomeOrderNum, + getHomeEquipment, + getHomeEquipmentAlarmList, +} from '@/api/home'; + export default { name: 'Home', mixins: [tableHeightMixin], @@ -175,69 +187,107 @@ export default { topTime: '', timeZone: '', middleMenu: [ - { name: '工单管理', url: '', icon: 'home-work-menu' }, - { name: '订单管理', url: '', icon: 'home-order-menu' }, - { name: '设备管理', url: '', icon: 'home-device-menu' }, - { name: '质量管理', url: '', icon: 'home-quality-menu' }, - { name: '仓库管理', url: '', icon: 'home-store-menu' }, - ], - orderList: [ - { name: '工单1', value: 50 }, - { name: '工单2', value: 60 }, - { name: '工单3', value: 30 }, - { name: '工单4', value: 60 }, - { name: '工单5', value: 10 }, - { name: '工单6', value: 60 }, - { name: '工单7', value: 40 }, - { name: '工单8', value: 70 }, - { name: '工单9', value: 90 }, + { name: '生产管理', url: 'productLine24h', icon: 'home-work-menu' }, + { + name: '能源管理', + url: 'EnergyQuantityRealtime', + icon: 'home-order-menu', + }, + { name: '设备管理', url: 'PlanConfig', icon: 'home-device-menu' }, + { name: '质量管理', url: 'qualityScrapLog', icon: 'home-quality-menu' }, + { name: '仓库管理', url: 'warehouse-info', icon: 'home-store-menu' }, ], heightNum: 640, tableProps: [ { - prop: 'productionLineName', + prop: 'equipmentName', label: '设备名称', showOverflowtooltip: true, }, { - prop: 'sectionName', + prop: 'alarmContent', label: '告警内容', showOverflowtooltip: true, }, { - prop: 'createTime', + prop: 'updateTime', label: '告警时间', width: 180, filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), }, ], - list: [ - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - { productionLineName: 1 }, - ], + homeProduce: { + quantity: undefined, + yieldRate: undefined, + endWorkOrderQuantity: undefined, + endOrderQuantity: undefined, + orderList: [], + }, + homeDevice: { + allEquipment: undefined, + onlineEquipment: undefined, + errorEquipment: undefined, + stopEquipment: undefined, + list: [], + }, + times: [], + showTime: '', }; }, created() { this.getTime(); + this.handleClick(); + this.getHomeEquipment(); + this.showTime = moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD'); }, beforeDestroy() { clearInterval(this.timer); }, methods: { + handleClick() { + let start = + Date.parse(new Date()) + let end = + Date.parse(new Date()) + switch (this.activeName) { + case '日': + this.showTime = moment(new Date()) + .subtract(0, 'days') + .format('YYYY-MM-DD'); + this.times = [start, end]; + break; + case '周': + start = + moment(new Date()).subtract(6, 'days').format('x') + this.showTime = + moment(new Date()).subtract(6, 'days').format('MM-DD') + + ' ~ ' + + moment(new Date()).subtract(0, 'days').format('MM-DD'); + this.times = [start, end]; + break; + case '月': + start = + moment(new Date()).subtract(1, 'month').format('x') + this.showTime = + moment(new Date()).subtract(1, 'month').format('MM-DD') + + ' ~ ' + + moment(new Date()).subtract(0, 'days').format('MM-DD'); + this.times = [start, end]; + break; + case '年': + start = + moment(new Date()).subtract(1, 'year').format('x') + this.showTime = + moment(new Date()).subtract(1, 'year').format('YYYY') + + ' ~ ' + + moment(new Date()).subtract(0, 'days').format('YYYY'); + this.times = [start, end]; + break; + default: + console.log(val); + } + this.getHomeOrder(); + }, getTime() { let _this = this; this.timer = setInterval(function () { @@ -247,6 +297,59 @@ export default { _this.topTime = temp[1]; }, 1000); }, + getHomeOrder() { + getHomeOrder(this.times).then((response) => { + if (response.hasOwnProperty('data')) { + this.homeProduce.quantity = response.data.quantity; + this.homeProduce.yieldRate = response.data.yieldRate * 100; + this.homeProduce.endWorkOrderQuantity = + response.data.endWorkOrderQuantity; + this.homeProduce.orderList = response.data.orderMonitorVO; + } else { + this.homeProduce = { + quantity: undefined, + yieldRate: undefined, + endWorkOrderQuantity: undefined, + endOrderQuantity: undefined, + orderList: [], + }; + } + }); + getHomeOrderNum(this.times).then((response) => { + if (response.hasOwnProperty('data')) { + this.homeProduce.endOrderQuantity = response.data.endOrderQuantity; + } else { + this.homeProduce.endOrderQuantity = '-'; + } + }); + }, + getHomeEquipment() { + getHomeEquipment().then((response) => { + if (response.hasOwnProperty('data')) { + this.homeDevice.allEquipment = response.data.allEquipment; + this.homeDevice.onlineEquipment = response.data.onlineEquipment; + this.homeDevice.errorEquipment = response.data.errorEquipment; + this.homeDevice.stopEquipment = response.data.stopEquipment; + } else { + this.homeDevice = { + allEquipment: undefined, + onlineEquipment: undefined, + errorEquipment: undefined, + stopEquipment: undefined, + }; + } + }); + getHomeEquipmentAlarmList().then((response) => { + if (response.hasOwnProperty('data')) { + this.homeDevice.list = response.data; + } else { + this.homeDevice.list = []; + } + }); + }, + goPage(val) { + this.$router.push({ name: val.url }); + }, }, }; @@ -260,56 +363,14 @@ export default { height: 300px; width: 100%; } -.date-tabs { - padding-left: 40px; - padding-top: 20px; - position: relative; -} -:deep(.date-tabs) { - .el-tabs__header { - margin-bottom: 8px; - display: inline-block; - transform: translateY(-12px); - } - - .el-tabs__content { - overflow: visible; - } - - .el-tabs__item { - font-size: 18px; - color: #fff; - padding-left: 0 !important; - padding-right: 0 !important; - line-height: 36px !important; - height: 36px; - } - .el-tabs__item.is-active { - color: #0b58ff; - } -} -.current-date { - color: #fff; - font-size: 18px; - position: absolute; - left: 260px; - top: 14px; -} -.current-time { - color: #fff; - font-size: 18px; - position: absolute; - right: 38px; - top: 14px; -} .main-top { width: 100%; - padding: 0 20px 0 40px; + padding: 10px 20px 0 40px; .title { position: absolute; left: 34px; top: 20px; - width: 180px; + width: 90%; font-size: 32px; z-index: 10; .title-inner { @@ -318,12 +379,53 @@ export default { top: 5px; font-size: 24px; } + .date-tabs { + position: absolute; + right: 100px; + top: 5px; + font-size: 18px; + } + :deep(.date-tabs) { + .el-tabs__header { + margin-bottom: 8px; + display: inline-block; + } + + .el-tabs__content { + overflow: visible; + } + + .el-tabs__item { + font-size: 18px; + padding-left: 0 !important; + padding-right: 0 !important; + line-height: 20px !important; + height: 24px; + } + .el-tabs__item.is-active { + color: #0b58ff; + } + } + .current-date { + font-size: 10px; + font-weight: 500; + position: absolute; + right: 0px; + top: 5px; + } + // .current-time { + // width: 160px; + // font-size: 18px; + // position: absolute; + // right: -20px; + // top: 5px; + // } } .box { background-color: #fff; border-radius: 24px; - height: 192px; - padding: 40px 24px 32px 24px; + height: 232px; + padding: 60px 24px 32px 24px; .num-box { height: 120px; padding-top: 26px; diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 84b0d837..e98c1fcb 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,66 +1,17 @@