12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520 |
- <template>
- <div class="module-container">
- <el-row>
- <el-col
- :span="24"
- class="filter-container"
- >
- <el-select
- v-model="project"
- placeholder="请选择"
- size="small"
- clearable
- @change="filterCharts"
- >
- <el-option
- label="全部项目"
- value=""
- />
- <el-option
- v-for="item in projectList"
- :key="item.projectId"
- :label="item.projectName"
- :value="item.projectId"
- />
- </el-select>
- </el-col>
- </el-row>
- <el-row
- :gutter="15"
- class="content-container"
- >
- <el-col :span="8">
- <el-row class="half-container">
- <dataContainer
- title="设备状态"
- :tip-content="(project ? filterForm.projectName : '所有项目') + '的设备状态统计'"
- >
- <div
- id="deviceStatus"
- class="charts-container"
- />
- </dataContainer>
- </el-row>
- <el-row class="half-container">
- <dataContainer
- title="设备类型"
- :tip-content="(project ? filterForm.projectName : '所有项目') + '的设备类型统计'"
- >
- <div
- id="deviceType"
- class="charts-container"
- />
- </dataContainer>
- </el-row>
- </el-col>
- <el-col :span="8">
- <el-row class="two-third-container">
- <dataContainer title="基础数据">
- <div
- v-if="filterForm.projectId"
- class="base-project-container"
- >
- <div class="project-info">
- <el-image
- :src="projectOption.src"
- fit="cover"
- style="width: 50%; height: 15vh; float: left; margin: 0 10px 10px 0;"
- />
- <span class="project-info-title">{{ projectOption.title }}</span>
- <br>
- <span class="project-info-text">{{ projectOption.info }}</span>
- </div>
- </div>
- <div
- v-else
- class="base-all-project"
- />
- <div class="base-info-container">
- <div
- class="base-info-card"
- @click="getChartData(1)"
- >
- <el-tooltip
- placement="top"
- popper-class="tooltip-dark"
- effect="dark"
- >
- <template #content>
- <span class="tooltip-title">在管设备:</span>{{ (project ? filterForm.projectName : '所有项目') + '的设备总数' }}
- </template>
- <div class="base-info-title base-info-icon1">
- 在管设备
- </div>
- </el-tooltip>
- <div class="base-info-data">
- {{ baseInfoOption.deviceCount }}
- </div>
- <div class="base-info-tip">
- 在管项目
- <span>{{ baseInfoOption.projectCount }}</span>
- 个 在管机房
- <span>{{ baseInfoOption.devicePartrolCount }}</span>
- 个
- </div>
- </div>
- <div
- class="base-info-card"
- @click="getChartData(2)"
- >
- <el-tooltip
- placement="top"
- popper-class="tooltip-dark"
- effect="dark"
- >
- <template #content>
- <span class="tooltip-title">设备完好率:</span>维修中、故障中定义为设备损坏状态,其他状态定义为完好状态
- </template>
- <div class="base-info-title base-info-icon2">
- 设备完好率
- </div>
- </el-tooltip>
- <div class="base-info-data">
- {{ baseInfoOption.intactRate }}%
- </div>
- </div>
- <div
- class="base-info-card"
- @click="getChartData(3)"
- >
- <el-tooltip
- placement="top"
- popper-class="tooltip-dark"
- effect="dark"
- >
- <template #content>
- <span class="tooltip-title">巡检完成率:</span>{{ '所有项目' + getYearAndMonth() + '巡检完成率(所有项目的任务完成数总计*100%/任务总数总计)' }}
- </template>
- <div class="base-info-title base-info-icon3">
- 巡检完成率
- </div>
- </el-tooltip>
- <div class="base-info-data">
- {{ baseInfoOption.patrolFinishRate }}%
- </div>
- </div>
- <div
- class="base-info-card"
- @click="getChartData(4)"
- >
- <el-tooltip
- placement="top"
- popper-class="tooltip-dark"
- effect="dark"
- >
- <template #content>
- <span class="tooltip-title">维保完成率:</span>{{ '所有项目' + getYearAndMonth() + '维保完成率(所有项目的任务完成数总计*100%/任务总数总计)' }}
- </template>
- <div class="base-info-title base-info-icon4">
- 维保完成率
- </div>
- </el-tooltip>
- <div class="base-info-data">
- {{ baseInfoOption.maintainFinishRatehRate }}%
- </div>
- </div>
- </div>
- </dataContainer>
- </el-row>
- <el-row class="one-third-container">
- <dataContainer
- title="巡检任务"
- :tip-content="(project ? filterForm.projectName : '所有项目') + getYearAndMonth() + '已生成巡检任务统计'"
- >
- <div
- id="patrolTask"
- class="charts-container"
- />
- </dataContainer>
- </el-row>
- </el-col>
- <el-col :span="8">
- <el-row class="one-third-container">
- <dataContainer
- title="设备大检预警信息"
- :tip-content="(project ? filterForm.projectName : '所有项目') + getYearAndMonth() + '预警中的大检信息'"
- >
- <div class="warning-info-box">
- <div
- class="warning-info-move-box"
- :style="{
- animation: warningInfoList.length <= 2 ? 'none' : '',
- 'animation-duration': (warningInfoList.length - 2) + 's'
- }"
- >
- <div
- v-for="(item ,index) in warningInfoList"
- :key="index"
- class="warning-info-card"
- >
- <div class="warning-info-data">
- <div class="warning-info-data-title">
- <span>{{ item.projectName }}:</span>
- {{ item.addressName }}机房 {{ item.sysName }}系统 {{ item.deviceName }}设备
- </div>
- <div class="warning-info-data-content">
- {{ item.warningContent }}
- </div>
- </div>
- <div class="warning-info-date">
- <div class="warning-info-date-label">
- 预警日期:{{ item.warningTime }}
- </div>
- <div class="warning-info-date-label">
- 到期日期:{{ item.inspectionTime }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </dataContainer>
- </el-row>
- <el-row class="one-third-container">
- <dataContainer
- title="设备大检任务"
- :tip-content="(project ? filterForm.projectName : '所有项目') + '已生成大检任务统计'"
- >
- <div
- id="deviceTask"
- class="charts-container"
- />
- </dataContainer>
- </el-row>
- <el-row class="one-third-container">
- <dataContainer
- title="维保任务"
- :tip-content="(project ? filterForm.projectName : '所有项目') + getYearAndMonth() + '已生成维保任务统计'"
- >
- <div
- id="maintenanceTask"
- class="charts-container"
- />
- </dataContainer>
- </el-row>
- </el-col>
- </el-row>
- <el-drawer
- v-model="tableOption.display"
- :title="tableOption.title"
- size="90%"
- custom-class="table-dialog"
- >
- <div class="drawer-body">
- <el-table
- v-loading="tableOption.loading"
- :data="tableOption.data"
- :height="resizeHeight - 190"
- stripe
- border
- fit
- >
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="deviceName"
- label="设备名称"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="deviceCode"
- label="设备编码"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="deviceState"
- label="当前状态"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="sysName"
- label="所属系统"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="devicePartrolName"
- label="所属机房"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="levelName"
- label="系统级别"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="isDisable"
- label="是否报废"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="fmDeviceType"
- label="设备/设施"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="buildingLocations"
- label="设备地址"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceStatus' || tableOption.type == 'deviceType'"
- prop="isImportant"
- label="是否重点设备"
- align="center"
- >
- <template #default="scope">
- {{ scope.row.isImportant ? '是' : '否' }}
- </template>
- </el-table-column>
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="projectName"
- label="所属项目"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="addressName"
- label="机房"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="sysName"
- label="所属系统"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="patrolRuleName"
- label="计划名称"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="userName"
- label="巡检人员"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="fullStartDate"
- label="开始时间"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="fullEndDate"
- label="结束时间"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="submitDate"
- label="提交时间"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="taskStateName"
- label="巡检状态"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="handleStateName"
- label="审核状态"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="workingTime"
- label="工时(分钟)"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'patrolMaintenanceTask'"
- prop="serverTime"
- label="同步时间"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="projectName"
- label="所属项目"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="addressName"
- label="机房名称"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="sysName"
- label="系统名称"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="deviceName"
- label="设备名称"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="deviceCode"
- label="设备编码"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="warningStatusName"
- label="预警状态"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="useDate"
- label="投入日期"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="inspectionInterial"
- label="大检间隔"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="warningTime"
- label="预警时间"
- align="center"
- />
- <el-table-column
- v-if="tableOption.type == 'deviceTask'"
- prop="detailName"
- label="大检类型"
- align="center"
- />
- </el-table>
- <el-pagination
- background
- layout="total, prev, pager, next"
- :total="tableOption.total"
- @current-change="handlePageChange"
- />
- </div>
- <div class="drawer-footer">
- <el-button
- size="medium"
- @click="tableOption.display = false"
- >
- 取 消
- </el-button>
- </div>
- </el-drawer>
- <el-drawer
- v-model="chartsOption.display"
- :title="chartsOption.title"
- size="90%"
- custom-class="table-dialog"
- >
- <div class="drawer-body">
- <div
- id="chartsContainer"
- class="charts-container"
- style="background-color: #ffffff;"
- />
- </div>
- <div class="drawer-footer">
- <el-button
- size="medium"
- @click="chartsOption.display = false"
- >
- 取 消
- </el-button>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import dataContainer from 'comps/dataContainer/index.vue'
- import * as echarts from 'echarts'
- import {
- getProjectDictionary
- } from 'api/dictionary'
- import {
- getProjectDataOfEngineering,
- getDeviceStatusDataOfEngineering,
- getDeviceStatusListOfEngineering,
- getDeviceTypeDataOfEngineering,
- getBaseInfoDataOfEngineering,
- getBaseInfoRatioOfEngineering,
- getBaseInfoChartsDataOfEngineering,
- getBaseInfoRatioChartsDataOfEngineering,
- getPatrolTaskDataOfEngineering,
- getTaskListOfEngineering,
- getWarningInfoDataOfEngineering,
- getDeviceTaskDataOfEngineering,
- getDeviceTaskListOfEngineering,
- getMaintenanceTaskDataOfEngineering
- } from 'api/engineering'
- export default {
- name: 'EngineeringScreen',
- components: {
- dataContainer
- },
- props: {
- resizeHeight: {
- type: Number,
- default: 500
- }
- },
- data () {
- return {
- project: '',
- projectList: [],
- filterForm: {
- companyId: localStorage.companyId || 281,
- areaId: '',
- projectId: '',
- projectName: ''
- },
- colorList: ['#87c9fa', '#b7e9ff', '#007afc', '#4aa1ff', '#71b5ff', '#26baff', '#e8f5ff', '#299ff6'],
- deviceStatusOption: [
- { name: '维修中', key: 'repairing', code: 2 },
- { name: '关机中', key: 'shutdown', code: 4 },
- { name: '维保中', key: 'maintenance', code: 3 },
- { name: '故障中', key: 'fault', code: 6 },
- { name: '停机中', key: 'stopDown', code: 7 },
- { name: '运行中', key: 'running', code: 1 }
- ],
- deviceTypeOption: [],
- projectOption: {
- src: '',
- title: '',
- info: ''
- },
- baseInfoOption: {
- deviceCount: '',
- projectCount: '',
- devicePartrolCount: '',
- intactRate: '',
- patrolFinishRate: '',
- maintainFinishRatehRate: ''
- },
- patrolTaskOption: [
- { name: '已完成', key: 'finished', code: 1 },
- { name: '待完成', key: 'unfinished', code: 0 },
- { name: '已销单', key: 'cancel', code: 5 },
- { name: '已过期', key: 'overDue', code: 2 },
- { name: '未派单', key: 'notDeliver', code: 6 },
- { name: '审核关闭', key: 'closed', code: 7 }
- ],
- warningInfoList: [],
- deviceTaskOption: [
- { name: '待处理', key: '0' },
- { name: '已处理', key: '1' },
- { name: '已超期', key: '2' }
- ],
- maintenanceTaskOption: [
- { name: '已完成', key: 'finished', code: 1 },
- { name: '待完成', key: 'unfinished', code: 0 },
- { name: '已销单', key: 'cancel', code: 5 },
- { name: '已过期', key: 'overDue', code: 2 },
- { name: '未派单', key: 'notDeliver', code: 6 },
- { name: '审核关闭', key: 'closed', code: 7 }
- ],
- tableOption: {
- filterForm: {},
- api: '',
- title: '',
- type: '',
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- loading: false,
- display: false,
- data: []
- },
- chartsOption: {
- title: '',
- display: false
- }
- }
- },
- mounted () {
- getProjectDictionary({
- companyId: localStorage.companyId || 281
- }).then(res => {
- if (res.status == 200) {
- this.projectList = res.data
- }
- })
- this.getScreenData()
- setInterval(() => {
- this.getScreenData()
- }, 60000)
- window.addEventListener('resize', this.resizePage)
- },
- methods: {
- // 获取当前年月
- getYearAndMonth () {
- return new Date().getFullYear() + '年' + (new Date().getMonth() + 1) + '月'
- },
- // 选取项目过滤图表
- filterCharts (value) {
- this.filterForm = {
- companyId: localStorage.companyId || 281,
- areaId: '',
- projectId: '',
- projectName: ''
- }
- if (value) {
- const projectOption = this.projectList.find(item => item.projectId == value)
- this.filterForm = {
- companyId: projectOption.companyId,
- areaId: projectOption.areaId,
- projectId: projectOption.projectId,
- projectName: projectOption.projectName
- }
- getProjectDataOfEngineering({
- projectId: this.filterForm.projectId
- }).then(res => {
- if (res.resultCode == 200) {
- this.projectOption = {
- src: res.data.imagePath,
- title: res.data.projectName,
- info: res.data.projectDesc
- }
- }
- })
- }
- this.getScreenData()
- },
- // 获取数据可视化数据
- getScreenData () {
- // 获取设备状态数据
- this.getDeviceStatusData()
- this.getDeviceTypeData()
- this.getBaseInfoData()
- this.getPatrolTaskData()
- this.getWarningInfoData()
- this.getDeviceTaskData()
- this.getMaintenanceTaskData()
- },
- // 获取设备状态数据
- getDeviceStatusData () {
- const that = this
- getDeviceStatusDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('deviceStatus'))
- myChart.clear()
- myChart.off('click')
- myChart.off('legendselectchanged')
- myChart.setOption({
- color: this.colorList,
- title: {
- text: '状态总数',
- subtext: res.data.total,
- textStyle: {
- color: '#46AEFD',
- fontSize: 12
- },
- subtextStyle: {
- fontSize: 14,
- color: '#FFFFFF'
- },
- left: 'center',
- top: '34%'
- },
- legend: {
- icon: 'circle',
- bottom: '10',
- orient: 'horizontal',
- itemGap: 20,
- formatter: function (name) {
- return '{nam|' + name + ' }\n{val|' + res.data[that.deviceStatusOption.find(item => item.name == name).key] + '}'
- },
- textStyle: {
- rich: {
- nam: {
- padding: [0, 80, 0, 0],
- align: 'center',
- lineHeight: 28,
- color: '#51D0FF'
- },
- val: {
- padding: [0, 80, 0, 0],
- align: 'center',
- color: '#FFB17C'
- }
- }
- }
- },
- series: [
- {
- name: '设备状态',
- type: 'pie',
- radius: ['35%', '50%'],
- center: ['50%', '40%'],
- minAngle: 0.5,
- roseType: 'radius',
- label: {
- formatter: '{b}: {c}'
- },
- labelLine: {
- normal: {
- length: 30,
- length2: 20
- }
- },
- itemStyle: {
- shadowColor: '#4db2ff',
- shadowBlur: 8
- },
- data: that.deviceStatusOption.map((item, index) => {
- return {
- name: item.name,
- value: res.data[item.key],
- through: item.through
- }
- }).sort((a, b) => {
- return b.value - a.value
- }).map((item, index) => {
- return {
- name: item.name,
- value: item.value,
- label: {
- color: item.through ? '#F56C6C' : this.colorList[index]
- }
- }
- })
- }
- ]
- })
- myChart.on('click', (params) => {
- this.showDeviceStatusTable(params)
- })
- myChart.on('legendselectchanged', (params) => {
- this.showDeviceStatusTable(params)
- myChart.dispatchAction({
- type: 'legendSelect',
- name: params.name
- })
- })
- }
- })
- },
- // 展示设备状态数据
- showDeviceStatusTable (params) {
- this.tableOption.api = getDeviceStatusListOfEngineering
- this.tableOption.filterForm = {
- deviceState: this.deviceStatusOption.find(item => item.name == params.name).code
- }
- this.tableOption.title = params.name + '设备'
- this.tableOption.type = 'deviceStatus'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- },
- // 获取设备类型数据
- getDeviceTypeData () {
- getDeviceTypeDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- this.deviceTypeOption = res.data.sysNum
- const myChart = echarts.init(document.getElementById('deviceType'))
- myChart.clear()
- myChart.off('click')
- myChart.off('legendselectchanged')
- myChart.setOption({
- color: this.colorList,
- title: {
- text: '类型总数',
- subtext: res.data.sysNum.reduce((total, item) => {
- return total + parseInt(item.value)
- }, 0),
- textStyle: {
- color: '#46AEFD',
- fontSize: 12
- },
- subtextStyle: {
- fontSize: 14,
- color: '#FFFFFF'
- },
- left: 'center',
- top: '32%'
- },
- legend: {
- icon: 'circle',
- bottom: '10',
- left: 'center',
- orient: 'horizontal',
- itemGap: 20,
- formatter: function (name) {
- return '{nam|' + name + ' }\n{val|' + res.data.sysNum.find(item => item.name == name).value + '}'
- },
- textStyle: {
- rich: {
- nam: {
- padding: [0, 80, 0, 0],
- align: 'center',
- lineHeight: 28,
- color: '#51D0FF'
- },
- val: {
- padding: [0, 80, 0, 0],
- align: 'center',
- color: '#FFB17C'
- }
- }
- }
- },
- series: [
- {
- name: '设备类型',
- type: 'pie',
- radius: ['32%', '45%'],
- center: ['50%', '38%'],
- minAngle: 0.5,
- roseType: 'radius',
- label: {
- formatter: '{b}: {c}'
- },
- labelLine: {
- normal: {
- length: 30,
- length2: 20
- }
- },
- itemStyle: {
- shadowColor: '#4db2ff',
- shadowBlur: 8
- },
- data: res.data.sysNum.map((item, index) => {
- return {
- name: item.name,
- value: item.value,
- id: item.id,
- id1: 'wsad',
- label: {
- color: this.colorList[index]
- }
- }
- }).sort((a, b) => {
- return b.value - a.value
- })
- }
- ]
- })
- myChart.on('click', (params) => {
- this.showDeviceTypeTable(params)
- })
- myChart.on('legendselectchanged', (params) => {
- this.showDeviceTypeTable(params)
- myChart.dispatchAction({
- type: 'legendSelect',
- name: params.name
- })
- })
- }
- })
- },
- // 展示设备类型数据
- showDeviceTypeTable (params) {
- this.tableOption.api = getDeviceStatusListOfEngineering
- this.tableOption.filterForm = {
- sysId: this.deviceTypeOption.find(item => item.name == params.name).id
- }
- this.tableOption.title = params.name + '设备'
- this.tableOption.type = 'deviceType'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- },
- // 获取基础数据
- getBaseInfoData () {
- getBaseInfoDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- this.baseInfoOption.deviceCount = res.data.deviceCount
- this.baseInfoOption.projectCount = res.data.projectCount
- this.baseInfoOption.devicePartrolCount = res.data.devicePartrolCount
- }
- })
- getBaseInfoRatioOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- this.baseInfoOption.intactRate = res.data.intactRate
- this.baseInfoOption.patrolFinishRate = res.data.patrolFinishRate
- this.baseInfoOption.maintainFinishRatehRate = res.data.maintainFinishRatehRate
- }
- })
- },
- // 获取巡检任务数据
- getPatrolTaskData () {
- const that = this
- getPatrolTaskDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('patrolTask'))
- myChart.clear()
- myChart.off('click')
- myChart.off('legendselectchanged')
- myChart.setOption({
- color: this.colorList,
- title: {
- text: '任务总数',
- subtext: res.data.total,
- textAlign: 'center',
- textStyle: {
- color: '#46AEFD',
- fontSize: 12
- },
- subtextStyle: {
- fontSize: 14,
- color: '#FFFFFF'
- },
- left: '33%',
- top: '40%'
- },
- legend: {
- icon: 'circle',
- width: 200,
- height: 180,
- right: '10',
- top: 'center',
- orient: 'vertical',
- itemGap: 20,
- formatter: function (name) {
- return '{nam|' + name + ' }\n{val|' + res.data[that.patrolTaskOption.find(item => item.name == name).key] + '}'
- },
- textStyle: {
- rich: {
- nam: {
- padding: [0, 80, 0, 0],
- align: 'center',
- lineHeight: 28,
- color: '#51D0FF'
- },
- val: {
- padding: [0, 80, 0, 0],
- align: 'center',
- color: '#FFB17C'
- }
- }
- }
- },
- series: [
- {
- name: '巡检任务',
- type: 'pie',
- radius: ['40%', '68%'],
- center: ['34%', '50%'],
- minAngle: 0.5,
- roseType: 'radius',
- label: {
- formatter: '{b}: {c}'
- },
- labelLine: {
- length: 20
- },
- labelLayout: {
- moveOverlap: 'shiftY'
- },
- itemStyle: {
- shadowColor: '#4db2ff',
- shadowBlur: 8
- },
- data: that.patrolTaskOption.map((item, index) => {
- return {
- name: item.name,
- value: res.data[item.key],
- through: item.through
- }
- }).sort((a, b) => {
- return b.value - a.value
- }).map((item, index) => {
- return {
- name: item.name,
- value: item.value,
- label: {
- color: item.through ? '#F56C6C' : this.colorList[index]
- }
- }
- })
- }
- ]
- })
- myChart.on('click', (params) => {
- this.showPatrolTaskTable(params)
- })
- myChart.on('legendselectchanged', (params) => {
- this.showPatrolTaskTable(params)
- myChart.dispatchAction({
- type: 'legendSelect',
- name: params.name
- })
- })
- }
- })
- },
- // 展示巡检任务数据
- showPatrolTaskTable (params) {
- this.tableOption.api = getTaskListOfEngineering
- this.tableOption.filterForm = {
- lpCategory: 1,
- taskState: this.patrolTaskOption.find(item => item.name == params.name).code
- }
- this.tableOption.title = params.name + '任务'
- this.tableOption.type = 'patrolMaintenanceTask'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- },
- // 获取预警信息数据
- getWarningInfoData () {
- getWarningInfoDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- this.warningInfoList = res.data.warningInfoList
- }
- })
- },
- // 获取设备大检任务数据
- getDeviceTaskData () {
- const that = this
- getDeviceTaskDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('deviceTask'))
- myChart.clear()
- myChart.off('click')
- myChart.off('legendselectchanged')
- myChart.setOption({
- color: this.colorList,
- title: {
- text: '任务总数',
- subtext: res.data.warningInfoTotal,
- textAlign: 'center',
- textStyle: {
- color: '#46AEFD',
- fontSize: 12
- },
- subtextStyle: {
- fontSize: 14,
- color: '#FFFFFF'
- },
- left: '33%',
- top: '40%'
- },
- legend: {
- icon: 'circle',
- width: 200,
- height: 180,
- right: '10',
- top: 'center',
- orient: 'vertical',
- itemGap: 20,
- formatter: function (name) {
- const site = res.data.warningInfoCount.find(site => site.warningStatusName == name)
- return '{nam|' + name + ' }\n{val|' + (site ? site.countNum : 0) + '}'
- },
- textStyle: {
- rich: {
- nam: {
- padding: [0, 80, 0, 0],
- align: 'center',
- lineHeight: 28,
- color: '#51D0FF'
- },
- val: {
- padding: [0, 80, 0, 0],
- align: 'center',
- color: '#FFB17C'
- }
- }
- }
- },
- series: [
- {
- name: '巡检任务',
- type: 'pie',
- radius: ['40%', '68%'],
- center: ['34%', '50%'],
- minAngle: 0.5,
- roseType: 'radius',
- label: {
- formatter: '{b}: {c}'
- },
- labelLine: {
- length: 20
- },
- labelLayout: {
- moveOverlap: 'shiftY'
- },
- itemStyle: {
- shadowColor: '#4db2ff',
- shadowBlur: 8
- },
- data: that.deviceTaskOption.map((item, index) => {
- const site = res.data.warningInfoCount.find(site => site.warningStatus == item.key)
- return {
- name: item.name,
- value: site ? site.countNum : 0,
- through: item.through
- }
- }).sort((a, b) => {
- return b.value - a.value
- }).map((item, index) => {
- return {
- name: item.name,
- value: item.value,
- label: {
- color: item.through ? '#F56C6C' : this.colorList[index]
- }
- }
- })
- }
- ]
- })
- myChart.on('click', (params) => {
- this.showDeviceTaskTable(params)
- })
- myChart.on('legendselectchanged', (params) => {
- this.showDeviceTaskTable(params)
- myChart.dispatchAction({
- type: 'legendSelect',
- name: params.name
- })
- })
- }
- })
- },
- // 展示设备大检任务数据
- showDeviceTaskTable (params) {
- this.tableOption.api = getDeviceTaskListOfEngineering
- this.tableOption.filterForm = {
- warningStatus: this.deviceTaskOption.find(item => item.name == params.name).key
- }
- this.tableOption.title = params.name + '任务'
- this.tableOption.type = 'deviceTask'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- },
- // 获取维保任务数据
- getMaintenanceTaskData () {
- const that = this
- getMaintenanceTaskDataOfEngineering(this.filterForm).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('maintenanceTask'))
- myChart.clear()
- myChart.off('click')
- myChart.off('legendselectchanged')
- myChart.setOption({
- color: this.colorList,
- title: {
- text: '任务总数',
- subtext: res.data.warningInfoTotal,
- textAlign: 'center',
- textStyle: {
- color: '#46AEFD',
- fontSize: 12
- },
- subtextStyle: {
- fontSize: 14,
- color: '#FFFFFF'
- },
- left: '33%',
- top: '40%'
- },
- legend: {
- icon: 'circle',
- width: 200,
- height: 180,
- right: '10',
- top: 'center',
- orient: 'vertical',
- itemGap: 20,
- formatter: function (name) {
- return '{nam|' + name + ' }\n{val|' + res.data[that.maintenanceTaskOption.find(item => item.name == name).key] + '}'
- },
- textStyle: {
- rich: {
- nam: {
- padding: [0, 80, 0, 0],
- align: 'center',
- lineHeight: 28,
- color: '#51D0FF'
- },
- val: {
- padding: [0, 80, 0, 0],
- align: 'center',
- color: '#FFB17C'
- }
- }
- }
- },
- series: [
- {
- name: '巡检任务',
- type: 'pie',
- radius: ['40%', '68%'],
- center: ['34%', '50%'],
- minAngle: 0.5,
- roseType: 'radius',
- label: {
- formatter: '{b}: {c}'
- },
- labelLine: {
- length: 20
- },
- labelLayout: {
- moveOverlap: 'shiftY'
- },
- itemStyle: {
- shadowColor: '#4db2ff',
- shadowBlur: 8
- },
- data: that.maintenanceTaskOption.map((item, index) => {
- return {
- name: item.name,
- value: res.data[item.key],
- through: item.through
- }
- }).sort((a, b) => {
- return b.value - a.value
- }).map((item, index) => {
- return {
- name: item.name,
- value: item.value,
- label: {
- color: item.through ? '#F56C6C' : this.colorList[index]
- }
- }
- })
- }
- ]
- })
- myChart.on('click', (params) => {
- this.showMaintenanceTaskTable(params)
- })
- myChart.on('legendselectchanged', (params) => {
- this.showMaintenanceTaskTable(params)
- myChart.dispatchAction({
- type: 'legendSelect',
- name: params.name
- })
- })
- }
- })
- },
- // 展示维保任务数据
- showMaintenanceTaskTable (params) {
- this.tableOption.api = getTaskListOfEngineering
- this.tableOption.filterForm = {
- lpCategory: 2,
- taskState: this.maintenanceTaskOption.find(item => item.name == params.name).code
- }
- this.tableOption.title = params.name + '任务'
- this.tableOption.type = 'patrolMaintenanceTask'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- },
- // 切换页面
- handlePageChange (val) {
- this.tableOption.pageIndex = val
- this.getTableList()
- },
- // 获取列表
- getTableList () {
- this.tableOption.loading = true
- this.tableOption.api({
- ...this.filterForm,
- ...this.tableOption.filterForm,
- pageIndex: this.tableOption.pageIndex,
- pageSize: this.tableOption.pageSize
- }).then(res => {
- this.tableOption.loading = false
- if (res.status == 200) {
- this.tableOption.data = res.data.records
- this.tableOption.total = res.data.total
- }
- })
- },
- // 获取图表数据
- getChartData (type) {
- if (this.project) {
- return false
- }
- if (type == 1) {
- this.chartsOption.display = true
- this.chartsOption.title = '在管设备'
- getBaseInfoChartsDataOfEngineering({
- ...this.filterForm
- }).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('chartsContainer'))
- myChart.clear()
- myChart.setOption({
- color: ['#286be0'],
- legend: {
- top: '4%',
- data: ['设备数量']
- },
- grid: {
- left: '5%',
- right: '5%',
- top: '10%',
- bottom: '5%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- data: res.data.map(item => {
- return item.projectName
- })
- },
- yAxis: {
- type: 'value'
- },
- series: [{
- name: '设备数量',
- type: 'bar',
- label: {
- show: true,
- position: 'top'
- },
- data: res.data.map(item => {
- return item.deviceNum
- })
- }]
- })
- }
- })
- } else if (type == 3 || type == 4) {
- this.tableOption.filterForm = {
- lpCategory: type == 3 ? 1 : 2
- }
- this.chartsOption.display = true
- this.chartsOption.title = type == 3 ? '巡检完成率' : '维保完成率'
- getBaseInfoRatioChartsDataOfEngineering({
- ...this.filterForm,
- lpCategory: type == 3 ? 1 : 2
- }).then(res => {
- if (res.status == 200) {
- const myChart = echarts.init(document.getElementById('chartsContainer'))
- myChart.clear()
- myChart.off('click')
- const sourceType = res.data.map(item => {
- return item.projectName
- })
- sourceType.unshift('ratio')
- const sourceData1 = res.data.map(item => {
- return item.finishRate
- })
- sourceData1.unshift('完成率')
- const sourceData2 = res.data.map(item => {
- return item.unFinishRate
- })
- sourceData2.unshift('未完成率')
- myChart.setOption({
- color: ['#286be0', '#87c9fa'],
- legend: {
- top: res.data.length > 6 ? 'middle' : '4%',
- left: res.data.length <= 6 ? 'center' : '1%',
- orient: res.data.length > 6 ? 'vertical' : 'horizontal',
- tooltip: {
- show: true,
- formatter: (params) => {
- return params.name == '完成率' ? '完成率:任务完成数÷任务总数×100%(包含特殊关闭)' : '未完成率:(任务未完成数+已过期数+特殊关闭)÷任务总数×100%(包含特殊关闭)'
- }
- }
- },
- dataset: {
- source: [
- sourceType,
- sourceData1,
- sourceData2
- ]
- },
- tooltip: {
- trigger: 'item',
- formatter: '{b}:{d}%'
- },
- series: res.data.map((item, index) => {
- return {
- type: 'pie',
- radius: res.data.length <= 9 ? '30%' : (100 / Math.ceil(res.data.length / 3) - 4) + '%',
- center: [
- 100 / 6 * ((index % 3) * 2 + 1) + '%',
- 50 / Math.ceil(res.data.length / 3) * (Math.floor(index / 3) * 2 + 1) + '%'
- ],
- encode: {
- itemName: 'ratio',
- value: item.projectName
- },
- label: {
- position: 'inner',
- fontSize: 14,
- color: '#ffffff',
- formatter: '{d}%'
- },
- markPoint: {
- symbol: 'roundRect',
- itemStyle: {
- color: 'transparent'
- },
- tooltip: {
- show: false
- },
- data: [
- {
- name: item.triangle,
- x: 100 / 6 * ((index % 3) * 2 + 1) + '%',
- y: 50 / Math.ceil(res.data.length / 3) * (Math.floor(index / 3 + 1) * 2) - 4 + '%',
- label: {
- normal: {
- show: true,
- width: '33%',
- align: 'center',
- formatter: item.projectName,
- color: '#000000',
- fontSize: 18,
- fontWeight: 'bold'
- }
- }
- }
- ]
- }
- }
- })
- })
- myChart.on('click', (params) => {
- this.tableOption.api = getTaskListOfEngineering
- this.tableOption.filterForm = {
- lpCategory: this.tableOption.filterForm.lpCategory,
- finishType: params.name == '完成率' ? 1 : 2,
- companyId: localStorage.companyId,
- projectId: res.data[params.componentIndex].projectId
- }
- this.tableOption.title = params.name == '完成率' ? '已完成任务' : '未完成任务'
- this.tableOption.type = 'patrolMaintenanceTask'
- this.tableOption.pageIndex = 1
- this.tableOption.data = []
- this.tableOption.display = true
- this.getTableList()
- })
- }
- })
- }
- },
- resizePage () {
- this.$nextTick(() => {
- echarts.init(document.getElementById('deviceStatus')).resize()
- echarts.init(document.getElementById('deviceType')).resize()
- echarts.init(document.getElementById('patrolTask')).resize()
- echarts.init(document.getElementById('deviceTask')).resize()
- echarts.init(document.getElementById('maintenanceTask')).resize()
- try {
- echarts.init(document.getElementById('chartsContainer')).resize()
- } catch (e) {
- console.log('--')
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .base-info-container{
- width: calc(100% + 10px);
- margin-left: -5px;
- display: flex;
- height: 7vw;
- .base-info-card{
- width: calc(25% - 8px);
- height: 100%;
- margin: 4px;
- padding: 15px 5px 15px 20px;
- .base-info-title{
- height: 3vh;
- font-size: 1.6vh;
- line-height: 3vh;
- background-size: 2.2vh;
- }
- .base-info-data{
- width: 100%;
- height: calc(100% - 6vh);
- font-size: 2.4vh;
- }
- .base-info-tip{
- height: 4vh;
- font-size: 1.2vh;
- line-height: 2vh;
- }
- }
- }
- </style>
|