From 36e8795b59c7f7393758ca96e0c2438eddaee8be Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 07 三月 2025 16:14:41 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue | 250 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 183 insertions(+), 67 deletions(-) diff --git a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue index 8ee1144..5426507 100644 --- a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue +++ b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue @@ -5,18 +5,102 @@ <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-col :md="6" :sm="6"> + <a-form-item label="璁惧绫诲瀷"> + <a-select + :value="queryParams.equipmentType" + mode="multiple" + placeholder="璇烽�夋嫨璁惧绫诲瀷" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'equipmentType')" + > + <a-select-option v-for="(item,index) in equipmentTypeList" :value="item.value" :key="index"> + {{ item.label }} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> + <a-form-item label="椹卞姩绫诲瀷"> + <a-select + :value="queryParams.driveType" + mode="multiple" + placeholder="璇烽�夋嫨椹卞姩绫诲瀷" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'driveType')" + > + <a-select-option v-for="(item,index) in driveTypeList" :value="item.value" :key="index"> + {{ item.label }} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> <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 :md="3" :sm="3" :xs="3"> + <a-space> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button> + </a-space> + </a-col> + + <a-col :md="2" :sm="2"> + <a + @click="toggleSearchStatus=!toggleSearchStatus" + @selectstart="$event.preventDefault()" + style="display: inline-block;height: 32px;line-height: 32px" + > + {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </a-col> + </a-row> + + <a-row :gutter="24" v-if="toggleSearchStatus"> + <a-col :md="6" :sm="6" :xs="6"> + <a-form-item label="璁惧绾у埆"> + <a-select + :value="queryParams.deviceLevel" + mode="multiple" + placeholder="璇烽�夋嫨璁惧绾у埆" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'deviceLevel')" + > + <a-select-option v-for="(item,index) in device_level_list" :value="item.value" :key="index"> + {{ item.label }} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + + <a-col :md="5" :sm="5" :xs="5"> + <a-form-item label="閲嶈绋嬪害"> + <a-select + v-model="queryParam.deviceImportanceLevel" + placeholder="璇烽�夋嫨璁惧閲嶈绋嬪害" + allow-clear + > + <a-select-option v-for="(item,index) in device_importance_level_list" :value="item.value" + :key="index"> + {{ item.label }} + </a-select-option> + </a-select> + </a-form-item> </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}" @@ -51,13 +135,11 @@ <script> import moment from 'moment' - import { putAction, getAction } from '@/api/manage' + import { getAction } from '@/api/manage' import $ from 'jquery' import '@/components/table2excel/table2excel' - import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api' - import { - JeecgListMixin - } from '@/mixins/JeecgListMixin' + import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' + import api from '@api/mdc' const columns = [ { title: '鎶ヨ鍙�', dataIndex: 'alarmCode', key: 'alarmCode', align: 'center' }, @@ -98,7 +180,6 @@ ] export default { - // mixins: [JeecgListMixin], name: 'alarmAnalysisMain', components: {}, data() { @@ -115,9 +196,17 @@ TreeIDTwo: 2, deviceTypeDict: '', dates: [], + equipmentTypeList: [], + driveTypeList: [], + device_level_list: [], + device_importance_level_list: [], identifying: [], queryParam: {}, - queryParams: {}, + queryParams: { + equipmentType: [], + driveType: [], + deviceLevel: [] + }, queryParamEquip: {}, queryParamPeople: {}, efficiencyOptions: [ @@ -134,7 +223,8 @@ efficiencyList: '/mdc/alarmAnalyze/alarmList', listByType: '/mdc/MdcUtilizationRate/getByType', alarmTrend: '/mdc/alarmAnalyze/alarmTrend', - equipmentAlarmList: '/mdc/alarmAnalyze/equipmentAlarmList' + equipmentAlarmList: '/mdc/alarmAnalyze/equipmentAlarmList', + queryEquipmentType: '/mdc/mdcEquipmentType/queryEquipmentType' }, tableHeads: [], pieDate: [0], @@ -142,7 +232,8 @@ YData: [0], columns, innerColumns, - hasRequsetAlarmCodeList: [] + hasRequestAlarmCodeList: [], + toggleSearchStatus: false } }, props: { nodeTree: '', Type: '', nodePeople: '' }, @@ -150,12 +241,11 @@ * 鐢熷懡鍛ㄦ湡 鎸傝浇鍓� * */ 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() - + this.searchReset() + this.queryGroup() + this.getDriveTypeByApi() + this.initDictData('device_level') + this.initDictData('device_importance_level') }, mounted() { this.drawWrin() @@ -234,6 +324,46 @@ } }, methods: { + queryGroup() { + getAction(this.url.queryEquipmentType).then(res => { + if (res.success) { + this.equipmentTypeList = res.result.map(item => { + return { + label: item.equipmentTypeName, + value: item.equipmentTypeName + } + }) + } else { + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + }, + + // 璋冪敤鎺ュ彛鑾峰彇鎺у埗绯荤粺绫诲瀷 + getDriveTypeByApi() { + api.getDriveTypeApi().then((res) => { + if (res.success) this.driveTypeList = res.result + }) + }, + + initDictData(dictCode) { + // //浼樺厛浠庣紦瀛樹腑璇诲彇瀛楀吀閰嶇疆 + if (getDictItemsFromCache(dictCode)) { + this[dictCode + '_list'] = getDictItemsFromCache(dictCode) + return + } + //鏍规嵁瀛楀吀Code, 鍒濆鍖栧瓧鍏告暟缁� + ajaxGetDictItems(dictCode, null).then((res) => { + if (res.success) { + this[dictCode + '_list'] = res.result + return + } + }) + }, + numBerTwo(value) { if (value) { return parseFloat((value * 100).toFixed(2)) @@ -241,6 +371,7 @@ return '0' } }, + TableDraw(key, val) { let that = this that.echartLoading = true @@ -257,15 +388,6 @@ }) that.XData = res.result.dateCountList.map(item => item.key) that.YData = res.result.dateCountList.map(item => item.count) - - // this.tableHeads = res.result.dates - // this.dataList = res.result - // this.draw() - // this.checkSameData(this.dataList) - // this.checkSameData1(this.dataList) - // this.checkSameData2(this.dataList) - // this.combineCell(); - // this.initDeviceType(this.dataList) that.drawWrin() } }) @@ -279,37 +401,12 @@ //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 @@ -318,29 +415,44 @@ this.queryParam.parentId = this.queryParamPeople.parentId this.queryParam.equipmentId = '' } - this.loadData1() + + Object.keys(this.queryParams).forEach(item => { + if (Array.isArray(this.queryParams[item])) { + if (this.queryParams[item].length !== 0) this.queryParam[item] = this.queryParams[item].join() + else delete this.queryParam[item] + } + }) + this.loadData() }, - loadData1() { + + searchReset() { + this.queryParams = { + equipmentType: [], + driveType: [], + deviceLevel: [] + } + this.queryParam = {} + 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.loadData() + }, + + loadData() { this.outerDataLoading = true this.tableHeads = [] this.dataList = [] getAction(this.url.efficiencyList, this.queryParam).then(res => { if (res.success) { - // this.tableHeads = res.result.dates this.dataList = res.result - this.hasRequsetAlarmCodeList = [] - // this.draw() - // this.checkSameData(this.dataList) - // this.checkSameData1(this.dataList) - // this.checkSameData2(this.dataList) - // this.combineCell(); - // this.initDeviceType(this.dataList) - + this.hasRequestAlarmCodeList = [] } }).finally(() => { this.outerDataLoading = false }) }, + drawWrin() { this.equipmentWarningPie = this.$echarts.init(document.getElementById('MdcEquipmentWarningPie'), 'macarons') let equipmentWarningPieOption = { @@ -483,7 +595,7 @@ let _this = this // 褰撳睍寮�鏃惰嫢璇ヨ鏈灞曞紑杩囨墠浼氳姹傚悗鍙版暟鎹紝灞曞紑杩囩殑鏁版嵁浼氳缂撳瓨鏃犻渶閲嶅璇锋眰 this.queryParam.alarmCode = record.alarmCode - if (expanded && !this.hasRequsetAlarmCodeList.includes(record.alarmCode)) { + if (expanded && !this.hasRequestAlarmCodeList.includes(record.alarmCode)) { this.innerDataLoading = true getAction(this.url.equipmentAlarmList, this.queryParam).then(res => { if (res.success) { @@ -492,7 +604,7 @@ item.innerDataList = res.result } }) - _this.hasRequsetAlarmCodeList.push(record.alarmCode) + _this.hasRequestAlarmCodeList.push(record.alarmCode) } }) .finally(() => { @@ -501,6 +613,10 @@ } }, + selectChange(value, key) { + this.queryParams[key] = value + }, + /** * 褰撴祻瑙堝櫒鍙绐楀彛灏哄鍙戠敓鏀瑰彉鏃惰Е鍙� */ -- Gitblit v1.9.3