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/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/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/warehouse/warehouse-info/BarChart.vue b/src/views/warehouse/warehouse-info/BarChart.vue index 6466b781..aa58e505 100644 --- a/src/views/warehouse/warehouse-info/BarChart.vue +++ b/src/views/warehouse/warehouse-info/BarChart.vue @@ -144,21 +144,24 @@ export default { this.chart.getZr().off('click'); this.chart.getZr().on('click', function () { if (_this.targetId !== '') { - switch (_this.targetId) { - case 1: - _this.$router.push({ - path: 'warehouse-manage1/InventoryOverview/' + _this.targetId, - }); - break; - case '1818175999715164161': - _this.$router.push({ - path: 'warehouse-manage2/InventoryOverview/' + _this.targetId, - }); - break; - default: - console.log(_this.targetId); - break; - } + _this.$router.push({ + path: `warehouse-manage${_this.targetId}/InventoryOverview/` + _this.targetId, + }); + // switch (_this.targetId) { + // case 1: + // _this.$router.push({ + // path: 'warehouse-manage1/InventoryOverview/' + _this.targetId, + // }); + // break; + // case '1818175999715164161': + // _this.$router.push({ + // path: 'warehouse-manage2/InventoryOverview/' + _this.targetId, + // }); + // break; + // default: + // console.log(_this.targetId); + // break; + // } } }); }, diff --git a/src/views/warehouse/warehouse-info/index.vue b/src/views/warehouse/warehouse-info/index.vue index a9a50373..3f1c1496 100644 --- a/src/views/warehouse/warehouse-info/index.vue +++ b/src/views/warehouse/warehouse-info/index.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2024-07-02 15:56:48 * @LastEditors: zwq - * @LastEditTime: 2024-08-02 14:57:52 + * @LastEditTime: 2024-09-23 09:15:30 * @Description: -->