This commit is contained in:
helloDy 2024-04-03 11:22:32 +08:00
commit 4571786780
45 changed files with 5194 additions and 4528 deletions

View File

@ -1,7 +1,7 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-03-29 14:45:32
# @LastEditTime: 2024-04-03 11:22:19
# @LastEditors: DY
# @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.1.49: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.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082'

View File

@ -34,4 +34,22 @@ export function getQoq(data) {
method: 'post',
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
})
}

View File

@ -68,3 +68,4 @@ export function exportEnergyTypeExcel(query) {
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

View File

@ -12,7 +12,7 @@
:label-width="`${labelWidth}px`"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
v-loading="0 && formLoading">
<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-form-item :label="col.label" :prop="col.prop" :rules="col.rules">

View File

@ -97,6 +97,8 @@ export const DICT_TYPE = {
TABLE_NAME: 'table_name',
METHOD: 'method',
PUSH: 'push',
ENERGY_TYPE: 'energy_type',
// ============== ORDER - 订单模块 =============
ORDER_STATUS: 'order_status',
@ -117,7 +119,7 @@ export const DICT_TYPE = {
// ============== GROUP - 班组模块 =============
WORK_SHOP: 'workshop',
// ============== GROUP - 质量模块 =============
// ============== GROUP - 质量模块 =============
MATERIAL_GRADE: 'material_grade'
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-07-19 15:18:30
* @LastEditors: zhp
* @LastEditTime: 2024-03-28 15:28:07
* @LastEditTime: 2024-03-29 16:49:00
* @Description:
-->
<template>
@ -16,11 +16,11 @@
许昌安彩AGV原片周转看板
<h3 class="unit">单位河南汇融数字科技有限公司</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">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button>
</el-button> -->
</el-row>
<el-row class="container-main flex-col" type="flex">
<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'">
<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">
<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" />
{{ op.name }}
</p>
<p v-else class="now-secondary-title">{{ op.name }}</p>
<el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white"
:percentage="op.outRate * 100" class="custom-progress-bar" />
</p> -->
<!-- <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 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>
</div>
</base-container>
@ -496,7 +498,7 @@ export default {
seconds = "0" + seconds;
}
//
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
},
windowWidth(value) {
this.clientWidth = value
@ -530,11 +532,6 @@ export default {
</script>
<style lang="scss" scoped>
.visual-container {
width: 1920px;
height: 1080px;
@ -556,7 +553,7 @@ export default {
top: 25px;
color: rgba(255, 255, 255, 0.80);
font-size: 20px;
letter-spacing: 0px;
letter-spacing: 1px;
}
.time {
position: absolute;
@ -564,7 +561,7 @@ export default {
top: 25px;
color: rgba(255, 255, 255, 0.80);
font-size: 20px;
letter-spacing: 0px;
letter-spacing: .72px;
}
.title-button {
color: #00fff0;
@ -607,6 +604,12 @@ export default {
::v-deep .el-progress-bar__inner {
background-color: unset;
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 {
position: absolute;

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-01-29 16:50:26
* @LastEditTime: 2024-03-28 16:35:49
* @LastEditTime: 2024-04-02 15:01:40
* @LastEditors: zhp
* @Description:
-->
@ -17,11 +17,11 @@
许昌安彩冷端看板
<h3 class="unit">单位河南汇融数字科技有限公司</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">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button>
</el-button> -->
</el-row>
<el-row class="container-main flex-col" type="flex">
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1">
@ -40,6 +40,12 @@
<top-radio-group />
</div> -->
<!-- 像下面这样表格里的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"
:height="359" :show-legend="true" />
</base-container>
@ -64,11 +70,11 @@
</div> -->
<!-- <el-row :gutter="9"> -->
<!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> -->
<pile-bar-chart style="margin-bottom: -15px" ref="firstPileChart" :height="90" />
<second-pile-bar-chart style="margin-bottom: -15px" id=" 'second' " ref="secondPileChart" :height="90" />
<third-pile-bar-chart style="margin-bottom: -15px" id=" 'third' " ref="thirdPileChart" :height="90" />
<fourth-pile-bar-chart style="margin-bottom: -15px" id=" 'fourth' " ref="fourthPileChart" :height="90" />
<fifth-pile-bar-chart style="margin-bottom: -15px" id=" 'fifth' " ref="fifthPileChart" :height="100" />
<pile-bar-chart id=" 'one' " style="margin-top: -5px;" ref="firstPileChart" :height="80" />
<second-pile-bar-chart id=" 'second' " ref="secondPileChart" :height="90" />
<third-pile-bar-chart id=" 'third' " ref="thirdPileChart" :height="90" />
<fourth-pile-bar-chart id=" 'fourth' " ref="fourthPileChart" :height="90" />
<fifth-pile-bar-chart style="margin-top: -5px;" id=" 'fifth' " ref="fifthPileChart" :height="90" />
<!-- <pile-bar-chart ref="secondPileChart"
:height="90" />
<pile-bar-chart ref="thirdPileChart"
@ -244,6 +250,7 @@ export default {
funWs: undefined,
SJGws: undefined,
funWsData: {},
coldDetData:[],
SJGWsData: {},
cxNameList:[],
cxDataList:[],
@ -314,85 +321,7 @@ export default {
}
},
mounted() {
let nameList = []
let nameWasteList = []
let topNameList = []
let productList = []
let wasteList = []
let yieldList = []
// let sumAreaList = []
// let yieldList = []
// this.cutTableDataList =
let coldDetData = [
{
"first": 0.8834,
"lineName": "Y61",
"product": 0.8834,
"productArea": 35069.28,
"second": 0,
'sumArea': 38400,
'wastArea': 3330.72,
"yield": 0.9133
},
{
"first": 0.847,
"lineName": "Y62",
"product": 0.847,
"productArea": 26765.46,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.8668,
"lineName": "Y63",
"product": 0.8668,
"productArea": 26448.46,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.9064,
"lineName": "Y64",
"product": 0.9064,
"productArea": 26667.32,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.8838,
"lineName": "Y65",
"product": 0.8838,
"productArea": 26554.32,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
}
]
coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea)
productList.push(ele.productArea)
wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea)
yieldList.push({
name: '良品',
yield:ele.yield
})
// sumAreaList.push(ele.sumArea)
// yieldList.push((ele.yield * 100).toFixed(3))
})
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.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.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]])
this.getProductData()
// this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
this.getTimes()
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
@ -414,39 +343,123 @@ export default {
}
},
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)
// },
getProductData() {
let nameList = []
let nameWasteList = []
let topNameList = []
let productList = []
let wasteList = []
let yieldList = []
let sumAreaList = []
// let yieldList = []
// this.cutTableDataList =
this.coldDetData = [
{
"first": 0.8834,
"lineName": "Y61",
"product": 0.8834,
"productArea": 35069.28,
"second": 0,
'sumArea': 38400,
'wastArea': 3330.72,
"yield": 0.9133
},
{
"first": 0.847,
"lineName": "Y62",
"product": 0.847,
"productArea": 26765.46,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.8668,
"lineName": "Y63",
"product": 0.8668,
"productArea": 26448.46,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.9064,
"lineName": "Y64",
"product": 0.9064,
"productArea": 26667.32,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
},
{
"first": 0.8838,
"lineName": "Y65",
"product": 0.8838,
"productArea": 26554.32,
"second": 0,
'sumArea': 1111111,
'wastArea': 22222,
"yield": 0.9133
}
]
this.coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
productList.push(ele.productArea)
wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea + '㎡')
// yieldList.push({
// name: '',
// yield:ele.yield
// })
sumAreaList.push(ele.sumArea)
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.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.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]])
this.$refs.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]])
})
},
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) {
this.Cutws.ws.onclose = (event) => { console.log(event );}
},
@ -495,7 +508,7 @@ export default {
seconds = "0" + seconds;
}
//
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
},
SJGInitWebSocket() {
let date = new Date().valueOf()
@ -525,10 +538,9 @@ export default {
])
}
this.realEqConfig.data = this.realEqList
this.$nextTick(() => {
// this.$nextTick(() => {
this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
})
// })
};
// if (typeof (WebSocket) === 'undefined') {
// 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>`
])
this.cutConfig.data = cutArr
this.$refs['cutScrollBoard'].updateRows(cutArr)
// this.$nextTick(() => {
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') {
let nameList = []
let nameWasteList = []
@ -581,22 +597,25 @@ export default {
let wasteList = []
let sumAreaList = []
let yieldList = []
this.coldDetData = this.cutWsData.coldDetData
// this.cutTableDataList =
this.cutWsData.coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
productList.push(ele.productArea)
wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea + '㎡')
sumAreaList.push(ele.sumArea)
yieldList.push(parseFloat((ele.yield * 100).toFixed(3)))
})
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.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.fifthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
this.$nextTick(() => {
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.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.fifthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
})
}
};
// if (typeof (WebSocket) === 'undefined') {
@ -632,17 +651,18 @@ export default {
for (let i in this.funWsData.data.annealFanInfo) {
index++,
arr.push([
`
<span style="color:rgba(255,255,255,0.5)" >${index || ''}
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}
</span>`,
`<span style="color:rgba(255,255,255,0.5)" >${i || ''}
</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>`,
// `<span style="color:rgba(255,255,255,0.5)" >${i || ''}
// </span>`,
`<span style="color:rgba(255,255,255,0.5)">${i || ''}</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.$refs['annealFunScrollBoard'].updateRows(arr)
// this.$nextTick(() => {
this.$refs['annealFunScrollBoard'].updateRows(arr)
// })
}
if (this.funWsData.type === 'FanInfo') {
let arr = []
@ -650,14 +670,16 @@ export default {
for (let i in this.funWsData.data.fanInfo) {
index++,
arr.push([
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)" >${i || ''}</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>`,
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}
</span>`,
`<span style="color:rgba(255,255,255,0.5)">${i || ''}</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.$refs['funScrollBoard'].updateRows(arr)
// this.$nextTick(() => {
this.$refs['funScrollBoard'].updateRows(arr)
// })
}
};
// if (typeof (WebSocket) === 'undefined') {
@ -772,7 +794,37 @@ export default {
</script>
<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 {
width: 1920px;
height: 1080px;
@ -794,7 +846,7 @@ export default {
top: 25px;
color: rgba(255, 255, 255, 0.80);
font-size: 20px;
letter-spacing: 0px;
letter-spacing: 1px;
}
.time {
@ -803,7 +855,7 @@ export default {
color: rgba(255, 255, 255, 0.80);
top: 25px;
font-size: 20px;
letter-spacing: 0px;
letter-spacing: .72px;
}
.title-button {

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-03-28 16:45:24
* @LastEditTime: 2024-03-29 14:50:50
* @Description:
-->
<template>
@ -158,6 +158,9 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id))
this.$nextTick(() => {
this.chart.resize();
});
this.chart.setOption({
title: this.showCenterTitle
? {

View File

@ -2,7 +2,7 @@
* @Author: gtz
* @Date: 2022-01-19 15:58:17
* @LastEditors: zhp
* @LastEditTime: 2024-03-27 10:26:35
* @LastEditTime: 2024-03-29 14:47:29
* @Description: file content
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
-->
@ -164,7 +164,7 @@ export default {
width: 100%;
// background-color: rgba($color: #061027, $alpha: 0.15);
position: relative;
opacity: calc(.8);
// opacity: calc(.8);
// border: 2px solid;
// background: url('../../../../assets/img/energy.png') no-repeat;
// background-size: 100% 100%;
@ -274,6 +274,8 @@ export default {
width: 100%;
color: #ffffff;
font-size: 24px;
font-weight: normal;
letter-spacing: .8px;
padding: 0.67em 0.67em 0.3em 0.67em;
display: flex;
}

View File

@ -2,13 +2,13 @@
<!--
* @Author: zhp
* @Date: 2023-09-21 09:06:28
* @LastEditTime: 2024-03-25 18:34:58
* @LastEditTime: 2024-04-01 09:12:56
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<div :id="id" class="productChart" :style="{ height: '390px', width: width }" />
<div :id="id" class="coldProductChart" :style="{ height: '390px', width: width }" />
</div>
</template>
@ -71,9 +71,9 @@ export default {
mounted() {
console.log('mounted')
console.log('borderRadius: ', this.borderRadius)
// this.$nextTick(() => {
// this.initChart()
// })
this.$el.addEventListener('resize', () => {
console.log('resziing.....');
});
},
beforeDestroy() {
if (!this.chart) {
@ -114,6 +114,7 @@ export default {
name: '产线良品率',
symbol: 'circle', //
type: 'line',
// symbolSize: 7,
yAxisIndex: 0,
areaStyle: {
opacity: 0.8,
@ -141,6 +142,16 @@ export default {
]
// const colors = ['#5470C6', '#91CC75', '#EE6666']
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({
// color: colors,
tooltip: {
@ -151,22 +162,33 @@ export default {
},
grid: {
left: "3%",
right: "5%",
right: "10%",
bottom: "3%",
containLabel: true
},
legend: {
itemWidth: 10,
itemHeight: 10,
top: '20',
// right: '20px',
data: ['产线产量', '产线良品率'],
textStyle: {
fontSize: 12 * this.beilv,
color: '#ced1d5'
}
},
// legend: {
// itemWidth: 10,
// itemHeight: 10,
// top: '5',
// right: '20px',
// data: [
// // { icon: 'rect', name: '访' },
// { icon: 'roundRect', name: '线' },
// // {
// // icon: 'circle', name: '线',
// // itemWidth: 7,
// // itemHeight: 7,
// // },
// ],
// textStyle: {
// fontSize: 12 * this.beilv,
// color: '#ced1d5'
// }
// },
xAxis: {
axisTick: {
show: false
},
type: 'category',
axisLine: {
lineStyle: {
@ -202,7 +224,7 @@ export default {
type: 'value',
name: '良品率/%',
nameTextStyle: {// y
color: '#fff',
color: 'rgba(255,255,255,0.5)', //
align: "left",
},
position: 'right',
@ -245,7 +267,7 @@ export default {
type: 'value',
name: '产量/㎡', // y
nameTextStyle: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
// fontSize: 10,
align: "right",
},
@ -286,7 +308,8 @@ export default {
}
</script>
<style>
.productChart{
.coldProductChart{
top: -10px;
}
</style>

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2023-09-21 09:06:28
* @LastEditTime: 2024-03-28 16:31:20
* @LastEditTime: 2024-03-29 16:26:28
* @LastEditors: zhp
* @Description:
-->
@ -106,7 +106,8 @@ export default {
position: 'top', //
textStyle: { //
color: '#ced1d5',
fontSize: 12
fontSize: 12,
fontWight:'bolder'
}
},
}
@ -142,7 +143,7 @@ export default {
}
},
// data: passRateList
data: []
data: passRateList
}
]
// const colors = ['#5470C6', '#91CC75', '#EE6666']
@ -166,19 +167,23 @@ export default {
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: {
itemWidth: 10,
itemHeight: 10,
top: '0%',
right: '20px',
data: ['产线产量', '产线良品率'],
data: ['产线良品率', '产线产量'],
textStyle: {
fontSize: 12 * this.beilv,
color: '#ced1d5'
color: '#ced1d5',
fontWight: 'bolder'
}
},
xAxis: {
axisTick: {
show: false
},
type: 'category',
axisLine: {
lineStyle: {
@ -187,8 +192,11 @@ export default {
width: '1' // 线
}
},
textStyle: {
fontWight: 'bolder'
},
axisLabel: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
// formatter: '{value}'
// textStyle: {
@ -217,7 +225,7 @@ export default {
type: 'value',
name: '良品率/%',
nameTextStyle: {// y
color: '#fff',
color: 'rgba(255,255,255,0.5)', //
align: "left",
},
position: 'right',
@ -231,7 +239,7 @@ export default {
}
},
axisLabel: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
// formatter: '{value}'
formatter: '{value}%'
@ -261,7 +269,7 @@ export default {
type: 'value',
name: '产量/片', // y
nameTextStyle: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
// fontSize: 10,
align: "right",
},
@ -278,7 +286,7 @@ export default {
axisLabel: {
// textStyle: {
// color: 'rgba(255,255,255,0.5)', //
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
// show: true,
lineStyle: {
color: "#25528f",

View File

@ -111,8 +111,9 @@ export default {
show: true, //
position: 'top', //
textStyle: { //
color: '#ced1d5',
fontSize: 12
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
fontWeight: 'bolder'
}
},
}
@ -144,6 +145,9 @@ export default {
// }
// },
xAxis: {
axisTick: {
show: false
},
type: 'category',
axisLine: {
lineStyle: {
@ -152,8 +156,11 @@ export default {
width: '1' // 线
}
},
textStyle: {
fontWeight: 'bolder'
},
axisLabel: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
// formatter: '{value}'
},
@ -167,13 +174,13 @@ export default {
yAxis: {
name: '单位kwh',
nameTextStyle: {
color: '#fff',
color: 'rgba(255,255,255,0.5)', //
fontSize: 10,
align: 'right',
},
type: 'value',
axisLabel: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
// formatter: '{value}/kwh'
},

View File

@ -1,13 +1,13 @@
<!--
* @Author: zhp
* @Date: 2023-12-27 13:54:52
* @LastEditTime: 2024-03-28 16:30:14
* @LastEditTime: 2024-04-01 09:14:45
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<div :id="id" class="productChart" :style="{ height: height + 'px', width: width }" />
<div :id="id" :style="{ height:'75px', width: width }" />
</div>
</template>
@ -71,7 +71,10 @@ export default {
}
},
mounted() {
console.log('mounted')
// console.log('mounted')
window.addEventListener('resize', () => {
this.resize()
})
// console.log('borderRadius: ', this.borderRadius)
// console.log('33333', this.dataList)
// let arr = []
@ -91,6 +94,12 @@ export default {
this.chart = null
},
methods: {
resize() {
this.chart.resize({
width: 'auto',
height: 90
});;
},
initChart(nameList, topNameList, nameWasteList, passRateList, wasteList) {
let rawData = []
let colors = ['#0fdedb', '#2359ec']
@ -106,7 +115,6 @@ export default {
}
// }
console.log('total', totalData)
this.chart = echarts.init(document.getElementById(this.id))
const series = [
'良品',
'废品',
@ -137,6 +145,17 @@ export default {
// width,
// 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({
legend: {
formatter: function (name) {
@ -152,7 +171,8 @@ export default {
left: '20',
icon: 'rect',
textStyle: {
color: '#ffffff'
color: 'rgba(255,255,255,.6)',
fontSize:12,
}
},
grid: {
@ -184,9 +204,9 @@ export default {
splitNumber: 50,
// boundaryGap: [20, 20],
textStyle: {
color: '#ffffff',
color: 'rgba(255,255,255,.6)',
verticalAlign: 'bottom',
fontSize: 12,
fontSize: 16,
align: 'left',
padding: [0, 0, 10, -5]
}
@ -212,9 +232,9 @@ export default {
splitNumber: 50,
// boundaryGap: [20, 20],
textStyle: {
color: '#ffffff',
color: 'rgba(255,255,255,.6)',
verticalAlign: 'bottom',
fontSize: 12,
fontSize: 16,
align: 'right',
padding: [0, 0, 10, -5]
}
@ -228,10 +248,15 @@ export default {
},
series:series
})
this.chart.resize({
width: 'auto',
height: 90
});;
this.$nextTick(() => {
setTimeout(() => {
this.resize()
},1000);
})
// this.chart.resize({
// width: 'auto',
// height: 90
// });;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,148 +1,149 @@
<template>
<div
id="analysischartBar"
style="width: 100%"
:style="{ height: chartHeight + 'px' }"
></div>
<div
id="analysischartBar"
style="width: 100%"
:style="{ height: chartHeight + 'px' }"></div>
</template>
<script>
import * as echarts from 'echarts'
import resize from '@/utils/chartMixins/resize'
import * as echarts from 'echarts';
import resize from '@/utils/chartMixins/resize';
export default {
name: "BarChart",
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('analysischartBar')
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: 'bar',
barMaxWidth: 20,
label: {
show: true,
position: 'top'
},
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: 'shadow'
},
formatter: function(params) {
return (
params[0].axisValue +
`<br>` +
params.map((item) => {
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 seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</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">
name: 'BarChart',
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
chartHeight: this.tableHeight(250) / 2,
};
},
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(250) / 2;
});
},
methods: {
getChart() {
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose(); // Dom
}
this.chartDom = document.getElementById('analysischartBar');
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: 'bar',
barMaxWidth: 20,
label: {
show: true,
position: 'top',
},
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.toFixed(2) : '';
obj.data.push(num);
}
yData.push(obj);
}
var option = {
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
return (
params[0].axisValue +
`<br>` +
params
.map((item) => {
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 seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</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">
<span>${str}${seriesNameStr}</span>
<span>${valueStr}</span>
</span>`
}).join(``)
)
}
},
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true
},
legend: {
data: legendData,
right: '1%',
icon: 'rect',
itemHeight: 8,
itemWidth: 8
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: "45"
}
},
yAxis: {
type: 'value'
},
series: yData
};
</span>`;
})
.join(``)
);
},
},
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true,
},
legend: {
data: legendData,
right: '1%',
icon: 'rect',
itemHeight: 8,
itemWidth: 8,
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: '45',
},
},
yAxis: {
type: 'value',
},
series: yData,
};
option && this.chart.setOption(option);
}
}
}
option && this.chart.setOption(option);
},
},
};
</script>

View File

@ -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>

View File

@ -1,96 +1,129 @@
<template>
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
<!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/>
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
<el-tab-pane label="柱状图" name="bar">
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
</el-tab-pane>
<el-tab-pane label="折线图" name="line">
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
</el-tab-pane>
</el-tabs>
<!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div>
</div>
<div
class="app-container contrastAnalysisBox"
id="contrastAnalysisBox">
<!-- 搜索工作栏 -->
<search-area
:isFold="isFold"
@submit="getList"
@export="exportExl" />
<div v-show="chartData.length">
<bar-chart
ref="analysisBarChart"
:chartData="chartData"
: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>
</template>
<script>
import { getCompare } from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import BarChart from "./components/barChart"
import LineChart from "./components/lineChart"
import { getCompare } from '@/api/analysis/energyAnalysis';
import SearchArea from './components/searchArea';
import BarChart from './components/barChart';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import FileSaver from 'file-saver';
import * as XLSX from 'xlsx/xlsx.mjs';
// import moment from 'moment'
export default {
name: 'ContrastAnalysis',
components: { SearchArea, BarChart, LineChart },
data() {
return {
isFold: false,
activeName: 'bar',
chartData: [],
timeDim: ''
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
})
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
},
methods: {
getList(params) {
this.timeDim = params.timeDim
getCompare({ ...params }).then((res) => {
console.log(res)
if (res.code === 0) {
this.chartData = res.data || []
} else {
this.chartData = []
}
})
},
switchChart() {
if (this.activeName === 'bar') {
this.$nextTick((res) => {
this.$refs.analysisBarChart.getChart()
})
} else {
this.$nextTick((res) => {
this.$refs.analysisLineChart.getChart()
})
}
}
}
}
name: 'ContrastAnalysis',
components: { SearchArea, BarChart },
mixins: [tableHeightMixin],
data() {
return {
isFold: false,
chartData: [],
timeDim: '',
tableProps: [],
list: [],
tableH: this.tableHeight(250) / 2,
};
},
mounted() {
window.addEventListener('resize', () => {
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
});
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
},
methods: {
_setTableHeight() {
this.tableH = this.tableHeight(250) / 2;
},
getList(params) {
this.timeDim = params.timeDim;
getCompare({ ...params }).then((res) => {
if (res.code === 0) {
this.getTableList(res.data || []);
this.chartData = res.data || [];
} else {
this.chartData = [];
}
});
},
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>
<style lang='scss'>
.contrastAnalysisBox {
.el-tabs__nav::after {
content: "";
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);
}
.contrast-out-table {
margin-top: 20px;
}
}
</style>

View File

@ -1,232 +1,253 @@
<template>
<el-form :inline="true" class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item label="对象选择" required>
<el-cascader
v-model="objArr"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
size="small"
style="width: 250px;"
clearable></el-cascader>
</el-form-item>
<el-form-item label="时间维度" required>
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
<el-option
v-for="item in timeType"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" required>
<div v-show="queryParams.type === 1">
<el-date-picker
v-model="monthValue"
type="month"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择月">
</el-date-picker>
</div>
<div v-show="queryParams.type === 2">
<el-date-picker
v-model="weekValue"
type="week"
format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择周">
</el-date-picker>
</div>
<div v-show="queryParams.type === 3">
<el-date-picker
v-model="dateValue"
type="date"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择日">
</el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
</el-form-item>
</el-form>
<el-form
:inline="true"
class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item
label="对象选择"
required>
<el-select
v-model="queryParams.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.type"
placeholder="请选择"
style="width: 80px"
size="small">
<el-option
v-for="item in timeType"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="时间"
required>
<div v-show="queryParams.type === 1">
<el-date-picker
v-model="monthValue"
type="month"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择月"></el-date-picker>
</div>
<div v-show="queryParams.type === 2">
<el-date-picker
v-model="weekValue"
type="week"
format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择周"></el-date-picker>
</div>
<div v-show="queryParams.type === 3">
<el-date-picker
v-model="dateValue"
type="date"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择日"></el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
@click="search">
查询
</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
@click="exportData"
plain>
导出
</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { getTree } from '@/api/base/factory'
import moment from 'moment'
import { getTree } from '@/api/analysis/energyAnalysis';
import moment from 'moment';
export default {
name: 'searchArea',
data() {
return {
//
queryParams: {
type: 1,
searchTime: null,
objId: null
},
timeType: [
{id: 1, name: '月'},
{id: 2, name: '周'},
{id: 3, name: '日'}
],
monthValue: '',
weekValue: '',
dateValue: '',
objArr: [],
objList: [],
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now()
}
},
pickerOptionsWeek: {
disabledDate(time) {
let day = Date.now()
let limitTime = moment(day).day(-1)
return time.getTime() > new Date(limitTime).getTime()
}
}
}
},
mounted() {
this.getObjTree()
},
methods: {
getObjTree() {
getTree().then(res => {
this.objList = res.data || []
})
},
selectTime() {
switch (this.queryParams.type) {
case 1:
this.queryParams.searchTime = this.monthValue
break;
case 2:
this.queryParams.searchTime = this.weekValue
break;
default:
this.queryParams.searchTime = this.dateValue
}
},
//
search() {
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象')
return false
} else {
this.queryParams.objId = this.objArr[this.objArr.length-1]
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度')
return false
}
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间')
return false
}
switch (this.queryParams.type) {
case 1:
this.queryParams.searchTime = this.transformTime(this.monthValue)
break;
case 2:
let value = moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59'
this.queryParams.searchTime = new Date(value).getTime()
break;
default:
let value2 = moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59'
this.queryParams.searchTime = new Date(value2).getTime()
}
this.$emit('submit', this.queryParams)
},
exportData() {
let name
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId)
} else {
this.$modal.msgWarning("对象不能为空")
return false
}
this.$emit('exportD', {name: name})
},
// name
getObjName(list, id) {
let _this = this
for (let i = 0; i < list.length; i++) {
let a = list[i]
if (a.id === id) {
return a.name
} else {
if (a.children && a.children.length > 0) {
let res = _this.getObjName(a.children, id)
if (res) {
return res
}
}
}
}
},
transformTime(timeStamp) {//
let year = moment(timeStamp).format('YYYY')
let month = moment(timeStamp).format('MM')
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
let value = new Date(newData).getTime()
return value
}
}
}
name: 'searchArea',
data() {
return {
//
queryParams: {
type: 1,
searchTime: null,
objId: null,
objType: 1,
},
timeType: [
{ id: 1, name: '月' },
{ id: 2, name: '周' },
{ id: 3, name: '日' },
],
monthValue: '',
weekValue: '',
dateValue: '',
objList: [],
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now();
},
},
pickerOptionsWeek: {
disabledDate(time) {
let day = Date.now();
let limitTime = moment(day).day(-1);
return time.getTime() > new Date(limitTime).getTime();
},
},
};
},
mounted() {
this.getObjTree();
},
methods: {
getObjTree() {
getTree().then((res) => {
this.objList = res.data || [];
if (this.objList.length > 0) {
this.queryParams.objId = this.objList[0].id;
}
});
},
selectTime() {
switch (this.queryParams.type) {
case 1:
this.queryParams.searchTime = this.monthValue;
break;
case 2:
this.queryParams.searchTime = this.weekValue;
break;
default:
this.queryParams.searchTime = this.dateValue;
}
},
//
search() {
if (!this.queryParams.objId) {
this.$modal.msgError('请选择对象');
return false;
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度');
return false;
}
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间');
return false;
}
switch (this.queryParams.type) {
case 1:
this.queryParams.searchTime = this.transformTime(this.monthValue);
break;
case 2:
let value =
moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59';
this.queryParams.searchTime = new Date(value).getTime();
break;
default:
let value2 =
moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59';
this.queryParams.searchTime = new Date(value2).getTime();
}
this.$emit('submit', this.queryParams);
},
exportData() {
let name;
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId);
} else {
this.$modal.msgWarning('对象不能为空');
return false;
}
this.$emit('exportD', { name: name });
},
// name
getObjName(list, id) {
for (let i = 0; i < list.length; i++) {
let a = list[i];
if (a.id === id) {
return a.name;
}
}
},
transformTime(timeStamp) {
//
let year = moment(timeStamp).format('YYYY');
let month = moment(timeStamp).format('MM');
let newData =
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
let value = new Date(newData).getTime();
return value;
},
},
};
</script>
<style lang='scss'>
/* 级联选择器 */
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
}
.demo-form-inline {
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0B58FF;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0B58FF;
}
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0b58ff;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0b58ff;
}
}
</style>
<style lang="scss" scoped>
.separateStyle {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
vertical-align: middle;
display: inline-block;
width: 1px;
height: 24px;
background: #e8e8e8;
vertical-align: middle;
}
.demo-form-inline {
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0B58FF;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
.el-form-item {
margin-right: 10px;
margin-bottom: 4px;
}
}
</style>

View File

@ -1,132 +1,140 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-area @submit="getList" @exportD="exportData"/>
<!-- 表格 -->
<div v-show="chartData.length">
<base-table
:table-props="tableProps"
:table-data="list"
class="qoq-out-table"
/>
<div class="chartTitle">环比分析图</div>
<div style='width: 100%'>
<line-chart ref="analysisLineChart" :chartData="chartData"/>
</div>
</div>
<!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-area
@submit="getList"
@exportD="exportData" />
<!-- 表格 -->
<div v-show="chartData.length">
<base-table
:table-props="tableProps"
:table-data="list"
class="qoq-out-table" />
<div class="chartTitle">环比分析图</div>
<div style="width: 100%">
<line-chart
ref="analysisLineChart"
:chartData="chartData" />
</div>
</div>
<!-- 没有数据 -->
<div
class="no-data-bg"
v-show="!chartData.length"></div>
</div>
</template>
<script>
import { getQoq } from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import LineChart from "./components/lineChart"
import FileSaver from "file-saver"
import * as XLSX from 'xlsx/xlsx.mjs'
import { getQoq } from '@/api/analysis/energyAnalysis';
import SearchArea from './components/searchArea';
import LineChart from './components/lineChart';
import FileSaver from 'file-saver';
import * as XLSX from 'xlsx/xlsx.mjs';
export default {
name: 'QoqAnalysis',
components: { SearchArea, LineChart },
data() {
return {
chartData: [],
tableProps: [],
list: []
}
},
methods: {
getList(params) {
getQoq({ ...params }).then((res) => {
if (res.code === 0 && res.data) {
this.getTableList(res.data)
} else {
this.chartData = []
this.list = []
}
})
},
getTableList(arr) {
let data = arr.data
let nameData = arr.nameData
let tempX = []
data[0].data.map((item) => {
let obj = {}
obj.prop = item.dynamicName
obj.label = item.dynamicName
obj.id = item.id
obj.children = []
tempX.push(obj)
})
for (let i = 0; i < nameData.length; i++) {
for (let j = 0; j < tempX.length; j++) {
if (tempX[j].id === nameData[i].parentId) {
let obj = {}
obj.prop = tempX[j].prop + '_' + nameData[i].name
obj.label = nameData[i].name
tempX[j].children.push(obj)
}
}
}
this.tableProps = [{prop: 'time',label: '时间'}].concat(tempX)
//
this.list = []
for (let k = 0; k < data.length; k++) {
let obj = {}
obj.time = data[k].time
let arr1 = data[k].data
obj.type = []
for (let q = 0; q < arr1.length; q++) {
let name = arr1[q].dynamicName
obj.type.push(name)
let arr2 = arr1[q].children
for (let p = 0; p < arr2.length; p++) {
let prop = name + '_' + arr2[p].dynamicName
obj[prop] = arr2[p].dynamicValue
}
}
this.list.push(obj)
}
this.chartData = this.list
},
exportData(val) {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(document.querySelector(".qoq-out-table"))
let fileName = val.name + "环比分析.xlsx"
var wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array"
})
try {
FileSaver.saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
fileName
)
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout);
}
return wbout
} else {
this.$modal.msgWarning("暂无数据导出")
}
}
}
}
name: 'QoqAnalysis',
components: { SearchArea, LineChart },
data() {
return {
chartData: [],
tableProps: [],
list: [],
};
},
methods: {
getList(params) {
getQoq({ ...params }).then((res) => {
if (res.code === 0 && res.data) {
this.getTableList(res.data);
} else {
this.chartData = [];
this.list = [];
}
});
},
getTableList(arr) {
let data = arr.data;
let nameData = arr.nameData;
let tempX = [];
data[0].data.map((item) => {
let obj = {};
obj.prop = item.dynamicName;
obj.label = item.dynamicName;
obj.id = item.id;
obj.children = [];
tempX.push(obj);
});
for (let i = 0; i < nameData.length; i++) {
for (let j = 0; j < tempX.length; j++) {
if (tempX[j].id === nameData[i].parentId) {
let obj = {};
obj.prop = tempX[j].prop + '_' + nameData[i].name;
obj.label = nameData[i].name;
tempX[j].children.push(obj);
}
}
}
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
//
this.list = [];
for (let k = 0; k < data.length; k++) {
let obj = {};
obj.time = data[k].time;
let arr1 = data[k].data;
obj.type = [];
for (let q = 0; q < arr1.length; q++) {
let name = arr1[q].dynamicName;
obj.type.push(name);
let arr2 = arr1[q].children;
for (let p = 0; p < arr2.length; p++) {
let prop = name + '_' + arr2[p].dynamicName;
obj[prop] = arr2[p].dynamicValue;
}
}
this.list.push(obj);
}
this.chartData = this.list;
},
exportData(val) {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(
document.querySelector('.qoq-out-table')
);
let fileName = val.name + '环比分析.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>
<style lang='scss' scoped>
.chartTitle {
font-size: 16px;
color: #000;
margin-top: 20px;
font-size: 16px;
color: #000;
margin-top: 20px;
}
.chartTitle::before {
content: '';
display: inline-block;
width: 4px;
height: 18px;
background-color: #0B58FF;
border-radius: 1px;
margin-right: 8px;
vertical-align: bottom;
content: '';
display: inline-block;
width: 4px;
height: 18px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
vertical-align: bottom;
}
</style>

View File

@ -1,103 +1,102 @@
<template>
<div
id="analysischartLine"
style="width: 100%"
:style="{ height: chartHeight + 'px' }"
></div>
<div
id="analysischartLine"
style="width: 100%"
:style="{ height: chartHeight + 'px' }"></div>
</template>
<script>
import * as echarts from 'echarts'
import resize from '@/utils/chartMixins/resize'
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 xData = []
let yData = []
for (let i = 0; i < this.chartData.length; i++) {
let time = ""
if (this.timeDim === '3') {
let year = this.chartData[i].time.slice(0,4)
let weak = this.chartData[i].time.slice(4,6)
time = year+' 第 '+weak+' 周'
} else {
time = this.chartData[i].time
}
xData.push(time)
yData.push(this.chartData[i].useNum)
}
name: 'LineChart',
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
chartHeight: this.tableHeight(214) - 100,
};
},
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 xData = [];
let yData = [];
for (let i = 0; i < this.chartData.length; i++) {
let time = '';
if (this.timeDim === '3') {
let year = this.chartData[i].time.slice(0, 4);
let weak = this.chartData[i].time.slice(4, 6);
time = year + ' 第 ' + weak + ' 周';
} else {
time = this.chartData[i].time;
}
xData.push(time);
yData.push(this.chartData[i].useNum);
}
var option = {
color:['#288AFF'],
// tooltip: {
// trigger: 'axis'
// },
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: "45"
}
},
yAxis: {
type: 'value'
},
series: [
{
data: yData,
type: 'line'
}
]
};
var option = {
color: ['#288AFF'],
// tooltip: {
// trigger: 'axis'
// },
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true,
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: '45',
},
},
yAxis: {
type: 'value',
},
series: [
{
data: yData,
type: 'line',
},
],
};
option && this.chart.setOption(option);
}
}
}
option && this.chart.setOption(option);
},
},
};
</script>

View File

@ -1,94 +1,113 @@
<template>
<div class="app-container trendAnalysisBox" id="trendAnalysisBox">
<!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/>
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
<el-tab-pane label="柱状图" name="bar">
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim"/>
</el-tab-pane>
<el-tab-pane label="折线图" name="line">
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
</el-tab-pane>
</el-tabs>
<!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div>
</div>
<div
class="app-container trendAnalysisBox"
id="trendAnalysisBox">
<!-- 搜索工作栏 -->
<search-area
:isFold="isFold"
@submit="getList"
@export="exportExl" />
<div v-show="chartData.length">
<base-table
:table-props="tableProps"
:table-data="list"
class="trend-out-table" />
<line-chart
ref="analysisLineChart"
:chartData="chartData"
:timeDim="timeDim" />
</div>
<!-- 没有数据 -->
<div
class="no-data-bg"
v-show="!chartData.length"></div>
</div>
</template>
<script>
import { getEnergyTrend } from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import BarChart from "./components/barChart"
import LineChart from "./components/lineChart"
import { getEnergyTrend, exportTrend } from '@/api/analysis/energyAnalysis';
import SearchArea from './components/searchArea';
import LineChart from './components/lineChart';
// import moment from 'moment'
export default {
name: 'TrendAnalysis',
components: { SearchArea, BarChart, LineChart },
data() {
return {
isFold: false,
activeName: 'bar',
chartData: [],
timeDim: ''
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
})
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
},
methods: {
getList(params) {
this.timeDim = params.timeDim
getEnergyTrend({ ...params }).then((res) => {
if (res.code === 0) {
this.chartData = res.data
} else {
this.chartData = []
}
})
},
switchChart() {
if (this.activeName === 'bar') {
this.$nextTick((res) => {
this.$refs.analysisBarChart.getChart()
})
} else {
this.$nextTick((res) => {
this.$refs.analysisLineChart.getChart()
})
}
}
}
}
name: 'TrendAnalysis',
components: { SearchArea, LineChart },
data() {
return {
isFold: false,
chartData: [],
timeDim: '',
tableProps: [],
list: [],
};
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
});
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
},
methods: {
getList(params) {
this.timeDim = params.timeDim;
getEnergyTrend({ ...params }).then((res) => {
if (res.code === 0) {
this.getTableList(res.data || []);
this.chartData = res.data || [];
} else {
this.chartData = [];
}
});
},
getTableList(arr) {
this.tableProps = [];
this.list = [];
let tempX = [];
let listObj = { useNum: '消耗量' }; //
for (let i = 0; i < arr.length; i++) {
let obj = {};
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>
<style lang='scss'>
.trendAnalysisBox {
.el-tabs__nav::after {
content: "";
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);
}
.trend-out-table {
margin-bottom: 15px;
}
}
</style>

View File

@ -1,205 +1,227 @@
<template>
<el-form :inline="true" class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item label="对象选择" required>
<el-cascader
v-model="objArr"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
size="small"
clearable></el-cascader>
</el-form-item>
<el-form-item label="时间维度" required>
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
<el-option
v-for="item in timeType"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" required>
<div v-show="queryParams.type === 1 || queryParams.type === 2">
<el-date-picker
v-model="yearValue"
type="year"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择年">
</el-date-picker>
</div>
<div v-show="queryParams.type === 3">
<el-date-picker
v-model="yearMonth"
type="month"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择月">
</el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
</el-form-item>
</el-form>
<el-form
:inline="true"
class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item
label="对象选择"
required>
<el-select
v-model="queryParams.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.type"
placeholder="请选择"
style="width: 80px"
size="small">
<el-option
v-for="item in timeType"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="时间"
required>
<div v-show="queryParams.type === 1 || queryParams.type === 2">
<el-date-picker
v-model="yearValue"
type="year"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择年"></el-date-picker>
</div>
<div v-show="queryParams.type === 3">
<el-date-picker
v-model="yearMonth"
type="month"
:picker-options="pickerOptions"
@change="selectTime"
:clearable="false"
size="small"
placeholder="选择月"></el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
@click="search">
查询
</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
@click="exportData"
plain>
导出
</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { getTree } from '@/api/base/factory'
import moment from 'moment'
import { getTree } from '@/api/analysis/energyAnalysis';
import moment from 'moment';
export default {
name: 'searchArea',
data() {
return {
//
queryParams: {
type: 1, // 123
searchTime: null,
objId: null
},
timeType: [
{id: 1, name: '季度'},
{id: 2, name: '月'},
{id: 3, name: '日'}
],
yearValue: '',
yearMonth: '',
objArr: [],
objList: [],
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now()
}
}
}
},
mounted() {
this.getObjTree()
},
methods: {
getObjTree() {
getTree().then(res => {
this.objList = res.data || []
})
},
selectTime() {
if (this.queryParams.type === 3) {
this.queryParams.searchTime = this.yearMonth
} else {
this.queryParams.searchTime = this.yearValue
}
},
//
search() {
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象')
return false
} else {
this.queryParams.objId = this.objArr[this.objArr.length-1]
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度')
return false
}
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间')
return false
}
if (this.queryParams.type === 3) {
this.queryParams.searchTime = this.transformTime(this.yearMonth) + ''
} else {
this.queryParams.searchTime = this.transformYear(this.yearValue) + ''
}
this.$emit('submit', this.queryParams)
},
exportData() {
let name
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId)
} else {
this.$modal.msgWarning("对象不能为空")
return false
}
this.$emit('exportD', {name: name})
},
// name
getObjName(list, id) {
let _this = this
for (let i = 0; i < list.length; i++) {
let a = list[i]
if (a.id === id) {
return a.name
} else {
if (a.children && a.children.length > 0) {
let res = _this.getObjName(a.children, id)
if (res) {
return res
}
}
}
}
},
transformTime(timeStamp) {//
let year = moment(timeStamp).format('YYYY')
let month = moment(timeStamp).format('MM')
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) {//
let year = moment(timeStamp).format('YYYY')
let newData = year+'-12-31 23:59:59'
let value = new Date(newData).getTime()
return value
}
}
}
name: 'searchArea',
data() {
return {
//
queryParams: {
type: 1, // 123
searchTime: null,
objId: null,
objType: 1,
},
timeType: [
{ id: 1, name: '季度' },
{ id: 2, name: '月' },
{ id: 3, name: '日' },
],
yearValue: '',
yearMonth: '',
objList: [],
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now();
},
},
};
},
mounted() {
this.getObjTree();
},
methods: {
getObjTree() {
getTree().then((res) => {
this.objList = res.data || [];
if (this.objList.length > 0) {
this.queryParams.objId = this.objList[0].id;
}
});
},
selectTime() {
if (this.queryParams.type === 3) {
this.queryParams.searchTime = this.yearMonth;
} else {
this.queryParams.searchTime = this.yearValue;
}
},
//
search() {
if (!this.queryParams.objId) {
this.$modal.msgError('请选择对象');
return false;
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度');
return false;
}
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间');
return false;
}
if (this.queryParams.type === 3) {
this.queryParams.searchTime = this.transformTime(this.yearMonth) + '';
} else {
this.queryParams.searchTime = this.transformYear(this.yearValue) + '';
}
this.$emit('submit', this.queryParams);
},
exportData() {
let name;
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId);
} else {
this.$modal.msgWarning('对象不能为空');
return false;
}
this.$emit('exportD', { name: name });
},
// name
getObjName(list, id) {
for (let i = 0; i < list.length; i++) {
let a = list[i];
if (a.id === id) {
return a.name;
}
}
},
transformTime(timeStamp) {
//
let year = moment(timeStamp).format('YYYY');
let month = moment(timeStamp).format('MM');
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) {
//
let year = moment(timeStamp).format('YYYY');
let newData = year + '-12-31 23:59:59';
let value = new Date(newData).getTime();
return value;
},
},
};
</script>
<style lang='scss'>
/* 级联选择器 */
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
}
.demo-form-inline {
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0B58FF;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0B58FF;
}
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0b58ff;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0b58ff;
}
}
</style>
<style lang="scss" scoped>
.demo-form-inline {
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0B58FF;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
.el-form-item {
margin-right: 10px;
margin-bottom: 4px;
}
}
.separateStyle {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
vertical-align: middle;
display: inline-block;
width: 1px;
height: 24px;
background: #e8e8e8;
vertical-align: middle;
}
</style>

View File

@ -1,139 +1,155 @@
<template>
<el-form ref="form" :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
v-for="item in plcList"
:key="item.id"
:label="item.plcTableName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="对象" prop="bindObjectId">
<el-cascader
style='width: 100%;'
v-model="objIds"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
@change="selectObj"
clearable></el-cascader>
</el-form-item>
</el-form>
<el-form
ref="form"
: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
v-for="item in plcList"
:key="item.id"
:label="item.plcTableName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="对象"
prop="bindObjectId">
<el-cascader
style="width: 100%"
v-model="objIds"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
@change="selectObj"
clearable></el-cascader>
</el-form-item>
</el-form>
</template>
<script>
import { getEnergyPlcConnect, updateEnergyPlcConnect, createEnergyPlcConnect } from '@/api/base/energyPlcConnect'
import { getEnergyPlcAll } from '@/api/base/energyPlc'
import {
getEnergyPlcConnect,
updateEnergyPlcConnect,
createEnergyPlcConnect,
} from '@/api/base/energyPlcConnect';
import { getEnergyPlcAll } from '@/api/base/energyPlc';
export default {
name: 'EnergyPlcConnectAdd',
props: {
objList: {
type: Array,
default: () => []
},
},
data() {
return {
form: {
id: '',
plcId: '',
bindObjectId: '',
bindObjectType: ''
},
objIds: [],//
plcList: [],
isEdit: false, //
rules: {
plcId: [{ required: true, message: '关联表名不能为空', trigger: 'change' }],
bindObjectId: [{ required: true, message: '对象不能为空', trigger: 'change' }]
}
}
},
methods: {
init(id) {
getEnergyPlcAll().then((res) => {
this.plcList = res.data || []
})
if (id) {
this.isEdit = true
this.form.id = id
getEnergyPlcConnect( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.objIds = this.changeDetSelect(this.form.bindObjectId, this.objList)
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
//
changeDetSelect(key, treeData) {
let arr = [] //
let returnArr = [] //
let depth = 0 //
//
function childrenEach(childrendData, depthN) {
for (var j = 0; j < childrendData.length; j++) {
depth = depthN
arr[depthN] = childrendData[j].id
if (childrendData[j].id == key) {
returnArr = arr.slice(0, depthN + 1)
break
} else {
if (childrendData[j].children) {
depth++
childrenEach(childrendData[j].children, depth)
}
}
}
return returnArr
}
return childrenEach(treeData, depth)
},
selectObj(val) {
this.form.bindObjectId = val[val.length-1]
this.form.bindObjectType = val.length-1
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.isEdit) {
//
updateEnergyPlcConnect({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyPlcConnect({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.form.id = ''
this.form.plcId = ''
this.form.bindObjectId = ''
this.form.bindObjectType = ''
this.objIds = []
this.isEdit = false
}
}
}
</script>
<style>
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
}
</style>
name: 'EnergyPlcConnectAdd',
props: {
objList: {
type: Array,
default: () => [],
},
},
data() {
return {
form: {
id: '',
plcId: '',
bindObjectId: '',
bindObjectType: '',
},
objIds: [], //
plcList: [],
isEdit: false, //
rules: {
plcId: [
{ required: true, message: '关联表名不能为空', trigger: 'change' },
],
bindObjectId: [
{ required: true, message: '对象不能为空', trigger: 'change' },
],
},
};
},
methods: {
init(id) {
getEnergyPlcAll().then((res) => {
this.plcList = res.data || [];
});
if (id) {
this.isEdit = true;
this.form.id = id;
getEnergyPlcConnect(id).then((res) => {
if (res.code === 0) {
this.form = res.data;
this.objIds = this.changeDetSelect(
this.form.bindObjectId,
this.objList
);
}
});
} else {
this.isEdit = false;
this.form.id = '';
}
},
//
changeDetSelect(key, treeData) {
let arr = []; //
let returnArr = []; //
let depth = 0; //
//
function childrenEach(childrendData, depthN) {
for (var j = 0; j < childrendData.length; j++) {
depth = depthN;
arr[depthN] = childrendData[j].id;
if (childrendData[j].id == key) {
returnArr = arr.slice(0, depthN + 1);
break;
} else {
if (childrendData[j].children) {
depth++;
childrenEach(childrendData[j].children, depth);
}
}
}
return returnArr;
}
return childrenEach(treeData, depth);
},
selectObj(val) {
this.form.bindObjectId = val[val.length - 1];
this.form.bindObjectType = val.length - 1;
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.isEdit) {
//
updateEnergyPlcConnect({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
createEnergyPlcConnect({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.form.id = '';
this.form.plcId = '';
this.form.bindObjectId = '';
this.form.bindObjectType = '';
this.objIds = [];
this.isEdit = false;
},
},
};
</script>

View File

@ -1,236 +1,270 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
:max-height="tableH">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
@confirm="handleConfirm" :before-close="handleCancel" width='30%'>
<energy-plc-connect-add ref="energyPlcConnect" :objList="objList" @successSubmit="successSubmit" />
</base-dialog>
<!-- 参数绑定/查看 -->
<energy-plc-param v-if="paramVisible" ref="plcParam" @closeDrawer="closeDrawer"
:energyTypeList="energyTypeList"></energy-plc-param>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="160"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="30%">
<energy-plc-connect-add
ref="energyPlcConnect"
:objList="objList"
@successSubmit="successSubmit" />
</base-dialog>
<!-- 参数绑定/查看 -->
<energy-plc-param
v-if="paramVisible"
ref="plcParam"
@closeDrawer="closeDrawer"
:energyTypeList="energyTypeList"></energy-plc-param>
</div>
</template>
<script>
import { getEnergyPlcConnectPage, deleteEnergyPlcConnect } from "@/api/base/energyPlcConnect";
import {
getEnergyPlcConnectPage,
deleteEnergyPlcConnect,
} from '@/api/base/energyPlcConnect';
// import { publicFormatter } from '@/utils/dict'
import { getTree } from '@/api/base/factory'
import { getEnergyTypeListAll } from '@/api/base/energyType'
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd'
import EnergyPlcParam from './components/energyPlcParam'
import { getTree } from '@/api/analysis/energyAnalysis';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd';
import EnergyPlcParam from './components/energyPlcParam';
const tableProps = [
{
prop: 'objName',
label: '对象'
},
{
prop: 'objCode',
label: '对象编码',
showOverflowtooltip: true
},
{
prop: 'plcTableName',
label: '关联表名'
},
{
prop: 'plcTableCode',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'cnName',
label: '标识名',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'varNum',
label: '绑定参数数量'
}
]
{
prop: 'objName',
label: '对象',
},
{
prop: 'objCode',
label: '对象编码',
showOverflowtooltip: true,
},
{
prop: 'plcTableName',
label: '关联表名',
},
{
prop: 'plcTableCode',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'cnName',
label: '标识名',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'varNum',
label: '绑定参数数量',
},
];
export default {
name: "EnergyPlcConnect",
components: { EnergyPlcConnectAdd, EnergyPlcParam },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'cnName'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc-connect:bind')
? {
type: 'connect',
btnName: '绑定'
}
: undefined,
{
type: 'detail',
btnName: '详情'
},
this.$auth.hasPermi('base:energy-plc-connect:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc-connect:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
cnName: null
},
paramVisible: false,
energyTypeList: [],
objList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
mounted() {
//
this.getEnergyTypeList()
//
this.getObjTree()
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.cnName = val.cnName
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlcConnect.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcConnectPage(this.queryParams).then(response => {
let arr = response.data.list || [];
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyPlcConnect.init(val.data.id)
})
this.centervisible = true
break
case 'delete':
this.handleDelete(val.data)
break
case 'detail':
this.paramVisible = true
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'detail')
})
break
default:
this.paramVisible = true
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'connect')
})
}
},
handleCancel() {
this.$refs.energyPlcConnect.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlcConnect.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除对象为"' + row.objName + '"的数据项?').then(function () {
return deleteEnergyPlcConnect(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
closeDrawer() {
this.getList()
},
getEnergyTypeList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || []
})
},
getObjTree() {
getTree().then(res => {
this.objList = res.data || []
})
}
}
name: 'EnergyPlcConnect',
components: { EnergyPlcConnectAdd, EnergyPlcParam },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'cnName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc-connect:bind')
? {
type: 'connect',
btnName: '绑定',
}
: undefined,
{
type: 'detail',
btnName: '详情',
},
this.$auth.hasPermi('base:energy-plc-connect:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc-connect:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
cnName: null,
},
paramVisible: false,
energyTypeList: [],
objList: [],
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
},
mounted() {
//
this.getEnergyTypeList();
//
this.getObjTree();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.cnName = val.cnName;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlcConnect.init();
});
}
},
/** 查询列表 */
getList() {
getEnergyPlcConnectPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyPlcConnect.init(val.data.id);
});
this.centervisible = true;
break;
case 'delete':
this.handleDelete(val.data);
break;
case 'detail':
this.paramVisible = true;
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'detail');
});
break;
default:
this.paramVisible = true;
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'connect');
});
}
},
handleCancel() {
this.$refs.energyPlcConnect.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyPlcConnect.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除对象为"' + row.objName + '"的数据项?')
.then(function () {
return deleteEnergyPlcConnect(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
closeDrawer() {
this.getList();
},
getEnergyTypeList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || [];
});
},
getObjTree() {
getTree().then((res) => {
this.objList = res.data || [];
});
},
},
};
</script>

View File

@ -1,329 +1,422 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="能源类型" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型编码" prop="code">
<el-input v-model="form.code" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计价方式" prop="pricingMethod">
<el-select 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-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-show="form.pricingMethod === 2">
<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-col>
<el-col :span="12" v-show="form.pricingMethod === 1">
<el-form-item 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-form-item>
</el-col>
<el-col :span="24" v-show="form.pricingMethod === 0">
<el-form-item 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" />
</base-table>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.pricingMethod === 1">
<el-form-item 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" />
</base-table>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否推送" prop="push">
<el-switch v-model="form.push"></el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form
ref="form"
:rules="rules"
label-width="100px"
:model="form">
<el-row>
<el-col :span="12">
<el-form-item
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-col>
<el-col :span="12">
<el-form-item
label="类型编码"
prop="code">
<el-input
v-model="form.code"
disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="单位"
prop="unit">
<el-select
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-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="计价方式"
prop="pricingMethod">
<el-select
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-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span="12"
v-show="form.pricingMethod === 2">
<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-col>
<el-col
:span="12"
v-show="form.pricingMethod === 1">
<el-form-item
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-form-item>
</el-col>
<el-col
:span="24"
v-show="form.pricingMethod === 0">
<el-form-item
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" />
</base-table>
</el-form-item>
</el-col>
<el-col
:span="24"
v-show="form.pricingMethod === 1">
<el-form-item
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" />
</base-table>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="描述"
prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyType, updateEnergyType, createEnergyType, getEnergyTypeCode } from '@/api/base/energyType'
import inputArea from './InputArea.vue'
import timePickerArea from './TimePickerArea.vue'
import {
getEnergyType,
updateEnergyType,
createEnergyType,
getEnergyTypeCode,
} from '@/api/base/energyType';
import inputArea from './InputArea.vue';
import timePickerArea from './TimePickerArea.vue';
const tableProps1 = [
{
prop: 'startTime',
label: '开始时间',
subcomponent: timePickerArea
},
{
prop: 'endTime',
label: '结束时间',
subcomponent: timePickerArea
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea
}
]
{
prop: 'startTime',
label: '开始时间',
subcomponent: timePickerArea,
},
{
prop: 'endTime',
label: '结束时间',
subcomponent: timePickerArea,
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea,
},
];
const tableProps2 = [
{
prop: 'startUsed',
label: '下限值',
// subcomponent: inputArea
},
{
prop: 'endUsed',
label: '上限量',
subcomponent: inputArea
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea
}
]
{
prop: 'startUsed',
label: '下限值',
// subcomponent: inputArea
},
{
prop: 'endUsed',
label: '上限量',
subcomponent: inputArea,
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea,
},
];
export default {
name: 'energyTypeAdd',
data() {
return {
form: {
id: '',
name: '',
code: '',
unit: '',
singlePrice: 0,
pricingMethod: 2,
dim: '',
push: false,
description: ''
},
isEdit: false, //
rules: {
name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }],
pricingMethod: [{ required: true, message: '计价方式不能为空', trigger: 'change' }]
},
timeKye: 0,
usedKye: 0,
tableProps1,
tableProps2,
tableData1: [],
tableData2: [],
tableBtn: [
{
type: 'delete',
name: '删除'
}
],
addButtonShow: '新增'
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getEnergyType(id).then((res) => {
if (res.code === 0) {
this.form.name = res.data.name
this.form.code = res.data.code
this.form.unit = res.data.unit
this.form.pricingMethod = res.data.pricingMethod
this.form.push = res.data.push ? true : false
this.form.description = res.data.description
switch (this.form.pricingMethod) {
case 0:
this.tableData1 = res.data.segPriceList || []
break;
case 1:
this.tableData2 = res.data.usedPriceList || []
this.form.dim = res.data.dim
break;
default:
this.form.singlePrice = res.data.singlePrice || 0
}
}
})
console.log(this.form)
} else {
this.isEdit = false
this.form.id = ''
getEnergyTypeCode().then((res) => {
this.form.code = res.data
})
}
},
//
inputChange1(val) {
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop]
if ((this.tableData1.length > val._pageIndex) && val.prop === 'endTime') {
this.tableData1[val._pageIndex].startTime = val[val.prop]
}
this.timeKye++
},
inputChange2(val) {
//
if (!!val.endUsed && (val.endUsed <= val.startUsed)) {
this.$modal.msgError('上限值不能等于或者小于下限值')
return false
}
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop]
if ((this.tableData2.length > val._pageIndex) && val.prop === 'endUsed') {
this.tableData2[val._pageIndex].startUsed = val[val.prop]
}
this.usedKye++
},
//
emitButtonClick1() {
let n = this.tableData1.length
let obj = {}
obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime
obj.endTime = ''
obj.price = 0
this.tableData1.push(obj)
},
emitButtonClick2() {
let n = this.tableData2.length
let obj = {}
obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed
obj.endUsed = 0
obj.price = 0
this.tableData2.push(obj)
},
//
handleClick1(val) {
this.tableData1.splice(val.data._pageIndex - 1, 1)
this.timeKye++
},
handleClick2(val) {
this.tableData2.splice(val.data._pageIndex - 1, 1)
this.usedKye++
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
switch (this.form.pricingMethod) {
case 0://
if (this.tableData1.length === 0) {
this.$modal.msgError('时间段表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
case 1:// 使
if (this.tableData2.length === 0) {
this.$modal.msgError('使用量表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
default://
if (!this.form.singlePrice) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
}
console.log(this.form)
if (this.isEdit) {
//
updateEnergyType({
id: this.form.id,
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
push: this.form.push ? 1 : 0
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyType({
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [],
push: this.form.push ? 1 : 0
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.form.singlePrice = 0
this.isEdit = false
this.timeKye = 0
this.usedKye = 0
this.tableData1 = []
this.tableData2 = []
}
}
}
name: 'energyTypeAdd',
data() {
return {
form: {
id: '',
name: '',
code: '',
unit: '',
singlePrice: 0,
pricingMethod: 2,
dim: '',
description: '',
},
isEdit: false, //
rules: {
name: [
{ required: true, message: '能源类型不能为空', trigger: 'blur' },
],
pricingMethod: [
{ required: true, message: '计价方式不能为空', trigger: 'change' },
],
},
timeKye: 0,
usedKye: 0,
tableProps1,
tableProps2,
tableData1: [],
tableData2: [],
tableBtn: [
{
type: 'delete',
name: '删除',
},
],
addButtonShow: '新增',
};
},
methods: {
init(id) {
if (id) {
this.isEdit = true;
this.form.id = id;
getEnergyType(id).then((res) => {
if (res.code === 0) {
this.form.name = res.data.name;
this.form.code = res.data.code;
this.form.unit = res.data.unit;
this.form.pricingMethod = res.data.pricingMethod;
this.form.description = res.data.description;
switch (this.form.pricingMethod) {
case 0:
this.tableData1 = res.data.segPriceList || [];
break;
case 1:
this.tableData2 = res.data.usedPriceList || [];
this.form.dim = res.data.dim;
break;
default:
this.form.singlePrice = res.data.singlePrice || 0;
}
}
});
console.log(this.form);
} else {
this.isEdit = false;
this.form.id = '';
getEnergyTypeCode().then((res) => {
this.form.code = res.data;
});
}
},
//
inputChange1(val) {
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop];
if (this.tableData1.length > val._pageIndex && val.prop === 'endTime') {
this.tableData1[val._pageIndex].startTime = val[val.prop];
}
this.timeKye++;
},
inputChange2(val) {
//
if (!!val.endUsed && val.endUsed <= val.startUsed) {
this.$modal.msgError('上限值不能等于或者小于下限值');
return false;
}
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop];
if (this.tableData2.length > val._pageIndex && val.prop === 'endUsed') {
this.tableData2[val._pageIndex].startUsed = val[val.prop];
}
this.usedKye++;
},
//
emitButtonClick1() {
let n = this.tableData1.length;
let obj = {};
obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime;
obj.endTime = '';
obj.price = 0;
this.tableData1.push(obj);
},
emitButtonClick2() {
let n = this.tableData2.length;
let obj = {};
obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed;
obj.endUsed = 0;
obj.price = 0;
this.tableData2.push(obj);
},
//
handleClick1(val) {
this.tableData1.splice(val.data._pageIndex - 1, 1);
this.timeKye++;
},
handleClick2(val) {
this.tableData2.splice(val.data._pageIndex - 1, 1);
this.usedKye++;
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
switch (this.form.pricingMethod) {
case 0: //
if (this.tableData1.length === 0) {
this.$modal.msgError('时间段表格数据不能为空');
return false;
} else {
this.tableData1.map((item) => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查');
return false;
}
});
}
break;
case 1: // 使
if (this.tableData2.length === 0) {
this.$modal.msgError('使用量表格数据不能为空');
return false;
} else {
this.tableData1.map((item) => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查');
return false;
}
});
}
break;
default: //
if (!this.form.singlePrice) {
this.$modal.msgError('单价有误请检查,请检查');
return false;
}
}
console.log(this.form);
if (this.isEdit) {
//
updateEnergyType({
id: this.form.id,
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
singlePrice:
this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList:
this.form.pricingMethod === 0 ? this.tableData1 : [],
usedPriceList:
this.form.pricingMethod === 1 ? this.tableData2 : [],
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
createEnergyType({
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
dim: this.form.pricingMethod === 1 ? this.form.dim : '',
singlePrice:
this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList:
this.form.pricingMethod === 0 ? this.tableData1 : [],
usedPriceList:
this.form.pricingMethod === 1 ? this.tableData2 : [],
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
this.form.singlePrice = 0;
this.isEdit = false;
this.timeKye = 0;
this.usedKye = 0;
this.tableData1 = [];
this.tableData2 = [];
},
},
};
</script>

View File

@ -1,224 +1,191 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-type-add ref="energyType" @successSubmit="successSubmit" />
</base-dialog>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
:removeBlue="true"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-type-add
ref="energyType"
@successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyTypePage, deleteEnergyType } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict'
import InnerTable from './components/InnerTable'
import EnergyTypeAdd from './components/energyTypeAdd'
import { getEnergyTypePage, deleteEnergyType } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import InnerTable from './components/InnerTable';
import EnergyTypeAdd from './components/energyTypeAdd';
const tableProps = [
{
prop: 'code',
label: '类型编码',
showOverflowtooltip: true,
minWidth: 150
},
{
prop: 'name',
label: '能源类型'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit')
},
{
prop: 'pricingMethod',
label: '计价方式'
},
{
prop: 'push',
label: '是否推送',
filter: publicFormatter('push')
},
{
prop: 'price',
label: '价格(元)',
subcomponent: InnerTable
}
]
{
prop: 'code',
label: '类型编码',
showOverflowtooltip: true,
minWidth: 150,
},
{
prop: 'name',
label: '能源类型',
filter: publicFormatter('energy_type'),
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'pricingMethod',
label: '计价方式',
},
{
prop: 'price',
label: '价格(元)',
subcomponent: InnerTable,
},
];
export default {
name: "EnergyType",
components: { EnergyTypeAdd },
data() {
return {
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' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-type:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-type:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
pricingMethodList: [
{value: 0,label: '分时间段计价'},
{value: 1,label: '分使用量计价'},
{value: 2,label: '单一计价'}
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
code: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
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.$refs.energyType.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyTypePage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.pricingMethodList.map(i => {
if (item.pricingMethod === i.value) {
item.pricingMethod = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyType.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyType.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyType.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyType(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
name: 'EnergyType',
components: { EnergyTypeAdd },
data() {
return {
formConfig: [
{
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-type:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-type:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(220),
pricingMethodList: [
{ value: 0, label: '分时间段计价' },
{ value: 1, label: '分使用量计价' },
{ value: 2, label: '单一计价' },
],
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 100,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(220);
});
this.getList();
},
methods: {
buttonClick() {
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyType.init();
});
},
/** 查询列表 */
getList() {
getEnergyTypePage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.pricingMethodList.map((i) => {
if (item.pricingMethod === i.value) {
item.pricingMethod = i.label;
}
});
});
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyType.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.energyType.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyType.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?')
.then(function () {
return deleteEnergyType(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,282 +1,360 @@
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="抄表方式" prop="method">
<el-select v-model="form.method" placeholder="请选择" style="width: 100%;" @change="changeMethod">
<el-option
v-for="item in getDictDatas(DICT_TYPE.METHOD)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if='form.method == 1'>
<el-form-item label="监控对象" prop="objectId">
<el-cascader
style='width: 100%;'
v-model="objIds"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
@change="selectObj"
clearable></el-cascader>
</el-form-item>
</el-col>
<el-col :span="12" v-if='form.method == 2'>
<el-form-item label="水/气表名" prop="tableName">
<el-select v-model="form.tableName" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监控能源类型" prop="energyTypeId">
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable @change="toggleType">
<el-option
v-for="item in this.energyTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if='form.method == 1'>
<el-form-item 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-form-item>
</el-col>
<el-col :span="12" 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
v-for="item in detailList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="指标类型" prop="limitType">
<el-select v-model="form.limitType" placeholder="请选择" style="width: 100%;" :disabled='form.method == 2'>
<el-option
v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="消耗量阈值">
<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-col>
</el-row>
</el-form>
<el-form
ref="form"
:rules="rules"
label-width="110px"
:model="form">
<el-row>
<el-col :span="12">
<el-form-item
label="抄表方式"
prop="method">
<el-select
v-model="form.method"
placeholder="请选择"
style="width: 100%"
@change="changeMethod">
<el-option
v-for="item in getDictDatas(DICT_TYPE.METHOD)"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="form.method == 1">
<el-form-item
label="监控对象"
prop="objectId">
<el-cascader
style="width: 100%"
v-model="objIds"
:options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
@change="selectObj"
clearable></el-cascader>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="form.method == 2">
<el-form-item
label="能源表名"
prop="tableName">
<el-select
v-model="form.tableName"
placeholder="请选择"
style="width: 100%">
<el-option
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="监控能源类型"
prop="energyTypeId">
<el-select
v-model="form.energyTypeId"
placeholder="请选择"
style="width: 100%"
filterable
@change="toggleType">
<el-option
v-for="item in this.energyTypeList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="form.method == 1">
<el-form-item
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-form-item>
</el-col>
<el-col
:span="12"
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
v-for="item in detailList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="指标类型"
prop="limitType">
<el-select
v-model="form.limitType"
placeholder="请选择"
style="width: 100%"
:disabled="form.method == 2">
<el-option
v-for="item in getDictDatas(DICT_TYPE.MONITOR_INDEX_TYPE)"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="消耗量阈值">
<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-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyLimit, updateEnergyLimit, createEnergyLimit, getEnergyParamList } from '@/api/monitoring/energyLimit'
import {
getEnergyLimit,
updateEnergyLimit,
createEnergyLimit,
getEnergyParamList,
} from '@/api/monitoring/energyLimit';
export default {
name: 'energyLimitAdd',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return []
}
},
objList: {
type: Array,
default: () => []
}
},
data() {
return {
form: {
id: '',
method: '1',
objectId: '',
objectType: '',
energyTypeId: '',
type: '',
plcParamId: '',
limitType: '',
minValue: 0,
maxValue: 0
},
objIds: [],//
isEdit: false, //
rules: {
method: [{ required: true, message: '抄表方式不能为空', trigger: 'change' }],
objectId: [{ required: true, message: '监控对象不能为空', trigger: 'change' }],
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }],
limitType: [{ required: true, message: '指标类型不能为空', trigger: 'change' }]
},
detailList: []
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getEnergyLimit( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.plcParamId = res.data.plcParamId || ''
this.form.method = this.form.method ? this.form.method + '' : ''
this.form.limitType = this.form.limitType ? this.form.limitType + '' : ''
this.objIds = this.changeDetSelect(this.form.objectId, this.objList)
if (this.form.type === 2) {
this.getDetailList()
}
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
//
changeMethod() {
if(this.form.method === '2'){
this.form.limitType = "2"
}else{
this.form.limitType = ''
}
},
//
getDetailList() {
getEnergyParamList({
objId: this.form.objectId,
energyTypeId: this.form.energyTypeId
}).then((res) => {
if (res.code === 0) {
this.detailList = res.data
} else {
this.detailList = []
}
})
},
typeChange(val) {
console.log(this.form)
this.form.plcParamId = ''
if (val === 2) {
if (this.form.objectId && this.form.energyTypeId) {
this.getDetailList()
}
}
},
toggleType() {
if (this.form.energyTypeId && this.form.type) {
this.getDetailList()
this.form.plcParamId = ''
}
},
//
changeDetSelect(key, treeData) {
let arr = [] //
let returnArr = [] //
let depth = 0 //
//
function childrenEach(childrendData, depthN) {
for (var j = 0; j < childrendData.length; j++) {
depth = depthN
arr[depthN] = childrendData[j].id
if (childrendData[j].id == key) {
returnArr = arr.slice(0, depthN + 1)
break
} else {
if (childrendData[j].children) {
depth++
childrenEach(childrendData[j].children, depth)
}
}
}
return returnArr
}
return childrenEach(treeData, depth)
},
selectObj(val) {
this.form.objectId = val[val.length-1]
this.form.objectType = val.length-1
if (this.form.energyTypeId && this.form.type) {
this.getDetailList()
this.form.plcParamId = ''
}
},
selectDetail() {
this.$forceUpdate()
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.type === 2 && !this.form.plcParamId) {
this.$modal.msgError("监控模式为详细时,详细参数为必填");
return false
}
if (this.form.minValue && this.form.maxValue) {
if (this.form.minValue > this.form.maxValue) {
this.$modal.msgError("消耗量阈值,最小值不能大于最大值");
return false
}
}
this.form.minValue = this.form.minValue || 0
this.form.maxValue = this.form.maxValue || 0
if (this.isEdit) {
//
updateEnergyLimit({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyLimit({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.form.type = ''
this.form.plcParamId = ''
this.form.minValue = null
this.form.maxValue = null
this.objIds = ''
this.detailList = []
this.isEdit = false
}
}
}
name: 'energyLimitAdd',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return [];
},
},
objList: {
type: Array,
default: () => [],
},
},
data() {
return {
form: {
id: '',
method: '1',
objectId: '',
objectType: '',
energyTypeId: '',
type: '',
plcParamId: '',
limitType: '',
minValue: 0,
maxValue: 0,
},
objIds: [], //
isEdit: false, //
rules: {
method: [
{ required: true, message: '抄表方式不能为空', trigger: 'change' },
],
objectId: [
{ required: true, message: '监控对象不能为空', trigger: 'change' },
],
energyTypeId: [
{ required: true, message: '能源类型不能为空', trigger: 'change' },
],
type: [
{ required: true, message: '监控模式不能为空', trigger: 'change' },
],
limitType: [
{ required: true, message: '指标类型不能为空', trigger: 'change' },
],
},
detailList: [],
};
},
methods: {
init(id) {
if (id) {
this.isEdit = true;
this.form.id = id;
getEnergyLimit(id).then((res) => {
if (res.code === 0) {
this.form = res.data;
this.form.plcParamId = res.data.plcParamId || '';
this.form.method = this.form.method ? this.form.method + '' : '';
this.form.limitType = this.form.limitType
? this.form.limitType + ''
: '';
this.objIds = this.changeDetSelect(
this.form.objectId,
this.objList
);
if (this.form.type === 2) {
this.getDetailList();
}
}
});
} else {
this.isEdit = false;
this.form.id = '';
}
},
//
changeMethod() {
if (this.form.method === '2') {
this.form.limitType = '2';
} else {
this.form.limitType = '';
}
},
//
getDetailList() {
getEnergyParamList({
objId: this.form.objectId,
energyTypeId: this.form.energyTypeId,
}).then((res) => {
if (res.code === 0) {
this.detailList = res.data;
} else {
this.detailList = [];
}
});
},
typeChange(val) {
console.log(this.form);
this.form.plcParamId = '';
if (val === 2) {
if (this.form.objectId && this.form.energyTypeId) {
this.getDetailList();
}
}
},
toggleType() {
if (this.form.energyTypeId && this.form.type) {
this.getDetailList();
this.form.plcParamId = '';
}
},
//
changeDetSelect(key, treeData) {
let arr = []; //
let returnArr = []; //
let depth = 0; //
//
function childrenEach(childrendData, depthN) {
for (var j = 0; j < childrendData.length; j++) {
depth = depthN;
arr[depthN] = childrendData[j].id;
if (childrendData[j].id == key) {
returnArr = arr.slice(0, depthN + 1);
break;
} else {
if (childrendData[j].children) {
depth++;
childrenEach(childrendData[j].children, depth);
}
}
}
return returnArr;
}
return childrenEach(treeData, depth);
},
selectObj(val) {
this.form.objectId = val[val.length - 1];
this.form.objectType = val.length - 1;
if (this.form.energyTypeId && this.form.type) {
this.getDetailList();
this.form.plcParamId = '';
}
},
selectDetail() {
this.$forceUpdate();
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.type === 2 && !this.form.plcParamId) {
this.$modal.msgError('监控模式为详细时,详细参数为必填');
return false;
}
if (this.form.minValue && this.form.maxValue) {
if (this.form.minValue > this.form.maxValue) {
this.$modal.msgError('消耗量阈值,最小值不能大于最大值');
return false;
}
}
this.form.minValue = this.form.minValue || 0;
this.form.maxValue = this.form.maxValue || 0;
if (this.isEdit) {
//
updateEnergyLimit({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
createEnergyLimit({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
this.form.type = '';
this.form.plcParamId = '';
this.form.minValue = null;
this.form.maxValue = null;
this.objIds = '';
this.detailList = [];
this.isEdit = false;
},
},
};
</script>
<style>
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
display: none;
}
</style>

View File

@ -1,269 +1,278 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width='50%'
>
<energy-limit-add ref="energyLimit" @successSubmit="successSubmit" :energyTypeList="energyTypeList" :objList="objList"/>
</base-dialog>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<energy-limit-add
ref="energyLimit"
@successSubmit="successSubmit"
:energyTypeList="energyTypeList"
:objList="objList" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyLimitPage, deleteEnergyLimit } from "@/api/monitoring/energyLimit";
import { getEnergyTypeListAll } from "@/api/base/energyType";
import { getTree } from '@/api/base/factory'
import { publicFormatter } from '@/utils/dict'
import EnergyLimitAdd from './components/energyLimitAdd'
import {
getEnergyLimitPage,
deleteEnergyLimit,
} from '@/api/monitoring/energyLimit';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { getTree } from '@/api/base/factory';
import { publicFormatter } from '@/utils/dict';
import EnergyLimitAdd from './components/energyLimitAdd';
const tableProps = [
{
prop: 'method',
label: '抄表方式',
filter: publicFormatter('method')
},
{
prop: 'objName',
label: '监控对象'
},
{
prop: 'objCode',
label: '对象编码'
},
{
prop: 'tableName',
label: '水/气表名',
filter: publicFormatter('table_name')
},
{
prop: 'energyType',
label: '能源类型'
},
{
prop: 'type',
label: '监控模式',
filter: (val) => (val != null ? ['合并', '详细'][val-1] : '-'),
},
{
prop: 'plcParamName',
label: '监控参数'
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type')
},
{
prop: 'limitValue',
label: '阈值'
}
]
{
prop: 'method',
label: '抄表方式',
filter: publicFormatter('method'),
},
{
prop: 'objName',
label: '监控对象',
},
{
prop: 'objCode',
label: '对象编码',
},
{
prop: 'tableName',
label: '能源表名',
filter: publicFormatter('table_name'),
},
{
prop: 'energyType',
label: '能源类型',
filter: publicFormatter('energy_type'),
},
{
prop: 'type',
label: '监控模式',
filter: (val) => (val != null ? ['合并', '详细'][val - 1] : '-'),
},
{
prop: 'plcParamName',
label: '监控参数',
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type'),
},
{
prop: 'limitValue',
label: '阈值',
},
];
export default {
name: "EnergyLimit",
components: { EnergyLimitAdd },
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId'
},
{
type: 'select',
label: '指标类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
labelField: 'label',
valueField: 'value',
param: 'limitType'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('monitoring:energy-limit:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('monitoring:energy-limit:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
limitType: null
},
energyTypeList: [],
typeList: [
{label: '合并', value: '1'},
{label: '详细', value: '2'}
],
objList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getTypeList()
//
this.getObjTree()
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || []
this.energyTypeList = res.data || []
})
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.limitType = val.limitType
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyLimit.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyLimitPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.typeList.map(i => {
if (item.type === i.value) {
item.type = i.label
}
})
if (item.minValue && item.maxValue) {
item.limitValue = item.minValue + '-' + item.maxValue
} else if(item.minValue){
item.limitValue = '最小值' + item.minValue
}else if(item.maxValue){
item.limitValue = '最大值' + item.maxValue
} else {
item.limitValue = ''
}
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyLimit.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyLimit.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyLimit.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?').then(function() {
return deleteEnergyLimit(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
getObjTree() {
getTree().then(res => {
this.objList = res.data || []
})
}
}
name: 'EnergyLimit',
components: { EnergyLimitAdd },
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
},
{
type: 'select',
label: '指标类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
labelField: 'label',
valueField: 'value',
param: 'limitType',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('monitoring:energy-limit:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('monitoring:energy-limit:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
limitType: null,
},
energyTypeList: [],
typeList: [
{ label: '合并', value: '1' },
{ label: '详细', value: '2' },
],
objList: [],
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
this.getTypeList();
//
this.getObjTree();
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [];
this.energyTypeList = res.data || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.limitType = val.limitType;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyLimit.init();
});
}
},
/** 查询列表 */
getList() {
getEnergyLimitPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.typeList.map((i) => {
if (item.type === i.value) {
item.type = i.label;
}
});
if (item.minValue && item.maxValue) {
item.limitValue = item.minValue + '-' + item.maxValue;
} else if (item.minValue) {
item.limitValue = '最小值' + item.minValue;
} else if (item.maxValue) {
item.limitValue = '最大值' + item.maxValue;
} else {
item.limitValue = '';
}
});
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyLimit.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.energyLimit.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyLimit.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?')
.then(function () {
return deleteEnergyLimit(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
getObjTree() {
getTree().then((res) => {
this.objList = res.data || [];
});
},
},
};
</script>

View File

@ -1,185 +1,196 @@
<template>
<div class="app-container" id='energyReportBox'>
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
:isFold="isFold"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
/>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
<div
class="app-container"
id="energyReportBox">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
:isFold="isFold"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
</div>
</template>
<script>
import { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport"
import { getEnergyTypeListAll } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi'
import {
energyReportPageAuto,
energyReportPageExportAuto,
} from '@/api/monitoring/energyReport';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
const tableProps = [
{
prop: 'statisticType',
label: '统计类型',
filter: publicFormatter('statistic_type')
},
{
prop: 'startTime',
label: '开始时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'endTime',
label: '结束时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'statisticName',
label: '统计方案'
},
{
prop: 'energyType',
label: '能源类型'
},
{
prop: 'startNum',
label: '抄表数(起始)'
},
{
prop: 'endNum',
label: '抄表数(结束)'
},
{
prop: 'useNum',
label: '消耗量'
}
]
{
prop: 'statisticType',
label: '统计类型',
filter: publicFormatter('statistic_type'),
},
{
prop: 'startTime',
label: '开始时间',
filter: parseTime,
minWidth: 160,
},
{
prop: 'endTime',
label: '结束时间',
filter: parseTime,
minWidth: 160,
},
{
prop: 'statisticName',
label: '统计方案',
},
{
prop: 'energyType',
label: '能源类型',
},
{
prop: 'startNum',
label: '抄表数(起始)',
},
{
prop: 'endNum',
label: '抄表数(结束)',
},
{
prop: 'useNum',
label: '消耗量',
},
];
export default {
name: "EnergyLimit",
data() {
return {
isFold: false,
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true
},
{
type: 'select',
label: '统计类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
labelField: 'label',
valueField: 'value',
param: 'statisticType'
},
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('monitoring:energy-report:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
plain: true
}
],
tableProps,
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
statisticType: null,
startTime: null,
endTime: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
this.isFold = this.searchBarWidth('energyReportBox', 1198)
})
this.getList()
this.getTypeList()
},
mounted() {
this.isFold = this.searchBarWidth('energyReportBox', 1198)
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || []
// this.energyTypeList = res.data || []
})
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.statisticType = val.statisticType
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
this.getList()
break
default:
this.$modal.confirm('是否确认导出').then(() => {
return energyReportPageExportAuto({...this.queryParams});
}).then(response => {
this.$download.excel(response, '能源统计报表.xls');
}).catch(() => {})
}
},
/** 查询列表 */
getList() {
energyReportPageAuto(this.queryParams).then(response => {
this.list = response.data.list || [];
this.total = response.data.total;
});
}
}
name: 'EnergyLimit',
data() {
return {
isFold: false,
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true,
},
{
type: 'select',
label: '统计类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
labelField: 'label',
valueField: 'value',
param: 'statisticType',
},
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('monitoring:energy-report:export')
? 'button'
: '',
btnName: '导出',
name: 'add',
color: 'primary',
plain: true,
},
],
tableProps,
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
statisticType: null,
startTime: null,
endTime: null,
},
};
},
created() {
window.addEventListener('resize', this._eventListeners);
this.getList();
this.getTypeList();
},
mounted() {
this.isFold = this.searchBarWidth('energyReportBox', 1198);
},
destroyed() {
window.removeEventListener('resize', this._eventListeners);
},
methods: {
_eventListeners() {
this.tableH = this.tableHeight(260);
this.isFold = this.searchBarWidth('energyReportBox', 1198);
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [];
// this.energyTypeList = res.data || []
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.statisticType = val.statisticType;
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
this.getList();
break;
default:
this.$modal
.confirm('是否确认导出')
.then(() => {
return energyReportPageExportAuto({ ...this.queryParams });
})
.then((response) => {
this.$download.excel(response, '能源统计报表.xls');
})
.catch(() => {});
}
},
/** 查询列表 */
getList() {
energyReportPageAuto(this.queryParams).then((response) => {
this.list = response.data.list || [];
this.total = response.data.total;
});
},
},
};
</script>

View File

@ -4,7 +4,8 @@
<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"
@clickBtn="handleClick" />
</base-table>
@ -33,10 +34,10 @@ import {
import basicPage from '../../mixins/basic-page';
import moment from 'moment';
import addOrUpdate from './dialogForm.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'QualityInspectionBoxBtn',
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
components: { addOrUpdate },
data() {
return {
@ -114,7 +115,7 @@ export default {
//
listQuery: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
inspectionDetContent: null,
},
addOrUpdateVisible: false,

View File

@ -4,7 +4,8 @@
<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"
@clickBtn="handleClick" />
</base-table>
@ -34,10 +35,11 @@ import basicPage from './basic-page';
import moment from 'moment';
import addOrUpdate from './dialogForm.vue';
import ProcessBomList from './ProcessBomList.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import row from './row.vue';
export default {
name: 'QualityInspectionBoxBtn',
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
components: { addOrUpdate, ProcessBomList },
data() {
return {
@ -123,7 +125,7 @@ export default {
//
listQuery: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
userName: null,
nickName:null
},

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<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">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
@ -29,6 +29,7 @@ import {
deleteQualityHotMaterial,
getHotMaterialAllList
} from '@/api/base/qualityHotMaterial';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
// import { getList, } from "@/api/base/qualityScrapType";
const tableProps = [
{
@ -74,7 +75,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -207,7 +208,7 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.pageSize = 20;
this.listQuery.materialId = val.materialId ? val.materialId : undefined;
this.listQuery.checkTime = val.checkTime ? val.checkTime : undefined;
this.getDataList();
@ -215,7 +216,7 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};

View File

@ -4,7 +4,7 @@
<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">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
@ -59,14 +59,14 @@ import {
getQualityInspectionDetPage,
exportQualityInspectionDetExcel,
} from '@/api/base/qualityInspectionDet';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
export default {
name: 'QualityInspectionDet',
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
typeList: [], //
@ -153,7 +153,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
content: null,
createTime: [],
},

View File

@ -4,8 +4,8 @@
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
@emitFun="handleEmitFun">
<base-table :max-height="tableH" :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize"
:table-data="list" @emitFun="handleEmitFun">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -61,10 +61,10 @@ import {
exportQualityInspectionTypeExcel,
} from '@/api/base/qualityInspectionType';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'QualityInspectionType',
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
tableBtn: [

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2024-03-25 16:07:07
* @LastEditTime: 2024-03-29 14:08:18
* @Description:
-->
<template>
@ -24,12 +24,12 @@
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
getMaterialUseLogPage,
getWorkOrderList,
exportEnergyPlcExcel
} from '@/api/quality/materialTraceability';
const tableProps = [
{
prop: 'materialName',
@ -73,6 +73,7 @@ const tableProps = [
];
export default {
mixins: [tableHeightMixin],
// mixins: [basicPage],
data() {
return {
@ -82,7 +83,7 @@ export default {
// // exportURL: exportPackingExcel,
// },
tableProps,
tableH: this.tableHeight(260),
// tableH: this.tableHeight(260),
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)
? {
@ -174,9 +175,9 @@ export default {
// AddOrUpdate,
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
// window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(260)
// })
this.getList()
this.getDict()
},

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2024-03-21 15:17:05
* @LastEditTime: 2024-03-29 14:08:30
* @Description:
-->
<template>
@ -25,6 +25,8 @@
// import basicPage from '../mixins/basic-page';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
getOriginalGlassRetrace,
getWorkOrderList,
@ -85,6 +87,7 @@ const tableProps = [
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
// urlOptions: {
@ -119,7 +122,7 @@ export default {
startTime: undefined,
endTime:undefined,
},
tableH: this.tableHeight(260),
// tableH: this.tableHeight(260),
formConfig: [
{
type: 'select',
@ -184,9 +187,9 @@ export default {
// AddOrUpdate,
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
// window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(260)
// })
this.getList()
this.getDict()
},

View File

@ -2,13 +2,14 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2024-03-20 09:25:40
* @LastEditTime: 2024-03-29 15:32:33
* @Description:
-->
<template>
<div class="app-container">
<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"
@clickBtn="handleClick" />
</base-table>
@ -30,6 +31,7 @@ import {
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'name',
@ -78,7 +80,7 @@ const tableProps = [
];
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
// urlOptions: {

View File

@ -1,14 +1,7 @@
<!--
* @Author: zhp
* @Date: 2023-11-09 16:32:21
* @LastEditTime: 2023-11-09 16:32:21
* @LastEditors: zhp
* @Description:
-->
<!--
* @Author: zhp
* @Date: 2023-11-07 19:28:13
* @LastEditTime: 2023-11-08 14:11:43
* @LastEditTime: 2024-03-29 14:21:52
* @LastEditors: zhp
* @Description:
-->

View File

@ -1,17 +1,10 @@
<!--
* @Author: zhp
* @Date: 2023-11-28 10:41:50
* @LastEditTime: 2023-11-28 10:49:43
* @LastEditTime: 2024-03-29 14:14:13
* @LastEditors: zhp
* @Description:
-->
<!--
filename: index.vue
author: liubin
date: 2023-10-18 12:25:46
description:
-->
<template>
<div class="app-container process-flow-view">
<ProcessInfo />

View File

@ -91,8 +91,18 @@ export default {
// : undefined,
].filter((v) => v),
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',
label: '巡检时间',
@ -100,33 +110,12 @@ export default {
filter: parseTime,
showOverflowtooltip: true,
},
{ prop: 'groupClass', label: '班次', showOverflowtooltip: true },
// {
// prop: '_detail',
// label: '',
// subcomponent: {
// 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: 'groupClass',
label: '班次',
showOverflowtooltip: true,
filter: (v) => v ?? '---',
},
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
@ -161,9 +150,7 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('se:check-record:export')
? 'button'
: '',
type: this.$auth.hasPermi('se:check-record:export') ? 'button' : '',
btnName: '导出',
name: 'export',
plain: true,

View File

@ -80,8 +80,9 @@ import {
import RecordDetail from './Record--detail.vue';
import { TableBtn } from '@/components/tableInnerComponents';
const timeFilter = (val) =>
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---';
const timeFilter = (val) => {
return val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---';
};
export default {
name: 'SpecialEquipmentMaintainRecord',