merge
This commit is contained in:
commit
4571786780
4
.env.dev
4
.env.dev
@ -1,7 +1,7 @@
|
|||||||
###
|
###
|
||||||
# @Author: Do not edit
|
# @Author: Do not edit
|
||||||
# @Date: 2023-08-29 09:40:39
|
# @Date: 2023-08-29 09:40:39
|
||||||
# @LastEditTime: 2024-03-29 14:45:32
|
# @LastEditTime: 2024-04-03 11:22:19
|
||||||
# @LastEditors: DY
|
# @LastEditors: DY
|
||||||
# @Description:
|
# @Description:
|
||||||
###
|
###
|
||||||
@ -18,7 +18,7 @@ VUE_APP_TITLE = MES系统
|
|||||||
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
|
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
|
||||||
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
|
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
|
||||||
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
|
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
|
||||||
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
|
# VUE_APP_BASE_API = 'http://192.168.4.173:48082'
|
||||||
# VUE_APP_BASE_API = 'http://192.168.1.104:48082'
|
# VUE_APP_BASE_API = 'http://192.168.1.104:48082'
|
||||||
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
|
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
|
||||||
# VUE_APP_BASE_API = 'http://192.168.1.62:48082'
|
# VUE_APP_BASE_API = 'http://192.168.1.62:48082'
|
||||||
|
@ -35,3 +35,21 @@ export function getQoq(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取能源设备树
|
||||||
|
export function getTree() {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/energy-analysis/getTree',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出(走势分析)
|
||||||
|
export function exportTrend(data) {
|
||||||
|
return request({
|
||||||
|
url: '/analysis/energy-analysis/exportTrend',
|
||||||
|
method: 'post',
|
||||||
|
responseType: 'blob',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
@ -68,3 +68,4 @@ export function exportEnergyTypeExcel(query) {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 126 KiB |
Binary file not shown.
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 141 KiB |
@ -12,7 +12,7 @@
|
|||||||
:label-width="`${labelWidth}px`"
|
:label-width="`${labelWidth}px`"
|
||||||
:size="size"
|
:size="size"
|
||||||
:label-position="labelPosition"
|
:label-position="labelPosition"
|
||||||
v-loading="formLoading">
|
v-loading="0 && formLoading">
|
||||||
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
||||||
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
||||||
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
||||||
|
@ -97,6 +97,8 @@ export const DICT_TYPE = {
|
|||||||
TABLE_NAME: 'table_name',
|
TABLE_NAME: 'table_name',
|
||||||
METHOD: 'method',
|
METHOD: 'method',
|
||||||
PUSH: 'push',
|
PUSH: 'push',
|
||||||
|
ENERGY_TYPE: 'energy_type',
|
||||||
|
|
||||||
|
|
||||||
// ============== ORDER - 订单模块 =============
|
// ============== ORDER - 订单模块 =============
|
||||||
ORDER_STATUS: 'order_status',
|
ORDER_STATUS: 'order_status',
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2021-07-19 15:18:30
|
* @Date: 2021-07-19 15:18:30
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-28 15:28:07
|
* @LastEditTime: 2024-03-29 16:49:00
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@ -16,11 +16,11 @@
|
|||||||
许昌安彩AGV原片周转看板
|
许昌安彩AGV原片周转看板
|
||||||
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
||||||
<h3 class="time">{{ times }}</h3>
|
<h3 class="time">{{ times }}</h3>
|
||||||
<el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px', fontSize: '32px' }"
|
<!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px', fontSize: '32px' }"
|
||||||
@click="changeFullScreen">
|
@click="changeFullScreen">
|
||||||
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
||||||
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="container-main flex-col" type="flex">
|
<el-row class="container-main flex-col" type="flex">
|
||||||
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15 * beilv" type="flex" class="flex-1">
|
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15 * beilv" type="flex" class="flex-1">
|
||||||
@ -35,13 +35,15 @@
|
|||||||
<base-container :beilv="1" :size="'eqStatus'" :title="'周转进度'" :title-icon="'order'" :back="'energy'">
|
<base-container :beilv="1" :size="'eqStatus'" :title="'周转进度'" :title-icon="'order'" :back="'energy'">
|
||||||
<div class="order" style="width:100%; overflow: hidden scroll;height: 350px;">
|
<div class="order" style="width:100%; overflow: hidden scroll;height: 350px;">
|
||||||
<el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: 1em">
|
<el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: 1em">
|
||||||
<p v-if="op.outRate === 1" class="now-secondary-title" style="color:#4679FD">
|
<!-- <p v-if="op.outRate === 1" class="now-secondary-title"
|
||||||
|
style="font-size: 14px; opacity: calc(.6);color:#4679FD">
|
||||||
<i class="el-icon-check" />
|
<i class="el-icon-check" />
|
||||||
{{ op.name }}
|
{{ op.name }}
|
||||||
</p>
|
</p> -->
|
||||||
<p v-else class="now-secondary-title">{{ op.name }}</p>
|
<!-- <p class="now-secondary-title">{{ op.name }}</p> -->
|
||||||
<el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white"
|
<p class="now-secondary-title" style="font-size: 14px;opacity: calc(.6);">{{ op.name }}</p>
|
||||||
:percentage="op.outRate * 100" class="custom-progress-bar" />
|
<el-progress style="width: 910px;" text-color="rgba(255, 255, 255, .6)" :stroke-width="10"
|
||||||
|
define-back-color="rgba(32, 57, 96, 1)" :percentage="op.outRate * 100" class="custom-progress-bar" />
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</base-container>
|
</base-container>
|
||||||
@ -496,7 +498,7 @@ export default {
|
|||||||
seconds = "0" + seconds;
|
seconds = "0" + seconds;
|
||||||
}
|
}
|
||||||
//拼接格式化当前时间
|
//拼接格式化当前时间
|
||||||
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
},
|
},
|
||||||
windowWidth(value) {
|
windowWidth(value) {
|
||||||
this.clientWidth = value
|
this.clientWidth = value
|
||||||
@ -530,11 +532,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.visual-container {
|
.visual-container {
|
||||||
width: 1920px;
|
width: 1920px;
|
||||||
height: 1080px;
|
height: 1080px;
|
||||||
@ -556,7 +553,7 @@ export default {
|
|||||||
top: 25px;
|
top: 25px;
|
||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.80);
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
.time {
|
.time {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -564,7 +561,7 @@ export default {
|
|||||||
top: 25px;
|
top: 25px;
|
||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.80);
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: .72px;
|
||||||
}
|
}
|
||||||
.title-button {
|
.title-button {
|
||||||
color: #00fff0;
|
color: #00fff0;
|
||||||
@ -607,6 +604,12 @@ export default {
|
|||||||
::v-deep .el-progress-bar__inner {
|
::v-deep .el-progress-bar__inner {
|
||||||
background-color: unset;
|
background-color: unset;
|
||||||
background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
||||||
|
}
|
||||||
|
::v-deep .el-progress__text {
|
||||||
|
margin-top: -70px;
|
||||||
|
margin-left: 820px;
|
||||||
|
// background-color: unset;
|
||||||
|
// background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
||||||
}
|
}
|
||||||
.visual-select {
|
.visual-select {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2024-01-29 16:50:26
|
* @Date: 2024-01-29 16:50:26
|
||||||
* @LastEditTime: 2024-03-28 16:35:49
|
* @LastEditTime: 2024-04-02 15:01:40
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
@ -17,11 +17,11 @@
|
|||||||
许昌安彩冷端看板
|
许昌安彩冷端看板
|
||||||
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
||||||
<h3 class="time">{{ times }}</h3>
|
<h3 class="time">{{ times }}</h3>
|
||||||
<el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
|
<!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
|
||||||
@click="changeFullScreen">
|
@click="changeFullScreen">
|
||||||
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
||||||
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="container-main flex-col" type="flex">
|
<el-row class="container-main flex-col" type="flex">
|
||||||
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1">
|
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1">
|
||||||
@ -40,6 +40,12 @@
|
|||||||
<top-radio-group />
|
<top-radio-group />
|
||||||
</div> -->
|
</div> -->
|
||||||
<!-- 像下面这样表格里的limit值,也许可以用js动态计算出来 -->
|
<!-- 像下面这样表格里的limit值,也许可以用js动态计算出来 -->
|
||||||
|
<div v-if="coldDetData" class="myLegend">
|
||||||
|
<div class="barLegend"></div>
|
||||||
|
<h4 class="barText">产线产量</h4>
|
||||||
|
<div class="barCircle"></div>
|
||||||
|
<h4 class="barCircleText">产线良品率</h4>
|
||||||
|
</div>
|
||||||
<double-y-chart ref="productChart" :id="'doubleYChart'" :name-list="cxNameList" :data-list="cxDataList"
|
<double-y-chart ref="productChart" :id="'doubleYChart'" :name-list="cxNameList" :data-list="cxDataList"
|
||||||
:height="359" :show-legend="true" />
|
:height="359" :show-legend="true" />
|
||||||
</base-container>
|
</base-container>
|
||||||
@ -64,11 +70,11 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
<!-- <el-row :gutter="9"> -->
|
<!-- <el-row :gutter="9"> -->
|
||||||
<!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> -->
|
<!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> -->
|
||||||
<pile-bar-chart style="margin-bottom: -15px" ref="firstPileChart" :height="90" />
|
<pile-bar-chart id=" 'one' " style="margin-top: -5px;" ref="firstPileChart" :height="80" />
|
||||||
<second-pile-bar-chart style="margin-bottom: -15px" id=" 'second' " ref="secondPileChart" :height="90" />
|
<second-pile-bar-chart id=" 'second' " ref="secondPileChart" :height="90" />
|
||||||
<third-pile-bar-chart style="margin-bottom: -15px" id=" 'third' " ref="thirdPileChart" :height="90" />
|
<third-pile-bar-chart id=" 'third' " ref="thirdPileChart" :height="90" />
|
||||||
<fourth-pile-bar-chart style="margin-bottom: -15px" id=" 'fourth' " ref="fourthPileChart" :height="90" />
|
<fourth-pile-bar-chart id=" 'fourth' " ref="fourthPileChart" :height="90" />
|
||||||
<fifth-pile-bar-chart style="margin-bottom: -15px" id=" 'fifth' " ref="fifthPileChart" :height="100" />
|
<fifth-pile-bar-chart style="margin-top: -5px;" id=" 'fifth' " ref="fifthPileChart" :height="90" />
|
||||||
<!-- <pile-bar-chart ref="secondPileChart"
|
<!-- <pile-bar-chart ref="secondPileChart"
|
||||||
:height="90" />
|
:height="90" />
|
||||||
<pile-bar-chart ref="thirdPileChart"
|
<pile-bar-chart ref="thirdPileChart"
|
||||||
@ -244,6 +250,7 @@ export default {
|
|||||||
funWs: undefined,
|
funWs: undefined,
|
||||||
SJGws: undefined,
|
SJGws: undefined,
|
||||||
funWsData: {},
|
funWsData: {},
|
||||||
|
coldDetData:[],
|
||||||
SJGWsData: {},
|
SJGWsData: {},
|
||||||
cxNameList:[],
|
cxNameList:[],
|
||||||
cxDataList:[],
|
cxDataList:[],
|
||||||
@ -314,16 +321,39 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.getProductData()
|
||||||
|
// this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
|
||||||
|
this.getTimes()
|
||||||
|
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
|
||||||
|
this.funInitWebSocket()
|
||||||
|
if (!this.wsIsOpen) {
|
||||||
|
getDcsMsg()
|
||||||
|
this.wsIsOpen = true
|
||||||
|
console.log('开启websocket==========')
|
||||||
|
}
|
||||||
|
this.CutInitWebSocket()
|
||||||
|
this.SJGInitWebSocket()
|
||||||
|
const _this = this;
|
||||||
|
_this.beilv2 = document.documentElement.clientWidth / 1920
|
||||||
|
window.onresize = () => {
|
||||||
|
return (() => {
|
||||||
|
_this.clientWidth = `${document.documentElement.clientWidth}`
|
||||||
|
this.beilv2 = _this.clientWidth / 1920
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getProductData() {
|
||||||
let nameList = []
|
let nameList = []
|
||||||
let nameWasteList = []
|
let nameWasteList = []
|
||||||
let topNameList = []
|
let topNameList = []
|
||||||
let productList = []
|
let productList = []
|
||||||
let wasteList = []
|
let wasteList = []
|
||||||
let yieldList = []
|
let yieldList = []
|
||||||
// let sumAreaList = []
|
let sumAreaList = []
|
||||||
// let yieldList = []
|
// let yieldList = []
|
||||||
// this.cutTableDataList =
|
// this.cutTableDataList =
|
||||||
let coldDetData = [
|
this.coldDetData = [
|
||||||
{
|
{
|
||||||
"first": 0.8834,
|
"first": 0.8834,
|
||||||
"lineName": "Y61",
|
"lineName": "Y61",
|
||||||
@ -375,78 +405,61 @@ export default {
|
|||||||
"yield": 0.9133
|
"yield": 0.9133
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
coldDetData.forEach((ele, index) => {
|
this.coldDetData.forEach((ele, index) => {
|
||||||
nameList.push(ele.lineName)
|
nameList.push(ele.lineName)
|
||||||
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea)
|
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
|
||||||
productList.push(ele.productArea)
|
productList.push(ele.productArea)
|
||||||
wasteList.push(ele.wastArea)
|
wasteList.push(ele.wastArea)
|
||||||
nameWasteList.push('缺陷面积:' + ele.wastArea)
|
nameWasteList.push('缺陷面积:' + ele.wastArea + '㎡')
|
||||||
yieldList.push({
|
// yieldList.push({
|
||||||
name: '良品',
|
// name: '良品',
|
||||||
yield:ele.yield
|
// yield:ele.yield
|
||||||
})
|
// })
|
||||||
// sumAreaList.push(ele.sumArea)
|
sumAreaList.push(ele.sumArea)
|
||||||
// yieldList.push((ele.yield * 100).toFixed(3))
|
yieldList.push((ele.yield * 100).toFixed(3))
|
||||||
})
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
|
||||||
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
||||||
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
|
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
|
||||||
this.$refs.thirdPileChart.initChart(nameList, [topNameList[2]], [nameWasteList[2]], [productList[2]], [wasteList[2]])
|
this.$refs.thirdPileChart.initChart(nameList, [topNameList[2]], [nameWasteList[2]], [productList[2]], [wasteList[2]])
|
||||||
this.$refs.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]])
|
this.$refs.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]])
|
||||||
this.$refs.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]])
|
this.$refs.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]])
|
||||||
// this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
|
})
|
||||||
this.getTimes()
|
},
|
||||||
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
|
getData() {
|
||||||
this.funInitWebSocket()
|
let detData = [
|
||||||
if (!this.wsIsOpen) {
|
{
|
||||||
getDcsMsg()
|
name: '1',
|
||||||
this.wsIsOpen = true
|
run: '运行',
|
||||||
console.log('开启websocket==========')
|
},
|
||||||
}
|
{
|
||||||
this.CutInitWebSocket()
|
name: '2',
|
||||||
this.SJGInitWebSocket()
|
run: '未运行',
|
||||||
const _this = this;
|
},
|
||||||
_this.beilv2 = document.documentElement.clientWidth / 1920
|
{
|
||||||
window.onresize = () => {
|
name: '3',
|
||||||
return (() => {
|
run: '运行',
|
||||||
_this.clientWidth = `${document.documentElement.clientWidth}`
|
},
|
||||||
this.beilv2 = _this.clientWidth / 1920
|
{
|
||||||
})()
|
name: '4',
|
||||||
}
|
run: '未运行',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '1',
|
||||||
|
run: '运行',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
this.realEqList = detData.map((item, index) => [
|
||||||
|
// console.log(item)
|
||||||
|
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||||
|
</span>`,
|
||||||
|
`<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`,
|
||||||
|
`<span style="color:rgba(255,255,255,0.5)"><div style="${item.run == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${item.run || ''}</span>`,
|
||||||
|
])
|
||||||
|
this.realEqConfig.data = this.realEqList
|
||||||
|
this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
// getData() {
|
|
||||||
// let detData = [
|
|
||||||
// {
|
|
||||||
// name: '1',
|
|
||||||
// run: '运行',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '2',
|
|
||||||
// run: '未运行',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '3',
|
|
||||||
// run: '运行',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '4',
|
|
||||||
// run: '未运行',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '1',
|
|
||||||
// run: '运行',
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
// this.realEqList = detData.map((item, index) => [
|
|
||||||
// // console.log(item)
|
|
||||||
// `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
|
||||||
// </span>`,
|
|
||||||
// `<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`,
|
|
||||||
// `<span style="color:rgba(255,255,255,0.5)"><div style="${item.run == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${item.run || ''}</span>`,
|
|
||||||
// ])
|
|
||||||
// this.realEqConfig.data = this.realEqList
|
|
||||||
// this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
|
|
||||||
// },
|
|
||||||
CutWebsocketClose(e) {
|
CutWebsocketClose(e) {
|
||||||
this.Cutws.ws.onclose = (event) => { console.log(event );}
|
this.Cutws.ws.onclose = (event) => { console.log(event );}
|
||||||
},
|
},
|
||||||
@ -495,7 +508,7 @@ export default {
|
|||||||
seconds = "0" + seconds;
|
seconds = "0" + seconds;
|
||||||
}
|
}
|
||||||
//拼接格式化当前时间
|
//拼接格式化当前时间
|
||||||
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
},
|
},
|
||||||
SJGInitWebSocket() {
|
SJGInitWebSocket() {
|
||||||
let date = new Date().valueOf()
|
let date = new Date().valueOf()
|
||||||
@ -525,10 +538,9 @@ export default {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
this.realEqConfig.data = this.realEqList
|
this.realEqConfig.data = this.realEqList
|
||||||
this.$nextTick(() => {
|
// this.$nextTick(() => {
|
||||||
this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
|
this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
|
||||||
|
// })
|
||||||
})
|
|
||||||
};
|
};
|
||||||
// if (typeof (WebSocket) === 'undefined') {
|
// if (typeof (WebSocket) === 'undefined') {
|
||||||
// alert('您的浏览器不支持WebSocket')
|
// alert('您的浏览器不支持WebSocket')
|
||||||
@ -572,7 +584,11 @@ export default {
|
|||||||
<div style = "${(item.product * 100).toFixed(2) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div>`
|
<div style = "${(item.product * 100).toFixed(2) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div>`
|
||||||
])
|
])
|
||||||
this.cutConfig.data = cutArr
|
this.cutConfig.data = cutArr
|
||||||
|
// this.$nextTick(() => {
|
||||||
this.$refs['cutScrollBoard'].updateRows(cutArr)
|
this.$refs['cutScrollBoard'].updateRows(cutArr)
|
||||||
|
// })
|
||||||
|
// this.cutConfig.data = cutArr
|
||||||
|
// this.$refs['cutScrollBoard'].updateRows(cutArr)
|
||||||
} else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') {
|
} else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') {
|
||||||
let nameList = []
|
let nameList = []
|
||||||
let nameWasteList = []
|
let nameWasteList = []
|
||||||
@ -581,22 +597,25 @@ export default {
|
|||||||
let wasteList = []
|
let wasteList = []
|
||||||
let sumAreaList = []
|
let sumAreaList = []
|
||||||
let yieldList = []
|
let yieldList = []
|
||||||
|
this.coldDetData = this.cutWsData.coldDetData
|
||||||
// this.cutTableDataList =
|
// this.cutTableDataList =
|
||||||
this.cutWsData.coldDetData.forEach((ele, index) => {
|
this.cutWsData.coldDetData.forEach((ele, index) => {
|
||||||
nameList.push(ele.lineName)
|
nameList.push(ele.lineName)
|
||||||
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea)
|
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
|
||||||
productList.push(ele.productArea)
|
productList.push(ele.productArea)
|
||||||
wasteList.push(ele.wastArea)
|
wasteList.push(ele.wastArea)
|
||||||
nameWasteList.push('缺陷面积:' + ele.wastArea)
|
nameWasteList.push('缺陷面积:' + ele.wastArea + '㎡')
|
||||||
sumAreaList.push(ele.sumArea)
|
sumAreaList.push(ele.sumArea)
|
||||||
yieldList.push(parseFloat((ele.yield * 100).toFixed(3)))
|
yieldList.push(parseFloat((ele.yield * 100).toFixed(3)))
|
||||||
})
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
||||||
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
|
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
|
||||||
this.$refs.thirdPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
this.$refs.thirdPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
||||||
this.$refs.fourthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
this.$refs.fourthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
||||||
this.$refs.fifthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
this.$refs.fifthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
|
||||||
this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
|
this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// if (typeof (WebSocket) === 'undefined') {
|
// if (typeof (WebSocket) === 'undefined') {
|
||||||
@ -632,17 +651,18 @@ export default {
|
|||||||
for (let i in this.funWsData.data.annealFanInfo) {
|
for (let i in this.funWsData.data.annealFanInfo) {
|
||||||
index++,
|
index++,
|
||||||
arr.push([
|
arr.push([
|
||||||
`
|
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}
|
||||||
<span style="color:rgba(255,255,255,0.5)" >${index || ''}
|
|
||||||
</span>`,
|
</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)" >${i || ''}
|
// `<span style="color:rgba(255,255,255,0.5)" >${i || ''}
|
||||||
</span>`,
|
// </span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${i || ''}</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)"><div style="${item.run == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${item.run || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)"><div style="${this.funWsData.data.annealFanInfo[i] == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${this.funWsData.data.annealFanInfo[i] || ''}</span>`,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
this.annealFunConfig.data = arr
|
this.annealFunConfig.data = arr
|
||||||
|
// this.$nextTick(() => {
|
||||||
this.$refs['annealFunScrollBoard'].updateRows(arr)
|
this.$refs['annealFunScrollBoard'].updateRows(arr)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
if (this.funWsData.type === 'FanInfo') {
|
if (this.funWsData.type === 'FanInfo') {
|
||||||
let arr = []
|
let arr = []
|
||||||
@ -650,14 +670,16 @@ export default {
|
|||||||
for (let i in this.funWsData.data.fanInfo) {
|
for (let i in this.funWsData.data.fanInfo) {
|
||||||
index++,
|
index++,
|
||||||
arr.push([
|
arr.push([
|
||||||
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}
|
||||||
`<span style="color:rgba(255,255,255,0.5)" >${i || ''}</span>`,
|
</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${i || ''}</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)"><div style="${item.run == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${item.run || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)"><div style="${this.funWsData.data.fanInfo[i] == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${this.funWsData.data.fanInfo[i] || ''}</span>`,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
this.funConfig.data = arr
|
this.funConfig.data = arr
|
||||||
|
// this.$nextTick(() => {
|
||||||
this.$refs['funScrollBoard'].updateRows(arr)
|
this.$refs['funScrollBoard'].updateRows(arr)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// if (typeof (WebSocket) === 'undefined') {
|
// if (typeof (WebSocket) === 'undefined') {
|
||||||
@ -772,7 +794,37 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.myLegend{
|
||||||
|
position: absolute;
|
||||||
|
top: -20px;
|
||||||
|
right: 50px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(255,255,255,.6);
|
||||||
|
.barLegend{
|
||||||
|
// float: left;
|
||||||
|
background: linear-gradient(#9DD5FF, #1295FF);
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.barText{
|
||||||
|
// float: right;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.barCircle{
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(255, 209, 96, 1);
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.barCircleText{
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
.visual-container {
|
.visual-container {
|
||||||
width: 1920px;
|
width: 1920px;
|
||||||
height: 1080px;
|
height: 1080px;
|
||||||
@ -794,7 +846,7 @@ export default {
|
|||||||
top: 25px;
|
top: 25px;
|
||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.80);
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
@ -803,7 +855,7 @@ export default {
|
|||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.80);
|
||||||
top: 25px;
|
top: 25px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: .72px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-button {
|
.title-button {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2022-01-21 14:43:06
|
* @Date: 2022-01-21 14:43:06
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-28 16:45:24
|
* @LastEditTime: 2024-03-29 14:50:50
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@ -158,6 +158,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initChart() {
|
initChart() {
|
||||||
this.chart = echarts.init(document.getElementById(this.id))
|
this.chart = echarts.init(document.getElementById(this.id))
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.chart.resize();
|
||||||
|
});
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
title: this.showCenterTitle
|
title: this.showCenterTitle
|
||||||
? {
|
? {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: gtz
|
* @Author: gtz
|
||||||
* @Date: 2022-01-19 15:58:17
|
* @Date: 2022-01-19 15:58:17
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-27 10:26:35
|
* @LastEditTime: 2024-03-29 14:47:29
|
||||||
* @Description: file content
|
* @Description: file content
|
||||||
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
|
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
|
||||||
-->
|
-->
|
||||||
@ -164,7 +164,7 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
// background-color: rgba($color: #061027, $alpha: 0.15);
|
// background-color: rgba($color: #061027, $alpha: 0.15);
|
||||||
position: relative;
|
position: relative;
|
||||||
opacity: calc(.8);
|
// opacity: calc(.8);
|
||||||
// border: 2px solid;
|
// border: 2px solid;
|
||||||
// background: url('../../../../assets/img/energy.png') no-repeat;
|
// background: url('../../../../assets/img/energy.png') no-repeat;
|
||||||
// background-size: 100% 100%;
|
// background-size: 100% 100%;
|
||||||
@ -274,6 +274,8 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
font-weight: normal;
|
||||||
|
letter-spacing: .8px;
|
||||||
padding: 0.67em 0.67em 0.3em 0.67em;
|
padding: 0.67em 0.67em 0.3em 0.67em;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-09-21 09:06:28
|
* @Date: 2023-09-21 09:06:28
|
||||||
* @LastEditTime: 2024-03-25 18:34:58
|
* @LastEditTime: 2024-04-01 09:12:56
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div :id="id" class="productChart" :style="{ height: '390px', width: width }" />
|
<div :id="id" class="coldProductChart" :style="{ height: '390px', width: width }" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -71,9 +71,9 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
console.log('mounted')
|
console.log('mounted')
|
||||||
console.log('borderRadius: ', this.borderRadius)
|
console.log('borderRadius: ', this.borderRadius)
|
||||||
// this.$nextTick(() => {
|
this.$el.addEventListener('resize', () => {
|
||||||
// this.initChart()
|
console.log('resziing.....');
|
||||||
// })
|
});
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (!this.chart) {
|
if (!this.chart) {
|
||||||
@ -114,6 +114,7 @@ export default {
|
|||||||
name: '产线良品率',
|
name: '产线良品率',
|
||||||
symbol: 'circle', //变为实心圆
|
symbol: 'circle', //变为实心圆
|
||||||
type: 'line',
|
type: 'line',
|
||||||
|
// symbolSize: 7,
|
||||||
yAxisIndex: 0,
|
yAxisIndex: 0,
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
@ -141,6 +142,16 @@ export default {
|
|||||||
]
|
]
|
||||||
// const colors = ['#5470C6', '#91CC75', '#EE6666']
|
// const colors = ['#5470C6', '#91CC75', '#EE6666']
|
||||||
this.chart = echarts.init(document.getElementById(this.id))
|
this.chart = echarts.init(document.getElementById(this.id))
|
||||||
|
let isFinished = false //标记 isFinished
|
||||||
|
this.chart.on('finished', _ => {
|
||||||
|
if (!isFinished) {
|
||||||
|
console.log('我只执行一次')
|
||||||
|
isFinished = true
|
||||||
|
// this.isLoading = false //关闭loading
|
||||||
|
this.chart.resize() //重新渲染charts大小
|
||||||
|
}
|
||||||
|
console.log(113, 'finished')
|
||||||
|
})
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
// color: colors,
|
// color: colors,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@ -151,22 +162,33 @@ export default {
|
|||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: "3%",
|
left: "3%",
|
||||||
right: "5%",
|
right: "10%",
|
||||||
bottom: "3%",
|
bottom: "3%",
|
||||||
containLabel: true
|
containLabel: true
|
||||||
},
|
},
|
||||||
legend: {
|
// legend: {
|
||||||
itemWidth: 10,
|
// itemWidth: 10,
|
||||||
itemHeight: 10,
|
// itemHeight: 10,
|
||||||
top: '20',
|
// top: '5',
|
||||||
// right: '20px',
|
// right: '20px',
|
||||||
data: ['产线产量', '产线良品率'],
|
// data: [
|
||||||
textStyle: {
|
// // { icon: 'rect', name: '直接访问' },
|
||||||
fontSize: 12 * this.beilv,
|
// { icon: 'roundRect', name: '产线产量' },
|
||||||
color: '#ced1d5'
|
// // {
|
||||||
}
|
// // icon: 'circle', name: '产线良品率',
|
||||||
},
|
// // itemWidth: 7,
|
||||||
|
// // itemHeight: 7,
|
||||||
|
// // },
|
||||||
|
// ],
|
||||||
|
// textStyle: {
|
||||||
|
// fontSize: 12 * this.beilv,
|
||||||
|
// color: '#ced1d5'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
axisTick: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
type: 'category',
|
type: 'category',
|
||||||
axisLine: {
|
axisLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
@ -202,7 +224,7 @@ export default {
|
|||||||
type: 'value',
|
type: 'value',
|
||||||
name: '良品率/%',
|
name: '良品率/%',
|
||||||
nameTextStyle: {// y轴上方单位的颜色
|
nameTextStyle: {// y轴上方单位的颜色
|
||||||
color: '#fff',
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
align: "left",
|
align: "left",
|
||||||
},
|
},
|
||||||
position: 'right',
|
position: 'right',
|
||||||
@ -245,7 +267,7 @@ export default {
|
|||||||
type: 'value',
|
type: 'value',
|
||||||
name: '产量/㎡', // y轴上方的单位
|
name: '产量/㎡', // y轴上方的单位
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
// fontSize: 10,
|
// fontSize: 10,
|
||||||
align: "right",
|
align: "right",
|
||||||
},
|
},
|
||||||
@ -286,7 +308,8 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.productChart{
|
|
||||||
|
.coldProductChart{
|
||||||
top: -10px;
|
top: -10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-09-21 09:06:28
|
* @Date: 2023-09-21 09:06:28
|
||||||
* @LastEditTime: 2024-03-28 16:31:20
|
* @LastEditTime: 2024-03-29 16:26:28
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
@ -106,7 +106,8 @@ export default {
|
|||||||
position: 'top', //在上方显示
|
position: 'top', //在上方显示
|
||||||
textStyle: { //数值样式
|
textStyle: { //数值样式
|
||||||
color: '#ced1d5',
|
color: '#ced1d5',
|
||||||
fontSize: 12
|
fontSize: 12,
|
||||||
|
fontWight:'bolder'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// data: passRateList
|
// data: passRateList
|
||||||
data: []
|
data: passRateList
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// const colors = ['#5470C6', '#91CC75', '#EE6666']
|
// const colors = ['#5470C6', '#91CC75', '#EE6666']
|
||||||
@ -166,19 +167,23 @@ export default {
|
|||||||
type: 'cross'
|
type: 'cross'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: { top: 90, right: 60, bottom: 20, left: 20, containLabel: true },
|
grid: { top: 90, right: 70, bottom: 20, left: 20, containLabel: true },
|
||||||
legend: {
|
legend: {
|
||||||
itemWidth: 10,
|
itemWidth: 10,
|
||||||
itemHeight: 10,
|
itemHeight: 10,
|
||||||
top: '0%',
|
top: '0%',
|
||||||
right: '20px',
|
right: '20px',
|
||||||
data: ['产线产量', '产线良品率'],
|
data: ['产线良品率', '产线产量'],
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 12 * this.beilv,
|
fontSize: 12 * this.beilv,
|
||||||
color: '#ced1d5'
|
color: '#ced1d5',
|
||||||
|
fontWight: 'bolder'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
axisTick: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
type: 'category',
|
type: 'category',
|
||||||
axisLine: {
|
axisLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
@ -187,8 +192,11 @@ export default {
|
|||||||
width: '1' // 坐标线的宽度
|
width: '1' // 坐标线的宽度
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
textStyle: {
|
||||||
|
fontWight: 'bolder'
|
||||||
|
},
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
// formatter: '{value}'
|
// formatter: '{value}'
|
||||||
// textStyle: {
|
// textStyle: {
|
||||||
@ -217,7 +225,7 @@ export default {
|
|||||||
type: 'value',
|
type: 'value',
|
||||||
name: '良品率/%',
|
name: '良品率/%',
|
||||||
nameTextStyle: {// y轴上方单位的颜色
|
nameTextStyle: {// y轴上方单位的颜色
|
||||||
color: '#fff',
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
align: "left",
|
align: "left",
|
||||||
},
|
},
|
||||||
position: 'right',
|
position: 'right',
|
||||||
@ -231,7 +239,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
// formatter: '{value}'
|
// formatter: '{value}'
|
||||||
formatter: '{value}%'
|
formatter: '{value}%'
|
||||||
@ -261,7 +269,7 @@ export default {
|
|||||||
type: 'value',
|
type: 'value',
|
||||||
name: '产量/片', // y轴上方的单位
|
name: '产量/片', // y轴上方的单位
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
// fontSize: 10,
|
// fontSize: 10,
|
||||||
align: "right",
|
align: "right",
|
||||||
},
|
},
|
||||||
@ -278,7 +286,7 @@ export default {
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
// textStyle: {
|
// textStyle: {
|
||||||
// color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
// color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
// show: true,
|
// show: true,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: "#25528f",
|
color: "#25528f",
|
||||||
|
@ -111,8 +111,9 @@ export default {
|
|||||||
show: true, //开启显示
|
show: true, //开启显示
|
||||||
position: 'top', //在上方显示
|
position: 'top', //在上方显示
|
||||||
textStyle: { //数值样式
|
textStyle: { //数值样式
|
||||||
color: '#ced1d5',
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 12
|
fontSize: 12,
|
||||||
|
fontWeight: 'bolder'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -144,6 +145,9 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
axisTick: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
type: 'category',
|
type: 'category',
|
||||||
axisLine: {
|
axisLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
@ -152,8 +156,11 @@ export default {
|
|||||||
width: '1' // 坐标线的宽度
|
width: '1' // 坐标线的宽度
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
textStyle: {
|
||||||
|
fontWeight: 'bolder'
|
||||||
|
},
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
// formatter: '{value}'
|
// formatter: '{value}'
|
||||||
},
|
},
|
||||||
@ -167,13 +174,13 @@ export default {
|
|||||||
yAxis: {
|
yAxis: {
|
||||||
name: '单位kwh',
|
name: '单位kwh',
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
color: '#fff',
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
},
|
},
|
||||||
type: 'value',
|
type: 'value',
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: "#fff",
|
color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
// formatter: '{value}/kwh'
|
// formatter: '{value}/kwh'
|
||||||
},
|
},
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-12-27 13:54:52
|
* @Date: 2023-12-27 13:54:52
|
||||||
* @LastEditTime: 2024-03-28 16:30:14
|
* @LastEditTime: 2024-04-01 09:14:45
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div :id="id" class="productChart" :style="{ height: height + 'px', width: width }" />
|
<div :id="id" :style="{ height:'75px', width: width }" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -71,7 +71,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('mounted')
|
// console.log('mounted')
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
this.resize()
|
||||||
|
})
|
||||||
// console.log('borderRadius: ', this.borderRadius)
|
// console.log('borderRadius: ', this.borderRadius)
|
||||||
// console.log('33333', this.dataList)
|
// console.log('33333', this.dataList)
|
||||||
// let arr = []
|
// let arr = []
|
||||||
@ -91,6 +94,12 @@ export default {
|
|||||||
this.chart = null
|
this.chart = null
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resize() {
|
||||||
|
this.chart.resize({
|
||||||
|
width: 'auto',
|
||||||
|
height: 90
|
||||||
|
});;
|
||||||
|
},
|
||||||
initChart(nameList, topNameList, nameWasteList, passRateList, wasteList) {
|
initChart(nameList, topNameList, nameWasteList, passRateList, wasteList) {
|
||||||
let rawData = []
|
let rawData = []
|
||||||
let colors = ['#0fdedb', '#2359ec']
|
let colors = ['#0fdedb', '#2359ec']
|
||||||
@ -106,7 +115,6 @@ export default {
|
|||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
console.log('total', totalData)
|
console.log('total', totalData)
|
||||||
this.chart = echarts.init(document.getElementById(this.id))
|
|
||||||
const series = [
|
const series = [
|
||||||
'良品',
|
'良品',
|
||||||
'废品',
|
'废品',
|
||||||
@ -137,6 +145,17 @@ export default {
|
|||||||
// width,
|
// width,
|
||||||
// height
|
// height
|
||||||
// })
|
// })
|
||||||
|
this.chart = echarts.init(document.getElementById(this.id))
|
||||||
|
let isFinished = false //标记 isFinished
|
||||||
|
this.chart.on('finished', _ => {
|
||||||
|
if (!isFinished) {
|
||||||
|
console.log('我只执行一次')
|
||||||
|
isFinished = true
|
||||||
|
// this.isLoading = false //关闭loading
|
||||||
|
this.chart.resize() //重新渲染charts大小
|
||||||
|
}
|
||||||
|
console.log(113, 'finished')
|
||||||
|
})
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
legend: {
|
legend: {
|
||||||
formatter: function (name) {
|
formatter: function (name) {
|
||||||
@ -152,7 +171,8 @@ export default {
|
|||||||
left: '20',
|
left: '20',
|
||||||
icon: 'rect',
|
icon: 'rect',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#ffffff'
|
color: 'rgba(255,255,255,.6)',
|
||||||
|
fontSize:12,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@ -184,9 +204,9 @@ export default {
|
|||||||
splitNumber: 50,
|
splitNumber: 50,
|
||||||
// boundaryGap: [20, 20],
|
// boundaryGap: [20, 20],
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#ffffff',
|
color: 'rgba(255,255,255,.6)',
|
||||||
verticalAlign: 'bottom',
|
verticalAlign: 'bottom',
|
||||||
fontSize: 12,
|
fontSize: 16,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
padding: [0, 0, 10, -5]
|
padding: [0, 0, 10, -5]
|
||||||
}
|
}
|
||||||
@ -212,9 +232,9 @@ export default {
|
|||||||
splitNumber: 50,
|
splitNumber: 50,
|
||||||
// boundaryGap: [20, 20],
|
// boundaryGap: [20, 20],
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#ffffff',
|
color: 'rgba(255,255,255,.6)',
|
||||||
verticalAlign: 'bottom',
|
verticalAlign: 'bottom',
|
||||||
fontSize: 12,
|
fontSize: 16,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
padding: [0, 0, 10, -5]
|
padding: [0, 0, 10, -5]
|
||||||
}
|
}
|
||||||
@ -228,10 +248,15 @@ export default {
|
|||||||
},
|
},
|
||||||
series:series
|
series:series
|
||||||
})
|
})
|
||||||
this.chart.resize({
|
this.$nextTick(() => {
|
||||||
width: 'auto',
|
setTimeout(() => {
|
||||||
height: 90
|
this.resize()
|
||||||
});;
|
},1000);
|
||||||
|
})
|
||||||
|
// this.chart.resize({
|
||||||
|
// width: 'auto',
|
||||||
|
// height: 90
|
||||||
|
// });;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2021-07-19 15:18:30
|
* @Date: 2021-07-19 15:18:30
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-28 16:10:47
|
* @LastEditTime: 2024-04-02 09:46:46
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@ -10,40 +10,41 @@
|
|||||||
<el-row class="container-title" :style="{
|
<el-row class="container-title" :style="{
|
||||||
height: 88 + 'px',
|
height: 88 + 'px',
|
||||||
lineHeight: 88 + 'px',
|
lineHeight: 88 + 'px',
|
||||||
fontSize: 31 + 'px'
|
fontSize: 31 + 'px',
|
||||||
}">
|
}">
|
||||||
<img src="../../assets/img/logo.png" style="width:1.1em;position:relative;top:.22em" alt="">
|
<img src="../../assets/img/logo.png" style="width: 1.1em; position: relative; top: 0.22em" alt="" />
|
||||||
许昌安彩深加工看板
|
许昌安彩深加工看板
|
||||||
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
<h3 class="unit">单位:河南汇融数字科技有限公司</h3>
|
||||||
<h3 class="time">{{ times }}</h3>
|
<h3 class="time">{{ times }}</h3>
|
||||||
<el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
|
<!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
|
||||||
@click="changeFullScreen">
|
@click="changeFullScreen">
|
||||||
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
|
||||||
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="container-main flex-col" type="flex">
|
<el-row class="container-main flex-col" type="flex">
|
||||||
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1" style="height: 50%;">
|
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1" style="height: 50%">
|
||||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
||||||
<base-container :title="'设备报警'" :size="'small'" :height="318" :title-icon="'eqAlarm'">
|
<base-container :title="'设备报警'" :size="'small'" :height="318" :title-icon="'eqAlarm'">
|
||||||
<dv-scroll-board class="eqTable" :config="eqConfig" style="width:100%;height:350px" ref='eqScrollBoard' />
|
<dv-scroll-board class="eqTable" :config="eqConfig" style="width: 100%; height: 350px"
|
||||||
|
ref="eqScrollBoard" />
|
||||||
</base-container>
|
</base-container>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
||||||
<base-container :title="'各工序缺陷汇总'" :size="'small'" :title-icon="'scrap'">
|
<base-container :title="'各工序缺陷汇总'" :size="'small'" :title-icon="'scrap'">
|
||||||
<dv-scroll-board :config="processConfig" style="width:100%;height:350px" ref='processScrollBoard' />
|
<dv-scroll-board :config="processConfig" style="width: 100%; height: 350px" ref="processScrollBoard" />
|
||||||
</base-container>
|
</base-container>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
|
||||||
<base-container :height="318" :size="'small'" :title="'工单监控'" :title-icon="'eqMonitoring'">
|
<base-container :height="318" :size="'small'" :title="'工单监控'" :title-icon="'eqMonitoring'">
|
||||||
<div class="order" style="width:100%; overflow: hidden scroll;height: 350px;">
|
<div class="order" style="width: 100%; overflow: hidden scroll; height: 350px">
|
||||||
<el-row v-for="op in orderList" :key="op.id" style="margin-bottom: 1em">
|
<el-row v-for="op in orderList" :key="op.id" style="margin-bottom: 1em">
|
||||||
<!-- <el-col :span="12"> -->
|
<!-- <el-col :span="12"> -->
|
||||||
|
|
||||||
<p class="now-secondary-title">{{ op.name }}</p>
|
<p class="now-secondary-title" style="font-size: 14px;opacity: calc(.6);">{{ op.name }}</p>
|
||||||
<el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white"
|
<el-progress style="width: 610px;" text-color="rgba(255, 255, 255, .6)" :stroke-width="10"
|
||||||
:percentage="op.progressRate" class="custom-progress-bar" />
|
define-back-color="rgba(32, 57, 96, 1)" :percentage="op.progressRate" class="custom-progress-bar" />
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
@ -66,7 +67,7 @@
|
|||||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
|
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
|
||||||
<base-container :show-time="true" :no-content-padding="true" :height="318 + 338 + 16" :size="'eqStatus'"
|
<base-container :show-time="true" :no-content-padding="true" :height="318 + 338 + 16" :size="'eqStatus'"
|
||||||
:title="'产线产量及良品率'" :title-icon="'productLine'">
|
:title="'产线产量及良品率'" :title-icon="'productLine'">
|
||||||
<double-y-chart ref="productLineChart" :id=" 'doubleYChart' " :height="390" :show-legend="true" />
|
<double-y-chart ref="productLineChart" :id="'doubleYChart'" :height="390" :show-legend="true" />
|
||||||
</base-container>
|
</base-container>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -75,105 +76,175 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import baseContainer from './components/baseContainer'
|
import baseContainer from './components/baseContainer';
|
||||||
import baseTable1 from './components/baseTable'
|
import baseTable1 from './components/baseTable';
|
||||||
import screenfull from 'screenfull'
|
import screenfull from 'screenfull';
|
||||||
import doubleYChart from './components/doubleYChart '
|
import doubleYChart from './components/doubleYChart ';
|
||||||
import LinearBarChart from './components/linearBarChart'
|
import LinearBarChart from './components/linearBarChart';
|
||||||
import WebSocketHeartbeat from './ws.js';
|
import WebSocketHeartbeat from './ws.js';
|
||||||
|
|
||||||
// 创建WebSocketHeartbeat实例
|
// 创建WebSocketHeartbeat实例
|
||||||
const qualityYearList = [
|
const qualityYearList = [
|
||||||
{
|
{
|
||||||
name: '翻转机', code: 'EQ20240110112358000235', status: '运行', error: '否'
|
name: '翻转机',
|
||||||
|
code: 'EQ20240110112358000235',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '烘干炉', code: 'EQ20240110112537000241', status: '运行', error: '否'
|
name: '烘干炉',
|
||||||
|
code: 'EQ20240110112537000241',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '清洗机', code: ' EQ20240110112310000232', status: '运行', error: '否'
|
name: '清洗机',
|
||||||
},
|
code: ' EQ20240110112310000232',
|
||||||
{ name: '钢化清洗机', code: 'EQ20240110111700000208', status: '运行', error: '否' },
|
status: '运行',
|
||||||
{ name: '固化机', code: 'EQ20240110111700000201', status: '运行', error: '否' },
|
error: '否',
|
||||||
{
|
|
||||||
name: '磨边清洗机', code: ' EQ20240110111700000208', status: '运行', error: '否'
|
|
||||||
},
|
|
||||||
{ name: '预热机', code: 'EQ20240110111700000205', status: '故障', error: '是' },
|
|
||||||
{ name: '下片机', code: 'EQ20240115151435000279', status: '运行', error: '否' },
|
|
||||||
{
|
|
||||||
name: '冷却机', code: 'EQ20240110111700000203', status: '运行', error: '否'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'A储片机106', code: 'EQ20240110111700000202', status: '运行', error: '否'
|
name: '钢化清洗机',
|
||||||
|
code: 'EQ20240110111700000208',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
},
|
},
|
||||||
{ name: '二次清洗机', code: 'EQ20240110111700000209', status: '运行', error: '否' },
|
|
||||||
{
|
{
|
||||||
name: '二次磨边机', code: ' EQ20240110110927000181', status: '故障', error: '是'
|
name: '固化机',
|
||||||
|
code: 'EQ20240110111700000201',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
},
|
},
|
||||||
{ name: '测试设备', code: 'EQ20240110111700000201', status: '运行', error: '否' }
|
{
|
||||||
]
|
name: '磨边清洗机',
|
||||||
|
code: ' EQ20240110111700000208',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '预热机',
|
||||||
|
code: 'EQ20240110111700000205',
|
||||||
|
status: '故障',
|
||||||
|
error: '是',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '下片机',
|
||||||
|
code: 'EQ20240115151435000279',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '冷却机',
|
||||||
|
code: 'EQ20240110111700000203',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'A储片机106',
|
||||||
|
code: 'EQ20240110111700000202',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '二次清洗机',
|
||||||
|
code: 'EQ20240110111700000209',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '二次磨边机',
|
||||||
|
code: ' EQ20240110110927000181',
|
||||||
|
status: '故障',
|
||||||
|
error: '是',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '测试设备',
|
||||||
|
code: 'EQ20240110111700000201',
|
||||||
|
status: '运行',
|
||||||
|
error: '否',
|
||||||
|
},
|
||||||
|
];
|
||||||
const qualityMonthList = [
|
const qualityMonthList = [
|
||||||
{
|
{
|
||||||
productionLineName: 'D61',
|
productionLineName: 'D61',
|
||||||
sectionName: '成型',
|
sectionName: '成型',
|
||||||
count: '3片',
|
count: '3片',
|
||||||
inspectionTypeName: '细长泡'
|
inspectionTypeName: '细长泡',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D62',
|
productionLineName: 'D62',
|
||||||
sectionName: '组合落板',
|
sectionName: '组合落板',
|
||||||
count: '4片',
|
count: '4片',
|
||||||
inspectionTypeName: '细长泡'
|
inspectionTypeName: '细长泡',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D61',
|
productionLineName: 'D61',
|
||||||
sectionName: '磨边',
|
sectionName: '磨边',
|
||||||
count: '6片',
|
count: '6片',
|
||||||
inspectionTypeName: '开口泡'
|
inspectionTypeName: '开口泡',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D63',
|
productionLineName: 'D63',
|
||||||
sectionName: '清洗',
|
sectionName: '清洗',
|
||||||
count: '5片',
|
count: '5片',
|
||||||
inspectionTypeName: '结石'
|
inspectionTypeName: '结石',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D64',
|
productionLineName: 'D64',
|
||||||
sectionName: '打孔',
|
sectionName: '打孔',
|
||||||
count: '2片',
|
count: '2片',
|
||||||
inspectionTypeName: '结石'
|
inspectionTypeName: '结石',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D63',
|
productionLineName: 'D63',
|
||||||
sectionName: '成型',
|
sectionName: '成型',
|
||||||
count: '7片',
|
count: '7片',
|
||||||
inspectionTypeName: '开口泡'
|
inspectionTypeName: '开口泡',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
productionLineName: 'D61',
|
productionLineName: 'D61',
|
||||||
sectionName: '上片',
|
sectionName: '上片',
|
||||||
count: '8片',
|
count: '8片',
|
||||||
inspectionTypeName: '结石'
|
inspectionTypeName: '结石',
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
const orderProcessList = [
|
const orderProcessList = [
|
||||||
{
|
{
|
||||||
id: '1', outRate: '.8', name: '凯盛0322'
|
id: '1',
|
||||||
}, {
|
outRate: '.8',
|
||||||
id: '2', outRate: '.4', name: '光伏玻璃4.0'
|
name: '凯盛0322',
|
||||||
}, {
|
|
||||||
id: '3', outRate: '.5', name: '光伏玻璃3.0'
|
|
||||||
}, {
|
|
||||||
id: '4', outRate: '.3', name: '光伏玻璃2.0'
|
|
||||||
}, {
|
|
||||||
id: '5', outRate: '.5', name: '光伏玻璃1.0'
|
|
||||||
}, {
|
|
||||||
id: '6', outRate: '.8', name: '光伏玻璃'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '7', outRate: '.8', name: '统计订单'
|
id: '2',
|
||||||
}
|
outRate: '.4',
|
||||||
]
|
name: '光伏玻璃4.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
outRate: '.5',
|
||||||
|
name: '光伏玻璃3.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4',
|
||||||
|
outRate: '.3',
|
||||||
|
name: '光伏玻璃2.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '5',
|
||||||
|
outRate: '.5',
|
||||||
|
name: '光伏玻璃1.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '6',
|
||||||
|
outRate: '.8',
|
||||||
|
name: '光伏玻璃',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '7',
|
||||||
|
outRate: '.8',
|
||||||
|
name: '统计订单',
|
||||||
|
},
|
||||||
|
];
|
||||||
export default {
|
export default {
|
||||||
name: 'ProductionMonitoringCockpit',
|
name: 'ProductionMonitoringCockpit',
|
||||||
components: {
|
components: {
|
||||||
@ -183,7 +254,7 @@ export default {
|
|||||||
// baseTable3,
|
// baseTable3,
|
||||||
// TopRadioGroup,
|
// TopRadioGroup,
|
||||||
doubleYChart,
|
doubleYChart,
|
||||||
LinearBarChart
|
LinearBarChart,
|
||||||
// pieChart1,
|
// pieChart1,
|
||||||
// pieChart2
|
// pieChart2
|
||||||
// pieChart3
|
// pieChart3
|
||||||
@ -194,7 +265,7 @@ export default {
|
|||||||
beilv2: 1,
|
beilv2: 1,
|
||||||
beilv: 1,
|
beilv: 1,
|
||||||
value: 100,
|
value: 100,
|
||||||
orderList:[],
|
orderList: [],
|
||||||
times: '',
|
times: '',
|
||||||
EnergyMonitoringNameList: [],
|
EnergyMonitoringNameList: [],
|
||||||
// equipmentList:[],
|
// equipmentList:[],
|
||||||
@ -204,27 +275,27 @@ export default {
|
|||||||
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
||||||
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
||||||
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
||||||
columnWidth: [70, 100, 200, 90, 90,],
|
columnWidth: [70, 100, 200, 90, 90],
|
||||||
align: ['center'],
|
align: ['center'],
|
||||||
data: [],
|
data: [],
|
||||||
// index:true,
|
// index:true,
|
||||||
rowNum: 10
|
rowNum: 10,
|
||||||
},
|
},
|
||||||
processConfig: {
|
processConfig: {
|
||||||
header: ['序号', '产线名称', '工序', '损耗片数', '缺陷类型'],
|
header: ['序号', '产线名称', '工序', '损耗片数', '缺陷类型'],
|
||||||
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
||||||
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
||||||
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
||||||
columnWidth: [70, 130, 100, 120, 110,],
|
columnWidth: [70, 130, 100, 120, 110],
|
||||||
align: ['center'],
|
align: ['center'],
|
||||||
data: [],
|
data: [],
|
||||||
// index:true,
|
// index:true,
|
||||||
rowNum: 10
|
rowNum: 10,
|
||||||
},
|
},
|
||||||
// cxDataList,
|
// cxDataList,
|
||||||
SJGws: undefined,
|
SJGws: undefined,
|
||||||
wsHeartbeat:undefined,
|
wsHeartbeat: undefined,
|
||||||
productLineList:[],
|
productLineList: [],
|
||||||
qualityYearList,
|
qualityYearList,
|
||||||
clientWidth: 0,
|
clientWidth: 0,
|
||||||
containerWidth: 111111,
|
containerWidth: 111111,
|
||||||
@ -235,127 +306,152 @@ export default {
|
|||||||
// qualityMonthTableProps,
|
// qualityMonthTableProps,
|
||||||
modelMonth: '',
|
modelMonth: '',
|
||||||
dateType: '0',
|
dateType: '0',
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
styles() {
|
styles() {
|
||||||
const v = Math.floor(this.value * this.beilv2 * 100) / 10000
|
const v = Math.floor(this.value * this.beilv2 * 100) / 10000;
|
||||||
return {
|
return {
|
||||||
transform: `scale(${v})`,
|
transform: `scale(${v})`,
|
||||||
transformOrigin: 'top left'
|
transformOrigin: 'top left',
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isFullScreen: function (val) {
|
isFullScreen: function (val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
const _this = this;
|
const _this = this;
|
||||||
_this.beilv2 = document.documentElement.clientWidth / 1920
|
_this.beilv2 = document.documentElement.clientWidth / 1920;
|
||||||
console.log(_this.beilv2);
|
console.log(_this.beilv2);
|
||||||
} else {
|
} else {
|
||||||
const _this = this;
|
const _this = this;
|
||||||
_this.beilv2 = document.documentElement.clientWidth / 1920
|
_this.beilv2 = document.documentElement.clientWidth / 1920;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clientWidth(val) {
|
clientWidth(val) {
|
||||||
if (!this.timer) {
|
if (!this.timer) {
|
||||||
this.clientWidth = val
|
this.clientWidth = val;
|
||||||
this.beilv2 = this.clientWidth / 1920
|
this.beilv2 = this.clientWidth / 1920;
|
||||||
this.timer = true
|
this.timer = true;
|
||||||
let _this = this
|
let _this = this;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
_this.timer = false
|
_this.timer = false;
|
||||||
}, 500)
|
}, 500);
|
||||||
}
|
}
|
||||||
this.windowWidth(val);
|
this.windowWidth(val);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.init()
|
this.getData();
|
||||||
|
this.init();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload()
|
window.location.reload();
|
||||||
}, 86400000)
|
}, 86400000);
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed() {
|
||||||
this.websocketClose()
|
this.websocketClose();
|
||||||
this.SJGWebsocketClose()
|
this.SJGWebsocketClose();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// let detData = [
|
let detData = [
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
name: '测试工单',
|
||||||
|
progressRate: 0.933333,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
name: '测试工单2',
|
||||||
|
progressRate: 0.932323,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
name: '测试工单3',
|
||||||
|
progressRate: 0.23232,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4',
|
||||||
|
name: '测试工单4',
|
||||||
|
progressRate: 0.32323,
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// id:'1',
|
// id: '5',
|
||||||
// name: '测试工单',
|
// name: '测试工单',
|
||||||
// progressRate:0.933333
|
// progressRate: 0.5555
|
||||||
|
// }, {
|
||||||
|
// id: '6',
|
||||||
|
// name: '测试工单',
|
||||||
|
// progressRate: 0.66564
|
||||||
// },
|
// },
|
||||||
// {
|
];
|
||||||
// id: '2',
|
this.orderList = detData.map((ele, index) => {
|
||||||
// name: '测试工单2',
|
if (ele.progressRate && ele.progressRate != 1) {
|
||||||
// progressRate: 0.932323
|
return {
|
||||||
// }, {
|
id: ele.id,
|
||||||
// id: '3',
|
name: ele.name,
|
||||||
// name: '测试工单3',
|
progressRate: parseFloat((ele.progressRate * 100).toFixed(3)),
|
||||||
// progressRate: 0.23232
|
};
|
||||||
// }, {
|
}
|
||||||
// id: '4',
|
});
|
||||||
// name: '测试工单4',
|
let EnergyNameList = ['Y61', 'Y62', 'Y63', 'Y64', 'Y65'];
|
||||||
// progressRate: 0.32323
|
this.EnergyMonitoringNameList = EnergyNameList;
|
||||||
// }
|
let EnergyDataList = [1, 2, 3, 4, 5];
|
||||||
// // {
|
// this.wsData.data.forEach((ele) => {
|
||||||
// // id: '5',
|
// EnergyDataList.push(ele.useQuantity)
|
||||||
// // name: '测试工单',
|
// })
|
||||||
// // progressRate: 0.5555
|
this.EnergyMonitoringList = EnergyDataList;
|
||||||
// // }, {
|
// console.log(EnergyDataList)
|
||||||
// // id: '6',
|
this.$refs.EnergyMonitoringChart.initChart(
|
||||||
// // name: '测试工单',
|
this.EnergyMonitoringNameList,
|
||||||
// // progressRate: 0.66564
|
this.EnergyMonitoringList
|
||||||
// // },
|
);
|
||||||
// ]
|
let eqArr = this.qualityYearList.map((item, index) => [
|
||||||
// this.orderList = detData.map((ele, index) => {
|
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||||
// if (ele.progressRate && ele.progressRate != 1) {
|
</span>`,
|
||||||
// return {
|
// formatDate(item.planStartTime) || '',
|
||||||
// id: ele.id,
|
`
|
||||||
// name: ele.name,
|
<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
||||||
// progressRate: parseFloat((ele.progressRate * 100).toFixed(3))
|
</span>`,
|
||||||
// }
|
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
||||||
// }
|
`<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
|
||||||
// });
|
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
||||||
// let EnergyNameList = ['Y61', 'Y62', 'Y63', 'Y64', 'Y65',]
|
]);
|
||||||
// this.EnergyMonitoringNameList = EnergyNameList
|
this.eqConfig.data = eqArr;
|
||||||
// let EnergyDataList = [1, 2, 3, 4, 5]
|
let arr = ['D64', 'D62', 'D61', 'D63', 'D65']
|
||||||
// // this.wsData.data.forEach((ele) => {
|
// let arr = [5, 6, 2, 4, 7, 9, 15];
|
||||||
// // EnergyDataList.push(ele.useQuantity)
|
// 因为7个数,所以长度减去一次为最大循环次数
|
||||||
// // })
|
for (let i = 0; i < arr.length - 1; i++) {
|
||||||
// this.EnergyMonitoringList = EnergyDataList
|
// 二次循环,注意:再减去外层的循环次数,向后依次两两相互比较转换;
|
||||||
// // console.log(EnergyDataList)
|
for (let j = 0; j < arr.length - i - 1; j++) {
|
||||||
// this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList, this.EnergyMonitoringList)
|
// 当前一个值大于后一个值
|
||||||
// let eqArr = this.qualityYearList.map((item, index) => [
|
if (arr[j].substr(arr[j].length - 1, 1) > arr[j + 1].substr(arr[j + 1].length - 1, 1)) {
|
||||||
// `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
// 定义变量,以赋值的形式前后交换,直到换到最小的在前面,左右再无比较,则循环结束形成排序结果
|
||||||
// </span>`,
|
let temp = arr[j];
|
||||||
// // formatDate(item.planStartTime) || '',
|
arr[j] = arr[j + 1];
|
||||||
// `
|
arr[j + 1] = temp;
|
||||||
// <span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
}
|
||||||
// </span>`,
|
}
|
||||||
// `<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
}
|
||||||
// `<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
|
console.log(arr);
|
||||||
// `<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
this.$refs['eqScrollBoard'].updateRows(eqArr);
|
||||||
// ])
|
this.$refs.productLineChart.initChart(
|
||||||
// this.eqConfig.data = eqArr
|
arr,
|
||||||
// this.$refs['eqScrollBoard'].updateRows(eqArr)
|
[98, 97, 98.7, 98.5, 98.3],
|
||||||
// this.$refs.productLineChart.initChart(['D61', 'D62', 'D63', 'D64', 'D65',], [98, 97, 98.7, 98.5, 98.3,], [3134, 2323, 3232, 3233, 2321])
|
[3134, 2323, 3232, 3233, 2321]
|
||||||
|
);
|
||||||
// this.getList()
|
// this.getList()
|
||||||
this.initWebSocket()
|
this.initWebSocket();
|
||||||
this.SJGInitWebSocket()
|
this.SJGInitWebSocket();
|
||||||
this.getTimes()
|
this.getTimes();
|
||||||
// this.$refs.EnergyMonitoringChart.initChart(['Y61', 'Y62', 'Y63', 'Y64', 'Y65',], [3134, 2323, 3232, 3233, 2321])
|
// this.$refs.EnergyMonitoringChart.initChart(['Y61', 'Y62', 'Y63', 'Y64', 'Y65',], [3134, 2323, 3232, 3233, 2321])
|
||||||
const _this = this;
|
const _this = this;
|
||||||
_this.beilv2 = document.documentElement.clientWidth / 1920
|
_this.beilv2 = document.documentElement.clientWidth / 1920;
|
||||||
window.onresize = () => {
|
window.onresize = () => {
|
||||||
return (() => {
|
return (() => {
|
||||||
_this.clientWidth = `${document.documentElement.clientWidth}`
|
_this.clientWidth = `${document.documentElement.clientWidth}`;
|
||||||
this.beilv2 = _this.clientWidth / 1920
|
this.beilv2 = _this.clientWidth / 1920;
|
||||||
})()
|
})();
|
||||||
}
|
};
|
||||||
this.getData()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// beforeDestroy() {
|
// beforeDestroy() {
|
||||||
@ -371,14 +467,22 @@ export default {
|
|||||||
</span>`,
|
</span>`,
|
||||||
// formatDate(item.planStartTime) || '',
|
// formatDate(item.planStartTime) || '',
|
||||||
`
|
`
|
||||||
<span style="color:rgba(255,255,255,0.5)" >${item.productionLineName || ''}
|
<span style="color:rgba(255,255,255,0.5)" >${
|
||||||
|
item.productionLineName || ''
|
||||||
|
}
|
||||||
</span>`,
|
</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.sectionName || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${
|
||||||
|
item.sectionName || ''
|
||||||
|
}</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.inspectionTypeName || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${
|
||||||
])
|
item.inspectionTypeName || ''
|
||||||
this.processConfig.data = processArr
|
}</span>`,
|
||||||
this.$refs['processScrollBoard'].updateRows(processArr)
|
]);
|
||||||
|
this.processConfig.data = processArr;
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
this.$refs['processScrollBoard'].updateRows(processArr);
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
// getList() {
|
// getList() {
|
||||||
// // this.$axios.get(
|
// // this.$axios.get(
|
||||||
@ -439,41 +543,55 @@ export default {
|
|||||||
let seconds = new Date().getSeconds(); //获取当前时间的秒数
|
let seconds = new Date().getSeconds(); //获取当前时间的秒数
|
||||||
//当小于 10 的是时候,在前面加 0
|
//当小于 10 的是时候,在前面加 0
|
||||||
if (hours < 10) {
|
if (hours < 10) {
|
||||||
hours = "0" + hours;
|
hours = '0' + hours;
|
||||||
}
|
}
|
||||||
if (minutes < 10) {
|
if (minutes < 10) {
|
||||||
minutes = "0" + minutes;
|
minutes = '0' + minutes;
|
||||||
}
|
}
|
||||||
if (seconds < 10) {
|
if (seconds < 10) {
|
||||||
seconds = "0" + seconds;
|
seconds = '0' + seconds;
|
||||||
}
|
}
|
||||||
//拼接格式化当前时间
|
//拼接格式化当前时间
|
||||||
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
this.times =
|
||||||
|
year +
|
||||||
|
'.' +
|
||||||
|
month +
|
||||||
|
'.' +
|
||||||
|
day +
|
||||||
|
' ' +
|
||||||
|
hours +
|
||||||
|
':' +
|
||||||
|
minutes +
|
||||||
|
':' +
|
||||||
|
seconds;
|
||||||
},
|
},
|
||||||
initWebSocket() {
|
initWebSocket() {
|
||||||
let date = new Date().valueOf()
|
let date = new Date().valueOf();
|
||||||
const wsUrl = process.env.VUE_APP_Socket_API + `/websocket/message?userId=EN${date}`
|
const wsUrl =
|
||||||
|
process.env.VUE_APP_Socket_API + `/websocket/message?userId=EN${date}`;
|
||||||
this.wsHeartbeat = new WebSocketHeartbeat(wsUrl);
|
this.wsHeartbeat = new WebSocketHeartbeat(wsUrl);
|
||||||
|
|
||||||
// 处理收到的消息
|
// 处理收到的消息
|
||||||
this.wsHeartbeat.ws.onmessage = (event) => {
|
this.wsHeartbeat.ws.onmessage = (event) => {
|
||||||
console.log('收到消息:', event.data)
|
console.log('收到消息:', event.data);
|
||||||
this.wsData = event?.data ? JSON.parse(event?.data) : {}
|
this.wsData = event?.data ? JSON.parse(event?.data) : {};
|
||||||
// console.log('22222', this.wsData.data)
|
// console.log('22222', this.wsData.data)
|
||||||
if (this.wsData.type === 'EnergyMonitoring') {
|
if (this.wsData.type === 'EnergyMonitoring') {
|
||||||
let EnergyNameList = []
|
let EnergyNameList = [];
|
||||||
this.wsData.data.forEach((ele) => {
|
this.wsData.data.forEach((ele) => {
|
||||||
EnergyNameList.push(ele.lineName)
|
EnergyNameList.push(ele.lineName);
|
||||||
})
|
});
|
||||||
this.EnergyMonitoringNameList = EnergyNameList
|
this.EnergyMonitoringNameList = EnergyNameList;
|
||||||
let EnergyDataList = []
|
let EnergyDataList = [];
|
||||||
this.wsData.data.forEach((ele) => {
|
this.wsData.data.forEach((ele) => {
|
||||||
EnergyDataList.push(ele.useQuantity
|
EnergyDataList.push(ele.useQuantity);
|
||||||
)
|
});
|
||||||
|
this.EnergyMonitoringList = EnergyDataList;
|
||||||
|
console.log(EnergyDataList);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList,this.EnergyMonitoringList);
|
||||||
})
|
})
|
||||||
this.EnergyMonitoringList = EnergyDataList
|
|
||||||
console.log(EnergyDataList)
|
|
||||||
this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList, this.EnergyMonitoringList)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// if (typeof (WebSocket) === 'undefined') {
|
// if (typeof (WebSocket) === 'undefined') {
|
||||||
@ -495,14 +613,15 @@ export default {
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
SJGInitWebSocket() {
|
SJGInitWebSocket() {
|
||||||
let date = new Date().valueOf()
|
let date = new Date().valueOf();
|
||||||
const SJGWsUrl = process.env.VUE_APP_Socket_API + `/websocket/message?userId=SJG${date}`
|
const SJGWsUrl =
|
||||||
|
process.env.VUE_APP_Socket_API + `/websocket/message?userId=SJG${date}`;
|
||||||
this.SJGws = new WebSocketHeartbeat(SJGWsUrl);
|
this.SJGws = new WebSocketHeartbeat(SJGWsUrl);
|
||||||
|
|
||||||
// 处理收到的消息
|
// 处理收到的消息
|
||||||
this.SJGws.ws.onmessage = (event) => {
|
this.SJGws.ws.onmessage = (event) => {
|
||||||
console.log('收到消息:', event.data)
|
console.log('收到消息:', event.data);
|
||||||
this.SJGWsData = event?.data ? JSON.parse(event?.data) : {}
|
this.SJGWsData = event?.data ? JSON.parse(event?.data) : {};
|
||||||
// console.log(this.wsData.detData);
|
// console.log(this.wsData.detData);
|
||||||
// console.log('22222', this.wsData.data)
|
// console.log('22222', this.wsData.data)
|
||||||
if (this.SJGWsData.type === 'order') {
|
if (this.SJGWsData.type === 'order') {
|
||||||
@ -511,69 +630,100 @@ export default {
|
|||||||
return {
|
return {
|
||||||
id: ele.id,
|
id: ele.id,
|
||||||
name: ele.name,
|
name: ele.name,
|
||||||
progressRate: parseFloat((ele.progressRate * 100).toFixed(3))
|
progressRate: parseFloat((ele.progressRate * 100).toFixed(3)),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(this.orderList)
|
console.log(this.orderList);
|
||||||
} else if (this.SJGWsData.type === 'equipment') {
|
} else if (this.SJGWsData.type === 'equipment') {
|
||||||
let eqArr = this.SJGWsData.detData.map((item, index) => [
|
let eqArr = this.SJGWsData.detData.map((item, index) => [
|
||||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||||
</span>`,
|
</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
`<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
||||||
</span>`,
|
</span>`,
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
`<span style="color:rgba(255,255,255,0.5)">${
|
||||||
`<span style="color:rgba(255,255,255,0.5)"><span style="color:rgba(255,255,255,0.5)"></span> ${item.status || ''}</span>`,
|
item.code || ''
|
||||||
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
}</span>`,
|
||||||
])
|
`<span style="color:rgba(255,255,255,0.5)"><span style="color:rgba(255,255,255,0.5)"></span> ${
|
||||||
this.eqConfig.data = eqArr
|
item.status || ''
|
||||||
this.$refs['eqScrollBoard'].updateRows(eqArr)
|
}</span>`,
|
||||||
|
`<span style="color:rgba(255,255,255,0.5)">${
|
||||||
|
item.error || ''
|
||||||
|
}</span>`,
|
||||||
|
]);
|
||||||
|
this.eqConfig.data = eqArr;
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
this.$refs['eqScrollBoard'].updateRows(eqArr);
|
||||||
|
// })
|
||||||
// console.log(SJGWsData.orderList)
|
// console.log(SJGWsData.orderList)
|
||||||
} else if (this.SJGWsData.type === 'productline') {
|
} else if (this.SJGWsData.type === 'productline') {
|
||||||
console.log('aaaaaaaaaaaaaaaaaaa', this.SJGWsData);
|
console.log('aaaaaaaaaaaaaaaaaaa', this.SJGWsData);
|
||||||
let nameList = []
|
let nameList = [];
|
||||||
let passRateList = []
|
let passRateList = [];
|
||||||
let outputNumList = []
|
let outputNumList = [];
|
||||||
this.SJGWsData.detData.forEach((ele) => {
|
this.SJGWsData.detData.forEach((ele) => {
|
||||||
// if (item.id == ele.productionLineId) {
|
// if (item.id == ele.productionLineId) {
|
||||||
// if (item.name.substr(0, 1) == "D") {
|
// if (item.name.substr(0, 1) == "D") {
|
||||||
// console.log(ele)
|
// console.log(ele)
|
||||||
nameList.push(ele.lineName)
|
nameList.push(ele.lineName);
|
||||||
outputNumList.push(ele.outputNum)
|
outputNumList.push(ele.outputNum);
|
||||||
passRateList.push(ele.passRate)
|
passRateList.push(ele.passRate);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
});
|
||||||
|
// let arr = ['D64', 'D62', 'D61', 'D63', 'D65']
|
||||||
|
for (let i = 0; i < nameList.length - 1; i++) {
|
||||||
|
// 二次循环,注意:再减去外层的循环次数,向后依次两两相互比较转换;
|
||||||
|
for (let j = 0; j < nameList.length - i - 1; j++) {
|
||||||
|
// 当前一个值大于后一个值
|
||||||
|
if (nameList[j].substr(nameList[j].length - 1, 1) > nameList[j + 1].substr(nameList[j + 1].length - 1, 1)) {
|
||||||
|
// 定义变量,以赋值的形式前后交换,直到换到最小的在前面,左右再无比较,则循环结束形成排序结果
|
||||||
|
let temp = nameList[j];
|
||||||
|
nameList[j] = nameList[j + 1];
|
||||||
|
nameList[j + 1] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.productLineChart.initChart(
|
||||||
|
nameList,
|
||||||
|
passRateList,
|
||||||
|
outputNumList
|
||||||
|
);
|
||||||
})
|
})
|
||||||
this.$refs.productLineChart.initChart(nameList, passRateList, outputNumList)
|
|
||||||
} else if (this.SJGInitWebSocket === 'inspection') {
|
} else if (this.SJGInitWebSocket === 'inspection') {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
SJGWebsocketClose(e) {
|
SJGWebsocketClose(e) {
|
||||||
this.SJGws.ws.onclose = (event) => { console.log(event); }
|
this.SJGws.ws.onclose = (event) => {
|
||||||
|
console.log(event);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
websocketClose(e) {
|
websocketClose(e) {
|
||||||
this.wsHeartbeat.ws.onclose = (event) => { console.log(event); }
|
this.wsHeartbeat.ws.onclose = (event) => {
|
||||||
|
console.log(event);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
windowWidth(value) {
|
windowWidth(value) {
|
||||||
this.clientWidth = value
|
this.clientWidth = value;
|
||||||
this.beilv2 = this.clientWidth / 1920
|
this.beilv2 = this.clientWidth / 1920;
|
||||||
},
|
},
|
||||||
change() {
|
change() {
|
||||||
console.log(this.isFullScreen);
|
console.log(this.isFullScreen);
|
||||||
debugger;
|
debugger;
|
||||||
this.isFullScreen = screenfull.isFullscreen
|
this.isFullScreen = screenfull.isFullscreen;
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
console.log(screenfull.isEnabled);
|
console.log(screenfull.isEnabled);
|
||||||
if (screenfull.isEnabled) {
|
if (screenfull.isEnabled) {
|
||||||
debugger;
|
debugger;
|
||||||
screenfull.on('change', this.change)
|
screenfull.on('change', this.change);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroy() {
|
destroy() {
|
||||||
if (screenfull.isEnabled) {
|
if (screenfull.isEnabled) {
|
||||||
screenfull.off('change', this.change)
|
screenfull.off('change', this.change);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeFullScreen() {
|
changeFullScreen() {
|
||||||
@ -581,19 +731,17 @@ export default {
|
|||||||
if (!screenfull.isEnabled) {
|
if (!screenfull.isEnabled) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: 'you browser can not work',
|
message: 'you browser can not work',
|
||||||
type: 'warning'
|
type: 'warning',
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
screenfull.toggle()
|
screenfull.toggle();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
.visual-container {
|
.visual-container {
|
||||||
width: 1920px;
|
width: 1920px;
|
||||||
height: 1080px;
|
height: 1080px;
|
||||||
@ -612,17 +760,17 @@ export default {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 290px;
|
left: 290px;
|
||||||
top: 25px;
|
top: 25px;
|
||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.8);
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
.time {
|
.time {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 1360px;
|
left: 1360px;
|
||||||
color: rgba(255, 255, 255, 0.80);
|
color: rgba(255, 255, 255, 0.8);
|
||||||
top: 25px;
|
top: 25px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 0px;
|
letter-spacing: 0.72px;
|
||||||
}
|
}
|
||||||
.title-button {
|
.title-button {
|
||||||
color: #00fff0;
|
color: #00fff0;
|
||||||
@ -666,11 +814,17 @@ export default {
|
|||||||
background-color: unset;
|
background-color: unset;
|
||||||
background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
||||||
}
|
}
|
||||||
.visual-select {
|
::v-deep .el-progress__text {
|
||||||
|
margin-top: -70px;
|
||||||
|
margin-left: 490px;
|
||||||
|
// background-color: unset;
|
||||||
|
// background-image: linear-gradient(to right, #4573fe, #47f8dc);
|
||||||
|
}
|
||||||
|
.visual-select {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1em;
|
right: 1em;
|
||||||
top: 2em;
|
top: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .container-main {
|
// .container-main {
|
||||||
// padding: 5px;
|
// padding: 5px;
|
||||||
@ -716,7 +870,7 @@ export default {
|
|||||||
background-color: rgba($color: #5bc4be, $alpha: 1);
|
background-color: rgba($color: #5bc4be, $alpha: 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.coldSelect{
|
.coldSelect {
|
||||||
.el-input {
|
.el-input {
|
||||||
min-height: 10px;
|
min-height: 10px;
|
||||||
}
|
}
|
||||||
@ -736,7 +890,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.order::-webkit-scrollbar {
|
.order::-webkit-scrollbar {
|
||||||
display: none
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -754,7 +908,7 @@ export default {
|
|||||||
/* .container-main {
|
/* .container-main {
|
||||||
min-height: calc(100vh - 10em);
|
min-height: calc(100vh - 10em);
|
||||||
} */
|
} */
|
||||||
.eqTable{
|
.eqTable {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -2,44 +2,43 @@
|
|||||||
<div
|
<div
|
||||||
id="analysischartBar"
|
id="analysischartBar"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: chartHeight + 'px' }"
|
:style="{ height: chartHeight + 'px' }"></div>
|
||||||
></div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts';
|
||||||
import resize from '@/utils/chartMixins/resize'
|
import resize from '@/utils/chartMixins/resize';
|
||||||
export default {
|
export default {
|
||||||
name: "BarChart",
|
name: 'BarChart',
|
||||||
mixins: [resize],
|
mixins: [resize],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chartDom: '',
|
chartDom: '',
|
||||||
chart: '',
|
chart: '',
|
||||||
chartHeight: this.tableHeight(214) - 70
|
chartHeight: this.tableHeight(250) / 2,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
chartData: {
|
chartData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => {
|
default: () => {
|
||||||
return []
|
return [];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
timeDim: {
|
timeDim: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chartData: function () {
|
chartData: function () {
|
||||||
this.getChart()
|
this.getChart();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.chartHeight = this.tableHeight(214) - 70
|
this.chartHeight = this.tableHeight(250) / 2;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getChart() {
|
getChart() {
|
||||||
@ -48,29 +47,29 @@ export default {
|
|||||||
this.chart !== '' &&
|
this.chart !== '' &&
|
||||||
this.chart !== undefined
|
this.chart !== undefined
|
||||||
) {
|
) {
|
||||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||||
}
|
}
|
||||||
this.chartDom = document.getElementById('analysischartBar')
|
this.chartDom = document.getElementById('analysischartBar');
|
||||||
this.chart = echarts.init(this.chartDom)
|
this.chart = echarts.init(this.chartDom);
|
||||||
let tempArr = []
|
let tempArr = [];
|
||||||
let xData = []
|
let xData = [];
|
||||||
let yData = []
|
let yData = [];
|
||||||
let legendData = []
|
let legendData = [];
|
||||||
if (this.chartData.length === 0) {
|
if (this.chartData.length === 0) {
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
tempArr = this.chartData[0].trendRespVOList
|
tempArr = this.chartData[0].trendRespVOList;
|
||||||
}
|
}
|
||||||
for (let k = 0; k < tempArr.length; k++) {
|
for (let k = 0; k < tempArr.length; k++) {
|
||||||
let time = ''
|
let time = '';
|
||||||
if (this.timeDim === '3') {
|
if (this.timeDim === '3') {
|
||||||
let year = tempArr[k].time.slice(0,4)
|
let year = tempArr[k].time.slice(0, 4);
|
||||||
let weak = tempArr[k].time.slice(4,6)
|
let weak = tempArr[k].time.slice(4, 6);
|
||||||
time = year+' 第 '+weak+' 周'
|
time = year + ' 第 ' + weak + ' 周';
|
||||||
} else {
|
} else {
|
||||||
time = tempArr[k].time
|
time = tempArr[k].time;
|
||||||
}
|
}
|
||||||
xData.push(time)
|
xData.push(time);
|
||||||
}
|
}
|
||||||
for (let i = 0; i < this.chartData.length; i++) {
|
for (let i = 0; i < this.chartData.length; i++) {
|
||||||
let obj = {
|
let obj = {
|
||||||
@ -79,70 +78,72 @@ export default {
|
|||||||
barMaxWidth: 20,
|
barMaxWidth: 20,
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'top'
|
position: 'top',
|
||||||
},
|
},
|
||||||
data: []
|
data: [],
|
||||||
}
|
};
|
||||||
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
|
legendData.push(this.chartData[i].objName + this.chartData[i].objCode);
|
||||||
let temp = this.chartData[i].trendRespVOList
|
let temp = this.chartData[i].trendRespVOList;
|
||||||
for (let j = 0; j < temp.length; j++) {
|
for (let j = 0; j < temp.length; j++) {
|
||||||
let num = temp[j].useNum ? temp[j].useNum : ''
|
let num = temp[j].useNum ? temp[j].useNum.toFixed(2) : '';
|
||||||
obj.data.push(num)
|
obj.data.push(num);
|
||||||
}
|
}
|
||||||
yData.push(obj)
|
yData.push(obj);
|
||||||
}
|
}
|
||||||
var option = {
|
var option = {
|
||||||
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
|
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF'],
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
type: 'shadow'
|
type: 'shadow',
|
||||||
},
|
},
|
||||||
formatter: function(params) {
|
formatter: function (params) {
|
||||||
return (
|
return (
|
||||||
params[0].axisValue +
|
params[0].axisValue +
|
||||||
`<br>` +
|
`<br>` +
|
||||||
params.map((item) => {
|
params
|
||||||
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`
|
.map((item) => {
|
||||||
let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`
|
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`;
|
||||||
let value = item.value ? item.value : '-'
|
let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`;
|
||||||
let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`
|
let value = item.value ? item.value : '-';
|
||||||
|
let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`;
|
||||||
return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
|
return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
|
||||||
<span>${str}${seriesNameStr}</span>
|
<span>${str}${seriesNameStr}</span>
|
||||||
<span>${valueStr}</span>
|
<span>${valueStr}</span>
|
||||||
</span>`
|
</span>`;
|
||||||
}).join(``)
|
})
|
||||||
)
|
.join(``)
|
||||||
}
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '4%',
|
left: '4%',
|
||||||
right: '1%',
|
right: '1%',
|
||||||
bottom: '1%',
|
bottom: '1%',
|
||||||
containLabel: true
|
containLabel: true,
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: legendData,
|
data: legendData,
|
||||||
right: '1%',
|
right: '1%',
|
||||||
icon: 'rect',
|
icon: 'rect',
|
||||||
itemHeight: 8,
|
itemHeight: 8,
|
||||||
itemWidth: 8
|
itemWidth: 8,
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: xData,
|
data: xData,
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
rotate: "45"
|
rotate: '45',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value',
|
||||||
},
|
},
|
||||||
series: yData
|
series: yData,
|
||||||
};
|
};
|
||||||
|
|
||||||
option && this.chart.setOption(option);
|
option && this.chart.setOption(option);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
@ -1,126 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div
|
|
||||||
id="analysischartLine"
|
|
||||||
style="width: 100%"
|
|
||||||
:style="{ height: chartHeight + 'px' }"
|
|
||||||
></div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import * as echarts from 'echarts'
|
|
||||||
import resize from '@/utils/chartMixins/resize'
|
|
||||||
export default {
|
|
||||||
name: "LineChart",
|
|
||||||
mixins: [resize],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
chartDom: '',
|
|
||||||
chart: '',
|
|
||||||
chartHeight: this.tableHeight(214) - 70
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
chartData: {
|
|
||||||
type: Array,
|
|
||||||
required: true,
|
|
||||||
default: () => {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
timeDim: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
chartData: function () {
|
|
||||||
this.getChart()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
this.chartHeight = this.tableHeight(214) - 70
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getChart() {
|
|
||||||
if (
|
|
||||||
this.chart !== null &&
|
|
||||||
this.chart !== '' &&
|
|
||||||
this.chart !== undefined
|
|
||||||
) {
|
|
||||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
|
||||||
}
|
|
||||||
this.chartDom = document.getElementById('analysischartLine')
|
|
||||||
this.chart = echarts.init(this.chartDom)
|
|
||||||
let tempArr = []
|
|
||||||
let xData = []
|
|
||||||
let yData = []
|
|
||||||
let legendData = []
|
|
||||||
if (this.chartData.length === 0) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
tempArr = this.chartData[0].trendRespVOList
|
|
||||||
}
|
|
||||||
for (let k = 0; k < tempArr.length; k++) {
|
|
||||||
let time = ''
|
|
||||||
if (this.timeDim === '3') {
|
|
||||||
let year = tempArr[k].time.slice(0,4)
|
|
||||||
let weak = tempArr[k].time.slice(4,6)
|
|
||||||
time = year+' 第 '+weak+' 周'
|
|
||||||
} else {
|
|
||||||
time = tempArr[k].time
|
|
||||||
}
|
|
||||||
xData.push(time)
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.chartData.length; i++) {
|
|
||||||
let obj = {
|
|
||||||
name: this.chartData[i].objName + this.chartData[i].objCode,
|
|
||||||
type: 'line',
|
|
||||||
stack: 'Total',
|
|
||||||
data: []
|
|
||||||
}
|
|
||||||
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
|
|
||||||
let temp = this.chartData[i].trendRespVOList
|
|
||||||
for (let j = 0; j < temp.length; j++) {
|
|
||||||
let num = temp[j].useNum ? temp[j].useNum : ''
|
|
||||||
obj.data.push(num)
|
|
||||||
}
|
|
||||||
yData.push(obj)
|
|
||||||
}
|
|
||||||
|
|
||||||
var option = {
|
|
||||||
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '4%',
|
|
||||||
right: '1%',
|
|
||||||
bottom: '1%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: legendData,
|
|
||||||
right: '1%'
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: xData,
|
|
||||||
axisLabel: {
|
|
||||||
rotate: "45"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: yData
|
|
||||||
};
|
|
||||||
|
|
||||||
option && this.chart.setOption(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,28 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }">
|
<div
|
||||||
<el-form :inline="true" class="demo-form-inline">
|
class="searchBarBox divHeight"
|
||||||
|
ref="searchBarRef"
|
||||||
|
:style="{ paddingRight: isFold ? '55px' : '0px' }">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline">
|
||||||
<span class="blue-block"></span>
|
<span class="blue-block"></span>
|
||||||
<el-form-item label="能源类型" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.energyTypeId" placeholder="请选择" style="width: 100px;" size="small">
|
label="能源类型"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.energyTypeId"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 150px"
|
||||||
|
@change="chooseType"
|
||||||
|
filterable
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in energyTypeList"
|
v-for="item in energyTypeList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.labelName"
|
||||||
:value="item.id">
|
:value="item.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间维度" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.timeDim" placeholder="请选择" style="width: 80px;" size="small">
|
label="时间维度"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.timeDim"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 80px"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
|
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间范围" required>
|
<el-form-item
|
||||||
|
label="时间范围"
|
||||||
|
required>
|
||||||
<div v-show="queryParams.timeDim === '1'">
|
<div v-show="queryParams.timeDim === '1'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeValue"
|
v-model="timeValue"
|
||||||
@ -36,10 +55,8 @@
|
|||||||
popper-class="noneMinute"
|
popper-class="noneMinute"
|
||||||
@change="timeSelect"
|
@change="timeSelect"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"
|
||||||
:clearable="false"
|
:clearable="false"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '2'">
|
<div v-show="queryParams.timeDim === '2'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -52,34 +69,31 @@
|
|||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"
|
||||||
@change="timeSelect"
|
@change="timeSelect"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '3'">
|
<div v-show="queryParams.timeDim === '3'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="weekValue1"
|
v-model="weekValue1"
|
||||||
type="week"
|
type="week"
|
||||||
format="yyyy 第 WW 周"
|
format="yyyy 第 WW 周"
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
:picker-options="pickerOptionsWeek"
|
:picker-options="pickerOptionsWeek"
|
||||||
@change="startWeek"
|
@change="startWeek"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择周">
|
placeholder="选择周"></el-date-picker>
|
||||||
</el-date-picker>-
|
-
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="weekValue2"
|
v-model="weekValue2"
|
||||||
type="week"
|
type="week"
|
||||||
format="yyyy 第 WW 周"
|
format="yyyy 第 WW 周"
|
||||||
:picker-options="pickerOptionsWeek"
|
:picker-options="pickerOptionsWeek"
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
@change="endWeek"
|
@change="endWeek"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择周">
|
placeholder="选择周"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '4'">
|
<div v-show="queryParams.timeDim === '4'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -92,14 +106,12 @@
|
|||||||
:clearable="false"
|
:clearable="false"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"
|
||||||
@change="timeSelect"
|
@change="timeSelect"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '5'">
|
<div v-show="queryParams.timeDim === '5'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
v-model="yearValue1"
|
v-model="yearValue1"
|
||||||
type="year"
|
type="year"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
@ -107,11 +119,10 @@
|
|||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
@change="startYear"
|
@change="startYear"
|
||||||
size="small"
|
size="small"
|
||||||
:clearable="false"
|
:clearable="false"></el-date-picker>
|
||||||
>
|
-
|
||||||
</el-date-picker>-
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
v-model="yearValue2"
|
v-model="yearValue2"
|
||||||
type="year"
|
type="year"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
@ -119,58 +130,96 @@
|
|||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
@change="endYear"
|
@change="endYear"
|
||||||
size="small"
|
size="small"
|
||||||
:clearable="false"
|
:clearable="false"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="对象维度" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.objType" placeholder="请选择" style="width: 80px;" @change="selectObjs" size="small">
|
v-if="energyType !== 0"
|
||||||
|
label="对象维度"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.objType"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 80px"
|
||||||
|
@change="selectObjs"
|
||||||
|
:disabled="energyType === 2"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(this.DICT_TYPE.OBJECT_TYPE)"
|
v-for="item in getDictDatas(this.DICT_TYPE.OBJECT_TYPE)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="对象选择" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple :multiple-limit='5' collapse-tags style="width: 200px;" size="small">
|
label="对象选择"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.objIds"
|
||||||
|
placeholder="请选择"
|
||||||
|
multiple
|
||||||
|
:multiple-limit="5"
|
||||||
|
collapse-tags
|
||||||
|
filterable
|
||||||
|
style="width: 200px"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in objectList"
|
v-for="item in objectList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
<span style="float: left">{{ item.name }}</span>
|
<span style="float: left">{{ item.name }}</span>
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
|
<span style="float: right; color: #8492a6; font-size: 13px">
|
||||||
|
{{ item.code }}
|
||||||
|
</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="search">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
@click="resetBtn">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
<span class="separateStyle"></span>
|
<span class="separateStyle"></span>
|
||||||
<el-button size="small" @click="resetBtn">重置</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
@click="exportBtn">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span v-if="isFold" class="foldClass" @click='switchMode'>
|
<span
|
||||||
|
v-if="isFold"
|
||||||
|
class="foldClass"
|
||||||
|
@click="switchMode">
|
||||||
{{ isExpand ? '收起' : '展开' }}
|
{{ isExpand ? '收起' : '展开' }}
|
||||||
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
|
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||||
import { getLineAll } from "@/api/base/productionLine"
|
import { getLineAll } from '@/api/base/productionLine';
|
||||||
import { getWorkShopAll } from "@/api/base/workshopSection"
|
import { getWorkShopAll } from '@/api/base/workshopSection';
|
||||||
import { getEquipmentAll } from "@/api/base/equipment"
|
import { getFactoryList } from '@/api/core/base/factory';
|
||||||
import moment from 'moment'
|
import moment from 'moment';
|
||||||
export default {
|
export default {
|
||||||
name: 'searchArea',
|
name: 'searchArea',
|
||||||
props: {
|
props: {
|
||||||
isFold: {// 多行模式(默认否)
|
isFold: {
|
||||||
|
// 多行模式(默认否)
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -182,275 +231,309 @@ export default {
|
|||||||
objType: '',
|
objType: '',
|
||||||
timeDim: null,
|
timeDim: null,
|
||||||
startTime: null,
|
startTime: null,
|
||||||
endTime: null
|
endTime: null,
|
||||||
},
|
},
|
||||||
timeValue: [],// 最大7天只能整点
|
energyType: 0, //1电2非电
|
||||||
dateValue: [],// 最大30天
|
timeValue: [], // 最大7天只能整点
|
||||||
weekValue1: null,//最多24周
|
dateValue: [], // 最大30天
|
||||||
|
weekValue1: null, //最多24周
|
||||||
weekValue2: null,
|
weekValue2: null,
|
||||||
monthValue: [],//最多24月
|
monthValue: [], //最多24月
|
||||||
yearValue1: null,//最多10年
|
yearValue1: null, //最多10年
|
||||||
yearValue2: null,
|
yearValue2: null,
|
||||||
energyTypeList: [],
|
energyTypeList: [],
|
||||||
objectList: [],
|
objectList: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
return date.getTime() > Date.now()
|
return date.getTime() > Date.now();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
pickerOptionsWeek: {
|
pickerOptionsWeek: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
let day = Date.now()
|
let day = Date.now();
|
||||||
let limitTime = moment(day).day(-1)
|
let limitTime = moment(day).day(-1);
|
||||||
return time.getTime() > new Date(limitTime).getTime()
|
return time.getTime() > new Date(limitTime).getTime();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getTypeList()
|
this.getTypeList();
|
||||||
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时
|
this.queryParams.timeDim = this.getDictDatas(
|
||||||
|
this.DICT_TYPE.TIME_DIM
|
||||||
|
)[0].value; // 默认时
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTypeList() {
|
getTypeList() {
|
||||||
getEnergyTypeListAll().then((res) => {
|
getEnergyTypeListAll().then((res) => {
|
||||||
this.energyTypeList = res.data || []
|
this.energyTypeList = res.data || [];
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
// 切换能源类型
|
||||||
|
chooseType(id) {
|
||||||
|
let val;
|
||||||
|
this.energyTypeList.map((item) => {
|
||||||
|
if (item.id === id) {
|
||||||
|
val = item.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (val == 1 || val == 2) {
|
||||||
|
this.energyType = 1;
|
||||||
|
this.queryParams.objType = null;
|
||||||
|
} else {
|
||||||
|
this.energyType = 2;
|
||||||
|
this.queryParams.objType = this.getDictDatas(
|
||||||
|
this.DICT_TYPE.OBJECT_TYPE
|
||||||
|
)[0].value;
|
||||||
|
}
|
||||||
|
this.selectObjs(this.queryParams.objType);
|
||||||
},
|
},
|
||||||
// 范围选择器
|
// 范围选择器
|
||||||
timeSelect() {
|
timeSelect() {
|
||||||
switch (this.queryParams.timeDim) {
|
switch (this.queryParams.timeDim) {
|
||||||
case '1':
|
case '1':
|
||||||
if (!this.timeValue) {
|
if (!this.timeValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.timeValue[1] - this.timeValue[0] > 7*24*3600000) {
|
if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为7天,请重新选择')
|
this.$modal.msgError('最大时间范围为7天,请重新选择');
|
||||||
this.timeValue = []
|
this.timeValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (!this.dateValue) {
|
if (!this.dateValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.dateValue[1] - this.dateValue[0] > 29*24*3600000) {
|
if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为30天,请重新选择') // 自动选择默认是0:00:00要求是23:59:59
|
this.$modal.msgError('最大时间范围为30天,请重新选择'); // 自动选择默认是0:00:00要求是23:59:59
|
||||||
this.dateValue = []
|
this.dateValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
if (!this.monthValue) {
|
if (!this.monthValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.monthValue[1] - this.monthValue[0] > 729*24*3600000) {
|
if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24个月,请重新选择')// 同理上面
|
this.$modal.msgError('最大时间范围为24个月,请重新选择'); // 同理上面
|
||||||
this.monthValue = []
|
this.monthValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 年选择器
|
// 年选择器
|
||||||
startYear() {
|
startYear() {
|
||||||
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
|
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
|
||||||
this.yearValue1 = null
|
this.yearValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
|
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为10年,请重新选择')
|
this.$modal.msgError('最大时间范围为10年,请重新选择');
|
||||||
this.yearValue1 = null
|
this.yearValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endYear() {
|
endYear() {
|
||||||
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
|
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
|
||||||
this.yearValue2 = null
|
this.yearValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
|
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为10年,请重新选择')
|
this.$modal.msgError('最大时间范围为10年,请重新选择');
|
||||||
this.yearValue2 = null
|
this.yearValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 周选择器
|
// 周选择器
|
||||||
startWeek() {
|
startWeek() {
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = new Date(this.weekValue1).getTime()
|
let a = new Date(this.weekValue1).getTime();
|
||||||
let b = new Date(this.weekValue2).getTime()
|
let b = new Date(this.weekValue2).getTime();
|
||||||
if (a > b) {
|
if (a > b) {
|
||||||
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
|
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
|
||||||
this.weekValue1 = null
|
this.weekValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (b - a > 167*24*3600000) {
|
if (b - a > 167 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24周,请重新选择')
|
this.$modal.msgError('最大时间范围为24周,请重新选择');
|
||||||
this.weekValue1 = null
|
this.weekValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endWeek() {
|
endWeek() {
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = new Date(this.weekValue1).getTime()
|
let a = new Date(this.weekValue1).getTime();
|
||||||
let b = new Date(this.weekValue2).getTime()
|
let b = new Date(this.weekValue2).getTime();
|
||||||
if (a > b) {
|
if (a > b) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
|
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
|
||||||
this.weekValue2 = null
|
this.weekValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (b - a > 167*24*3600000) {
|
if (b - a > 167 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24周,请重新选择')
|
this.$modal.msgError('最大时间范围为24周,请重新选择');
|
||||||
this.weekValue2 = null
|
this.weekValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 对象维度
|
// 对象维度
|
||||||
selectObjs(val) {
|
selectObjs(val) {
|
||||||
console.log(val)
|
console.log(val);
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case '1':
|
case '1':
|
||||||
getLineAll().then(res => {
|
getFactoryList().then((res) => {
|
||||||
this.objectList = res.data || []
|
this.objectList = res.data || [];
|
||||||
this.queryParams.objIds = []
|
this.queryParams.objIds = [];
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
getWorkShopAll().then(res => {
|
getLineAll().then((res) => {
|
||||||
this.objectList = res.data || []
|
this.objectList = res.data || [];
|
||||||
this.queryParams.objIds = []
|
this.queryParams.objIds = [];
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
getEquipmentAll().then(res => {
|
getWorkShopAll().then((res) => {
|
||||||
this.objectList = res.data || []
|
this.objectList = res.data || [];
|
||||||
this.queryParams.objIds = []
|
this.queryParams.objIds = [];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查询
|
// 查询
|
||||||
search() {
|
search() {
|
||||||
if (!this.queryParams.energyTypeId) {
|
if (!this.queryParams.energyTypeId) {
|
||||||
this.$modal.msgError('请选择能源类型')
|
this.$modal.msgError('请选择能源类型');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.queryParams.timeDim) {
|
if (!this.queryParams.timeDim) {
|
||||||
this.$modal.msgError('请选择时间维度')
|
this.$modal.msgError('请选择时间维度');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
switch (this.queryParams.timeDim) {
|
switch (this.queryParams.timeDim) {
|
||||||
case '1':
|
case '1':
|
||||||
if (this.timeValue && this.timeValue.length > 0) {
|
if (this.timeValue && this.timeValue.length > 0) {
|
||||||
this.queryParams.startTime = this.timeValue[0]
|
this.queryParams.startTime = this.timeValue[0];
|
||||||
this.queryParams.endTime = this.timeValue[1] // 不用转
|
this.queryParams.endTime = this.timeValue[1]; // 不用转
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (this.dateValue.length > 0) {
|
if (this.dateValue.length > 0) {
|
||||||
this.queryParams.startTime = this.dateValue[0]
|
this.queryParams.startTime = this.dateValue[0];
|
||||||
this.queryParams.endTime = this.dateValue[1] + 86399000 // 转为23:59:59
|
this.queryParams.endTime = this.dateValue[1] + 86399000; // 转为23:59:59
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('日范围不能为空')
|
this.$modal.msgError('日范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00'
|
let a =
|
||||||
let b = moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59'
|
moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00';
|
||||||
this.queryParams.startTime = new Date(a).getTime()
|
let b =
|
||||||
this.queryParams.endTime = new Date(b).getTime()
|
moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
this.queryParams.startTime = new Date(a).getTime();
|
||||||
|
this.queryParams.endTime = new Date(b).getTime();
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('周范围不能为空')
|
this.$modal.msgError('周范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '4':// 转为本月最后一天的最后一秒
|
case '4': // 转为本月最后一天的最后一秒
|
||||||
if (this.monthValue.length > 0) {
|
if (this.monthValue.length > 0) {
|
||||||
this.queryParams.startTime = this.monthValue[0]
|
this.queryParams.startTime = this.monthValue[0];
|
||||||
this.queryParams.endTime = this.transformTime(this.monthValue[1])
|
this.queryParams.endTime = this.transformTime(this.monthValue[1]);
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('月范围不能为空')
|
this.$modal.msgError('月范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
default://本年最后一天
|
default: //本年最后一天
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间')
|
this.$modal.msgError('结束时间不能早于开始时间');
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.startTime = this.yearValue1
|
this.queryParams.startTime = this.yearValue1;
|
||||||
this.queryParams.endTime = this.transformYear(this.yearValue2)
|
this.queryParams.endTime = this.transformYear(this.yearValue2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('年范围不能为空')
|
this.$modal.msgError('年范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.queryParams.objType) {
|
if (!this.queryParams.objType) {
|
||||||
this.$modal.msgError('请选择对象维度')
|
this.$modal.msgError('请选择对象维度');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.queryParams.objIds.length === 0) {
|
if (this.queryParams.objIds.length === 0) {
|
||||||
this.$modal.msgError('请选择对象')
|
this.$modal.msgError('请选择对象');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
this.queryParams.startTime = this.queryParams.startTime + ''
|
this.queryParams.startTime = this.queryParams.startTime + '';
|
||||||
this.queryParams.endTime = this.queryParams.endTime + ''
|
this.queryParams.endTime = this.queryParams.endTime + '';
|
||||||
console.log(this.queryParams)
|
console.log(this.queryParams);
|
||||||
this.$emit('submit', this.queryParams)
|
this.$emit('submit', this.queryParams);
|
||||||
},
|
},
|
||||||
resetBtn() {
|
resetBtn() {
|
||||||
this.queryParams.energyTypeId = null
|
this.queryParams.energyTypeId = null;
|
||||||
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时
|
this.queryParams.timeDim = this.getDictDatas(
|
||||||
this.queryParams.objIds = []
|
this.DICT_TYPE.TIME_DIM
|
||||||
this.queryParams.objType = ''
|
)[0].value; // 默认时
|
||||||
this.timeValue = []
|
this.queryParams.objIds = [];
|
||||||
this.dateValue = []
|
this.queryParams.objType = '';
|
||||||
this.weekValue1 = null
|
this.timeValue = [];
|
||||||
this.weekValue2 = null
|
this.dateValue = [];
|
||||||
this.monthValue = []
|
this.weekValue1 = null;
|
||||||
this.yearValue1 = null
|
this.weekValue2 = null;
|
||||||
this.yearValue2 = null
|
this.monthValue = [];
|
||||||
|
this.yearValue1 = null;
|
||||||
|
this.yearValue2 = null;
|
||||||
},
|
},
|
||||||
transformTime(timeStamp) {// 本月最后一天
|
// 导出
|
||||||
let year = moment(timeStamp).format('YYYY')
|
exportBtn() {
|
||||||
let month = moment(timeStamp).format('MM')
|
this.$emit('export');
|
||||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
|
||||||
let value = new Date(newData).getTime()
|
|
||||||
return value
|
|
||||||
},
|
},
|
||||||
transformYear(timeStamp) {// 本年最后一天
|
transformTime(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本月最后一天
|
||||||
let newData = year+'-12-31 23:59:59'
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let value = new Date(newData).getTime()
|
let month = moment(timeStamp).format('MM');
|
||||||
return value
|
let newData =
|
||||||
|
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
let value = new Date(newData).getTime();
|
||||||
|
return value;
|
||||||
},
|
},
|
||||||
switchMode() {// 展开和收起切换
|
transformYear(timeStamp) {
|
||||||
this.isExpand = !this.isExpand
|
// 本年最后一天
|
||||||
const element = this.$refs.searchBarRef
|
let year = moment(timeStamp).format('YYYY');
|
||||||
|
let newData = year + '-12-31 23:59:59';
|
||||||
|
let value = new Date(newData).getTime();
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
switchMode() {
|
||||||
|
// 展开和收起切换
|
||||||
|
this.isExpand = !this.isExpand;
|
||||||
|
const element = this.$refs.searchBarRef;
|
||||||
if (this.isExpand) {
|
if (this.isExpand) {
|
||||||
element.classList.remove('divHeight')
|
element.classList.remove('divHeight');
|
||||||
} else {
|
} else {
|
||||||
element.classList.add('divHeight')
|
element.classList.add('divHeight');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
/* 时间整点 */
|
/* 时间整点 */
|
||||||
@ -463,11 +546,11 @@ export default {
|
|||||||
.demo-form-inline {
|
.demo-form-inline {
|
||||||
.el-date-editor .el-range__icon {
|
.el-date-editor .el-range__icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.el-input__prefix .el-icon-date {
|
.el-input__prefix .el-icon-date {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -477,11 +560,15 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background-color: #0B58FF;
|
background-color: #0b58ff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
.el-form-item {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.searchBarBox .foldClass {
|
.searchBarBox .foldClass {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -489,7 +576,7 @@ export default {
|
|||||||
right: 0;
|
right: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color:#0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.searchBarBox .foldClass .iconfont {
|
.searchBarBox .foldClass .iconfont {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -502,7 +589,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #E8E8E8;
|
background: #e8e8e8;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,96 +1,129 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
|
<div
|
||||||
|
class="app-container contrastAnalysisBox"
|
||||||
|
id="contrastAnalysisBox">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-area :isFold="isFold" @submit="getList"/>
|
<search-area
|
||||||
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
|
:isFold="isFold"
|
||||||
<el-tab-pane label="柱状图" name="bar">
|
@submit="getList"
|
||||||
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
|
@export="exportExl" />
|
||||||
</el-tab-pane>
|
<div v-show="chartData.length">
|
||||||
<el-tab-pane label="折线图" name="line">
|
<bar-chart
|
||||||
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
|
ref="analysisBarChart"
|
||||||
</el-tab-pane>
|
:chartData="chartData"
|
||||||
</el-tabs>
|
:timeDim="timeDim" />
|
||||||
|
<base-table
|
||||||
|
:table-props="tableProps"
|
||||||
|
:table-data="list"
|
||||||
|
:max-height="tableH"
|
||||||
|
class="contrast-out-table" />
|
||||||
|
</div>
|
||||||
<!-- 没有数据 -->
|
<!-- 没有数据 -->
|
||||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
<div
|
||||||
|
class="no-data-bg"
|
||||||
|
v-show="!chartData.length"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getCompare } from "@/api/analysis/energyAnalysis"
|
import { getCompare } from '@/api/analysis/energyAnalysis';
|
||||||
import SearchArea from "./components/searchArea"
|
import SearchArea from './components/searchArea';
|
||||||
import BarChart from "./components/barChart"
|
import BarChart from './components/barChart';
|
||||||
import LineChart from "./components/lineChart"
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
import FileSaver from 'file-saver';
|
||||||
|
import * as XLSX from 'xlsx/xlsx.mjs';
|
||||||
// import moment from 'moment'
|
// import moment from 'moment'
|
||||||
export default {
|
export default {
|
||||||
name: 'ContrastAnalysis',
|
name: 'ContrastAnalysis',
|
||||||
components: { SearchArea, BarChart, LineChart },
|
components: { SearchArea, BarChart },
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFold: false,
|
isFold: false,
|
||||||
activeName: 'bar',
|
|
||||||
chartData: [],
|
chartData: [],
|
||||||
timeDim: ''
|
timeDim: '',
|
||||||
}
|
tableProps: [],
|
||||||
|
list: [],
|
||||||
|
tableH: this.tableHeight(250) / 2,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
|
||||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
|
|
||||||
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
|
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
|
||||||
})
|
});
|
||||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
|
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList(params) {
|
_setTableHeight() {
|
||||||
this.timeDim = params.timeDim
|
this.tableH = this.tableHeight(250) / 2;
|
||||||
getCompare({ ...params }).then((res) => {
|
|
||||||
console.log(res)
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.chartData = res.data || []
|
|
||||||
} else {
|
|
||||||
this.chartData = []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
switchChart() {
|
getList(params) {
|
||||||
if (this.activeName === 'bar') {
|
this.timeDim = params.timeDim;
|
||||||
this.$nextTick((res) => {
|
getCompare({ ...params }).then((res) => {
|
||||||
this.$refs.analysisBarChart.getChart()
|
if (res.code === 0) {
|
||||||
})
|
this.getTableList(res.data || []);
|
||||||
|
this.chartData = res.data || [];
|
||||||
} else {
|
} else {
|
||||||
this.$nextTick((res) => {
|
this.chartData = [];
|
||||||
this.$refs.analysisLineChart.getChart()
|
}
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
getTableList(arr) {
|
||||||
|
this.tableProps = [];
|
||||||
|
this.list = [];
|
||||||
|
let tempX = [];
|
||||||
|
let timeArr = arr[0].trendRespVOList || [];
|
||||||
|
this.list = timeArr.map((item) => {
|
||||||
|
return { time: item.time };
|
||||||
|
});
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
let obj = {};
|
||||||
|
obj.prop = arr[i].objId;
|
||||||
|
obj.label = arr[i].objName;
|
||||||
|
obj.minWidth = 100;
|
||||||
|
tempX.push(obj);
|
||||||
|
let tiemList = arr[i].trendRespVOList;
|
||||||
|
for (let j = 0; j < tiemList.length; j++) {
|
||||||
|
this.list[j][arr[i].objId] = tiemList[j].useNum
|
||||||
|
? tiemList[j].useNum.toFixed(2)
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
|
||||||
|
},
|
||||||
|
// 导出
|
||||||
|
exportExl() {
|
||||||
|
if (this.list.length > 0) {
|
||||||
|
var wb = XLSX.utils.table_to_book(
|
||||||
|
document.querySelector('.contrast-out-table')
|
||||||
|
);
|
||||||
|
let fileName = '对比分析.xlsx';
|
||||||
|
var wbout = XLSX.write(wb, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
bookSST: true,
|
||||||
|
type: 'array',
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
FileSaver.saveAs(
|
||||||
|
new Blob([wbout], { type: 'application/octet-stream' }),
|
||||||
|
fileName
|
||||||
|
);
|
||||||
|
this.$message.success('导出成功');
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') console.log(e, wbout);
|
||||||
}
|
}
|
||||||
}
|
return wbout;
|
||||||
|
} else {
|
||||||
|
this.$modal.msgWarning('暂无数据导出');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
.contrastAnalysisBox {
|
.contrastAnalysisBox {
|
||||||
.el-tabs__nav::after {
|
.contrast-out-table {
|
||||||
content: "";
|
margin-top: 20px;
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 2px;
|
|
||||||
background-color: #e4e7ed;
|
|
||||||
/* z-index: 1; */
|
|
||||||
}
|
|
||||||
.el-tabs__nav-wrap::after {
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
.el-tabs__item {
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
.el-tabs__item:hover {
|
|
||||||
color: rgba(0, 0, 0, 0.85);
|
|
||||||
}
|
|
||||||
.el-tabs__item.is-active {
|
|
||||||
color: rgba(0, 0, 0, 0.85);
|
|
||||||
}
|
|
||||||
.el-tabs__item {
|
|
||||||
color: rgba(0, 0, 0, 0.45);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,28 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form :inline="true" class="demo-form-inline">
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline">
|
||||||
<span class="blue-block"></span>
|
<span class="blue-block"></span>
|
||||||
<el-form-item label="对象选择" required>
|
<el-form-item
|
||||||
<el-cascader
|
label="对象选择"
|
||||||
v-model="objArr"
|
required>
|
||||||
:options="objList"
|
<el-select
|
||||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
v-model="queryParams.objId"
|
||||||
popper-class="cascaderParent"
|
placeholder="请选择"
|
||||||
size="small"
|
style="width: 250px"
|
||||||
style="width: 250px;"
|
filterable
|
||||||
clearable></el-cascader>
|
size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in objList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
:clearable="false"></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间维度" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
|
label="时间维度"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 80px"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in timeType"
|
v-for="item in timeType"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
:clearable="false">
|
:clearable="false"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间" required>
|
<el-form-item
|
||||||
|
label="时间"
|
||||||
|
required>
|
||||||
<div v-show="queryParams.type === 1">
|
<div v-show="queryParams.type === 1">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="monthValue"
|
v-model="monthValue"
|
||||||
@ -31,8 +47,7 @@
|
|||||||
@change="selectTime"
|
@change="selectTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择月">
|
placeholder="选择月"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.type === 2">
|
<div v-show="queryParams.type === 2">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -43,8 +58,7 @@
|
|||||||
@change="selectTime"
|
@change="selectTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择周">
|
placeholder="选择周"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.type === 3">
|
<div v-show="queryParams.type === 3">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -54,24 +68,34 @@
|
|||||||
@change="selectTime"
|
@change="selectTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择日">
|
placeholder="选择日"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="search">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span class="separateStyle"></span>
|
<span class="separateStyle"></span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="exportData"
|
||||||
|
plain>
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getTree } from '@/api/base/factory'
|
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||||
import moment from 'moment'
|
import moment from 'moment';
|
||||||
export default {
|
export default {
|
||||||
name: 'searchArea',
|
name: 'searchArea',
|
||||||
data() {
|
data() {
|
||||||
@ -80,133 +104,126 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
type: 1,
|
type: 1,
|
||||||
searchTime: null,
|
searchTime: null,
|
||||||
objId: null
|
objId: null,
|
||||||
|
objType: 1,
|
||||||
},
|
},
|
||||||
timeType: [
|
timeType: [
|
||||||
{id: 1, name: '月'},
|
{ id: 1, name: '月' },
|
||||||
{id: 2, name: '周'},
|
{ id: 2, name: '周' },
|
||||||
{id: 3, name: '日'}
|
{ id: 3, name: '日' },
|
||||||
],
|
],
|
||||||
monthValue: '',
|
monthValue: '',
|
||||||
weekValue: '',
|
weekValue: '',
|
||||||
dateValue: '',
|
dateValue: '',
|
||||||
objArr: [],
|
|
||||||
objList: [],
|
objList: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
return date.getTime() > Date.now()
|
return date.getTime() > Date.now();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
pickerOptionsWeek: {
|
pickerOptionsWeek: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
let day = Date.now()
|
let day = Date.now();
|
||||||
let limitTime = moment(day).day(-1)
|
let limitTime = moment(day).day(-1);
|
||||||
return time.getTime() > new Date(limitTime).getTime()
|
return time.getTime() > new Date(limitTime).getTime();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getObjTree()
|
this.getObjTree();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getObjTree() {
|
getObjTree() {
|
||||||
getTree().then(res => {
|
getTree().then((res) => {
|
||||||
this.objList = res.data || []
|
this.objList = res.data || [];
|
||||||
})
|
if (this.objList.length > 0) {
|
||||||
|
this.queryParams.objId = this.objList[0].id;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
selectTime() {
|
selectTime() {
|
||||||
switch (this.queryParams.type) {
|
switch (this.queryParams.type) {
|
||||||
case 1:
|
case 1:
|
||||||
this.queryParams.searchTime = this.monthValue
|
this.queryParams.searchTime = this.monthValue;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.queryParams.searchTime = this.weekValue
|
this.queryParams.searchTime = this.weekValue;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.queryParams.searchTime = this.dateValue
|
this.queryParams.searchTime = this.dateValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查询
|
// 查询
|
||||||
search() {
|
search() {
|
||||||
if (this.objArr.length === 0) {
|
if (!this.queryParams.objId) {
|
||||||
this.$modal.msgError('请选择对象')
|
this.$modal.msgError('请选择对象');
|
||||||
return false
|
return false;
|
||||||
} else {
|
|
||||||
this.queryParams.objId = this.objArr[this.objArr.length-1]
|
|
||||||
}
|
}
|
||||||
if (!this.queryParams.type) {
|
if (!this.queryParams.type) {
|
||||||
this.$modal.msgError('请选择时间维度')
|
this.$modal.msgError('请选择时间维度');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.queryParams.searchTime) {
|
if (!this.queryParams.searchTime) {
|
||||||
this.$modal.msgError('请选择时间')
|
this.$modal.msgError('请选择时间');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
switch (this.queryParams.type) {
|
switch (this.queryParams.type) {
|
||||||
case 1:
|
case 1:
|
||||||
this.queryParams.searchTime = this.transformTime(this.monthValue)
|
this.queryParams.searchTime = this.transformTime(this.monthValue);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
let value = moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59'
|
let value =
|
||||||
this.queryParams.searchTime = new Date(value).getTime()
|
moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
this.queryParams.searchTime = new Date(value).getTime();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
let value2 = moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59'
|
let value2 =
|
||||||
this.queryParams.searchTime = new Date(value2).getTime()
|
moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
this.queryParams.searchTime = new Date(value2).getTime();
|
||||||
}
|
}
|
||||||
this.$emit('submit', this.queryParams)
|
this.$emit('submit', this.queryParams);
|
||||||
},
|
},
|
||||||
exportData() {
|
exportData() {
|
||||||
let name
|
let name;
|
||||||
if (this.queryParams.objId) {
|
if (this.queryParams.objId) {
|
||||||
name = this.getObjName(this.objList, this.queryParams.objId)
|
name = this.getObjName(this.objList, this.queryParams.objId);
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgWarning("对象不能为空")
|
this.$modal.msgWarning('对象不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
this.$emit('exportD', {name: name})
|
this.$emit('exportD', { name: name });
|
||||||
},
|
},
|
||||||
// 递归取对象name
|
// 递归取对象name
|
||||||
getObjName(list, id) {
|
getObjName(list, id) {
|
||||||
let _this = this
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
let a = list[i]
|
let a = list[i];
|
||||||
if (a.id === id) {
|
if (a.id === id) {
|
||||||
return a.name
|
return a.name;
|
||||||
} else {
|
|
||||||
if (a.children && a.children.length > 0) {
|
|
||||||
let res = _this.getObjName(a.children, id)
|
|
||||||
if (res) {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
transformTime(timeStamp) {// 本月最后一天
|
transformTime(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本月最后一天
|
||||||
let month = moment(timeStamp).format('MM')
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
let month = moment(timeStamp).format('MM');
|
||||||
let value = new Date(newData).getTime()
|
let newData =
|
||||||
return value
|
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
}
|
let value = new Date(newData).getTime();
|
||||||
}
|
return value;
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
/* 级联选择器 */
|
|
||||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.demo-form-inline {
|
.demo-form-inline {
|
||||||
.el-date-editor .el-range__icon {
|
.el-date-editor .el-range__icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.el-input__prefix .el-icon-date {
|
.el-input__prefix .el-icon-date {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -215,7 +232,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #E8E8E8;
|
background: #e8e8e8;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.demo-form-inline {
|
.demo-form-inline {
|
||||||
@ -223,10 +240,14 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background-color: #0B58FF;
|
background-color: #0b58ff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
.el-form-item {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,29 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-area @submit="getList" @exportD="exportData"/>
|
<search-area
|
||||||
|
@submit="getList"
|
||||||
|
@exportD="exportData" />
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<div v-show="chartData.length">
|
<div v-show="chartData.length">
|
||||||
<base-table
|
<base-table
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
class="qoq-out-table"
|
class="qoq-out-table" />
|
||||||
/>
|
|
||||||
<div class="chartTitle">环比分析图</div>
|
<div class="chartTitle">环比分析图</div>
|
||||||
<div style='width: 100%'>
|
<div style="width: 100%">
|
||||||
<line-chart ref="analysisLineChart" :chartData="chartData"/>
|
<line-chart
|
||||||
|
ref="analysisLineChart"
|
||||||
|
:chartData="chartData" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 没有数据 -->
|
<!-- 没有数据 -->
|
||||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
<div
|
||||||
|
class="no-data-bg"
|
||||||
|
v-show="!chartData.length"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getQoq } from "@/api/analysis/energyAnalysis"
|
import { getQoq } from '@/api/analysis/energyAnalysis';
|
||||||
import SearchArea from "./components/searchArea"
|
import SearchArea from './components/searchArea';
|
||||||
import LineChart from "./components/lineChart"
|
import LineChart from './components/lineChart';
|
||||||
import FileSaver from "file-saver"
|
import FileSaver from 'file-saver';
|
||||||
import * as XLSX from 'xlsx/xlsx.mjs'
|
import * as XLSX from 'xlsx/xlsx.mjs';
|
||||||
export default {
|
export default {
|
||||||
name: 'QoqAnalysis',
|
name: 'QoqAnalysis',
|
||||||
components: { SearchArea, LineChart },
|
components: { SearchArea, LineChart },
|
||||||
@ -31,87 +36,90 @@ export default {
|
|||||||
return {
|
return {
|
||||||
chartData: [],
|
chartData: [],
|
||||||
tableProps: [],
|
tableProps: [],
|
||||||
list: []
|
list: [],
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList(params) {
|
getList(params) {
|
||||||
getQoq({ ...params }).then((res) => {
|
getQoq({ ...params }).then((res) => {
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
this.getTableList(res.data)
|
this.getTableList(res.data);
|
||||||
} else {
|
} else {
|
||||||
this.chartData = []
|
this.chartData = [];
|
||||||
this.list = []
|
this.list = [];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getTableList(arr) {
|
getTableList(arr) {
|
||||||
let data = arr.data
|
let data = arr.data;
|
||||||
let nameData = arr.nameData
|
let nameData = arr.nameData;
|
||||||
let tempX = []
|
let tempX = [];
|
||||||
data[0].data.map((item) => {
|
data[0].data.map((item) => {
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj.prop = item.dynamicName
|
obj.prop = item.dynamicName;
|
||||||
obj.label = item.dynamicName
|
obj.label = item.dynamicName;
|
||||||
obj.id = item.id
|
obj.id = item.id;
|
||||||
obj.children = []
|
obj.children = [];
|
||||||
tempX.push(obj)
|
tempX.push(obj);
|
||||||
})
|
});
|
||||||
for (let i = 0; i < nameData.length; i++) {
|
for (let i = 0; i < nameData.length; i++) {
|
||||||
for (let j = 0; j < tempX.length; j++) {
|
for (let j = 0; j < tempX.length; j++) {
|
||||||
if (tempX[j].id === nameData[i].parentId) {
|
if (tempX[j].id === nameData[i].parentId) {
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj.prop = tempX[j].prop + '_' + nameData[i].name
|
obj.prop = tempX[j].prop + '_' + nameData[i].name;
|
||||||
obj.label = nameData[i].name
|
obj.label = nameData[i].name;
|
||||||
tempX[j].children.push(obj)
|
tempX[j].children.push(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tableProps = [{prop: 'time',label: '时间'}].concat(tempX)
|
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
|
||||||
// 数据
|
// 数据
|
||||||
this.list = []
|
this.list = [];
|
||||||
for (let k = 0; k < data.length; k++) {
|
for (let k = 0; k < data.length; k++) {
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj.time = data[k].time
|
obj.time = data[k].time;
|
||||||
let arr1 = data[k].data
|
let arr1 = data[k].data;
|
||||||
obj.type = []
|
obj.type = [];
|
||||||
for (let q = 0; q < arr1.length; q++) {
|
for (let q = 0; q < arr1.length; q++) {
|
||||||
let name = arr1[q].dynamicName
|
let name = arr1[q].dynamicName;
|
||||||
obj.type.push(name)
|
obj.type.push(name);
|
||||||
let arr2 = arr1[q].children
|
let arr2 = arr1[q].children;
|
||||||
for (let p = 0; p < arr2.length; p++) {
|
for (let p = 0; p < arr2.length; p++) {
|
||||||
let prop = name + '_' + arr2[p].dynamicName
|
let prop = name + '_' + arr2[p].dynamicName;
|
||||||
obj[prop] = arr2[p].dynamicValue
|
obj[prop] = arr2[p].dynamicValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.list.push(obj)
|
this.list.push(obj);
|
||||||
}
|
}
|
||||||
this.chartData = this.list
|
this.chartData = this.list;
|
||||||
},
|
},
|
||||||
exportData(val) {
|
exportData(val) {
|
||||||
if (this.list.length > 0) {
|
if (this.list.length > 0) {
|
||||||
var wb = XLSX.utils.table_to_book(document.querySelector(".qoq-out-table"))
|
var wb = XLSX.utils.table_to_book(
|
||||||
let fileName = val.name + "环比分析.xlsx"
|
document.querySelector('.qoq-out-table')
|
||||||
|
);
|
||||||
|
let fileName = val.name + '环比分析.xlsx';
|
||||||
var wbout = XLSX.write(wb, {
|
var wbout = XLSX.write(wb, {
|
||||||
bookType: "xlsx",
|
bookType: 'xlsx',
|
||||||
bookSST: true,
|
bookSST: true,
|
||||||
type: "array"
|
type: 'array',
|
||||||
})
|
});
|
||||||
try {
|
try {
|
||||||
FileSaver.saveAs(
|
FileSaver.saveAs(
|
||||||
new Blob([wbout], { type: "application/octet-stream" }),
|
new Blob([wbout], { type: 'application/octet-stream' }),
|
||||||
fileName
|
fileName
|
||||||
)
|
);
|
||||||
|
this.$message.success('导出成功');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (typeof console !== "undefined") console.log(e, wbout);
|
if (typeof console !== 'undefined') console.log(e, wbout);
|
||||||
}
|
}
|
||||||
return wbout
|
return wbout;
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgWarning("暂无数据导出")
|
this.$modal.msgWarning('暂无数据导出');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.chartTitle {
|
.chartTitle {
|
||||||
@ -124,7 +132,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background-color: #0B58FF;
|
background-color: #0b58ff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
|
@ -2,44 +2,43 @@
|
|||||||
<div
|
<div
|
||||||
id="analysischartLine"
|
id="analysischartLine"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: chartHeight + 'px' }"
|
:style="{ height: chartHeight + 'px' }"></div>
|
||||||
></div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts';
|
||||||
import resize from '@/utils/chartMixins/resize'
|
import resize from '@/utils/chartMixins/resize';
|
||||||
export default {
|
export default {
|
||||||
name: "LineChart",
|
name: 'LineChart',
|
||||||
mixins: [resize],
|
mixins: [resize],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chartDom: '',
|
chartDom: '',
|
||||||
chart: '',
|
chart: '',
|
||||||
chartHeight: this.tableHeight(214) - 70
|
chartHeight: this.tableHeight(214) - 100,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
chartData: {
|
chartData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => {
|
default: () => {
|
||||||
return []
|
return [];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
timeDim: {
|
timeDim: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chartData: function () {
|
chartData: function () {
|
||||||
this.getChart()
|
this.getChart();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.chartHeight = this.tableHeight(214) - 70
|
this.chartHeight = this.tableHeight(214) - 70;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getChart() {
|
getChart() {
|
||||||
@ -48,27 +47,27 @@ export default {
|
|||||||
this.chart !== '' &&
|
this.chart !== '' &&
|
||||||
this.chart !== undefined
|
this.chart !== undefined
|
||||||
) {
|
) {
|
||||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||||
}
|
}
|
||||||
this.chartDom = document.getElementById('analysischartLine')
|
this.chartDom = document.getElementById('analysischartLine');
|
||||||
this.chart = echarts.init(this.chartDom)
|
this.chart = echarts.init(this.chartDom);
|
||||||
let xData = []
|
let xData = [];
|
||||||
let yData = []
|
let yData = [];
|
||||||
for (let i = 0; i < this.chartData.length; i++) {
|
for (let i = 0; i < this.chartData.length; i++) {
|
||||||
let time = ""
|
let time = '';
|
||||||
if (this.timeDim === '3') {
|
if (this.timeDim === '3') {
|
||||||
let year = this.chartData[i].time.slice(0,4)
|
let year = this.chartData[i].time.slice(0, 4);
|
||||||
let weak = this.chartData[i].time.slice(4,6)
|
let weak = this.chartData[i].time.slice(4, 6);
|
||||||
time = year+' 第 '+weak+' 周'
|
time = year + ' 第 ' + weak + ' 周';
|
||||||
} else {
|
} else {
|
||||||
time = this.chartData[i].time
|
time = this.chartData[i].time;
|
||||||
}
|
}
|
||||||
xData.push(time)
|
xData.push(time);
|
||||||
yData.push(this.chartData[i].useNum)
|
yData.push(this.chartData[i].useNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
var option = {
|
var option = {
|
||||||
color:['#288AFF'],
|
color: ['#288AFF'],
|
||||||
// tooltip: {
|
// tooltip: {
|
||||||
// trigger: 'axis'
|
// trigger: 'axis'
|
||||||
// },
|
// },
|
||||||
@ -76,28 +75,28 @@ export default {
|
|||||||
left: '4%',
|
left: '4%',
|
||||||
right: '1%',
|
right: '1%',
|
||||||
bottom: '1%',
|
bottom: '1%',
|
||||||
containLabel: true
|
containLabel: true,
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: xData,
|
data: xData,
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
rotate: "45"
|
rotate: '45',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value',
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
data: yData,
|
data: yData,
|
||||||
type: 'line'
|
type: 'line',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
option && this.chart.setOption(option);
|
option && this.chart.setOption(option);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
@ -1,38 +1,79 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }">
|
<div
|
||||||
<el-form :inline="true" class="demo-form-inline">
|
class="searchBarBox divHeight"
|
||||||
|
ref="searchBarRef"
|
||||||
|
:style="{ paddingRight: isFold ? '55px' : '0px' }">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline">
|
||||||
<span class="blue-block"></span>
|
<span class="blue-block"></span>
|
||||||
<el-form-item label="能源类型" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.energyTypeId" placeholder="请选择" style="width: 100px;" size="small">
|
label="能源类型"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.energyTypeId"
|
||||||
|
placeholder="请选择"
|
||||||
|
size="small"
|
||||||
|
@change="chooseType"
|
||||||
|
filterable
|
||||||
|
style="width: 100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in energyTypeList"
|
v-for="item in energyTypeList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.labelName"
|
||||||
:value="item.id">
|
:value="item.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="对象选择" required>
|
<el-form-item
|
||||||
|
v-if="energyType === 1"
|
||||||
|
label="对象选择"
|
||||||
|
required>
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="objArr"
|
v-model="objArr"
|
||||||
:options="objList"
|
:options="objList"
|
||||||
|
:show-all-levels="false"
|
||||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||||
popper-class="cascaderParent"
|
|
||||||
size="small"
|
size="small"
|
||||||
|
@change="changeLine"
|
||||||
clearable></el-cascader>
|
clearable></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间维度" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.timeDim" placeholder="请选择" style="width: 80px;" size="small">
|
v-if="energyType === 2"
|
||||||
|
label="对象选择"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="objId"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 250px"
|
||||||
|
filterable
|
||||||
|
size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in objList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
:clearable="false"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="时间维度"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.timeDim"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 80px"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
|
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
size="small">
|
size="small"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间范围" required>
|
<el-form-item
|
||||||
|
label="时间范围"
|
||||||
|
required>
|
||||||
<div v-show="queryParams.timeDim === '1'">
|
<div v-show="queryParams.timeDim === '1'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeValue"
|
v-model="timeValue"
|
||||||
@ -46,9 +87,7 @@
|
|||||||
popper-class="noneMinute"
|
popper-class="noneMinute"
|
||||||
@change="timeSelect"
|
@change="timeSelect"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '2'">
|
<div v-show="queryParams.timeDim === '2'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -61,31 +100,28 @@
|
|||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
@change="timeSelect"
|
@change="timeSelect"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '3'">
|
<div v-show="queryParams.timeDim === '3'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="weekValue1"
|
v-model="weekValue1"
|
||||||
type="week"
|
type="week"
|
||||||
format="yyyy 第 WW 周"
|
format="yyyy 第 WW 周"
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
:picker-options="pickerOptionsWeek"
|
:picker-options="pickerOptionsWeek"
|
||||||
@change="startWeek"
|
@change="startWeek"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择周">
|
placeholder="选择周"></el-date-picker>
|
||||||
</el-date-picker>-
|
-
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="weekValue2"
|
v-model="weekValue2"
|
||||||
type="week"
|
type="week"
|
||||||
format="yyyy 第 WW 周"
|
format="yyyy 第 WW 周"
|
||||||
:picker-options="pickerOptionsWeek"
|
:picker-options="pickerOptionsWeek"
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
@change="endWeek"
|
@change="endWeek"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择周">
|
placeholder="选择周"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '4'">
|
<div v-show="queryParams.timeDim === '4'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -97,59 +133,74 @@
|
|||||||
value-format="timestamp"
|
value-format="timestamp"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
size="small"
|
size="small"
|
||||||
style='width:350px;'
|
style="width: 350px"
|
||||||
@change="timeSelect"
|
@change="timeSelect"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.timeDim === '5'">
|
<div v-show="queryParams.timeDim === '5'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
v-model="yearValue1"
|
v-model="yearValue1"
|
||||||
type="year"
|
type="year"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
value-format="timestamp"
|
value-format="timestamp"
|
||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
size="small"
|
size="small"
|
||||||
@change="startYear"
|
@change="startYear"></el-date-picker>
|
||||||
>
|
-
|
||||||
</el-date-picker>-
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
style='width:170px;'
|
style="width: 170px"
|
||||||
v-model="yearValue2"
|
v-model="yearValue2"
|
||||||
type="year"
|
type="year"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions"
|
||||||
value-format="timestamp"
|
value-format="timestamp"
|
||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
size="small"
|
size="small"
|
||||||
@change="endYear"
|
@change="endYear"></el-date-picker>
|
||||||
>
|
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handBtn('search')">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
@click="resetBtn">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
<span class="separateStyle"></span>
|
<span class="separateStyle"></span>
|
||||||
<el-button size="small" @click="resetBtn">重置</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
@click="handBtn('exportBtn')">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span v-if="isFold" class="foldClass" @click='switchMode'>
|
<span
|
||||||
|
v-if="isFold"
|
||||||
|
class="foldClass"
|
||||||
|
@click="switchMode">
|
||||||
{{ isExpand ? '收起' : '展开' }}
|
{{ isExpand ? '收起' : '展开' }}
|
||||||
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
|
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
|
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||||
import { getTree } from '@/api/base/factory'
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||||
import moment from 'moment'
|
import moment from 'moment';
|
||||||
export default {
|
export default {
|
||||||
name: 'searchArea',
|
name: 'searchArea',
|
||||||
props: {
|
props: {
|
||||||
isFold: {// 多行模式(默认否)
|
isFold: {
|
||||||
|
// 多行模式(默认否)
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -160,258 +211,315 @@ export default {
|
|||||||
objId: null,
|
objId: null,
|
||||||
timeDim: null,
|
timeDim: null,
|
||||||
startTime: null,
|
startTime: null,
|
||||||
endTime: null
|
endTime: null,
|
||||||
|
objType: 1, //1工厂2产线3工段
|
||||||
},
|
},
|
||||||
objArr: [],
|
objId: null,
|
||||||
timeValue: [],// 最大7天只能整点
|
objType: 1, //1工厂2产线3工段,非电使用
|
||||||
dateValue: [],// 最大30天
|
|
||||||
weekValue1: null,//最多24周
|
|
||||||
weekValue2: null,
|
|
||||||
monthValue: [],//最多24月
|
|
||||||
yearValue1: null,//最多10年
|
|
||||||
yearValue2: null,
|
|
||||||
energyTypeList: [],
|
energyTypeList: [],
|
||||||
|
energyType: 0, //1电2非电
|
||||||
|
objArr: [],
|
||||||
|
timeValue: [], // 最大7天只能整点
|
||||||
|
dateValue: [], // 最大30天
|
||||||
|
weekValue1: null, //最多24周
|
||||||
|
weekValue2: null,
|
||||||
|
monthValue: [], //最多24月
|
||||||
|
yearValue1: null, //最多10年
|
||||||
|
yearValue2: null,
|
||||||
objList: [],
|
objList: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
return date.getTime() > Date.now()
|
return date.getTime() > Date.now();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
pickerOptionsWeek: {
|
pickerOptionsWeek: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
let day = Date.now()
|
let day = Date.now();
|
||||||
let limitTime = moment(day).day(-1)
|
let limitTime = moment(day).day(-1);
|
||||||
return time.getTime() > new Date(limitTime).getTime()
|
return time.getTime() > new Date(limitTime).getTime();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getTypeList()
|
this.getEnergyList();
|
||||||
this.getObjTree()
|
this.getObjTree();
|
||||||
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时
|
this.queryParams.timeDim = this.getDictDatas(
|
||||||
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000]
|
this.DICT_TYPE.TIME_DIM
|
||||||
|
)[0].value; // 默认时
|
||||||
|
this.timeValue = [
|
||||||
|
moment().startOf('day'),
|
||||||
|
moment().endOf('day') - 59 * 61 * 1000,
|
||||||
|
];
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTypeList() {
|
|
||||||
getEnergyTypeListAll().then((res) => {
|
|
||||||
this.energyTypeList = res.data || []
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getObjTree() {
|
getObjTree() {
|
||||||
getTree().then(res => {
|
getTree().then((res) => {
|
||||||
this.objList = res.data || []
|
this.objList = res.data || [];
|
||||||
})
|
if (this.objList.length > 0) {
|
||||||
|
this.objId = this.objList[0].id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取能源类型
|
||||||
|
getEnergyList() {
|
||||||
|
getEnergyTypeListAll().then((res) => {
|
||||||
|
this.energyTypeList = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 切换能源类型
|
||||||
|
chooseType(id) {
|
||||||
|
let val;
|
||||||
|
this.energyTypeList.map((item) => {
|
||||||
|
if (item.id === id) {
|
||||||
|
val = item.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (val == 1 || val == 2) {
|
||||||
|
this.energyType = 1;
|
||||||
|
} else {
|
||||||
|
this.energyType = 2;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择工厂/产线/单元
|
||||||
|
changeLine(val) {
|
||||||
|
this.objType = val.length || 0;
|
||||||
},
|
},
|
||||||
// 范围选择器
|
// 范围选择器
|
||||||
timeSelect() {
|
timeSelect() {
|
||||||
switch (this.queryParams.timeDim) {
|
switch (this.queryParams.timeDim) {
|
||||||
case '1':
|
case '1':
|
||||||
if (!this.timeValue) {
|
if (!this.timeValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.timeValue[1] - this.timeValue[0] > 7*24*3600000) {
|
if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为7天,请重新选择')
|
this.$modal.msgError('最大时间范围为7天,请重新选择');
|
||||||
this.timeValue = []
|
this.timeValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (!this.dateValue) {
|
if (!this.dateValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.dateValue[1] - this.dateValue[0] > 29*24*3600000) {
|
if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为30天,请重新选择') // 自动选择默认是0:00:00要求是23:59:59
|
this.$modal.msgError('最大时间范围为30天,请重新选择'); // 自动选择默认是0:00:00要求是23:59:59
|
||||||
this.dateValue = []
|
this.dateValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
if (!this.monthValue) {
|
if (!this.monthValue) {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.monthValue[1] - this.monthValue[0] > 729*24*3600000) {
|
if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24个月,请重新选择')// 同理上面
|
this.$modal.msgError('最大时间范围为24个月,请重新选择'); // 同理上面
|
||||||
this.monthValue = []
|
this.monthValue = [];
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 年选择器
|
// 年选择器
|
||||||
startYear() {
|
startYear() {
|
||||||
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
|
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
|
||||||
this.yearValue1 = null
|
this.yearValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
|
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为10年,请重新选择')
|
this.$modal.msgError('最大时间范围为10年,请重新选择');
|
||||||
this.yearValue1 = null
|
this.yearValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endYear() {
|
endYear() {
|
||||||
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
|
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
|
||||||
this.yearValue2 = null
|
this.yearValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
|
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为10年,请重新选择')
|
this.$modal.msgError('最大时间范围为10年,请重新选择');
|
||||||
this.yearValue2 = null
|
this.yearValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 周选择器
|
// 周选择器
|
||||||
startWeek() {
|
startWeek() {
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = new Date(this.weekValue1).getTime()
|
let a = new Date(this.weekValue1).getTime();
|
||||||
let b = new Date(this.weekValue2).getTime()
|
let b = new Date(this.weekValue2).getTime();
|
||||||
if (a > b) {
|
if (a > b) {
|
||||||
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
|
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
|
||||||
this.weekValue1 = null
|
this.weekValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (b - a > 167*24*3600000) {
|
if (b - a > 167 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24周,请重新选择')
|
this.$modal.msgError('最大时间范围为24周,请重新选择');
|
||||||
this.weekValue1 = null
|
this.weekValue1 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endWeek() {
|
endWeek() {
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = new Date(this.weekValue1).getTime()
|
let a = new Date(this.weekValue1).getTime();
|
||||||
let b = new Date(this.weekValue2).getTime()
|
let b = new Date(this.weekValue2).getTime();
|
||||||
if (a > b) {
|
if (a > b) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
|
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
|
||||||
this.weekValue2 = null
|
this.weekValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (b - a > 167*24*3600000) {
|
if (b - a > 167 * 24 * 3600000) {
|
||||||
this.$modal.msgError('最大时间范围为24周,请重新选择')
|
this.$modal.msgError('最大时间范围为24周,请重新选择');
|
||||||
this.weekValue2 = null
|
this.weekValue2 = null;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查询
|
// 查询
|
||||||
search() {
|
handBtn(val) {
|
||||||
if (!this.queryParams.energyTypeId) {
|
if (!this.queryParams.energyTypeId) {
|
||||||
this.$modal.msgError('请选择能源类型')
|
this.$modal.msgError('请选择能源类型');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.energyType == 1) {
|
||||||
if (this.objArr.length === 0) {
|
if (this.objArr.length === 0) {
|
||||||
this.$modal.msgError('请选择对象')
|
this.$modal.msgError('请选择对象');
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.objId = this.objArr[this.objArr.length-1]
|
this.queryParams.objId = this.objArr[this.objArr.length - 1];
|
||||||
|
this.queryParams.objType = this.objType;
|
||||||
}
|
}
|
||||||
|
} else if (this.energyType == 2) {
|
||||||
|
if (!this.objId) {
|
||||||
|
this.$modal.msgError('请选择对象');
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.queryParams.objId = this.objId;
|
||||||
|
this.queryParams.objType = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.queryParams.timeDim) {
|
if (!this.queryParams.timeDim) {
|
||||||
this.$modal.msgError('请选择时间维度')
|
this.$modal.msgError('请选择时间维度');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
switch (this.queryParams.timeDim) {
|
switch (this.queryParams.timeDim) {
|
||||||
case '1':
|
case '1':
|
||||||
if (this.timeValue && this.timeValue.length > 0) {
|
if (this.timeValue && this.timeValue.length > 0) {
|
||||||
this.queryParams.startTime = this.timeValue[0]
|
this.queryParams.startTime = this.timeValue[0];
|
||||||
this.queryParams.endTime = this.timeValue[1] // 不用转
|
this.queryParams.endTime = this.timeValue[1]; // 不用转
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('时间范围不能为空')
|
this.$modal.msgError('时间范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (this.dateValue && this.dateValue.length > 0) {
|
if (this.dateValue && this.dateValue.length > 0) {
|
||||||
this.queryParams.startTime = this.dateValue[0]
|
this.queryParams.startTime = this.dateValue[0];
|
||||||
this.queryParams.endTime = this.dateValue[1] + 86399000 // 转为23:59:59
|
this.queryParams.endTime = this.dateValue[1] + 86399000; // 转为23:59:59
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('日范围不能为空')
|
this.$modal.msgError('日范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
if (this.weekValue1 && this.weekValue2) {
|
if (this.weekValue1 && this.weekValue2) {
|
||||||
let a = moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00'
|
let a =
|
||||||
let b = moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59'
|
moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00';
|
||||||
this.queryParams.startTime = new Date(a).getTime()
|
let b =
|
||||||
this.queryParams.endTime = new Date(b).getTime()
|
moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
this.queryParams.startTime = new Date(a).getTime();
|
||||||
|
this.queryParams.endTime = new Date(b).getTime();
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('周范围不能为空')
|
this.$modal.msgError('周范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case '4':// 转为本月最后一天的最后一秒
|
case '4': // 转为本月最后一天的最后一秒
|
||||||
if (this.monthValue && this.monthValue.length > 0) {
|
if (this.monthValue && this.monthValue.length > 0) {
|
||||||
this.queryParams.startTime = this.monthValue[0]
|
this.queryParams.startTime = this.monthValue[0];
|
||||||
this.queryParams.endTime = this.transformTime(this.monthValue[1])
|
this.queryParams.endTime = this.transformTime(this.monthValue[1]);
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('月范围不能为空')
|
this.$modal.msgError('月范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
default://本年最后一天
|
default: //本年最后一天
|
||||||
if (this.yearValue1 && this.yearValue2) {
|
if (this.yearValue1 && this.yearValue2) {
|
||||||
if (this.yearValue2 < this.yearValue1) {
|
if (this.yearValue2 < this.yearValue1) {
|
||||||
this.$modal.msgError('结束时间不能早于开始时间')
|
this.$modal.msgError('结束时间不能早于开始时间');
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.startTime = this.yearValue1
|
this.queryParams.startTime = this.yearValue1;
|
||||||
this.queryParams.endTime = this.transformYear(this.yearValue2)
|
this.queryParams.endTime = this.transformYear(this.yearValue2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError('年范围不能为空')
|
this.$modal.msgError('年范围不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.queryParams.startTime = this.queryParams.startTime + ''
|
this.queryParams.startTime = this.queryParams.startTime + '';
|
||||||
this.queryParams.endTime = this.queryParams.endTime + ''
|
this.queryParams.endTime = this.queryParams.endTime + '';
|
||||||
this.$emit('submit', this.queryParams)
|
if (val === 'search') {
|
||||||
|
this.$emit('submit', this.queryParams);
|
||||||
|
} else {
|
||||||
|
this.$emit('export', this.queryParams);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 重置
|
// 重置
|
||||||
resetBtn() {
|
resetBtn() {
|
||||||
this.queryParams.energyTypeId = null
|
this.queryParams.energyTypeId = null;
|
||||||
this.queryParams.objId = null
|
this.energyType = 0;
|
||||||
this.objArr = []
|
this.queryParams.objId = null;
|
||||||
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时
|
this.objId = null;
|
||||||
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000]
|
this.objType = 1;
|
||||||
|
this.objArr = [];
|
||||||
|
this.queryParams.timeDim = this.getDictDatas(
|
||||||
|
this.DICT_TYPE.TIME_DIM
|
||||||
|
)[0].value; // 默认时
|
||||||
|
this.timeValue = [
|
||||||
|
moment().startOf('day'),
|
||||||
|
moment().endOf('day') - 59 * 61 * 1000,
|
||||||
|
];
|
||||||
},
|
},
|
||||||
transformTime(timeStamp) {// 本月最后一天
|
transformTime(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本月最后一天
|
||||||
let month = moment(timeStamp).format('MM')
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
let month = moment(timeStamp).format('MM');
|
||||||
let value = new Date(newData).getTime()
|
let newData =
|
||||||
return value
|
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
let value = new Date(newData).getTime();
|
||||||
|
return value;
|
||||||
},
|
},
|
||||||
transformYear(timeStamp) {// 本年最后一天
|
transformYear(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本年最后一天
|
||||||
let newData = year+'-12-31 23:59:59'
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let value = new Date(newData).getTime()
|
let newData = year + '-12-31 23:59:59';
|
||||||
return value
|
let value = new Date(newData).getTime();
|
||||||
|
return value;
|
||||||
},
|
},
|
||||||
switchMode() {// 展开和收起切换
|
switchMode() {
|
||||||
this.isExpand = !this.isExpand
|
// 展开和收起切换
|
||||||
const element = this.$refs.searchBarRef
|
this.isExpand = !this.isExpand;
|
||||||
|
const element = this.$refs.searchBarRef;
|
||||||
if (this.isExpand) {
|
if (this.isExpand) {
|
||||||
element.classList.remove('divHeight')
|
element.classList.remove('divHeight');
|
||||||
} else {
|
} else {
|
||||||
element.classList.add('divHeight')
|
element.classList.add('divHeight');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
/* 级联选择器 */
|
|
||||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
/* 时间整点 */
|
/* 时间整点 */
|
||||||
.noneMinute .el-time-spinner__wrapper {
|
.noneMinute .el-time-spinner__wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -422,11 +530,11 @@ export default {
|
|||||||
.demo-form-inline {
|
.demo-form-inline {
|
||||||
.el-date-editor .el-range__icon {
|
.el-date-editor .el-range__icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.el-input__prefix .el-icon-date {
|
.el-input__prefix .el-icon-date {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -436,11 +544,15 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background-color: #0B58FF;
|
background-color: #0b58ff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
.el-form-item {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.searchBarBox .foldClass {
|
.searchBarBox .foldClass {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -448,7 +560,7 @@ export default {
|
|||||||
right: 0;
|
right: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color:#0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.searchBarBox .foldClass .iconfont {
|
.searchBarBox .foldClass .iconfont {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -461,7 +573,7 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #E8E8E8;
|
background: #e8e8e8;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,94 +1,113 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container trendAnalysisBox" id="trendAnalysisBox">
|
<div
|
||||||
|
class="app-container trendAnalysisBox"
|
||||||
|
id="trendAnalysisBox">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-area :isFold="isFold" @submit="getList"/>
|
<search-area
|
||||||
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
|
:isFold="isFold"
|
||||||
<el-tab-pane label="柱状图" name="bar">
|
@submit="getList"
|
||||||
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim"/>
|
@export="exportExl" />
|
||||||
</el-tab-pane>
|
<div v-show="chartData.length">
|
||||||
<el-tab-pane label="折线图" name="line">
|
<base-table
|
||||||
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
|
:table-props="tableProps"
|
||||||
</el-tab-pane>
|
:table-data="list"
|
||||||
</el-tabs>
|
class="trend-out-table" />
|
||||||
|
<line-chart
|
||||||
|
ref="analysisLineChart"
|
||||||
|
:chartData="chartData"
|
||||||
|
:timeDim="timeDim" />
|
||||||
|
</div>
|
||||||
<!-- 没有数据 -->
|
<!-- 没有数据 -->
|
||||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
<div
|
||||||
|
class="no-data-bg"
|
||||||
|
v-show="!chartData.length"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyTrend } from "@/api/analysis/energyAnalysis"
|
import { getEnergyTrend, exportTrend } from '@/api/analysis/energyAnalysis';
|
||||||
import SearchArea from "./components/searchArea"
|
import SearchArea from './components/searchArea';
|
||||||
import BarChart from "./components/barChart"
|
import LineChart from './components/lineChart';
|
||||||
import LineChart from "./components/lineChart"
|
|
||||||
// import moment from 'moment'
|
// import moment from 'moment'
|
||||||
export default {
|
export default {
|
||||||
name: 'TrendAnalysis',
|
name: 'TrendAnalysis',
|
||||||
components: { SearchArea, BarChart, LineChart },
|
components: { SearchArea, LineChart },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFold: false,
|
isFold: false,
|
||||||
activeName: 'bar',
|
|
||||||
chartData: [],
|
chartData: [],
|
||||||
timeDim: ''
|
timeDim: '',
|
||||||
}
|
tableProps: [],
|
||||||
|
list: [],
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
this.tableH = this.tableHeight(260);
|
||||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
|
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
|
||||||
})
|
});
|
||||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
|
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList(params) {
|
getList(params) {
|
||||||
this.timeDim = params.timeDim
|
this.timeDim = params.timeDim;
|
||||||
getEnergyTrend({ ...params }).then((res) => {
|
getEnergyTrend({ ...params }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.chartData = res.data
|
this.getTableList(res.data || []);
|
||||||
|
this.chartData = res.data || [];
|
||||||
} else {
|
} else {
|
||||||
this.chartData = []
|
this.chartData = [];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
switchChart() {
|
getTableList(arr) {
|
||||||
if (this.activeName === 'bar') {
|
this.tableProps = [];
|
||||||
this.$nextTick((res) => {
|
this.list = [];
|
||||||
this.$refs.analysisBarChart.getChart()
|
let tempX = [];
|
||||||
})
|
let listObj = { useNum: '消耗量' }; // 数据
|
||||||
} else {
|
for (let i = 0; i < arr.length; i++) {
|
||||||
this.$nextTick((res) => {
|
let obj = {};
|
||||||
this.$refs.analysisLineChart.getChart()
|
obj.prop = arr[i].time;
|
||||||
})
|
obj.label = arr[i].time;
|
||||||
|
obj.minWidth = 100;
|
||||||
|
tempX.push(obj);
|
||||||
|
listObj[arr[i].time] = arr[i].useNum || null;
|
||||||
}
|
}
|
||||||
}
|
this.tableProps = [{ prop: 'useNum', label: '时间' }].concat(tempX);
|
||||||
}
|
this.list.push(listObj);
|
||||||
}
|
},
|
||||||
|
// 导出excel
|
||||||
|
exportExl(params) {
|
||||||
|
exportTrend({ ...params }).then((res) => {
|
||||||
|
// let fileName = '';
|
||||||
|
// const contentDisposition = res.headers['content-disposition'];
|
||||||
|
// if (contentDisposition) {
|
||||||
|
// fileName = decodeURIComponent(
|
||||||
|
// contentDisposition.slice(
|
||||||
|
// contentDisposition.indexOf('filename=') + 9
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
const blob = new Blob([res.data]);
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsDataURL(blob);
|
||||||
|
reader.onload = (e) => {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.download = '走势分析';
|
||||||
|
a.href = e.target.result;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
this.$message.success('导出成功');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
.trendAnalysisBox {
|
.trendAnalysisBox {
|
||||||
.el-tabs__nav::after {
|
.trend-out-table {
|
||||||
content: "";
|
margin-bottom: 15px;
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 2px;
|
|
||||||
background-color: #e4e7ed;
|
|
||||||
/* z-index: 1; */
|
|
||||||
}
|
|
||||||
.el-tabs__nav-wrap::after {
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
.el-tabs__item {
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
.el-tabs__item:hover {
|
|
||||||
color: rgba(0, 0, 0, 0.85);
|
|
||||||
}
|
|
||||||
.el-tabs__item.is-active {
|
|
||||||
color: rgba(0, 0, 0, 0.85);
|
|
||||||
}
|
|
||||||
.el-tabs__item {
|
|
||||||
color: rgba(0, 0, 0, 0.45);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,27 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form :inline="true" class="demo-form-inline">
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline">
|
||||||
<span class="blue-block"></span>
|
<span class="blue-block"></span>
|
||||||
<el-form-item label="对象选择" required>
|
<el-form-item
|
||||||
<el-cascader
|
label="对象选择"
|
||||||
v-model="objArr"
|
required>
|
||||||
:options="objList"
|
<el-select
|
||||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
v-model="queryParams.objId"
|
||||||
popper-class="cascaderParent"
|
placeholder="请选择"
|
||||||
size="small"
|
style="width: 250px"
|
||||||
clearable></el-cascader>
|
filterable
|
||||||
|
size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in objList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
:clearable="false"></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间维度" required>
|
<el-form-item
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
|
label="时间维度"
|
||||||
|
required>
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 80px"
|
||||||
|
size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in timeType"
|
v-for="item in timeType"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
:clearable="false">
|
:clearable="false"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间" required>
|
<el-form-item
|
||||||
|
label="时间"
|
||||||
|
required>
|
||||||
<div v-show="queryParams.type === 1 || queryParams.type === 2">
|
<div v-show="queryParams.type === 1 || queryParams.type === 2">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="yearValue"
|
v-model="yearValue"
|
||||||
@ -30,8 +47,7 @@
|
|||||||
@change="selectTime"
|
@change="selectTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择年">
|
placeholder="选择年"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="queryParams.type === 3">
|
<div v-show="queryParams.type === 3">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -41,24 +57,34 @@
|
|||||||
@change="selectTime"
|
@change="selectTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="选择月">
|
placeholder="选择月"></el-date-picker>
|
||||||
</el-date-picker>
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="search">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span class="separateStyle"></span>
|
<span class="separateStyle"></span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="exportData"
|
||||||
|
plain>
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getTree } from '@/api/base/factory'
|
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||||
import moment from 'moment'
|
import moment from 'moment';
|
||||||
export default {
|
export default {
|
||||||
name: 'searchArea',
|
name: 'searchArea',
|
||||||
data() {
|
data() {
|
||||||
@ -67,119 +93,111 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
type: 1, // 1季度2月3日
|
type: 1, // 1季度2月3日
|
||||||
searchTime: null,
|
searchTime: null,
|
||||||
objId: null
|
objId: null,
|
||||||
|
objType: 1,
|
||||||
},
|
},
|
||||||
timeType: [
|
timeType: [
|
||||||
{id: 1, name: '季度'},
|
{ id: 1, name: '季度' },
|
||||||
{id: 2, name: '月'},
|
{ id: 2, name: '月' },
|
||||||
{id: 3, name: '日'}
|
{ id: 3, name: '日' },
|
||||||
],
|
],
|
||||||
yearValue: '',
|
yearValue: '',
|
||||||
yearMonth: '',
|
yearMonth: '',
|
||||||
objArr: [],
|
|
||||||
objList: [],
|
objList: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
return date.getTime() > Date.now()
|
return date.getTime() > Date.now();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getObjTree()
|
this.getObjTree();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getObjTree() {
|
getObjTree() {
|
||||||
getTree().then(res => {
|
getTree().then((res) => {
|
||||||
this.objList = res.data || []
|
this.objList = res.data || [];
|
||||||
})
|
if (this.objList.length > 0) {
|
||||||
|
this.queryParams.objId = this.objList[0].id;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
selectTime() {
|
selectTime() {
|
||||||
if (this.queryParams.type === 3) {
|
if (this.queryParams.type === 3) {
|
||||||
this.queryParams.searchTime = this.yearMonth
|
this.queryParams.searchTime = this.yearMonth;
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.searchTime = this.yearValue
|
this.queryParams.searchTime = this.yearValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查询
|
// 查询
|
||||||
search() {
|
search() {
|
||||||
if (this.objArr.length === 0) {
|
if (!this.queryParams.objId) {
|
||||||
this.$modal.msgError('请选择对象')
|
this.$modal.msgError('请选择对象');
|
||||||
return false
|
return false;
|
||||||
} else {
|
|
||||||
this.queryParams.objId = this.objArr[this.objArr.length-1]
|
|
||||||
}
|
}
|
||||||
if (!this.queryParams.type) {
|
if (!this.queryParams.type) {
|
||||||
this.$modal.msgError('请选择时间维度')
|
this.$modal.msgError('请选择时间维度');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.queryParams.searchTime) {
|
if (!this.queryParams.searchTime) {
|
||||||
this.$modal.msgError('请选择时间')
|
this.$modal.msgError('请选择时间');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.queryParams.type === 3) {
|
if (this.queryParams.type === 3) {
|
||||||
this.queryParams.searchTime = this.transformTime(this.yearMonth) + ''
|
this.queryParams.searchTime = this.transformTime(this.yearMonth) + '';
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.searchTime = this.transformYear(this.yearValue) + ''
|
this.queryParams.searchTime = this.transformYear(this.yearValue) + '';
|
||||||
}
|
}
|
||||||
this.$emit('submit', this.queryParams)
|
this.$emit('submit', this.queryParams);
|
||||||
},
|
},
|
||||||
exportData() {
|
exportData() {
|
||||||
let name
|
let name;
|
||||||
if (this.queryParams.objId) {
|
if (this.queryParams.objId) {
|
||||||
name = this.getObjName(this.objList, this.queryParams.objId)
|
name = this.getObjName(this.objList, this.queryParams.objId);
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgWarning("对象不能为空")
|
this.$modal.msgWarning('对象不能为空');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
this.$emit('exportD', {name: name})
|
this.$emit('exportD', { name: name });
|
||||||
},
|
},
|
||||||
// 递归取对象name
|
// 递归取对象name
|
||||||
getObjName(list, id) {
|
getObjName(list, id) {
|
||||||
let _this = this
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
let a = list[i]
|
let a = list[i];
|
||||||
if (a.id === id) {
|
if (a.id === id) {
|
||||||
return a.name
|
return a.name;
|
||||||
} else {
|
|
||||||
if (a.children && a.children.length > 0) {
|
|
||||||
let res = _this.getObjName(a.children, id)
|
|
||||||
if (res) {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
transformTime(timeStamp) {// 本月最后一天
|
transformTime(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本月最后一天
|
||||||
let month = moment(timeStamp).format('MM')
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
let month = moment(timeStamp).format('MM');
|
||||||
let value = new Date(newData).getTime()
|
let newData =
|
||||||
return value
|
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||||
|
let value = new Date(newData).getTime();
|
||||||
|
return value;
|
||||||
},
|
},
|
||||||
transformYear(timeStamp) {// 本年最后一天
|
transformYear(timeStamp) {
|
||||||
let year = moment(timeStamp).format('YYYY')
|
// 本年最后一天
|
||||||
let newData = year+'-12-31 23:59:59'
|
let year = moment(timeStamp).format('YYYY');
|
||||||
let value = new Date(newData).getTime()
|
let newData = year + '-12-31 23:59:59';
|
||||||
return value
|
let value = new Date(newData).getTime();
|
||||||
}
|
return value;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
/* 级联选择器 */
|
|
||||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.demo-form-inline {
|
.demo-form-inline {
|
||||||
.el-date-editor .el-range__icon {
|
.el-date-editor .el-range__icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
.el-input__prefix .el-icon-date {
|
.el-input__prefix .el-icon-date {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0B58FF;
|
color: #0b58ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -189,17 +207,21 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background-color: #0B58FF;
|
background-color: #0b58ff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
.el-form-item {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.separateStyle {
|
.separateStyle {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: #E8E8E8;
|
background: #e8e8e8;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,36 +1,50 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
|
<el-form
|
||||||
<el-form-item label="关联表名" prop="plcId">
|
ref="form"
|
||||||
<el-select v-model="form.plcId" placeholder="请选择" style="width: 100%;" filterable>
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
:model="form">
|
||||||
|
<el-form-item
|
||||||
|
label="关联表名"
|
||||||
|
prop="plcId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.plcId"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
filterable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in plcList"
|
v-for="item in plcList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.plcTableName"
|
:label="item.plcTableName"
|
||||||
:value="item.id">
|
:value="item.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="对象" prop="bindObjectId">
|
<el-form-item
|
||||||
|
label="对象"
|
||||||
|
prop="bindObjectId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
style='width: 100%;'
|
style="width: 100%"
|
||||||
v-model="objIds"
|
v-model="objIds"
|
||||||
:options="objList"
|
:options="objList"
|
||||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||||
popper-class="cascaderParent"
|
|
||||||
@change="selectObj"
|
@change="selectObj"
|
||||||
clearable></el-cascader>
|
clearable></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyPlcConnect, updateEnergyPlcConnect, createEnergyPlcConnect } from '@/api/base/energyPlcConnect'
|
import {
|
||||||
import { getEnergyPlcAll } from '@/api/base/energyPlc'
|
getEnergyPlcConnect,
|
||||||
|
updateEnergyPlcConnect,
|
||||||
|
createEnergyPlcConnect,
|
||||||
|
} from '@/api/base/energyPlcConnect';
|
||||||
|
import { getEnergyPlcAll } from '@/api/base/energyPlc';
|
||||||
export default {
|
export default {
|
||||||
name: 'EnergyPlcConnectAdd',
|
name: 'EnergyPlcConnectAdd',
|
||||||
props: {
|
props: {
|
||||||
objList: {
|
objList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -39,101 +53,103 @@ export default {
|
|||||||
id: '',
|
id: '',
|
||||||
plcId: '',
|
plcId: '',
|
||||||
bindObjectId: '',
|
bindObjectId: '',
|
||||||
bindObjectType: ''
|
bindObjectType: '',
|
||||||
},
|
},
|
||||||
objIds: [],// 回显数组
|
objIds: [], // 回显数组
|
||||||
plcList: [],
|
plcList: [],
|
||||||
isEdit: false, //是否是编辑
|
isEdit: false, //是否是编辑
|
||||||
rules: {
|
rules: {
|
||||||
plcId: [{ required: true, message: '关联表名不能为空', trigger: 'change' }],
|
plcId: [
|
||||||
bindObjectId: [{ required: true, message: '对象不能为空', trigger: 'change' }]
|
{ required: true, message: '关联表名不能为空', trigger: 'change' },
|
||||||
}
|
],
|
||||||
}
|
bindObjectId: [
|
||||||
|
{ required: true, message: '对象不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(id) {
|
init(id) {
|
||||||
getEnergyPlcAll().then((res) => {
|
getEnergyPlcAll().then((res) => {
|
||||||
this.plcList = res.data || []
|
this.plcList = res.data || [];
|
||||||
})
|
});
|
||||||
if (id) {
|
if (id) {
|
||||||
this.isEdit = true
|
this.isEdit = true;
|
||||||
this.form.id = id
|
this.form.id = id;
|
||||||
getEnergyPlcConnect( id ).then((res) => {
|
getEnergyPlcConnect(id).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.form = res.data
|
this.form = res.data;
|
||||||
this.objIds = this.changeDetSelect(this.form.bindObjectId, this.objList)
|
this.objIds = this.changeDetSelect(
|
||||||
|
this.form.bindObjectId,
|
||||||
|
this.objList
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
this.form.id = ''
|
this.form.id = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 递归处理分类回显问题
|
// 递归处理分类回显问题
|
||||||
changeDetSelect(key, treeData) {
|
changeDetSelect(key, treeData) {
|
||||||
let arr = [] // 递归时操作的数组
|
let arr = []; // 递归时操作的数组
|
||||||
let returnArr = [] // 存放结果的数组
|
let returnArr = []; // 存放结果的数组
|
||||||
let depth = 0 // 定义全局层级
|
let depth = 0; // 定义全局层级
|
||||||
// 定义递归函数
|
// 定义递归函数
|
||||||
function childrenEach(childrendData, depthN) {
|
function childrenEach(childrendData, depthN) {
|
||||||
for (var j = 0; j < childrendData.length; j++) {
|
for (var j = 0; j < childrendData.length; j++) {
|
||||||
depth = depthN
|
depth = depthN;
|
||||||
arr[depthN] = childrendData[j].id
|
arr[depthN] = childrendData[j].id;
|
||||||
if (childrendData[j].id == key) {
|
if (childrendData[j].id == key) {
|
||||||
returnArr = arr.slice(0, depthN + 1)
|
returnArr = arr.slice(0, depthN + 1);
|
||||||
break
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (childrendData[j].children) {
|
if (childrendData[j].children) {
|
||||||
depth++
|
depth++;
|
||||||
childrenEach(childrendData[j].children, depth)
|
childrenEach(childrendData[j].children, depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnArr
|
return returnArr;
|
||||||
}
|
}
|
||||||
return childrenEach(treeData, depth)
|
return childrenEach(treeData, depth);
|
||||||
},
|
},
|
||||||
selectObj(val) {
|
selectObj(val) {
|
||||||
this.form.bindObjectId = val[val.length-1]
|
this.form.bindObjectId = val[val.length - 1];
|
||||||
this.form.bindObjectType = val.length-1
|
this.form.bindObjectType = val.length - 1;
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
// 编辑
|
// 编辑
|
||||||
updateEnergyPlcConnect({...this.form}).then((res) => {
|
updateEnergyPlcConnect({ ...this.form }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
createEnergyPlcConnect({...this.form}).then((res) => {
|
createEnergyPlcConnect({ ...this.form }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
formClear() {
|
formClear() {
|
||||||
this.form.id = ''
|
this.form.id = '';
|
||||||
this.form.plcId = ''
|
this.form.plcId = '';
|
||||||
this.form.bindObjectId = ''
|
this.form.bindObjectId = '';
|
||||||
this.form.bindObjectType = ''
|
this.form.bindObjectType = '';
|
||||||
this.objIds = []
|
this.objIds = [];
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,67 +1,95 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
<search-bar
|
||||||
|
:formConfigs="formConfig"
|
||||||
|
ref="searchBarForm"
|
||||||
|
@headBtnClick="buttonClick" />
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
|
<base-table
|
||||||
|
:page="queryParams.pageNo"
|
||||||
|
:limit="queryParams.pageSize"
|
||||||
|
:table-props="tableProps"
|
||||||
|
:table-data="list"
|
||||||
:max-height="tableH">
|
:max-height="tableH">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn"
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="160"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
@clickBtn="handleClick" />
|
@clickBtn="handleClick" />
|
||||||
</base-table>
|
</base-table>
|
||||||
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
|
<pagination
|
||||||
|
:page.sync="queryParams.pageNo"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
:total="total"
|
||||||
@pagination="getList" />
|
@pagination="getList" />
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
|
<base-dialog
|
||||||
@confirm="handleConfirm" :before-close="handleCancel" width='30%'>
|
:dialogTitle="addOrEditTitle"
|
||||||
<energy-plc-connect-add ref="energyPlcConnect" :objList="objList" @successSubmit="successSubmit" />
|
:dialogVisible="centervisible"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
:before-close="handleCancel"
|
||||||
|
width="30%">
|
||||||
|
<energy-plc-connect-add
|
||||||
|
ref="energyPlcConnect"
|
||||||
|
:objList="objList"
|
||||||
|
@successSubmit="successSubmit" />
|
||||||
</base-dialog>
|
</base-dialog>
|
||||||
<!-- 参数绑定/查看 -->
|
<!-- 参数绑定/查看 -->
|
||||||
<energy-plc-param v-if="paramVisible" ref="plcParam" @closeDrawer="closeDrawer"
|
<energy-plc-param
|
||||||
|
v-if="paramVisible"
|
||||||
|
ref="plcParam"
|
||||||
|
@closeDrawer="closeDrawer"
|
||||||
:energyTypeList="energyTypeList"></energy-plc-param>
|
:energyTypeList="energyTypeList"></energy-plc-param>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyPlcConnectPage, deleteEnergyPlcConnect } from "@/api/base/energyPlcConnect";
|
import {
|
||||||
|
getEnergyPlcConnectPage,
|
||||||
|
deleteEnergyPlcConnect,
|
||||||
|
} from '@/api/base/energyPlcConnect';
|
||||||
// import { publicFormatter } from '@/utils/dict'
|
// import { publicFormatter } from '@/utils/dict'
|
||||||
import { getTree } from '@/api/base/factory'
|
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||||
import { getEnergyTypeListAll } from '@/api/base/energyType'
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||||
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd'
|
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd';
|
||||||
import EnergyPlcParam from './components/energyPlcParam'
|
import EnergyPlcParam from './components/energyPlcParam';
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'objName',
|
prop: 'objName',
|
||||||
label: '对象'
|
label: '对象',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'objCode',
|
prop: 'objCode',
|
||||||
label: '对象编码',
|
label: '对象编码',
|
||||||
showOverflowtooltip: true
|
showOverflowtooltip: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'plcTableName',
|
prop: 'plcTableName',
|
||||||
label: '关联表名'
|
label: '关联表名',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'plcTableCode',
|
prop: 'plcTableCode',
|
||||||
label: '关联表编码',
|
label: '关联表编码',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
showOverflowtooltip: true
|
showOverflowtooltip: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'cnName',
|
prop: 'cnName',
|
||||||
label: '标识名',
|
label: '标识名',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
showOverflowtooltip: true
|
showOverflowtooltip: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'varNum',
|
prop: 'varNum',
|
||||||
label: '绑定参数数量'
|
label: '绑定参数数量',
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
export default {
|
export default {
|
||||||
name: "EnergyPlcConnect",
|
name: 'EnergyPlcConnect',
|
||||||
components: { EnergyPlcConnectAdd, EnergyPlcParam },
|
components: { EnergyPlcConnectAdd, EnergyPlcParam },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -70,49 +98,51 @@ export default {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
label: '标识名',
|
label: '标识名',
|
||||||
placeholder: '标识名',
|
placeholder: '标识名',
|
||||||
param: 'cnName'
|
param: 'cnName',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '查询',
|
btnName: '查询',
|
||||||
name: 'search',
|
name: 'search',
|
||||||
color: 'primary'
|
color: 'primary',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separate'
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('base:energy-plc-connect:create') ? 'button' : '',
|
type: this.$auth.hasPermi('base:energy-plc-connect:create')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
btnName: '新增',
|
btnName: '新增',
|
||||||
name: 'add',
|
name: 'add',
|
||||||
color: 'success',
|
color: 'success',
|
||||||
plain: true
|
plain: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tableProps,
|
tableProps,
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
this.$auth.hasPermi('base:energy-plc-connect:bind')
|
this.$auth.hasPermi('base:energy-plc-connect:bind')
|
||||||
? {
|
? {
|
||||||
type: 'connect',
|
type: 'connect',
|
||||||
btnName: '绑定'
|
btnName: '绑定',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
{
|
{
|
||||||
type: 'detail',
|
type: 'detail',
|
||||||
btnName: '详情'
|
btnName: '详情',
|
||||||
},
|
},
|
||||||
this.$auth.hasPermi('base:energy-plc-connect:update')
|
this.$auth.hasPermi('base:energy-plc-connect:update')
|
||||||
? {
|
? {
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
btnName: '编辑'
|
btnName: '编辑',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
this.$auth.hasPermi('base:energy-plc-connect:delete')
|
this.$auth.hasPermi('base:energy-plc-connect:delete')
|
||||||
? {
|
? {
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
btnName: '删除'
|
btnName: '删除',
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined,
|
||||||
].filter((v) => v),
|
].filter((v) => v),
|
||||||
tableH: this.tableHeight(260),
|
tableH: this.tableHeight(260),
|
||||||
// 总条数
|
// 总条数
|
||||||
@ -120,117 +150,121 @@ export default {
|
|||||||
// 班次基础信息列表
|
// 班次基础信息列表
|
||||||
list: [],
|
list: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
addOrEditTitle: "",
|
addOrEditTitle: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
centervisible: false,
|
centervisible: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
cnName: null
|
cnName: null,
|
||||||
},
|
},
|
||||||
paramVisible: false,
|
paramVisible: false,
|
||||||
energyTypeList: [],
|
energyTypeList: [],
|
||||||
objList: []
|
objList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
this.tableH = this.tableHeight(260);
|
||||||
})
|
});
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 获取能源列表
|
// 获取能源列表
|
||||||
this.getEnergyTypeList()
|
this.getEnergyTypeList();
|
||||||
// 获取对象树形结构
|
// 获取对象树形结构
|
||||||
this.getObjTree()
|
this.getObjTree();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.queryParams.cnName = val.cnName
|
this.queryParams.cnName = val.cnName;
|
||||||
this.getList()
|
this.getList();
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.addOrEditTitle = '新增'
|
this.addOrEditTitle = '新增';
|
||||||
this.centervisible = true
|
this.centervisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyPlcConnect.init()
|
this.$refs.energyPlcConnect.init();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
getList() {
|
getList() {
|
||||||
getEnergyPlcConnectPage(this.queryParams).then(response => {
|
getEnergyPlcConnectPage(this.queryParams).then((response) => {
|
||||||
let arr = response.data.list || [];
|
let arr = response.data.list || [];
|
||||||
this.list = arr
|
this.list = arr;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleClick(val) {
|
handleClick(val) {
|
||||||
console.log(val)
|
console.log(val);
|
||||||
switch (val.type) {
|
switch (val.type) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.addOrEditTitle = '编辑'
|
this.addOrEditTitle = '编辑';
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyPlcConnect.init(val.data.id)
|
this.$refs.energyPlcConnect.init(val.data.id);
|
||||||
})
|
});
|
||||||
this.centervisible = true
|
this.centervisible = true;
|
||||||
break
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
this.handleDelete(val.data)
|
this.handleDelete(val.data);
|
||||||
break
|
break;
|
||||||
case 'detail':
|
case 'detail':
|
||||||
this.paramVisible = true
|
this.paramVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.plcParam.init(val.data, 'detail')
|
this.$refs.plcParam.init(val.data, 'detail');
|
||||||
})
|
});
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.paramVisible = true
|
this.paramVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.plcParam.init(val.data, 'connect')
|
this.$refs.plcParam.init(val.data, 'connect');
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$refs.energyPlcConnect.formClear()
|
this.$refs.energyPlcConnect.formClear();
|
||||||
this.centervisible = false
|
this.centervisible = false;
|
||||||
this.addOrEditTitle = ''
|
this.addOrEditTitle = '';
|
||||||
},
|
},
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
this.$refs.energyPlcConnect.submitForm()
|
this.$refs.energyPlcConnect.submitForm();
|
||||||
},
|
},
|
||||||
successSubmit() {
|
successSubmit() {
|
||||||
this.handleCancel()
|
this.handleCancel();
|
||||||
this.getList()
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$modal.confirm('是否确认删除对象为"' + row.objName + '"的数据项?').then(function () {
|
this.$modal
|
||||||
|
.confirm('是否确认删除对象为"' + row.objName + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
return deleteEnergyPlcConnect(row.id);
|
return deleteEnergyPlcConnect(row.id);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess('删除成功');
|
||||||
}).catch(() => { });
|
})
|
||||||
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
closeDrawer() {
|
closeDrawer() {
|
||||||
this.getList()
|
this.getList();
|
||||||
},
|
},
|
||||||
getEnergyTypeList() {
|
getEnergyTypeList() {
|
||||||
getEnergyTypeListAll().then((res) => {
|
getEnergyTypeListAll().then((res) => {
|
||||||
this.energyTypeList = res.data || []
|
this.energyTypeList = res.data || [];
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getObjTree() {
|
getObjTree() {
|
||||||
getTree().then(res => {
|
getTree().then((res) => {
|
||||||
this.objList = res.data || []
|
this.objList = res.data || [];
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,79 +1,161 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
:model="form">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="能源类型" prop="name">
|
<el-form-item
|
||||||
<el-input v-model="form.name"></el-input>
|
label="能源类型"
|
||||||
|
prop="name">
|
||||||
|
<el-select
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in getDictDatas(DICT_TYPE.ENERGY_TYPE)"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="类型编码" prop="code">
|
<el-form-item
|
||||||
<el-input v-model="form.code" disabled></el-input>
|
label="类型编码"
|
||||||
|
prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.code"
|
||||||
|
disabled></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="单位" prop="unit">
|
<el-form-item
|
||||||
<el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
|
label="单位"
|
||||||
<el-option v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)" :key="item.value" :label="item.label"
|
prop="unit">
|
||||||
:value="item.value">
|
<el-select
|
||||||
</el-option>
|
v-model="form.unit"
|
||||||
|
placeholder="请选择"
|
||||||
|
filterable
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in getDictDatas(DICT_TYPE.UNIT_DICT)"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="计价方式" prop="pricingMethod">
|
<el-form-item
|
||||||
<el-select v-model="form.pricingMethod" placeholder="请选择" style="width: 100%;">
|
label="计价方式"
|
||||||
<el-option label="时间段" :value='0'></el-option>
|
prop="pricingMethod">
|
||||||
<el-option label="使用量" :value='1'></el-option>
|
<el-select
|
||||||
<el-option label="固定价位" :value='2'></el-option>
|
v-model="form.pricingMethod"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
label="时间段"
|
||||||
|
:value="0"></el-option>
|
||||||
|
<el-option
|
||||||
|
label="使用量"
|
||||||
|
:value="1"></el-option>
|
||||||
|
<el-option
|
||||||
|
label="固定价位"
|
||||||
|
:value="2"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12" v-show="form.pricingMethod === 2">
|
<el-col
|
||||||
<el-form-item label="单价(元)" prop="pricingMethod">
|
:span="12"
|
||||||
<el-input-number v-model="form.singlePrice" :precision="2" :min="0" :max="999999999"
|
v-show="form.pricingMethod === 2">
|
||||||
style="width: 100%;"></el-input-number>
|
<el-form-item
|
||||||
|
label="单价(元)"
|
||||||
|
prop="pricingMethod">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.singlePrice"
|
||||||
|
:precision="2"
|
||||||
|
:min="0"
|
||||||
|
:max="999999999"
|
||||||
|
style="width: 100%"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-show="form.pricingMethod === 1">
|
<el-col
|
||||||
<el-form-item label="计量维度" prop="dim">
|
:span="12"
|
||||||
<el-select v-model="form.dim" placeholder="请选择" style="width: 100%;">
|
v-show="form.pricingMethod === 1">
|
||||||
<el-option label="月" :value='4'></el-option>
|
<el-form-item
|
||||||
<el-option label="年" :value='5'></el-option>
|
label="计量维度"
|
||||||
|
prop="dim">
|
||||||
|
<el-select
|
||||||
|
v-model="form.dim"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
label="月"
|
||||||
|
:value="4"></el-option>
|
||||||
|
<el-option
|
||||||
|
label="年"
|
||||||
|
:value="5"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" v-show="form.pricingMethod === 0">
|
<el-col
|
||||||
<el-form-item label="时间段" prop="pricingMethod">
|
:span="24"
|
||||||
<base-table :key='timeKye' :table-props="tableProps1" :table-data="tableData1"
|
v-show="form.pricingMethod === 0">
|
||||||
:add-button-show="addButtonShow" @emitButtonClick="emitButtonClick1" @emitFun="inputChange1">
|
<el-form-item
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
|
label="时间段"
|
||||||
|
prop="pricingMethod">
|
||||||
|
<base-table
|
||||||
|
:key="timeKye"
|
||||||
|
:table-props="tableProps1"
|
||||||
|
:table-data="tableData1"
|
||||||
|
:add-button-show="addButtonShow"
|
||||||
|
@emitButtonClick="emitButtonClick1"
|
||||||
|
@emitFun="inputChange1">
|
||||||
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
@clickBtn="handleClick1" />
|
@clickBtn="handleClick1" />
|
||||||
</base-table>
|
</base-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" v-show="form.pricingMethod === 1">
|
<el-col
|
||||||
<el-form-item label="使用量" prop="pricingMethod">
|
:span="24"
|
||||||
<base-table :key='usedKye' :table-props="tableProps2" :table-data="tableData2"
|
v-show="form.pricingMethod === 1">
|
||||||
:add-button-show="addButtonShow" @emitButtonClick="emitButtonClick2" @emitFun="inputChange2">
|
<el-form-item
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
|
label="使用量"
|
||||||
|
prop="pricingMethod">
|
||||||
|
<base-table
|
||||||
|
:key="usedKye"
|
||||||
|
:table-props="tableProps2"
|
||||||
|
:table-data="tableData2"
|
||||||
|
:add-button-show="addButtonShow"
|
||||||
|
@emitButtonClick="emitButtonClick2"
|
||||||
|
@emitFun="inputChange2">
|
||||||
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
@clickBtn="handleClick2" />
|
@clickBtn="handleClick2" />
|
||||||
</base-table>
|
</base-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="24">
|
||||||
<el-form-item label="是否推送" prop="push">
|
<el-form-item
|
||||||
<el-switch v-model="form.push"></el-switch>
|
label="描述"
|
||||||
</el-form-item>
|
prop="description">
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="描述" prop="description">
|
|
||||||
<el-input v-model="form.description"></el-input>
|
<el-input v-model="form.description"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -81,26 +163,31 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyType, updateEnergyType, createEnergyType, getEnergyTypeCode } from '@/api/base/energyType'
|
import {
|
||||||
import inputArea from './InputArea.vue'
|
getEnergyType,
|
||||||
import timePickerArea from './TimePickerArea.vue'
|
updateEnergyType,
|
||||||
|
createEnergyType,
|
||||||
|
getEnergyTypeCode,
|
||||||
|
} from '@/api/base/energyType';
|
||||||
|
import inputArea from './InputArea.vue';
|
||||||
|
import timePickerArea from './TimePickerArea.vue';
|
||||||
const tableProps1 = [
|
const tableProps1 = [
|
||||||
{
|
{
|
||||||
prop: 'startTime',
|
prop: 'startTime',
|
||||||
label: '开始时间',
|
label: '开始时间',
|
||||||
subcomponent: timePickerArea
|
subcomponent: timePickerArea,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'endTime',
|
prop: 'endTime',
|
||||||
label: '结束时间',
|
label: '结束时间',
|
||||||
subcomponent: timePickerArea
|
subcomponent: timePickerArea,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'price',
|
prop: 'price',
|
||||||
label: '单价(元)',
|
label: '单价(元)',
|
||||||
subcomponent: inputArea
|
subcomponent: inputArea,
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
const tableProps2 = [
|
const tableProps2 = [
|
||||||
{
|
{
|
||||||
prop: 'startUsed',
|
prop: 'startUsed',
|
||||||
@ -110,14 +197,14 @@ const tableProps2 = [
|
|||||||
{
|
{
|
||||||
prop: 'endUsed',
|
prop: 'endUsed',
|
||||||
label: '上限量',
|
label: '上限量',
|
||||||
subcomponent: inputArea
|
subcomponent: inputArea,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'price',
|
prop: 'price',
|
||||||
label: '单价(元)',
|
label: '单价(元)',
|
||||||
subcomponent: inputArea
|
subcomponent: inputArea,
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
export default {
|
export default {
|
||||||
name: 'energyTypeAdd',
|
name: 'energyTypeAdd',
|
||||||
data() {
|
data() {
|
||||||
@ -130,13 +217,16 @@ export default {
|
|||||||
singlePrice: 0,
|
singlePrice: 0,
|
||||||
pricingMethod: 2,
|
pricingMethod: 2,
|
||||||
dim: '',
|
dim: '',
|
||||||
push: false,
|
description: '',
|
||||||
description: ''
|
|
||||||
},
|
},
|
||||||
isEdit: false, //是否是编辑
|
isEdit: false, //是否是编辑
|
||||||
rules: {
|
rules: {
|
||||||
name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }],
|
name: [
|
||||||
pricingMethod: [{ required: true, message: '计价方式不能为空', trigger: 'change' }]
|
{ required: true, message: '能源类型不能为空', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
pricingMethod: [
|
||||||
|
{ required: true, message: '计价方式不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
timeKye: 0,
|
timeKye: 0,
|
||||||
usedKye: 0,
|
usedKye: 0,
|
||||||
@ -147,130 +237,129 @@ export default {
|
|||||||
tableBtn: [
|
tableBtn: [
|
||||||
{
|
{
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
name: '删除'
|
name: '删除',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
addButtonShow: '新增'
|
addButtonShow: '新增',
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(id) {
|
init(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
this.isEdit = true
|
this.isEdit = true;
|
||||||
this.form.id = id
|
this.form.id = id;
|
||||||
getEnergyType(id).then((res) => {
|
getEnergyType(id).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.form.name = res.data.name
|
this.form.name = res.data.name;
|
||||||
this.form.code = res.data.code
|
this.form.code = res.data.code;
|
||||||
this.form.unit = res.data.unit
|
this.form.unit = res.data.unit;
|
||||||
this.form.pricingMethod = res.data.pricingMethod
|
this.form.pricingMethod = res.data.pricingMethod;
|
||||||
this.form.push = res.data.push ? true : false
|
this.form.description = res.data.description;
|
||||||
this.form.description = res.data.description
|
|
||||||
switch (this.form.pricingMethod) {
|
switch (this.form.pricingMethod) {
|
||||||
case 0:
|
case 0:
|
||||||
this.tableData1 = res.data.segPriceList || []
|
this.tableData1 = res.data.segPriceList || [];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.tableData2 = res.data.usedPriceList || []
|
this.tableData2 = res.data.usedPriceList || [];
|
||||||
this.form.dim = res.data.dim
|
this.form.dim = res.data.dim;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.form.singlePrice = res.data.singlePrice || 0
|
this.form.singlePrice = res.data.singlePrice || 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
console.log(this.form)
|
console.log(this.form);
|
||||||
} else {
|
} else {
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
this.form.id = ''
|
this.form.id = '';
|
||||||
getEnergyTypeCode().then((res) => {
|
getEnergyTypeCode().then((res) => {
|
||||||
this.form.code = res.data
|
this.form.code = res.data;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 输入框失去焦点
|
// 输入框失去焦点
|
||||||
inputChange1(val) {
|
inputChange1(val) {
|
||||||
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop]
|
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop];
|
||||||
if ((this.tableData1.length > val._pageIndex) && val.prop === 'endTime') {
|
if (this.tableData1.length > val._pageIndex && val.prop === 'endTime') {
|
||||||
this.tableData1[val._pageIndex].startTime = val[val.prop]
|
this.tableData1[val._pageIndex].startTime = val[val.prop];
|
||||||
}
|
}
|
||||||
this.timeKye++
|
this.timeKye++;
|
||||||
},
|
},
|
||||||
inputChange2(val) {
|
inputChange2(val) {
|
||||||
// 上限值必须大于下限值
|
// 上限值必须大于下限值
|
||||||
if (!!val.endUsed && (val.endUsed <= val.startUsed)) {
|
if (!!val.endUsed && val.endUsed <= val.startUsed) {
|
||||||
this.$modal.msgError('上限值不能等于或者小于下限值')
|
this.$modal.msgError('上限值不能等于或者小于下限值');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop]
|
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop];
|
||||||
if ((this.tableData2.length > val._pageIndex) && val.prop === 'endUsed') {
|
if (this.tableData2.length > val._pageIndex && val.prop === 'endUsed') {
|
||||||
this.tableData2[val._pageIndex].startUsed = val[val.prop]
|
this.tableData2[val._pageIndex].startUsed = val[val.prop];
|
||||||
}
|
}
|
||||||
this.usedKye++
|
this.usedKye++;
|
||||||
},
|
},
|
||||||
// 增加
|
// 增加
|
||||||
emitButtonClick1() {
|
emitButtonClick1() {
|
||||||
let n = this.tableData1.length
|
let n = this.tableData1.length;
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime
|
obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime;
|
||||||
obj.endTime = ''
|
obj.endTime = '';
|
||||||
obj.price = 0
|
obj.price = 0;
|
||||||
this.tableData1.push(obj)
|
this.tableData1.push(obj);
|
||||||
},
|
},
|
||||||
emitButtonClick2() {
|
emitButtonClick2() {
|
||||||
let n = this.tableData2.length
|
let n = this.tableData2.length;
|
||||||
let obj = {}
|
let obj = {};
|
||||||
obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed
|
obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed;
|
||||||
obj.endUsed = 0
|
obj.endUsed = 0;
|
||||||
obj.price = 0
|
obj.price = 0;
|
||||||
this.tableData2.push(obj)
|
this.tableData2.push(obj);
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
handleClick1(val) {
|
handleClick1(val) {
|
||||||
this.tableData1.splice(val.data._pageIndex - 1, 1)
|
this.tableData1.splice(val.data._pageIndex - 1, 1);
|
||||||
this.timeKye++
|
this.timeKye++;
|
||||||
},
|
},
|
||||||
handleClick2(val) {
|
handleClick2(val) {
|
||||||
this.tableData2.splice(val.data._pageIndex - 1, 1)
|
this.tableData2.splice(val.data._pageIndex - 1, 1);
|
||||||
this.usedKye++
|
this.usedKye++;
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
switch (this.form.pricingMethod) {
|
switch (this.form.pricingMethod) {
|
||||||
case 0:// 时间段
|
case 0: // 时间段
|
||||||
if (this.tableData1.length === 0) {
|
if (this.tableData1.length === 0) {
|
||||||
this.$modal.msgError('时间段表格数据不能为空')
|
this.$modal.msgError('时间段表格数据不能为空');
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.tableData1.map(item => {
|
this.tableData1.map((item) => {
|
||||||
if (item.price <= 0) {
|
if (item.price <= 0) {
|
||||||
this.$modal.msgError('单价有误请检查,请检查')
|
this.$modal.msgError('单价有误请检查,请检查');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:// 使用量
|
case 1: // 使用量
|
||||||
if (this.tableData2.length === 0) {
|
if (this.tableData2.length === 0) {
|
||||||
this.$modal.msgError('使用量表格数据不能为空')
|
this.$modal.msgError('使用量表格数据不能为空');
|
||||||
return false
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.tableData1.map(item => {
|
this.tableData1.map((item) => {
|
||||||
if (item.price <= 0) {
|
if (item.price <= 0) {
|
||||||
this.$modal.msgError('单价有误请检查,请检查')
|
this.$modal.msgError('单价有误请检查,请检查');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:// 固定单价
|
default: // 固定单价
|
||||||
if (!this.form.singlePrice) {
|
if (!this.form.singlePrice) {
|
||||||
this.$modal.msgError('单价有误请检查,请检查')
|
this.$modal.msgError('单价有误请检查,请检查');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.form)
|
console.log(this.form);
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
// 编辑
|
// 编辑
|
||||||
updateEnergyType({
|
updateEnergyType({
|
||||||
@ -281,16 +370,18 @@ export default {
|
|||||||
pricingMethod: this.form.pricingMethod,
|
pricingMethod: this.form.pricingMethod,
|
||||||
description: this.form.description,
|
description: this.form.description,
|
||||||
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
|
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
|
||||||
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
singlePrice:
|
||||||
segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
|
this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
||||||
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
|
segPriceList:
|
||||||
push: this.form.push ? 1 : 0
|
this.form.pricingMethod === 0 ? this.tableData1 : [],
|
||||||
|
usedPriceList:
|
||||||
|
this.form.pricingMethod === 1 ? this.tableData2 : [],
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
createEnergyType({
|
createEnergyType({
|
||||||
code: this.form.code,
|
code: this.form.code,
|
||||||
@ -299,31 +390,33 @@ export default {
|
|||||||
pricingMethod: this.form.pricingMethod,
|
pricingMethod: this.form.pricingMethod,
|
||||||
description: this.form.description,
|
description: this.form.description,
|
||||||
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
|
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
|
||||||
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
singlePrice:
|
||||||
segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
|
this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
||||||
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
|
segPriceList:
|
||||||
push: this.form.push ? 1 : 0
|
this.form.pricingMethod === 0 ? this.tableData1 : [],
|
||||||
|
usedPriceList:
|
||||||
|
this.form.pricingMethod === 1 ? this.tableData2 : [],
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
formClear() {
|
formClear() {
|
||||||
this.$refs.form.resetFields()
|
this.$refs.form.resetFields();
|
||||||
this.form.singlePrice = 0
|
this.form.singlePrice = 0;
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
this.timeKye = 0
|
this.timeKye = 0;
|
||||||
this.usedKye = 0
|
this.usedKye = 0;
|
||||||
this.tableData1 = []
|
this.tableData1 = [];
|
||||||
this.tableData2 = []
|
this.tableData2 = [];
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,224 +1,191 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-bar
|
<search-bar
|
||||||
:formConfigs="formConfig"
|
:formConfigs="formConfig"
|
||||||
ref="searchBarForm"
|
ref="searchBarForm"
|
||||||
@headBtnClick="buttonClick"
|
:removeBlue="true"
|
||||||
/>
|
@headBtnClick="buttonClick" />
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table
|
<base-table
|
||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
:max-height="tableH"
|
:max-height="tableH">
|
||||||
>
|
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
:width="80"
|
:width="80"
|
||||||
label="操作"
|
label="操作"
|
||||||
:method-list="tableBtn"
|
:method-list="tableBtn"
|
||||||
@clickBtn="handleClick"
|
@clickBtn="handleClick" />
|
||||||
/>
|
|
||||||
</base-table>
|
</base-table>
|
||||||
<pagination
|
|
||||||
:page.sync="queryParams.pageNo"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
:total="total"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<base-dialog
|
<base-dialog
|
||||||
:dialogTitle="addOrEditTitle"
|
:dialogTitle="addOrEditTitle"
|
||||||
:dialogVisible="centervisible"
|
:dialogVisible="centervisible"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleConfirm"
|
||||||
:before-close="handleCancel"
|
:before-close="handleCancel">
|
||||||
>
|
<energy-type-add
|
||||||
<energy-type-add ref="energyType" @successSubmit="successSubmit" />
|
ref="energyType"
|
||||||
|
@successSubmit="successSubmit" />
|
||||||
</base-dialog>
|
</base-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyTypePage, deleteEnergyType } from "@/api/base/energyType";
|
import { getEnergyTypePage, deleteEnergyType } from '@/api/base/energyType';
|
||||||
import { publicFormatter } from '@/utils/dict'
|
import { publicFormatter } from '@/utils/dict';
|
||||||
import InnerTable from './components/InnerTable'
|
import InnerTable from './components/InnerTable';
|
||||||
import EnergyTypeAdd from './components/energyTypeAdd'
|
import EnergyTypeAdd from './components/energyTypeAdd';
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'code',
|
prop: 'code',
|
||||||
label: '类型编码',
|
label: '类型编码',
|
||||||
showOverflowtooltip: true,
|
showOverflowtooltip: true,
|
||||||
minWidth: 150
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '能源类型'
|
label: '能源类型',
|
||||||
|
filter: publicFormatter('energy_type'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'unit',
|
prop: 'unit',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
filter: publicFormatter('energy_unit')
|
filter: publicFormatter('unit_dict'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'pricingMethod',
|
prop: 'pricingMethod',
|
||||||
label: '计价方式'
|
label: '计价方式',
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'push',
|
|
||||||
label: '是否推送',
|
|
||||||
filter: publicFormatter('push')
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'price',
|
prop: 'price',
|
||||||
label: '价格(元)',
|
label: '价格(元)',
|
||||||
subcomponent: InnerTable
|
subcomponent: InnerTable,
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
export default {
|
export default {
|
||||||
name: "EnergyType",
|
name: 'EnergyType',
|
||||||
components: { EnergyTypeAdd },
|
components: { EnergyTypeAdd },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
formConfig: [
|
formConfig: [
|
||||||
{
|
|
||||||
type: 'input',
|
|
||||||
label: '能源类型',
|
|
||||||
placeholder: '能源类型',
|
|
||||||
param: 'name'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
btnName: '查询',
|
|
||||||
name: 'search',
|
|
||||||
color: 'primary'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: this.$auth.hasPermi('base:energy-type:create') ? 'separate' : '',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
|
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
|
||||||
btnName: '新增',
|
btnName: '新增',
|
||||||
name: 'add',
|
name: 'add',
|
||||||
color: 'success',
|
color: 'success',
|
||||||
plain: true
|
plain: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tableProps,
|
tableProps,
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
this.$auth.hasPermi('base:energy-type:update')
|
this.$auth.hasPermi('base:energy-type:update')
|
||||||
? {
|
? {
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
btnName: '编辑'
|
btnName: '编辑',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
this.$auth.hasPermi('base:energy-type:delete')
|
this.$auth.hasPermi('base:energy-type:delete')
|
||||||
? {
|
? {
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
btnName: '删除'
|
btnName: '删除',
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined,
|
||||||
].filter((v) => v),
|
].filter((v) => v),
|
||||||
tableH: this.tableHeight(260),
|
tableH: this.tableHeight(220),
|
||||||
pricingMethodList: [
|
pricingMethodList: [
|
||||||
{value: 0,label: '分时间段计价'},
|
{ value: 0, label: '分时间段计价' },
|
||||||
{value: 1,label: '分使用量计价'},
|
{ value: 1, label: '分使用量计价' },
|
||||||
{value: 2,label: '单一计价'}
|
{ value: 2, label: '单一计价' },
|
||||||
],
|
],
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 班次基础信息列表
|
// 班次基础信息列表
|
||||||
list: [],
|
list: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
addOrEditTitle: "",
|
addOrEditTitle: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
centervisible: false,
|
centervisible: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 100,
|
||||||
name: null,
|
},
|
||||||
code: null
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
this.tableH = this.tableHeight(220);
|
||||||
})
|
});
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buttonClick(val) {
|
buttonClick() {
|
||||||
switch (val.btnName) {
|
this.addOrEditTitle = '新增';
|
||||||
case 'search':
|
this.centervisible = true;
|
||||||
this.queryParams.pageNo = 1;
|
|
||||||
this.queryParams.name = val.name
|
|
||||||
this.queryParams.code = val.code
|
|
||||||
this.getList()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
this.addOrEditTitle = '新增'
|
|
||||||
this.centervisible = true
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyType.init()
|
this.$refs.energyType.init();
|
||||||
})
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
getList() {
|
getList() {
|
||||||
getEnergyTypePage(this.queryParams).then(response => {
|
getEnergyTypePage(this.queryParams).then((response) => {
|
||||||
let arr = response.data.list || [];
|
let arr = response.data.list || [];
|
||||||
arr&&arr.map(item => {
|
arr &&
|
||||||
this.pricingMethodList.map(i => {
|
arr.map((item) => {
|
||||||
|
this.pricingMethodList.map((i) => {
|
||||||
if (item.pricingMethod === i.value) {
|
if (item.pricingMethod === i.value) {
|
||||||
item.pricingMethod = i.label
|
item.pricingMethod = i.label;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
this.list = arr
|
this.list = arr;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleClick(val) {
|
handleClick(val) {
|
||||||
switch (val.type) {
|
switch (val.type) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.addOrEditTitle = '编辑'
|
this.addOrEditTitle = '编辑';
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyType.init(val.data.id)
|
this.$refs.energyType.init(val.data.id);
|
||||||
})
|
});
|
||||||
this.centervisible = true
|
this.centervisible = true;
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.handleDelete(val.data)
|
this.handleDelete(val.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$refs.energyType.formClear()
|
this.$refs.energyType.formClear();
|
||||||
this.centervisible = false
|
this.centervisible = false;
|
||||||
this.addOrEditTitle = ''
|
this.addOrEditTitle = '';
|
||||||
},
|
},
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
this.$refs.energyType.submitForm()
|
this.$refs.energyType.submitForm();
|
||||||
},
|
},
|
||||||
successSubmit() {
|
successSubmit() {
|
||||||
this.handleCancel()
|
this.handleCancel();
|
||||||
this.getList()
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
|
this.$modal
|
||||||
|
.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
return deleteEnergyType(row.id);
|
return deleteEnergyType(row.id);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess('删除成功');
|
||||||
}).catch(() => {});
|
})
|
||||||
}
|
.catch(() => {});
|
||||||
}
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,22 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="110px"
|
||||||
|
:model="form">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="抄表方式" prop="method">
|
<el-form-item
|
||||||
<el-select v-model="form.method" placeholder="请选择" style="width: 100%;" @change="changeMethod">
|
label="抄表方式"
|
||||||
|
prop="method">
|
||||||
|
<el-select
|
||||||
|
v-model="form.method"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="changeMethod">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(DICT_TYPE.METHOD)"
|
v-for="item in getDictDatas(DICT_TYPE.METHOD)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if='form.method == 1'>
|
<el-col
|
||||||
<el-form-item label="监控对象" prop="objectId">
|
:span="12"
|
||||||
|
v-if="form.method == 1">
|
||||||
|
<el-form-item
|
||||||
|
label="监控对象"
|
||||||
|
prop="objectId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
style='width: 100%;'
|
style="width: 100%"
|
||||||
v-model="objIds"
|
v-model="objIds"
|
||||||
:options="objList"
|
:options="objList"
|
||||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||||
@ -25,73 +38,123 @@
|
|||||||
clearable></el-cascader>
|
clearable></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if='form.method == 2'>
|
<el-col
|
||||||
<el-form-item label="水/气表名" prop="tableName">
|
:span="12"
|
||||||
<el-select v-model="form.tableName" placeholder="请选择" style="width: 100%;">
|
v-if="form.method == 2">
|
||||||
|
<el-form-item
|
||||||
|
label="能源表名"
|
||||||
|
prop="tableName">
|
||||||
|
<el-select
|
||||||
|
v-model="form.tableName"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
|
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="监控能源类型" prop="energyTypeId">
|
<el-form-item
|
||||||
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable @change="toggleType">
|
label="监控能源类型"
|
||||||
|
prop="energyTypeId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.energyTypeId"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
filterable
|
||||||
|
@change="toggleType">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in this.energyTypeList"
|
v-for="item in this.energyTypeList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id">
|
:value="item.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if='form.method == 1'>
|
<el-col
|
||||||
<el-form-item label="监控模式" prop="type">
|
:span="12"
|
||||||
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;" @change="typeChange">
|
v-if="form.method == 1">
|
||||||
<el-option label="合并" :value= "1" ></el-option>
|
<el-form-item
|
||||||
<el-option label="详细" :value= "2" ></el-option>
|
label="监控模式"
|
||||||
|
prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="form.type"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="typeChange">
|
||||||
|
<el-option
|
||||||
|
label="合并"
|
||||||
|
:value="1"></el-option>
|
||||||
|
<el-option
|
||||||
|
label="详细"
|
||||||
|
:value="2"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if='form.method == 1'>
|
<el-col
|
||||||
<el-form-item label="监控详细参数" prop="type" v-if="form.type === 2">
|
:span="12"
|
||||||
<el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;" @change="selectDetail">
|
v-if="form.method == 1">
|
||||||
|
<el-form-item
|
||||||
|
label="监控详细参数"
|
||||||
|
prop="type"
|
||||||
|
v-if="form.type === 2">
|
||||||
|
<el-select
|
||||||
|
v-model="form.plcParamId"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="selectDetail">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in detailList"
|
v-for="item in detailList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id">
|
:value="item.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="指标类型" prop="limitType">
|
<el-form-item
|
||||||
<el-select v-model="form.limitType" placeholder="请选择" style="width: 100%;" :disabled='form.method == 2'>
|
label="指标类型"
|
||||||
|
prop="limitType">
|
||||||
|
<el-select
|
||||||
|
v-model="form.limitType"
|
||||||
|
placeholder="请选择"
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="form.method == 2">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
|
v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="消耗量阈值">
|
<el-form-item label="消耗量阈值">
|
||||||
<el-input-number v-model="form.minValue" placeholder="最小值" :max="9999999" style="width: 50%;"></el-input-number>
|
<el-input-number
|
||||||
<el-input-number v-model="form.maxValue" placeholder="最大值" :max="9999999" style="width: 50%;"></el-input-number>
|
v-model="form.minValue"
|
||||||
|
placeholder="最小值"
|
||||||
|
:max="9999999"
|
||||||
|
style="width: 50%"></el-input-number>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.maxValue"
|
||||||
|
placeholder="最大值"
|
||||||
|
:max="9999999"
|
||||||
|
style="width: 50%"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyLimit, updateEnergyLimit, createEnergyLimit, getEnergyParamList } from '@/api/monitoring/energyLimit'
|
import {
|
||||||
|
getEnergyLimit,
|
||||||
|
updateEnergyLimit,
|
||||||
|
createEnergyLimit,
|
||||||
|
getEnergyParamList,
|
||||||
|
} from '@/api/monitoring/energyLimit';
|
||||||
export default {
|
export default {
|
||||||
name: 'energyLimitAdd',
|
name: 'energyLimitAdd',
|
||||||
props: {
|
props: {
|
||||||
@ -99,13 +162,13 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => {
|
default: () => {
|
||||||
return []
|
return [];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
objList: {
|
objList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => [],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -119,161 +182,176 @@ export default {
|
|||||||
plcParamId: '',
|
plcParamId: '',
|
||||||
limitType: '',
|
limitType: '',
|
||||||
minValue: 0,
|
minValue: 0,
|
||||||
maxValue: 0
|
maxValue: 0,
|
||||||
},
|
},
|
||||||
objIds: [],// 回显数组
|
objIds: [], // 回显数组
|
||||||
isEdit: false, //是否是编辑
|
isEdit: false, //是否是编辑
|
||||||
rules: {
|
rules: {
|
||||||
method: [{ required: true, message: '抄表方式不能为空', trigger: 'change' }],
|
method: [
|
||||||
objectId: [{ required: true, message: '监控对象不能为空', trigger: 'change' }],
|
{ required: true, message: '抄表方式不能为空', trigger: 'change' },
|
||||||
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
|
],
|
||||||
type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }],
|
objectId: [
|
||||||
limitType: [{ required: true, message: '指标类型不能为空', trigger: 'change' }]
|
{ required: true, message: '监控对象不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
|
energyTypeId: [
|
||||||
|
{ required: true, message: '能源类型不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
|
type: [
|
||||||
|
{ required: true, message: '监控模式不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
|
limitType: [
|
||||||
|
{ required: true, message: '指标类型不能为空', trigger: 'change' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
detailList: []
|
detailList: [],
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(id) {
|
init(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
this.isEdit = true
|
this.isEdit = true;
|
||||||
this.form.id = id
|
this.form.id = id;
|
||||||
getEnergyLimit( id ).then((res) => {
|
getEnergyLimit(id).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.form = res.data
|
this.form = res.data;
|
||||||
this.form.plcParamId = res.data.plcParamId || ''
|
this.form.plcParamId = res.data.plcParamId || '';
|
||||||
this.form.method = this.form.method ? this.form.method + '' : ''
|
this.form.method = this.form.method ? this.form.method + '' : '';
|
||||||
this.form.limitType = this.form.limitType ? this.form.limitType + '' : ''
|
this.form.limitType = this.form.limitType
|
||||||
this.objIds = this.changeDetSelect(this.form.objectId, this.objList)
|
? this.form.limitType + ''
|
||||||
|
: '';
|
||||||
|
this.objIds = this.changeDetSelect(
|
||||||
|
this.form.objectId,
|
||||||
|
this.objList
|
||||||
|
);
|
||||||
if (this.form.type === 2) {
|
if (this.form.type === 2) {
|
||||||
this.getDetailList()
|
this.getDetailList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
this.form.id = ''
|
this.form.id = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 切换方式
|
// 切换方式
|
||||||
changeMethod() {
|
changeMethod() {
|
||||||
if(this.form.method === '2'){
|
if (this.form.method === '2') {
|
||||||
this.form.limitType = "2"
|
this.form.limitType = '2';
|
||||||
}else{
|
} else {
|
||||||
this.form.limitType = ''
|
this.form.limitType = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 监控详细参数
|
// 监控详细参数
|
||||||
getDetailList() {
|
getDetailList() {
|
||||||
getEnergyParamList({
|
getEnergyParamList({
|
||||||
objId: this.form.objectId,
|
objId: this.form.objectId,
|
||||||
energyTypeId: this.form.energyTypeId
|
energyTypeId: this.form.energyTypeId,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.detailList = res.data
|
this.detailList = res.data;
|
||||||
} else {
|
} else {
|
||||||
this.detailList = []
|
this.detailList = [];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
typeChange(val) {
|
typeChange(val) {
|
||||||
console.log(this.form)
|
console.log(this.form);
|
||||||
this.form.plcParamId = ''
|
this.form.plcParamId = '';
|
||||||
if (val === 2) {
|
if (val === 2) {
|
||||||
if (this.form.objectId && this.form.energyTypeId) {
|
if (this.form.objectId && this.form.energyTypeId) {
|
||||||
this.getDetailList()
|
this.getDetailList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleType() {
|
toggleType() {
|
||||||
if (this.form.energyTypeId && this.form.type) {
|
if (this.form.energyTypeId && this.form.type) {
|
||||||
this.getDetailList()
|
this.getDetailList();
|
||||||
this.form.plcParamId = ''
|
this.form.plcParamId = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 递归处理分类回显问题
|
// 递归处理分类回显问题
|
||||||
changeDetSelect(key, treeData) {
|
changeDetSelect(key, treeData) {
|
||||||
let arr = [] // 递归时操作的数组
|
let arr = []; // 递归时操作的数组
|
||||||
let returnArr = [] // 存放结果的数组
|
let returnArr = []; // 存放结果的数组
|
||||||
let depth = 0 // 定义全局层级
|
let depth = 0; // 定义全局层级
|
||||||
// 定义递归函数
|
// 定义递归函数
|
||||||
function childrenEach(childrendData, depthN) {
|
function childrenEach(childrendData, depthN) {
|
||||||
for (var j = 0; j < childrendData.length; j++) {
|
for (var j = 0; j < childrendData.length; j++) {
|
||||||
depth = depthN
|
depth = depthN;
|
||||||
arr[depthN] = childrendData[j].id
|
arr[depthN] = childrendData[j].id;
|
||||||
if (childrendData[j].id == key) {
|
if (childrendData[j].id == key) {
|
||||||
returnArr = arr.slice(0, depthN + 1)
|
returnArr = arr.slice(0, depthN + 1);
|
||||||
break
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (childrendData[j].children) {
|
if (childrendData[j].children) {
|
||||||
depth++
|
depth++;
|
||||||
childrenEach(childrendData[j].children, depth)
|
childrenEach(childrendData[j].children, depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnArr
|
return returnArr;
|
||||||
}
|
}
|
||||||
return childrenEach(treeData, depth)
|
return childrenEach(treeData, depth);
|
||||||
},
|
},
|
||||||
selectObj(val) {
|
selectObj(val) {
|
||||||
this.form.objectId = val[val.length-1]
|
this.form.objectId = val[val.length - 1];
|
||||||
this.form.objectType = val.length-1
|
this.form.objectType = val.length - 1;
|
||||||
if (this.form.energyTypeId && this.form.type) {
|
if (this.form.energyTypeId && this.form.type) {
|
||||||
this.getDetailList()
|
this.getDetailList();
|
||||||
this.form.plcParamId = ''
|
this.form.plcParamId = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectDetail() {
|
selectDetail() {
|
||||||
this.$forceUpdate()
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.type === 2 && !this.form.plcParamId) {
|
if (this.form.type === 2 && !this.form.plcParamId) {
|
||||||
this.$modal.msgError("监控模式为详细时,详细参数为必填");
|
this.$modal.msgError('监控模式为详细时,详细参数为必填');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (this.form.minValue && this.form.maxValue) {
|
if (this.form.minValue && this.form.maxValue) {
|
||||||
if (this.form.minValue > this.form.maxValue) {
|
if (this.form.minValue > this.form.maxValue) {
|
||||||
this.$modal.msgError("消耗量阈值,最小值不能大于最大值");
|
this.$modal.msgError('消耗量阈值,最小值不能大于最大值');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.form.minValue = this.form.minValue || 0
|
this.form.minValue = this.form.minValue || 0;
|
||||||
this.form.maxValue = this.form.maxValue || 0
|
this.form.maxValue = this.form.maxValue || 0;
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
// 编辑
|
// 编辑
|
||||||
updateEnergyLimit({...this.form}).then((res) => {
|
updateEnergyLimit({ ...this.form }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
createEnergyLimit({...this.form}).then((res) => {
|
createEnergyLimit({ ...this.form }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess('操作成功');
|
||||||
this.$emit('successSubmit')
|
this.$emit('successSubmit');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
formClear() {
|
formClear() {
|
||||||
this.$refs.form.resetFields()
|
this.$refs.form.resetFields();
|
||||||
this.form.type = ''
|
this.form.type = '';
|
||||||
this.form.plcParamId = ''
|
this.form.plcParamId = '';
|
||||||
this.form.minValue = null
|
this.form.minValue = null;
|
||||||
this.form.maxValue = null
|
this.form.maxValue = null;
|
||||||
this.objIds = ''
|
this.objIds = '';
|
||||||
this.detailList = []
|
this.detailList = [];
|
||||||
this.isEdit = false
|
this.isEdit = false;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
||||||
|
@ -1,35 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-bar
|
<search-bar
|
||||||
:formConfigs="formConfig"
|
:formConfigs="formConfig"
|
||||||
ref="searchBarForm"
|
ref="searchBarForm"
|
||||||
@headBtnClick="buttonClick"
|
@headBtnClick="buttonClick" />
|
||||||
/>
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table
|
<base-table
|
||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
:max-height="tableH"
|
:max-height="tableH">
|
||||||
>
|
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
:width="80"
|
:width="80"
|
||||||
label="操作"
|
label="操作"
|
||||||
:method-list="tableBtn"
|
:method-list="tableBtn"
|
||||||
@clickBtn="handleClick"
|
@clickBtn="handleClick" />
|
||||||
/>
|
|
||||||
</base-table>
|
</base-table>
|
||||||
<pagination
|
<pagination
|
||||||
:page.sync="queryParams.pageNo"
|
:page.sync="queryParams.pageNo"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList" />
|
||||||
/>
|
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<base-dialog
|
<base-dialog
|
||||||
:dialogTitle="addOrEditTitle"
|
:dialogTitle="addOrEditTitle"
|
||||||
@ -37,63 +32,70 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleConfirm"
|
||||||
:before-close="handleCancel"
|
:before-close="handleCancel"
|
||||||
width='50%'
|
width="50%">
|
||||||
>
|
<energy-limit-add
|
||||||
<energy-limit-add ref="energyLimit" @successSubmit="successSubmit" :energyTypeList="energyTypeList" :objList="objList"/>
|
ref="energyLimit"
|
||||||
|
@successSubmit="successSubmit"
|
||||||
|
:energyTypeList="energyTypeList"
|
||||||
|
:objList="objList" />
|
||||||
</base-dialog>
|
</base-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getEnergyLimitPage, deleteEnergyLimit } from "@/api/monitoring/energyLimit";
|
import {
|
||||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
getEnergyLimitPage,
|
||||||
import { getTree } from '@/api/base/factory'
|
deleteEnergyLimit,
|
||||||
import { publicFormatter } from '@/utils/dict'
|
} from '@/api/monitoring/energyLimit';
|
||||||
import EnergyLimitAdd from './components/energyLimitAdd'
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||||
|
import { getTree } from '@/api/base/factory';
|
||||||
|
import { publicFormatter } from '@/utils/dict';
|
||||||
|
import EnergyLimitAdd from './components/energyLimitAdd';
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'method',
|
prop: 'method',
|
||||||
label: '抄表方式',
|
label: '抄表方式',
|
||||||
filter: publicFormatter('method')
|
filter: publicFormatter('method'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'objName',
|
prop: 'objName',
|
||||||
label: '监控对象'
|
label: '监控对象',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'objCode',
|
prop: 'objCode',
|
||||||
label: '对象编码'
|
label: '对象编码',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'tableName',
|
prop: 'tableName',
|
||||||
label: '水/气表名',
|
label: '能源表名',
|
||||||
filter: publicFormatter('table_name')
|
filter: publicFormatter('table_name'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'energyType',
|
prop: 'energyType',
|
||||||
label: '能源类型'
|
label: '能源类型',
|
||||||
|
filter: publicFormatter('energy_type'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '监控模式',
|
label: '监控模式',
|
||||||
filter: (val) => (val != null ? ['合并', '详细'][val-1] : '-'),
|
filter: (val) => (val != null ? ['合并', '详细'][val - 1] : '-'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'plcParamName',
|
prop: 'plcParamName',
|
||||||
label: '监控参数'
|
label: '监控参数',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'limitType',
|
prop: 'limitType',
|
||||||
label: '指标类型',
|
label: '指标类型',
|
||||||
filter: publicFormatter('monitor_index_type')
|
filter: publicFormatter('monitor_index_type'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'limitValue',
|
prop: 'limitValue',
|
||||||
label: '阈值'
|
label: '阈值',
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
export default {
|
export default {
|
||||||
name: "EnergyLimit",
|
name: 'EnergyLimit',
|
||||||
components: { EnergyLimitAdd },
|
components: { EnergyLimitAdd },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -102,7 +104,7 @@ export default {
|
|||||||
type: 'select',
|
type: 'select',
|
||||||
label: '能源类型',
|
label: '能源类型',
|
||||||
selectOptions: [],
|
selectOptions: [],
|
||||||
param: 'energyTypeId'
|
param: 'energyTypeId',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -110,39 +112,41 @@ export default {
|
|||||||
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
|
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
|
||||||
labelField: 'label',
|
labelField: 'label',
|
||||||
valueField: 'value',
|
valueField: 'value',
|
||||||
param: 'limitType'
|
param: 'limitType',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '查询',
|
btnName: '查询',
|
||||||
name: 'search',
|
name: 'search',
|
||||||
color: 'primary'
|
color: 'primary',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separate'
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
|
type: this.$auth.hasPermi('monitoring:energy-limit:create')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
btnName: '新增',
|
btnName: '新增',
|
||||||
name: 'add',
|
name: 'add',
|
||||||
color: 'success',
|
color: 'success',
|
||||||
plain: true
|
plain: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tableProps,
|
tableProps,
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
this.$auth.hasPermi('monitoring:energy-limit:update')
|
this.$auth.hasPermi('monitoring:energy-limit:update')
|
||||||
? {
|
? {
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
btnName: '编辑'
|
btnName: '编辑',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
this.$auth.hasPermi('monitoring:energy-limit:delete')
|
this.$auth.hasPermi('monitoring:energy-limit:delete')
|
||||||
? {
|
? {
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
btnName: '删除'
|
btnName: '删除',
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined,
|
||||||
].filter((v) => v),
|
].filter((v) => v),
|
||||||
tableH: this.tableHeight(260),
|
tableH: this.tableHeight(260),
|
||||||
// 总条数
|
// 总条数
|
||||||
@ -150,7 +154,7 @@ export default {
|
|||||||
// 班次基础信息列表
|
// 班次基础信息列表
|
||||||
list: [],
|
list: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
addOrEditTitle: "",
|
addOrEditTitle: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
centervisible: false,
|
centervisible: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -158,112 +162,117 @@ export default {
|
|||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
energyTypeId: null,
|
energyTypeId: null,
|
||||||
limitType: null
|
limitType: null,
|
||||||
},
|
},
|
||||||
energyTypeList: [],
|
energyTypeList: [],
|
||||||
typeList: [
|
typeList: [
|
||||||
{label: '合并', value: '1'},
|
{ label: '合并', value: '1' },
|
||||||
{label: '详细', value: '2'}
|
{ label: '详细', value: '2' },
|
||||||
],
|
],
|
||||||
objList: []
|
objList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
this.tableH = this.tableHeight(260);
|
||||||
})
|
});
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getTypeList()
|
this.getTypeList();
|
||||||
// 获取对象树形结构
|
// 获取对象树形结构
|
||||||
this.getObjTree()
|
this.getObjTree();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTypeList() {
|
getTypeList() {
|
||||||
getEnergyTypeListAll().then((res) => {
|
getEnergyTypeListAll().then((res) => {
|
||||||
this.formConfig[0].selectOptions = res.data || []
|
this.formConfig[0].selectOptions = res.data || [];
|
||||||
this.energyTypeList = res.data || []
|
this.energyTypeList = res.data || [];
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.queryParams.energyTypeId = val.energyTypeId
|
this.queryParams.energyTypeId = val.energyTypeId;
|
||||||
this.queryParams.limitType = val.limitType
|
this.queryParams.limitType = val.limitType;
|
||||||
this.getList()
|
this.getList();
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.addOrEditTitle = '新增'
|
this.addOrEditTitle = '新增';
|
||||||
this.centervisible = true
|
this.centervisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyLimit.init()
|
this.$refs.energyLimit.init();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
getList() {
|
getList() {
|
||||||
getEnergyLimitPage(this.queryParams).then(response => {
|
getEnergyLimitPage(this.queryParams).then((response) => {
|
||||||
let arr = response.data.list || [];
|
let arr = response.data.list || [];
|
||||||
arr&&arr.map(item => {
|
arr &&
|
||||||
this.typeList.map(i => {
|
arr.map((item) => {
|
||||||
|
this.typeList.map((i) => {
|
||||||
if (item.type === i.value) {
|
if (item.type === i.value) {
|
||||||
item.type = i.label
|
item.type = i.label;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (item.minValue && item.maxValue) {
|
if (item.minValue && item.maxValue) {
|
||||||
item.limitValue = item.minValue + '-' + item.maxValue
|
item.limitValue = item.minValue + '-' + item.maxValue;
|
||||||
} else if(item.minValue){
|
} else if (item.minValue) {
|
||||||
item.limitValue = '最小值' + item.minValue
|
item.limitValue = '最小值' + item.minValue;
|
||||||
}else if(item.maxValue){
|
} else if (item.maxValue) {
|
||||||
item.limitValue = '最大值' + item.maxValue
|
item.limitValue = '最大值' + item.maxValue;
|
||||||
} else {
|
} else {
|
||||||
item.limitValue = ''
|
item.limitValue = '';
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.list = arr
|
this.list = arr;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleClick(val) {
|
handleClick(val) {
|
||||||
switch (val.type) {
|
switch (val.type) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.addOrEditTitle = '编辑'
|
this.addOrEditTitle = '编辑';
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.energyLimit.init(val.data.id)
|
this.$refs.energyLimit.init(val.data.id);
|
||||||
})
|
});
|
||||||
this.centervisible = true
|
this.centervisible = true;
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.handleDelete(val.data)
|
this.handleDelete(val.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$refs.energyLimit.formClear()
|
this.$refs.energyLimit.formClear();
|
||||||
this.centervisible = false
|
this.centervisible = false;
|
||||||
this.addOrEditTitle = ''
|
this.addOrEditTitle = '';
|
||||||
},
|
},
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
this.$refs.energyLimit.submitForm()
|
this.$refs.energyLimit.submitForm();
|
||||||
},
|
},
|
||||||
successSubmit() {
|
successSubmit() {
|
||||||
this.handleCancel()
|
this.handleCancel();
|
||||||
this.getList()
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$modal.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?').then(function() {
|
this.$modal
|
||||||
|
.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
return deleteEnergyLimit(row.id);
|
return deleteEnergyLimit(row.id);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess('删除成功');
|
||||||
}).catch(() => {});
|
})
|
||||||
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
getObjTree() {
|
getObjTree() {
|
||||||
getTree().then(res => {
|
getTree().then((res) => {
|
||||||
this.objList = res.data || []
|
this.objList = res.data || [];
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,76 +1,77 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container" id='energyReportBox'>
|
<div
|
||||||
|
class="app-container"
|
||||||
|
id="energyReportBox">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<search-bar
|
<search-bar
|
||||||
:formConfigs="formConfig"
|
:formConfigs="formConfig"
|
||||||
ref="searchBarForm"
|
ref="searchBarForm"
|
||||||
:isFold="isFold"
|
:isFold="isFold"
|
||||||
@headBtnClick="buttonClick"
|
@headBtnClick="buttonClick" />
|
||||||
/>
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table
|
<base-table
|
||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
:max-height="tableH"
|
:max-height="tableH" />
|
||||||
/>
|
|
||||||
<pagination
|
<pagination
|
||||||
:page.sync="queryParams.pageNo"
|
:page.sync="queryParams.pageNo"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport"
|
import {
|
||||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
energyReportPageAuto,
|
||||||
import { publicFormatter } from '@/utils/dict'
|
energyReportPageExportAuto,
|
||||||
import { parseTime } from '@/utils/ruoyi'
|
} from '@/api/monitoring/energyReport';
|
||||||
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||||
|
import { publicFormatter } from '@/utils/dict';
|
||||||
|
import { parseTime } from '@/utils/ruoyi';
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'statisticType',
|
prop: 'statisticType',
|
||||||
label: '统计类型',
|
label: '统计类型',
|
||||||
filter: publicFormatter('statistic_type')
|
filter: publicFormatter('statistic_type'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'startTime',
|
prop: 'startTime',
|
||||||
label: '开始时间',
|
label: '开始时间',
|
||||||
filter: parseTime,
|
filter: parseTime,
|
||||||
minWidth: 160
|
minWidth: 160,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'endTime',
|
prop: 'endTime',
|
||||||
label: '结束时间',
|
label: '结束时间',
|
||||||
filter: parseTime,
|
filter: parseTime,
|
||||||
minWidth: 160
|
minWidth: 160,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'statisticName',
|
prop: 'statisticName',
|
||||||
label: '统计方案'
|
label: '统计方案',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'energyType',
|
prop: 'energyType',
|
||||||
label: '能源类型'
|
label: '能源类型',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'startNum',
|
prop: 'startNum',
|
||||||
label: '抄表数(起始)'
|
label: '抄表数(起始)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'endNum',
|
prop: 'endNum',
|
||||||
label: '抄表数(结束)'
|
label: '抄表数(结束)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'useNum',
|
prop: 'useNum',
|
||||||
label: '消耗量'
|
label: '消耗量',
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
export default {
|
export default {
|
||||||
name: "EnergyLimit",
|
name: 'EnergyLimit',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFold: false,
|
isFold: false,
|
||||||
@ -80,7 +81,7 @@ export default {
|
|||||||
label: '能源类型',
|
label: '能源类型',
|
||||||
selectOptions: [],
|
selectOptions: [],
|
||||||
param: 'energyTypeId',
|
param: 'energyTypeId',
|
||||||
filterable: true
|
filterable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -88,37 +89,39 @@ export default {
|
|||||||
selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
|
selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
|
||||||
labelField: 'label',
|
labelField: 'label',
|
||||||
valueField: 'value',
|
valueField: 'value',
|
||||||
param: 'statisticType'
|
param: 'statisticType',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'datePicker',
|
type: 'datePicker',
|
||||||
label: '时间',
|
label: '时间',
|
||||||
dateType: 'datetimerange',
|
dateType: 'datetimerange',
|
||||||
format: 'yyyy-MM-dd HH:mm:ss',
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||||||
valueFormat: "timestamp",
|
valueFormat: 'timestamp',
|
||||||
rangeSeparator: '-',
|
rangeSeparator: '-',
|
||||||
startPlaceholder: '开始时间',
|
startPlaceholder: '开始时间',
|
||||||
endPlaceholder: '结束时间',
|
endPlaceholder: '结束时间',
|
||||||
param: 'timeVal',
|
param: 'timeVal',
|
||||||
defaultSelect: [],
|
defaultSelect: [],
|
||||||
width: 350
|
width: 350,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '查询',
|
btnName: '查询',
|
||||||
name: 'search',
|
name: 'search',
|
||||||
color: 'primary'
|
color: 'primary',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separate'
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('monitoring:energy-report:export') ? 'button' : '',
|
type: this.$auth.hasPermi('monitoring:energy-report:export')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
btnName: '导出',
|
btnName: '导出',
|
||||||
name: 'add',
|
name: 'add',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
plain: true
|
plain: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tableProps,
|
tableProps,
|
||||||
tableH: this.tableHeight(260),
|
tableH: this.tableHeight(260),
|
||||||
@ -133,53 +136,61 @@ export default {
|
|||||||
energyTypeId: null,
|
energyTypeId: null,
|
||||||
statisticType: null,
|
statisticType: null,
|
||||||
startTime: null,
|
startTime: null,
|
||||||
endTime: null
|
endTime: null,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', this._eventListeners);
|
||||||
this.tableH = this.tableHeight(260)
|
this.getList();
|
||||||
this.isFold = this.searchBarWidth('energyReportBox', 1198)
|
this.getTypeList();
|
||||||
})
|
|
||||||
this.getList()
|
|
||||||
this.getTypeList()
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.isFold = this.searchBarWidth('energyReportBox', 1198)
|
this.isFold = this.searchBarWidth('energyReportBox', 1198);
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
window.removeEventListener('resize', this._eventListeners);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
_eventListeners() {
|
||||||
|
this.tableH = this.tableHeight(260);
|
||||||
|
this.isFold = this.searchBarWidth('energyReportBox', 1198);
|
||||||
|
},
|
||||||
getTypeList() {
|
getTypeList() {
|
||||||
getEnergyTypeListAll().then((res) => {
|
getEnergyTypeListAll().then((res) => {
|
||||||
this.formConfig[0].selectOptions = res.data || []
|
this.formConfig[0].selectOptions = res.data || [];
|
||||||
// this.energyTypeList = res.data || []
|
// this.energyTypeList = res.data || []
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.queryParams.pageNo = 1
|
this.queryParams.pageNo = 1;
|
||||||
this.queryParams.energyTypeId = val.energyTypeId
|
this.queryParams.energyTypeId = val.energyTypeId;
|
||||||
this.queryParams.statisticType = val.statisticType
|
this.queryParams.statisticType = val.statisticType;
|
||||||
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
|
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
|
||||||
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
|
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
|
||||||
this.getList()
|
this.getList();
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
this.$modal.confirm('是否确认导出').then(() => {
|
this.$modal
|
||||||
return energyReportPageExportAuto({...this.queryParams});
|
.confirm('是否确认导出')
|
||||||
}).then(response => {
|
.then(() => {
|
||||||
|
return energyReportPageExportAuto({ ...this.queryParams });
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
this.$download.excel(response, '能源统计报表.xls');
|
this.$download.excel(response, '能源统计报表.xls');
|
||||||
}).catch(() => {})
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
getList() {
|
getList() {
|
||||||
energyReportPageAuto(this.queryParams).then(response => {
|
energyReportPageAuto(this.queryParams).then((response) => {
|
||||||
this.list = response.data.list || [];
|
this.list = response.data.list || [];
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
<base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
|
||||||
|
:table-data="tableData">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
||||||
@clickBtn="handleClick" />
|
@clickBtn="handleClick" />
|
||||||
</base-table>
|
</base-table>
|
||||||
@ -33,10 +34,10 @@ import {
|
|||||||
import basicPage from '../../mixins/basic-page';
|
import basicPage from '../../mixins/basic-page';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import addOrUpdate from './dialogForm.vue';
|
import addOrUpdate from './dialogForm.vue';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionBoxBtn',
|
name: 'QualityInspectionBoxBtn',
|
||||||
mixins: [basicPage],
|
mixins: [basicPage, tableHeightMixin],
|
||||||
components: { addOrUpdate },
|
components: { addOrUpdate },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -114,7 +115,7 @@ export default {
|
|||||||
// 查询参数
|
// 查询参数
|
||||||
listQuery: {
|
listQuery: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
inspectionDetContent: null,
|
inspectionDetContent: null,
|
||||||
},
|
},
|
||||||
addOrUpdateVisible: false,
|
addOrUpdateVisible: false,
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
<base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
|
||||||
|
:table-data="tableData">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
||||||
@clickBtn="handleClick" />
|
@clickBtn="handleClick" />
|
||||||
</base-table>
|
</base-table>
|
||||||
@ -34,10 +35,11 @@ import basicPage from './basic-page';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import addOrUpdate from './dialogForm.vue';
|
import addOrUpdate from './dialogForm.vue';
|
||||||
import ProcessBomList from './ProcessBomList.vue';
|
import ProcessBomList from './ProcessBomList.vue';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
import row from './row.vue';
|
import row from './row.vue';
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionBoxBtn',
|
name: 'QualityInspectionBoxBtn',
|
||||||
mixins: [basicPage],
|
mixins: [basicPage, tableHeightMixin],
|
||||||
components: { addOrUpdate, ProcessBomList },
|
components: { addOrUpdate, ProcessBomList },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -123,7 +125,7 @@ export default {
|
|||||||
// 查询参数
|
// 查询参数
|
||||||
listQuery: {
|
listQuery: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
userName: null,
|
userName: null,
|
||||||
nickName:null
|
nickName:null
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||||
<base-table v-loading="dataListLoading" :table-props="tableProps" :page="listQuery.pageNo"
|
<base-table :max-height="tableH" v-loading="dataListLoading" :table-props="tableProps" :page="listQuery.pageNo"
|
||||||
:limit="listQuery.pageSize" :table-data="tableData">
|
:limit="listQuery.pageSize" :table-data="tableData">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||||
@clickBtn="handleClick" />
|
@clickBtn="handleClick" />
|
||||||
@ -29,6 +29,7 @@ import {
|
|||||||
deleteQualityHotMaterial,
|
deleteQualityHotMaterial,
|
||||||
getHotMaterialAllList
|
getHotMaterialAllList
|
||||||
} from '@/api/base/qualityHotMaterial';
|
} from '@/api/base/qualityHotMaterial';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
// import { getList, } from "@/api/base/qualityScrapType";
|
// import { getList, } from "@/api/base/qualityScrapType";
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
@ -74,7 +75,7 @@ const tableProps = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [basicPage],
|
mixins: [basicPage, tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
urlOptions: {
|
urlOptions: {
|
||||||
@ -207,7 +208,7 @@ export default {
|
|||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 20;
|
||||||
this.listQuery.materialId = val.materialId ? val.materialId : undefined;
|
this.listQuery.materialId = val.materialId ? val.materialId : undefined;
|
||||||
this.listQuery.checkTime = val.checkTime ? val.checkTime : undefined;
|
this.listQuery.checkTime = val.checkTime ? val.checkTime : undefined;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
@ -215,7 +216,7 @@ export default {
|
|||||||
case 'reset':
|
case 'reset':
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 1,
|
total: 1,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
<base-table :max-height="tableH" :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||||
@emitFun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
||||||
@clickBtn="handleTableBtnClick" />
|
@clickBtn="handleTableBtnClick" />
|
||||||
@ -59,14 +59,14 @@ import {
|
|||||||
getQualityInspectionDetPage,
|
getQualityInspectionDetPage,
|
||||||
exportQualityInspectionDetExcel,
|
exportQualityInspectionDetExcel,
|
||||||
} from '@/api/base/qualityInspectionDet';
|
} from '@/api/base/qualityInspectionDet';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionDet',
|
name: 'QualityInspectionDet',
|
||||||
mixins: [basicPageMixin],
|
mixins: [basicPageMixin, tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
typeList: [], // 检测类型列表
|
typeList: [], // 检测类型列表
|
||||||
@ -153,7 +153,7 @@ export default {
|
|||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
content: null,
|
content: null,
|
||||||
createTime: [],
|
createTime: [],
|
||||||
},
|
},
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
<base-table :max-height="tableH" :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize"
|
||||||
@emitFun="handleEmitFun">
|
:table-data="list" @emitFun="handleEmitFun">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
||||||
@clickBtn="handleTableBtnClick" />
|
@clickBtn="handleTableBtnClick" />
|
||||||
</base-table>
|
</base-table>
|
||||||
@ -61,10 +61,10 @@ import {
|
|||||||
exportQualityInspectionTypeExcel,
|
exportQualityInspectionTypeExcel,
|
||||||
} from '@/api/base/qualityInspectionType';
|
} from '@/api/base/qualityInspectionType';
|
||||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionType',
|
name: 'QualityInspectionType',
|
||||||
mixins: [basicPageMixin],
|
mixins: [basicPageMixin, tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2023-08-01 14:55:51
|
* @Date: 2023-08-01 14:55:51
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-25 16:07:07
|
* @LastEditTime: 2024-03-29 14:08:18
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@ -24,12 +24,12 @@
|
|||||||
// import unitDict from './unitDict';
|
// import unitDict from './unitDict';
|
||||||
// import basicPage from '../mixins/basic-page';
|
// import basicPage from '../mixins/basic-page';
|
||||||
import { parseTime } from '../mixins/code-filter';
|
import { parseTime } from '../mixins/code-filter';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
import {
|
import {
|
||||||
getMaterialUseLogPage,
|
getMaterialUseLogPage,
|
||||||
getWorkOrderList,
|
getWorkOrderList,
|
||||||
exportEnergyPlcExcel
|
exportEnergyPlcExcel
|
||||||
} from '@/api/quality/materialTraceability';
|
} from '@/api/quality/materialTraceability';
|
||||||
|
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'materialName',
|
prop: 'materialName',
|
||||||
@ -73,6 +73,7 @@ const tableProps = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
// mixins: [basicPage],
|
// mixins: [basicPage],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -82,7 +83,7 @@ export default {
|
|||||||
// // exportURL: exportPackingExcel,
|
// // exportURL: exportPackingExcel,
|
||||||
// },
|
// },
|
||||||
tableProps,
|
tableProps,
|
||||||
tableH: this.tableHeight(260),
|
// tableH: this.tableHeight(260),
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
this.$auth.hasPermi(`base:packaging-print-log:update`)
|
this.$auth.hasPermi(`base:packaging-print-log:update`)
|
||||||
? {
|
? {
|
||||||
@ -174,9 +175,9 @@ export default {
|
|||||||
// AddOrUpdate,
|
// AddOrUpdate,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
// window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
// this.tableH = this.tableHeight(260)
|
||||||
})
|
// })
|
||||||
this.getList()
|
this.getList()
|
||||||
this.getDict()
|
this.getDict()
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2023-08-01 14:55:51
|
* @Date: 2023-08-01 14:55:51
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-21 15:17:05
|
* @LastEditTime: 2024-03-29 14:08:30
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@ -25,6 +25,8 @@
|
|||||||
// import basicPage from '../mixins/basic-page';
|
// import basicPage from '../mixins/basic-page';
|
||||||
import { publicFormatter } from '@/utils/dict';
|
import { publicFormatter } from '@/utils/dict';
|
||||||
import { parseTime } from '../mixins/code-filter';
|
import { parseTime } from '../mixins/code-filter';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getOriginalGlassRetrace,
|
getOriginalGlassRetrace,
|
||||||
getWorkOrderList,
|
getWorkOrderList,
|
||||||
@ -85,6 +87,7 @@ const tableProps = [
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
// mixins: [basicPage],
|
// mixins: [basicPage],
|
||||||
|
mixins: [tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// urlOptions: {
|
// urlOptions: {
|
||||||
@ -119,7 +122,7 @@ export default {
|
|||||||
startTime: undefined,
|
startTime: undefined,
|
||||||
endTime:undefined,
|
endTime:undefined,
|
||||||
},
|
},
|
||||||
tableH: this.tableHeight(260),
|
// tableH: this.tableHeight(260),
|
||||||
formConfig: [
|
formConfig: [
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -184,9 +187,9 @@ export default {
|
|||||||
// AddOrUpdate,
|
// AddOrUpdate,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
window.addEventListener('resize', () => {
|
// window.addEventListener('resize', () => {
|
||||||
this.tableH = this.tableHeight(260)
|
// this.tableH = this.tableHeight(260)
|
||||||
})
|
// })
|
||||||
this.getList()
|
this.getList()
|
||||||
this.getDict()
|
this.getDict()
|
||||||
},
|
},
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
* @Author: zwq
|
* @Author: zwq
|
||||||
* @Date: 2023-08-01 14:55:51
|
* @Date: 2023-08-01 14:55:51
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @LastEditTime: 2024-03-20 09:25:40
|
* @LastEditTime: 2024-03-29 15:32:33
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||||
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
|
<base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
|
||||||
|
:table-data="list">
|
||||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||||
@clickBtn="handleClick" />
|
@clickBtn="handleClick" />
|
||||||
</base-table>
|
</base-table>
|
||||||
@ -30,6 +31,7 @@ import {
|
|||||||
// exportEnergyPlcExcel
|
// exportEnergyPlcExcel
|
||||||
} from '@/api/quality/processTraceability';
|
} from '@/api/quality/processTraceability';
|
||||||
import { publicFormatter } from '@/utils/dict';
|
import { publicFormatter } from '@/utils/dict';
|
||||||
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
@ -78,7 +80,7 @@ const tableProps = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// mixins: [basicPage],
|
mixins: [tableHeightMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// urlOptions: {
|
// urlOptions: {
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-11-09 16:32:21
|
* @Date: 2023-11-09 16:32:21
|
||||||
* @LastEditTime: 2023-11-09 16:32:21
|
* @LastEditTime: 2024-03-29 14:21:52
|
||||||
* @LastEditors: zhp
|
|
||||||
* @Description:
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
* @Author: zhp
|
|
||||||
* @Date: 2023-11-07 19:28:13
|
|
||||||
* @LastEditTime: 2023-11-08 14:11:43
|
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: zhp
|
* @Author: zhp
|
||||||
* @Date: 2023-11-28 10:41:50
|
* @Date: 2023-11-28 10:41:50
|
||||||
* @LastEditTime: 2023-11-28 10:49:43
|
* @LastEditTime: 2024-03-29 14:14:13
|
||||||
* @LastEditors: zhp
|
* @LastEditors: zhp
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<!--
|
|
||||||
filename: index.vue
|
|
||||||
author: liubin
|
|
||||||
date: 2023-10-18 12:25:46
|
|
||||||
description:
|
|
||||||
-->
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container process-flow-view">
|
<div class="app-container process-flow-view">
|
||||||
<ProcessInfo />
|
<ProcessInfo />
|
||||||
|
@ -91,8 +91,18 @@ export default {
|
|||||||
// : undefined,
|
// : undefined,
|
||||||
].filter((v) => v),
|
].filter((v) => v),
|
||||||
tableProps: [
|
tableProps: [
|
||||||
{ prop: 'name', label: '巡检单名称', showOverflowtooltip: true },
|
{
|
||||||
{ prop: 'department', label: '部门', showOverflowtooltip: true },
|
prop: 'name',
|
||||||
|
label: '巡检单名称',
|
||||||
|
showOverflowtooltip: true,
|
||||||
|
filter: (v) => v ?? '---',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'department',
|
||||||
|
label: '部门',
|
||||||
|
showOverflowtooltip: true,
|
||||||
|
filter: (v) => v ?? '---',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'actualCheckTime',
|
prop: 'actualCheckTime',
|
||||||
label: '巡检时间',
|
label: '巡检时间',
|
||||||
@ -100,33 +110,12 @@ export default {
|
|||||||
filter: parseTime,
|
filter: parseTime,
|
||||||
showOverflowtooltip: true,
|
showOverflowtooltip: true,
|
||||||
},
|
},
|
||||||
{ prop: 'groupClass', label: '班次', showOverflowtooltip: true },
|
{
|
||||||
// {
|
prop: 'groupClass',
|
||||||
// prop: '_detail',
|
label: '班次',
|
||||||
// label: '巡检内容',
|
showOverflowtooltip: true,
|
||||||
// subcomponent: {
|
filter: (v) => v ?? '---',
|
||||||
// name: 'ViewDetail',
|
},
|
||||||
// props: ['injectData'],
|
|
||||||
// data() {
|
|
||||||
// return {};
|
|
||||||
// },
|
|
||||||
// methods: {
|
|
||||||
// handleClick() {
|
|
||||||
// this.$emit('emitData', {
|
|
||||||
// action: this.injectData.label,
|
|
||||||
// value: this.injectData,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// render: function (h) {
|
|
||||||
// return (
|
|
||||||
// <el-button type="text" onClick={this.handleClick}>
|
|
||||||
// 详情
|
|
||||||
// </el-button>
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
{ prop: 'remark', label: '备注' },
|
{ prop: 'remark', label: '备注' },
|
||||||
],
|
],
|
||||||
searchBarFormConfig: [
|
searchBarFormConfig: [
|
||||||
@ -161,9 +150,7 @@ export default {
|
|||||||
type: 'separate',
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('se:check-record:export')
|
type: this.$auth.hasPermi('se:check-record:export') ? 'button' : '',
|
||||||
? 'button'
|
|
||||||
: '',
|
|
||||||
btnName: '导出',
|
btnName: '导出',
|
||||||
name: 'export',
|
name: 'export',
|
||||||
plain: true,
|
plain: true,
|
||||||
|
@ -80,8 +80,9 @@ import {
|
|||||||
import RecordDetail from './Record--detail.vue';
|
import RecordDetail from './Record--detail.vue';
|
||||||
import { TableBtn } from '@/components/tableInnerComponents';
|
import { TableBtn } from '@/components/tableInnerComponents';
|
||||||
|
|
||||||
const timeFilter = (val) =>
|
const timeFilter = (val) => {
|
||||||
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---';
|
return val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---';
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SpecialEquipmentMaintainRecord',
|
name: 'SpecialEquipmentMaintainRecord',
|
||||||
|
Loading…
Reference in New Issue
Block a user