¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="loading"> |
| | | <div :bordered="false" class="device_list"> |
| | | <div class="com_box"> |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div style="width: 100%; background-color: #fff" class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | <a-col :md="4" :sm="4"> |
| | | <a-form-item label="设å¤ç¼å·"> |
| | | <a-input placeholder="è¾å
¥è®¾å¤ç¼å·æ¥è¯¢" :readOnly="readOnly" v-model="queryParams.equipmentId"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="4" :sm="4"> |
| | | <a-form-item label="å®è£
ä½ç½®"> |
| | | <a-input placeholder="è¾å
¥å®è£
ä½ç½®æ¥è¯¢" :readOnly="readOnly" v-model="queryParams.equipmentName"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="5" :sm="5" :xs="5"> |
| | | <a-form-item label="æ¶é´"> |
| | | <a-range-picker @change="dateParamChange" v-model="dates" format="YYYYMMDD"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="6" :sm="6" :xs="6"> |
| | | <a-form-item label="æ¶é´æ®µ"> |
| | | <a-time-picker :default-value="moment('00:00', 'HH:mm')" format="HH:mm" @change="onChangeStart"/> |
| | | è³ |
| | | <a-time-picker :default-value="moment('08:00', 'HH:mm')" format="HH:mm" @change="onChangeEnd"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="2" :sm="3" :xs="3"> |
| | | <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | <!-- tableåºå-begin --> |
| | | <div id="DeviceList"> |
| | | <div style="padding: 5px;width: 100%;height: 100%"> |
| | | <div style="width: 100%;height: 100%" id="dayAvailBar"></div> |
| | | </div> |
| | | </div> |
| | | <!-- tableåºå-end --> |
| | | </div> |
| | | </div> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import moment from 'moment' |
| | | import { getAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'equipmentAvailCompareMain', |
| | | props: { nodeTree: '', Type: '', nodePeople: '' }, |
| | | data() { |
| | | return { |
| | | activeKey: '1', |
| | | typeTree: '', |
| | | typeParent: 1, |
| | | typeEquipment: 1, |
| | | spaceTime: [], |
| | | usingRates: [], |
| | | dates: [], |
| | | readOnly: true, |
| | | queryParam: {}, |
| | | queryParams: {}, |
| | | queryParamEquip: {}, |
| | | queryParamPeople: {}, |
| | | url: { |
| | | dayUtilizationRateContrast: '/mdc/efficiencyReport/dayUtilizationRateContrast', |
| | | getEquipmentByPid: '/mdc/mdcEquipment/getEquipmentByPid', |
| | | getEquipmentByDepPid: '/mdc/mdcEquipment/getEquipmentByDepPid' |
| | | }, |
| | | AnalysisList: {}, |
| | | loading: false |
| | | } |
| | | }, |
| | | watch: { |
| | | Type(valmath) { |
| | | this.dataList = [] |
| | | this.queryParams.typeTree = valmath |
| | | // console.log(this.queryParams.typeTree) |
| | | }, |
| | | nodeTree(val) { //çå¬currSelected ååï¼å°åååçæ°å¼ä¼ éç» getCurrSelected äºä»¶ |
| | | if (JSON.stringify(val) != '{}') { |
| | | if (val.equipmentId) { |
| | | // this.$set(this.queryParam, 'tierName', val.title) |
| | | this.queryParamEquip.parentId = '' |
| | | this.queryParams.equipmentId = val.equipmentId |
| | | this.queryParams.equipmentName = val.equipmentName |
| | | this.queryParamEquip.equipmentId = val.equipmentId |
| | | this.searchQuery() |
| | | } else { |
| | | // this.$set(this.queryParam, 'tierName', val.title) |
| | | this.queryParamEquip.parentId = val.key |
| | | this.queryParams.equipmentId = '' |
| | | this.initEquipment(val.key) |
| | | } |
| | | |
| | | } |
| | | }, |
| | | nodePeople(val) { |
| | | if (JSON.stringify(val) != '{}') { |
| | | if (val.equipmentId) { |
| | | // this.$set(this.queryParam, 'tierName', val.title) |
| | | this.queryParamEquip.parentId = '' |
| | | this.queryParams.equipmentId = val.equipmentId |
| | | this.queryParamEquip.equipmentId = val.equipmentId |
| | | this.searchQuery() |
| | | } else { |
| | | // this.$set(this.queryParam, 'tierName', val.title) |
| | | this.queryParamEquip.parentId = val.key |
| | | this.queryParams.equipmentId = '' |
| | | this.initEquipmentDep(val.key) |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | drawTu() { |
| | | let dayAvailBar = this.$echarts.init(document.getElementById('dayAvailBar'), 'macarons') |
| | | //dayAvailLine = echarts.init(document.getElementById('dayAvailLine')); |
| | | let dayAvailBarOption = { |
| | | title: { |
| | | text: 'è®¾å¤æ¥å©ç¨çå¾', |
| | | x: 'center', |
| | | textStyle: { |
| | | fontSize: 18, |
| | | fontWeight: 'bolder', |
| | | color: '#151414' |
| | | } |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | formatter: '{a} <br/>{b} :({c}%)' |
| | | }, |
| | | toolbox: { |
| | | show: true, |
| | | feature: { |
| | | mark: { show: true }, |
| | | dataView: { show: true, readOnly: false }, |
| | | magicType: { show: true, type: ['line', 'bar'] }, |
| | | restore: { show: true }, |
| | | saveAsImage: { show: true } |
| | | } |
| | | }, |
| | | calculable: true, //æ¯å¦å¯ç¨ææ½é计ç®ç¹æ§ |
| | | xAxis: [ |
| | | { |
| | | type: 'category', |
| | | name: 'æ¶é´å段', |
| | | boundaryGap: true, |
| | | data: this.spaceTime |
| | | } |
| | | ], |
| | | yAxis: [ |
| | | { |
| | | type: 'value', |
| | | name: 'å©ç¨ç' |
| | | } |
| | | ], |
| | | series: [ |
| | | { |
| | | name: 'å©ç¨ç', |
| | | type: 'line', |
| | | barWidth: 50, |
| | | itemStyle: { |
| | | normal: { |
| | | color: '#4169E1' |
| | | } |
| | | }, |
| | | data: this.usingRates, |
| | | markPoint: { |
| | | data: [ |
| | | { type: 'max', name: 'æå¤§å¼', symbolSize: 70 }, |
| | | { type: 'min', name: 'æå°å¼', symbolSize: 70 } |
| | | ] |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | dayAvailBar.setOption(dayAvailBarOption) |
| | | }, |
| | | moment, |
| | | onChangeStart(time, timeString) { |
| | | this.queryParam.startTime = timeString |
| | | // console.log(time, timeString); |
| | | }, |
| | | onChangeEnd(time, timeString) { |
| | | this.queryParam.endTime = timeString |
| | | // console.log(time, timeString); |
| | | }, |
| | | disabledDate(current) { |
| | | //Can not slect days before today and today |
| | | return current && current > moment().subtract('days', 1) |
| | | }, |
| | | dataChange(val) { |
| | | if (val) this.queryParam.dateTime = val.format('YYYYMMDD') |
| | | }, |
| | | handleChange(value) { |
| | | this.queryParam.timeType = value |
| | | // console.log(this.queryParam.timeType) |
| | | }, |
| | | tabChange(val) { |
| | | this.activeKey = val |
| | | }, |
| | | dateParamChange(v1, v2) { |
| | | // console.log(v1,v2) |
| | | this.queryParam.startDate = v2[0] |
| | | this.queryParam.endDate = v2[1] |
| | | // console.log(v2[0],v2[1]) |
| | | }, |
| | | loadAnalysis() { |
| | | this.loading = true |
| | | getAction(this.url.dayUtilizationRateContrast, this.queryParam).then(res => { |
| | | if (res.success) { |
| | | this.spaceTime.push(res.result.dataList) |
| | | for (let i = 0; i < res.result.dayRateDto.length; i++) { |
| | | this.usingRates.push(res.result.dayRateDto[i].utilizationRate) |
| | | } |
| | | this.drawTu() |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | numFilter(value) { |
| | | if (value) { |
| | | return parseFloat((value * 100).toFixed(2)) |
| | | } else { |
| | | return '0' |
| | | } |
| | | }, |
| | | searchQuery() { |
| | | if (this.queryParam.startTime && this.queryParam.endTime && this.dates && this.dates.length > 0) { |
| | | this.loading = true |
| | | this.spaceTime = [] |
| | | this.usingRates = [] |
| | | if (this.queryParams.typeTree == '1') { |
| | | this.queryParams.parentId = this.queryParamEquip.parentId |
| | | // this.queryParams.equipmentId = this.queryParamEquip.equipmentId |
| | | |
| | | } else { |
| | | this.queryParams.parentId = this.queryParamEquip.parentId |
| | | // this.queryParams.equipmentId = "" |
| | | } |
| | | this.AnalysisList = [] |
| | | //è·åæ¥è¯¢æ¡ä»¶ |
| | | this.queryParam.parentId = this.queryParams.parentId |
| | | this.queryParam.equipmentId = this.queryParams.equipmentId |
| | | this.queryParam.typeTree = this.queryParams.typeTree |
| | | getAction(this.url.dayUtilizationRateContrast, this.queryParam).then((res) => { |
| | | if (res.success) { |
| | | this.spaceTime = res.result.dateList |
| | | for (let i = 0; i < res.result.dayRateDto.length; i++) { |
| | | // res.result[i].useRateDayShift = this.numFilter(res.result[i].useRateDayShift) |
| | | this.usingRates.push(this.numFilter(res.result.dayRateDto[i].utilizationRate)) |
| | | } |
| | | this.drawTu() |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: 'è¯·éæ©æ¶é´ææ¶é´æ®µ' |
| | | }) |
| | | } |
| | | }, |
| | | searchReset() { |
| | | this.loading = true |
| | | this.spaceTime = [] |
| | | this.usingRates = [] |
| | | if (this.queryParams.typeTree == '1') { |
| | | this.typeTree = this.queryParams.typeTree |
| | | this.typeParent = this.queryParams.parentId |
| | | this.typeEquipment = this.queryParams.equipmentId |
| | | this.queryParams = {} |
| | | this.queryParam = {} |
| | | this.queryParams.typeTree = this.typeTree |
| | | this.queryParams.parentId = this.typeParent |
| | | if (this.queryParams.parentId != '') { |
| | | this.queryParams.equipmentId = '' |
| | | this.initEquipment() |
| | | } else { |
| | | if (this.queryParams.equipmentId == this.queryParamEquip.equipmentId) { |
| | | this.queryParams.equipmentId = this.typeEquipment |
| | | } else { |
| | | this.queryParams.equipmentId = this.queryParamEquip.equipmentId |
| | | } |
| | | } |
| | | getAction(this.url.dayUtilizationRateContrast, this.queryParams).then((res) => { |
| | | if (res.success) { |
| | | this.spaceTime = res.result.dateList |
| | | for (let i = 0; i < res.result.dayRateDto.length; i++) { |
| | | this.usingRates.push(this.numFilter(res.result.dayRateDto[i].utilizationRate)) |
| | | } |
| | | this.drawTu() |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | } else { |
| | | this.typeTree = this.queryParams.typeTree |
| | | this.typeParent = this.queryParams.parentId |
| | | this.typeEquipment = this.queryParams.equipmentId |
| | | this.queryParams = {} |
| | | this.queryParam = {} |
| | | this.dates = [] |
| | | this.queryParams.typeTree = this.typeTree |
| | | this.queryParams.parentId = this.typeParent |
| | | if (this.queryParams.parentId != '') { |
| | | this.queryParams.equipmentId = '' |
| | | this.initEquipment() |
| | | } else { |
| | | if (this.queryParams.equipmentId == this.queryParamEquip.equipmentId) { |
| | | this.queryParams.equipmentId = this.typeEquipment |
| | | } else { |
| | | this.queryParams.equipmentId = this.queryParamEquip.equipmentId |
| | | } |
| | | } |
| | | getAction(this.url.dayUtilizationRateContrast, this.queryParams).then((res) => { |
| | | if (res.success) { |
| | | this.spaceTime = res.result.dateList |
| | | for (let i = 0; i < res.result.dayRateDto.length; i++) { |
| | | this.usingRates.push(this.numFilter(res.result.dayRateDto[i].utilizationRate)) |
| | | } |
| | | this.drawTu() |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | initEquipment(id) { |
| | | let _this = this |
| | | getAction(this.url.getEquipmentByPid, { pid: id }).then((res) => { |
| | | if (res.success) { |
| | | if (res.result != null) { |
| | | _this.$set(this.queryParams, 'equipmentName', res.result.equipmentName) |
| | | _this.$set(this.queryParams, 'equipmentId', res.result.equipmentId) |
| | | _this.$set(this.queryParam, 'equipmentId', res.result.equipmentId) |
| | | _this.equipment = res.result |
| | | _this.searchQuery() |
| | | } else { |
| | | this.queryParams = {} |
| | | // this.queryList() |
| | | this.equipment = {} |
| | | // _this.$message.warning('请è系管çåï¼å¼æ¾è®¾å¤æéï¼') |
| | | _this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: '请è系管çåï¼å¼æ¾è®¾å¤æéï¼' |
| | | }) |
| | | } |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | _this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | initEquipmentDep(id) { |
| | | let _this = this |
| | | getAction(this.url.getEquipmentByDepPid, { pid: id }).then((res) => { |
| | | if (res.success) { |
| | | if (res.result != null) { |
| | | _this.$set(this.queryParams, 'equipmentName', res.result.equipmentName) |
| | | _this.$set(this.queryParams, 'equipmentId', res.result.equipmentId) |
| | | _this.$set(this.queryParam, 'equipmentId', res.result.equipmentId) |
| | | _this.equipment = res.result |
| | | _this.searchQuery() |
| | | } else { |
| | | this.queryParams = {} |
| | | // this.queryList() |
| | | this.equipment = {} |
| | | // _this.$message.warning('请è系管çåï¼å¼æ¾è®¾å¤æéï¼') |
| | | _this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: '请è系管çåï¼å¼æ¾è®¾å¤æéï¼' |
| | | }) |
| | | } |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | _this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | created() { |
| | | this.dates = [moment().subtract('days', 7), moment().subtract('days', 0)] |
| | | this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD') |
| | | this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD') |
| | | this.queryParam.startTime = '00:00' |
| | | this.queryParam.endTime = '08:00' |
| | | this.queryParams.typeTree = '1' |
| | | |
| | | }, |
| | | mounted() { |
| | | this.initEquipment() |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /*@import '~@assets/less/common.less';*/ |
| | | |
| | | @media screen and (min-width: 1920px) { |
| | | .device_list { |
| | | height: 811px !important; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | @media screen and (min-width: 1680px) and (max-width: 1920px) { |
| | | .device_list { |
| | | height: 811px !important; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | @media screen and (min-width: 1400px) and (max-width: 1680px) { |
| | | .device_list { |
| | | height: 663px !important; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | @media screen and (min-width: 1280px) and (max-width: 1400px) { |
| | | .device_list { |
| | | height: 564px !important; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | @media screen and (max-width: 1280px) { |
| | | .device_list { |
| | | height: 564px !important; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | /deep/ .ant-card-body { |
| | | height: 100% !important; |
| | | } |
| | | |
| | | .device_list .com_box { |
| | | display: flex !important; |
| | | height: 100% !important; |
| | | flex-direction: column !important; |
| | | } |
| | | |
| | | .device_list .table-page-search-wrapper { |
| | | height: 6% !important; |
| | | } |
| | | |
| | | .device_list #DeviceList { |
| | | height: 90% !important; |
| | | } |
| | | </style> |