From cf9d04b97ef0b8abb63e587e0898e301765ed4b9 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期一, 18 八月 2025 17:07:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue | 521 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 521 insertions(+), 0 deletions(-)
diff --git a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
new file mode 100644
index 0000000..edda50f
--- /dev/null
+++ b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue
@@ -0,0 +1,521 @@
+<template>
+ <div class="efficiency_list" style="width: 100%;height: 100%;">
+ <div :bordered="false" style="height: 100%">
+ <!-- 鏌ヨ鍖哄煙 -->
+ <div class="table-page-search-wrapper">
+ <a-form layout="inline" @keyup.enter.native="searchQuery">
+ <a-row :gutter="24">
+ <a-col :md="7" :sm="7">
+ <a-form-item label="鏃堕棿">
+ <a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYYMMDD"
+ v-model="dates" :allowClear="false"/>
+ </a-form-item>
+ </a-col>
+ <a-col :lg="2" :md="2" :sm="2" :xs="2">
+ <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
+ </a-col>
+ </a-row>
+ </a-form>
+ </div>
+ <div id="DeviceList">
+ <div class="openRateTrendDg">
+ <a-table :columns="columns" :data-source="dataList" bordered :pagination="false" :scroll="{y:210}"
+ :customRow="customRow"
+ rowKey="alarmCode" @expand="handleExpandChange" :loading="outerDataLoading"
+ >
+ <span slot="timeCount" slot-scope="text">{{text | getFormattedTime}}</span>
+ <a-table
+ slot="expandedRowRender"
+ slot-scope="row"
+ :columns="innerColumns"
+ :data-source="row.innerDataList"
+ :pagination="false"
+ rowKey="rowIndex"
+ :loading="innerDataLoading"
+ >
+ <span slot="duration" slot-scope="text">{{text | getFormattedTime}}</span>
+ </a-table>
+ </a-table>
+ </div>
+
+ <a-spin :spinning="echartLoading">
+ <div style="width: 100%;height: 100%;display: flex;">
+ <div id="MdcEquipmentWarningPie" style="height: 100%;width: 35%;"></div>
+ <div id="MdcEquipmentWarningLine" style="height: 100%;width: 65%;"></div>
+ </div>
+ </a-spin>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script>
+ import moment from 'moment'
+ import { putAction, getAction } from '@/api/manage'
+ import $ from 'jquery'
+ import '@/components/table2excel/table2excel'
+ import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
+ import {
+ JeecgListMixin
+ } from '@/mixins/JeecgListMixin'
+
+ const columns = [
+ { title: '鎶ヨ鍙�', dataIndex: 'alarmCode', key: 'alarmCode', align: 'center' },
+ { title: '鍑虹幇娆℃暟', dataIndex: 'count', key: 'count', align: 'center', sorter: (a, b) => b.count - a.count },
+ {
+ title: '鍚堣鎸佺画鏃堕棿',
+ dataIndex: 'timeCount',
+ key: 'timeCount',
+ scopedSlots: { customRender: 'timeCount' },
+ align: 'center',
+ sorter: (a, b) => b.timeCount - a.timeCount
+ },
+ { title: '鎶ヨ淇℃伅', dataIndex: 'alarmContent', key: 'alarmContent', align: 'center', ellipsis: true }
+ ]
+
+ const innerColumns = [
+ {
+ title: '',
+ dataIndex: 'rowIndex',
+ key: 'rowIndex',
+ width: 60,
+ align: 'center',
+ customRender: function(t, r, index) {
+ return parseInt(index) + 1
+ }
+ },
+ { title: '璁惧缂栧彿', dataIndex: 'equipmentId', key: 'equipmentId', align: 'center' },
+ { title: '瀹夎浣嶇疆', dataIndex: 'equipmentName', key: 'equipmentName', align: 'center' },
+ { title: '鎶ヨ鏃堕棿', dataIndex: 'startTime', key: 'startTime', align: 'center' },
+ { title: '缁撴潫鏃堕棿', dataIndex: 'endTime', key: 'endTime', align: 'center' },
+ {
+ title: '鎸佺画鏃堕棿',
+ dataIndex: 'duration',
+ key: 'duration',
+ scopedSlots: { customRender: 'duration' },
+ align: 'center'
+ }
+ ]
+
+ export default {
+ // mixins: [JeecgListMixin],
+ name: 'alarmAnalysisMain',
+ components: {},
+ data() {
+ return {
+ dataSource: [],
+ /* table鍔犺浇鐘舵�� */
+ outerDataLoading: false,
+ innerDataLoading: false,
+ echartLoading: false,
+ typeTree: '',
+ typeParent: 1,
+ typeEquipment: 1,
+ TreeIDOne: 1,
+ TreeIDTwo: 2,
+ deviceTypeDict: '',
+ dates: [],
+ identifying: [],
+ queryParam: {},
+ queryParams: {},
+ queryParamEquip: {},
+ queryParamPeople: {},
+ efficiencyOptions: [
+ { label: '鍒╃敤鐜�', value: 'lyl' },
+ { label: '寮�鏈虹巼', value: 'kjl' },
+ { label: '寮�鏈烘椂闂�', value: 'kjsj' },
+ { label: '鍔犲伐鏃堕棿', value: 'jgsj' },
+ { label: '寰呮満鏃堕棿', value: 'djsj' },
+ { label: '鍏虫満鏃堕棿', value: 'gjsj' }
+ ],
+ checkedList: ['lyl'],
+ dataList: [],
+ url: {
+ efficiencyList: '/mdc/alarmAnalyze/alarmList',
+ listByType: '/mdc/MdcUtilizationRate/getByType',
+ alarmTrend: '/mdc/alarmAnalyze/alarmTrend',
+ equipmentAlarmList: '/mdc/alarmAnalyze/equipmentAlarmList'
+ },
+ tableHeads: [],
+ pieDate: [0],
+ XData: [0],
+ YData: [0],
+ columns,
+ innerColumns,
+ hasRequestAlarmCodeList: []
+ }
+ },
+ props: { nodeTree: '', Type: '', nodePeople: '' },
+ /**
+ * 鐢熷懡鍛ㄦ湡 鎸傝浇鍓�
+ * */
+ created() {
+ this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)]
+ this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD')
+ this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD')
+ this.queryParam.typeTree = '1'
+ this.loadData1()
+
+ },
+ mounted() {
+ this.drawWrin()
+ window.addEventListener('resize', this.handleWindowResize)
+ },
+ beforeDestroy() {
+ window.removeEventListener('resize', this.handleWindowResize)
+ },
+ watch: {
+ Type(valmath) {
+ this.dataList = []
+ this.queryParam.typeTree = valmath
+ },
+ nodeTree(val) { //鐩戝惉currSelected 鍙樺寲锛屽皢鍙樺寲鍚庣殑鏁板�间紶閫掔粰 getCurrSelected 浜嬩欢
+ if (JSON.stringify(val) != '{}') {
+ if (val.equipmentId != null) {
+ this.queryParamEquip.parentId = ''
+ this.queryParamEquip.equipmentId = val.equipmentId
+ } else {
+ this.queryParamEquip.parentId = val.key
+ this.queryParamEquip.equipmentId = ''
+ }
+ /*杩欓噷浣犳槸鐩戝惉鍒版爲寰楀彉鍖� 鏄笉鏄姹備竴娆�*/
+ this.searchQuery()
+ }
+ },
+ nodePeople(val) {
+ if (JSON.stringify(val) != '{}') {
+ if (val.equipmentId != null) {
+ this.queryParamPeople.parentId = val.equipmentId
+ this.queryParamPeople.equipmentId = ''
+ } else {
+ this.queryParamPeople.parentId = val.key
+ this.queryParamPeople.equipmentId = ''
+ }
+ this.searchQuery()
+ }
+ }
+ },
+ filters: {
+ numFilter(value) {
+ if (value) {
+ return parseFloat((value * 100).toFixed(2))
+ } else {
+ return '0'
+ }
+ },
+
+ /**
+ * 鏍煎紡鍖栨椂闂�
+ * @param seconds 绉掓暟
+ * @returns '' 鏍煎紡鍖栧悗鏃堕棿瀛楃涓�
+ */
+ getFormattedTime(seconds) {
+ var hours = Math.floor(seconds / 3600)
+ var minutes = Math.floor((seconds % 3600) / 60)
+ var secs = seconds % 60
+
+ if (hours === 0) {
+ if (minutes === 0) {
+ return secs === 0 ? 0 : `${secs}绉抈
+ } else {
+ if (secs === 0) {
+ return `${minutes}鍒哷
+ }
+ return `${minutes}鍒� ${secs}绉抈
+ }
+ } else {
+ if (minutes === 0 && secs === 0) {
+ return `${hours}灏忔椂`
+ } else if (minutes !== 0 && secs === 0) {
+ return `${hours}灏忔椂 ${minutes}鍒哷
+ }
+ }
+ return `${hours}灏忔椂 ${minutes}鍒� ${secs}绉抈
+ }
+ },
+ methods: {
+ numBerTwo(value) {
+ if (value) {
+ return parseFloat((value * 100).toFixed(2))
+ } else {
+ return '0'
+ }
+ },
+ TableDraw(key, val) {
+ let that = this
+ that.echartLoading = true
+ that.queryParam.alarmCode = val.alarmCode
+ console.log(this.queryParam)
+ getAction(that.url.alarmTrend, that.queryParam)
+ .then(res => {
+ if (res.success) {
+ that.pieDate = res.result.equipmentCountList.map(item => {
+ return {
+ name: item.key,
+ value: item.count
+ }
+ })
+ that.XData = res.result.dateCountList.map(item => item.key)
+ that.YData = res.result.dateCountList.map(item => item.count)
+
+ that.drawWrin()
+ }
+ })
+ .finally(() => {
+ that.echartLoading = false
+ })
+ console.log(this.YData)
+
+ },
+ disabledDate(current) {
+ //Can not slect days before today and today
+ return current && current > moment().subtract('days', 1)
+ },
+ initDeviceType(deviceList) {
+ let dictCode = 'mdc_equipmentType'
+ let items = []
+ items = getDictItemsFromCache(dictCode)
+ if (deviceList && items.length > 0) {
+ for (let a = 0; a < deviceList.length; a++) {
+ if (items && items.length > 0) {
+ for (let i = 0; i < items.length; i++) {
+ if (deviceList[a].equipmentType == items[i].value) {
+ deviceList[a].equipmentType = items[i].title
+ }
+ }
+ } else {
+ ajaxGetDictItems(dictCode, null).then((res) => {
+ if (res.success) {
+ let items = res.result
+ for (let i = 0; i < items.length; i++) {
+ if (deviceList[a].equipmentType == items[i].value) {
+ deviceList[a].equipmentType = items[i].title
+ }
+ }
+ }
+ })
+ }
+ }
+ }
+ },
+ dateParamChange(v1, v2) {
+ this.queryParam.startDate = v2[0]
+ this.queryParam.endDate = v2[1]
+ },
+ searchQuery() {
+ if (this.queryParam.typeTree == '1') {
+ this.queryParam.parentId = this.queryParamEquip.parentId
+ this.queryParam.equipmentId = this.queryParamEquip.equipmentId
+ } else {
+ this.queryParam.parentId = this.queryParamPeople.parentId
+ this.queryParam.equipmentId = ''
+ }
+ this.loadData1()
+ },
+ loadData1() {
+ this.outerDataLoading = true
+ this.tableHeads = []
+ this.dataList = []
+ getAction(this.url.efficiencyList, this.queryParam).then(res => {
+ if (res.success) {
+ this.dataList = res.result
+ this.hasRequestAlarmCodeList = []
+ }
+ }).finally(() => {
+ this.outerDataLoading = false
+ })
+ },
+ drawWrin() {
+ this.equipmentWarningPie = this.$echarts.init(document.getElementById('MdcEquipmentWarningPie'), 'macarons')
+ let equipmentWarningPieOption = {
+ title: {
+ text: '鍚勮澶囧嚭鐜版鎶ヨ鐨勬瘮渚�',
+ x: 'center',
+ y: 'bottom',
+ textStyle: {
+ color: '#4FAEDC'
+ }
+ },
+ tooltip: {
+ trigger: 'item',
+ formatter: '{b} : {c} ({d}%)'
+ },
+ calculable: true,
+ series: {
+ type: 'pie',
+ radius: '60%',
+ label: {
+ show: true,
+ formatter: '{b}\n{c}',
+ color: 'inherit'
+ },
+ itemStyle: {
+ color: function(params) {
+ const colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3']
+ return colorList[params.dataIndex % colorList.length]
+ }
+
+ },
+ data: this.pieDate
+ }
+ }
+ this.equipmentWarningPie.setOption(equipmentWarningPieOption, true)
+ this.equipmentWarningLine = this.$echarts.init(document.getElementById('MdcEquipmentWarningLine'), 'macarons')
+ let equipmentWarningLineOption = {
+ title: {
+ text: '姣忓ぉ鍑虹幇姝ゆ姤璀︾殑鏁伴噺璧板娍',
+ x: 'center',
+ y: 'bottom',
+ textStyle: {
+ color: '#4FAEDC'
+ }
+ },
+ tooltip: {
+ trigger: 'axis'
+ },
+ calculable: true,
+ xAxis: [
+ {
+ type: 'category',
+ show: true,
+ data: this.XData
+ /*axisLabel :{
+ interval:0
+ }*/,
+ axisLine: {
+ //x杞寸嚎鐨勯鑹蹭互鍙婂搴�
+ show: true,
+ lineStyle: {
+ width: 2,
+ color: '#4FAEDC'
+ }
+ }
+ }
+ ],
+ yAxis: [
+ {
+ type: 'value',
+ name: '娆℃暟',
+ axisLine: {
+ //x杞寸嚎鐨勯鑹蹭互鍙婂搴�
+ show: true,
+ lineStyle: {
+ width: 2,
+ color: '#4FAEDC'
+ }
+ }
+ }
+ ],
+ series: [
+ {
+ name: '鎶ヨ鏁伴噺',
+ type: 'line',
+ data: this.YData,
+ markPoint: {
+ data: [
+ { type: 'max', name: '鏈�澶у��' },
+ { type: 'min', name: '鏈�灏忓��' }
+ ],
+ label: {
+ color: '#fff'
+ }
+ },
+ itemStyle: {
+ normal: {
+ color: '#2EC7C9'
+ }
+ }
+ }
+ ]
+ }
+ this.equipmentWarningLine.setOption(equipmentWarningLineOption, true)
+ },
+
+ /**
+ * 鑷畾涔夎〃鏍艰瑙﹀彂
+ * @param record 褰撳墠琛屼俊鎭�
+ * @param index 褰撳墠琛屼笅鏍�
+ * @returns {{on: {click: on.click}}} 杩斿洖瀵硅薄
+ */
+ customRow(record, index) {
+ return {
+ on: {
+ click: (event) => {
+ // 濡傛灉鐐瑰嚮鐨勪笉鏄睍寮�鍥炬爣鍖哄煙鍒欐覆鏌撳浘琛紝鐩稿弽鍒欑浉褰撲簬鐐瑰嚮灞曞紑鍥炬爣
+ if (event.target.className !== 'ant-table-row-expand-icon-cell') {
+ this.TableDraw(index, record)
+ } else {
+ if (event.target.children && event.target.children.length > 0) event.target.children[0].click()
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ * 鑷畾涔夎〃鏍艰瑙﹀彂
+ * @param expanded 褰撳墠琛屾槸鍚︿负灞曞紑鐘舵��
+ * @param record 褰撳墠琛屼俊鎭�
+ */
+ handleExpandChange(expanded, record) {
+ let _this = this
+ // 褰撳睍寮�鏃惰嫢璇ヨ鏈灞曞紑杩囨墠浼氳姹傚悗鍙版暟鎹紝灞曞紑杩囩殑鏁版嵁浼氳缂撳瓨鏃犻渶閲嶅璇锋眰
+ this.queryParam.alarmCode = record.alarmCode
+ if (expanded && !this.hasRequestAlarmCodeList.includes(record.alarmCode)) {
+ this.innerDataLoading = true
+ getAction(this.url.equipmentAlarmList, this.queryParam).then(res => {
+ if (res.success) {
+ _this.dataList.forEach(item => {
+ if (item.alarmCode === record.alarmCode) {
+ item.innerDataList = res.result
+ }
+ })
+ _this.hasRequestAlarmCodeList.push(record.alarmCode)
+ }
+ })
+ .finally(() => {
+ _this.innerDataLoading = false
+ })
+ }
+ },
+
+ /**
+ * 褰撴祻瑙堝櫒鍙绐楀彛灏哄鍙戠敓鏀瑰彉鏃惰Е鍙�
+ */
+ handleWindowResize() {
+ if (this.equipmentWarningPie) this.equipmentWarningPie.resize()
+ if (this.equipmentWarningLine) this.equipmentWarningLine.resize()
+ }
+ }
+ }
+</script>
+<style scoped>
+ .efficiency_list #DeviceList {
+ height: 90% !important;
+ }
+
+ /deep/ .ant-table-body .ant-table-row td {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ }
+
+ /deep/ .ant-table-scroll > .ant-table-body > table > .ant-table-tbody > .ant-table-row td {
+ cursor: pointer;
+ }
+
+ /deep/ .ant-spin-nested-loading {
+ height: 55%;
+ }
+
+ /deep/ .ant-spin-container {
+ height: 100%;
+ }
+
+ /deep/ .ant-table.ant-table-bordered {
+ height: 265px;
+ }
+
+ /deep/ .ant-table-scroll > .ant-table-placeholder {
+ height: 210px;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3