projects/mesxc-lb #334

Merged
juzi merged 3 commits from projects/mesxc-lb into projects/mesxc-test 2024-04-12 16:50:12 +08:00
179 changed files with 16800 additions and 13871 deletions
Showing only changes of commit 02c3b3db0d - Show all commits

View File

@ -1,10 +1,3 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-03-25 15:59:53
# @LastEditors: zhp
# @Description:
###
# 开发环境配置
ENV = 'development'
@ -12,24 +5,18 @@ ENV = 'development'
VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082'
VUE_APP_BASE_API = 'http://10.70.2.2:8080'
# VUE_APP_BASE_API = 'http://192.168.1.20:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# 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'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# VUE_APP_BASE_API = 'http://192.168.1.47:48082'
# socket地址
VUE_APP_Socket_API = 'ws://10.70.2.2:8080'
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# 积木报表指向地址
VUE_APP_JIMU_API = 'http://10.70.2.22:8080'
VUE_APP_JIMU_API = 'http://192.168.0.33:48082'
# socket地址(现场)
# VUE_APP_Socket_API = 'ws://10.70.2.2:8080'
# socket地址(公司线上)
VUE_APP_Socket_API = 'ws://192.168.0.33:48082'
# socket dcs地址(只有现场)
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -1,11 +1,4 @@
###
# @Author: zhp
# @Date: 2023-11-07 19:11:40
# @LastEditTime: 2023-11-16 16:40:59
# @LastEditors: zhp
# @Description:
###
# 生产环境配置
# 生产环境配置(许昌现场)
ENV = 'production'
# 页面标题

View File

@ -1,4 +1,4 @@
# 生产环境配置
# 公司线上环境33服务器
ENV = 'production'
# 页面标题
@ -7,15 +7,12 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
# dcs地址
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'
# socket地址
VUE_APP_Socket_API = 'ws://10.70.2.2:8080'
# 积木报表指向地址
VUE_APP_JIMU_API = 'http://192.168.0.33:48082'
# socket地址
VUE_APP_Socket_API = 'ws://192.168.0.33:48082'
# dcs地址只有现场的
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'
# 根据服务器或域名修改

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

@ -53,4 +53,28 @@ export function energyQuantityManualExport(data) {
data: data,
responseType: 'blob'
})
}
// 获得能源表名配置分页
export function energyTablePage(data) {
return request({
url: '/base/energy-table/page',
method: 'post',
data: data
})
}
// 获得能源表名配置
export function energyTableGet(query) {
return request({
url: '/base/energy-table/get',
method: 'get',
params: query
})
}
// 更新能源表名配置
export function energyTableUpdate(data) {
return request({
url: '/base/energy-table/update',
method: 'put',
data: data
})
}

View File

@ -68,3 +68,4 @@ export function exportEnergyTypeExcel(query) {
responseType: 'blob'
})
}

View File

@ -2,7 +2,7 @@
/*
* @Author: zhp
* @Date: 2023-11-06 15:38:12
* @LastEditTime: 2023-12-15 15:29:16
* @LastEditTime: 2024-04-11 14:57:02
* @LastEditors: zhp
* @Description:
*/
@ -94,7 +94,7 @@ export function getWorkerList(query) {
export function getMaterialCheckList(query) {
return request({
url: '/base/core-hot-material-check/listByMaterial',
url: 'base/quality-hot-material-det/filterList',
method: 'get',
params: query
})
@ -102,7 +102,7 @@ export function getMaterialCheckList(query) {
export function createQualityHotMaterialDet(query){
return request({
url: '/base/quality-hot-material-det/create',
url: 'base/quality-hot-material-det/createBatch',
method: 'post',
data: query
})
@ -110,7 +110,7 @@ export function createQualityHotMaterialDet(query){
export function updateQualityHotMaterialDet(query){
return request({
url: '/base/quality-hot-material-det/listbyfilter',
url: 'base/quality-hot-material-det/updateBatch',
method: 'put',
data: query
})
@ -118,7 +118,7 @@ export function updateQualityHotMaterialDet(query){
export function getQualityHotMaterialDetList(query){
return request({
url: '/base/quality-hot-material-det/listbyfilter',
url: '/base/quality-hot-material-det/filterList',
method: 'get',
params: query
})

View File

@ -1,7 +1,7 @@
/*
* @Author: zhp
* @Date: 2023-11-07 15:02:37
* @LastEditTime: 2023-11-07 18:32:07
* @LastEditTime: 2024-04-09 15:14:42
* @LastEditors: zhp
* @Description:
*/

View File

@ -1,7 +1,7 @@
/*
* @Author: zhp
* @Date: 2023-11-07 14:10:18
* @LastEditTime: 2023-11-16 17:49:52
* @LastEditTime: 2024-04-11 16:16:05
* @LastEditors: zhp
* @Description:
*/
@ -18,14 +18,14 @@ export function getStatisticalDataPage(query) {
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
url: 'base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
export function getProductList(query) {
return request({
url: '/base/core-product/listAll',
url: 'base/core-product/listAll',
method: 'get',
params: query,
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@ -5,6 +5,7 @@ export default {
};
},
created() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
window.addEventListener('resize', this._setTableHeight);
},
destroyed() {
@ -12,7 +13,8 @@ export default {
},
methods: {
_setTableHeight() {
this.tableH = this.tableHeight(260);
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
// this.tableH = this.tableHeight(260);
},
},
};

View File

@ -32,6 +32,7 @@ const actions = {
}
// 处理 dictValue 层级
dictDataMap[dictData.dictType].push({
id: dictData.id,
value: dictData.value,
label: dictData.label,
colorType: dictData.colorType,

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-04-03 10:54:53
* @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">
@ -34,14 +34,16 @@
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
<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">
<el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: .5em">
<!-- <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: 935px;" 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,14 @@ export default {
::v-deep .el-progress-bar__inner {
background-color: unset;
background-image: linear-gradient(to right, #4573fe, #47f8dc);
}
::v-deep .el-progress__text {
width: 50px;
margin-top: -70px;
margin-left: 834px;
text-align: right;
// 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-11 09:55:04
* @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,13 @@
<top-radio-group />
</div> -->
<!-- 像下面这样表格里的limit值也许可以用js动态计算出来 -->
<div v-if="coldDetData" class="myLegend">
<div class=" barCircleLegend"></div>
<div class=" barCircle"></div>
<h4 class="barText">产线良品率</h4>
<div class="barLegend"></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 +71,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 +251,7 @@ export default {
funWs: undefined,
SJGws: undefined,
funWsData: {},
coldDetData:[],
SJGWsData: {},
cxNameList:[],
cxDataList:[],
@ -302,6 +310,7 @@ export default {
window.location.reload()
}, 86400000)
// this.getData()
// this.getReaiData()
},
destroyed() {
this.CutWebsocketClose()
@ -314,85 +323,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,6 +345,131 @@ export default {
}
},
methods: {
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('缺陷面积:' + this.NumFormat(ele.wastArea) + '㎡')
// yieldList.push({
// name: '',
// yield:ele.yield
// })
sumAreaList.push(ele.sumArea)
yieldList.push((ele.yield * 100).toFixed(0))
})
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]])
})
},
// getReaiData() {
// let detData = [
// {
// name: '1',
// run: '',
// },
// {
// name: '2',
// run: '',
// },
// {
// name: '3',
// run: '',
// },
// {
// name: '4',
// run: '',
// },
// {
// name: '1',
// run: '',
// },
// ]
// let arr = []
// let index = 0
// for (let i in detData) {
// 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)">${i || ''}</span>`,
// `<span style="color:rgba(255,255,255,0.5)"><div style="${detData[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> ${detData[i] || ''}</span>`,
// ])
// }
// // this.$nextTick(() => {
// this.annealFunConfig.data = arr
// this.$refs['annealFunScrollBoard'].updateRows(arr)
// // })
// },
// getData() {
// let detData = [
// {
@ -444,8 +500,10 @@ export default {
// `<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.$nextTick(() => {
// this.realEqConfig.data = this.realEqList
// this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
// // })
// },
CutWebsocketClose(e) {
this.Cutws.ws.onclose = (event) => { console.log(event );}
@ -495,7 +553,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 +583,9 @@ export default {
])
}
this.realEqConfig.data = this.realEqList
this.$nextTick(() => {
// this.$nextTick(() => {
this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
})
// })
};
// if (typeof (WebSocket) === 'undefined') {
// alert('WebSocket')
@ -560,19 +617,23 @@ export default {
this.cutWsData = event?.data ? JSON.parse(event?.data) : {}
if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'table') {
let cutArr = this.cutWsData.productHourData.map((item, index) => [
`<span style="color:rgba(255,255,255,0.7)" >${index + 1 || ''}
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
</span>`,
`<span style="color:rgba(255,255,255,0.7)" >${item.lineName || ''}
`<span style="color:rgba(255,255,255,0.5)" >${item.lineName || ''}
</span>`,
`<span style="color:rgba(255,255,255,0.7)">${this.formatTime(item.time) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.7)">${this.getSize(item.size) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.7)">${item.productArea + '㎡' || ''}</span>`,
`<span style="color:rgba(255,255,255,0.7)">${item.wasteArea + '㎡' || ''}</span>`,
`<div style = "${(item.product * 100).toFixed(2) > 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div>
<div style = "${(item.product * 100).toFixed(2) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div>`
`<span style="color:rgba(255,255,255,0.5)">${this.formatTime(item.time) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.getSize(item.size) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.productArea) + '㎡' || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.wasteArea) + '㎡' || ''}</span>`,
`<div style = "${(item.product * 100).toFixed(0) > 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</div>
<div style = "${(item.product * 100).toFixed(0) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</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 +642,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('缺陷面积:' + this.NumFormat(ele.wastArea) + '㎡')
sumAreaList.push(ele.sumArea)
yieldList.push(parseFloat((ele.yield * 100).toFixed(3)))
yieldList.push(parseFloat((ele.yield * 100).toFixed(0)))
})
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[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.$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[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 +696,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 +715,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') {
@ -678,6 +745,25 @@ export default {
// this.funWebsocket.onclose = this.funWebsocketClose
// }
},
NumFormat(value) {
if (!value) return '0.00'
value = value.toFixed(2)
var intPart = Math.trunc(value) //
// var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') //
var floatPart = '.00' //
var value2Array = value.split('.')
// =2
if (value2Array.length === 2) {
floatPart = value2Array[1].toString() //
if (floatPart.length === 1) {
return intPart + '.' + floatPart + '0'
} else {
return intPart + '.' + floatPart
}
} else {
return intPart + floatPart
}
},
// funWebsocketOnOpen() {
// console.log('socket')
// this.SJGWebsocket.onmessage()
@ -772,7 +858,47 @@ export default {
</script>
<style lang="scss" scoped>
.myLegend{
position: absolute;
top: -20px;
right: 20px;
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;
border-radius: 30%;
}
.barText{
// float: right;
display: inline-block;
margin-right: 10px;
}
.barCircleLegend{
width: 15px;
height: 1px;
background-color: rgba(255, 209, 96, 1);
position: absolute;
left: -4.1715px;
top: 21.7px;
}
.barCircle{
width: 6px;
height: 6px;
border-radius: 50%;
background-color: rgba(255, 209, 96, 1);
display: inline-block;
margin-right: 10px;
margin-bottom: 1.7px;
}
.barCircleText{
display: inline-block;
}
}
.visual-container {
width: 1920px;
height: 1080px;
@ -794,7 +920,7 @@ export default {
top: 25px;
color: rgba(255, 255, 255, 0.80);
font-size: 20px;
letter-spacing: 0px;
letter-spacing: 1px;
}
.time {
@ -803,7 +929,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

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-01-29 13:45:56
* @LastEditTime: 2024-03-13 08:58:01
* @LastEditTime: 2024-04-11 11:02:53
* @LastEditors: zhp
* @Description:
-->
@ -26,7 +26,7 @@ export default {
return {
chart: null,
// notMsg:true,
colors:['#2760ff', '#518eec', '#0ee8e4', '#ddb523'],
colors: ['#2760ff', '#518eec', '#49FBD6', '#ddb523'],
chartData: []
};
},
@ -45,7 +45,32 @@ export default {
this.$emit('emitFun')
}
}
},
},
mounted() {
this.chartData = [
{
name: '细长泡',
num: 1112,
yield: 0.97,
},
{
name: '长泡',
num: 1112,
yield: 0.97,
},
{
name: '开口泡',
num: 1112,
yield: 0.97,
},
{
name: '结石',
num: 1112,
yield: 0.97,
}
]
this.updateChart()
},
methods: {
updateChart() {
console.log('update')
@ -71,7 +96,7 @@ export default {
color:this.colors,
title:{
text: num,
subtext: '总数',
subtext: '总数/片',
top: '32%',
left: '49%',
textAlign: 'center',
@ -89,7 +114,7 @@ export default {
left: 'center',
itemWidth: 12,
itemHeight:12,
icon: 'rect',
icon: 'roundRect',
textStyle: {
color: '#fff'
},
@ -107,21 +132,36 @@ export default {
radius: ['45%', '70%'],
avoidLabelOverlap: true,
label: {
show: false
show: true,
normal: {
//
// params: data,
formatter: function (params) {
console.log(params);
return params.value + " | " + params.percent.toFixed(0) + "%" + "\n\n" + params.name;
},
textStyle: { //
// color: '#595959',
fontSize: 24.48
}
}
},
labelLine: {
show: true,
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name:item.name,
value: item.num,
value: item.num,
label: {
color: this.colors[index % 4]
},
itemStyle:{
color:{
type: 'linear',
x: 1,
y: 1,
x: 0,
y: 0,
x2: 0,
y2: 0,
y2: 1,
global: false,
colorStops:[
{offset: 0,color: this.colors[index%4]},

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-04-03 16:33:24
* @Description:
-->
<template>
@ -85,7 +85,6 @@ export default {
defaultConfig: {
// legend
legend: {
orient: 'vertical',
left: '75%',
bottom: 0,
itemHeight: 10,
@ -158,6 +157,9 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id))
this.$nextTick(() => {
this.chart.resize();
});
this.chart.setOption({
title: this.showCenterTitle
? {
@ -194,7 +196,7 @@ export default {
//
...this.defaultConfig.legend,
//
...this.legendConfig
// ...this.legendConfig
},
color: this.barColor,
series: [

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-09 15:24:39
* @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) {
@ -100,8 +100,9 @@ export default {
show: true, //
position: 'top', //
textStyle: { //
color: '#ced1d5',
fontSize: 12
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
fontWight: 'bolder'
}
},
}
@ -114,6 +115,7 @@ export default {
name: '产线良品率',
symbol: 'circle', //
type: 'line',
// symbolSize: 7,
yAxisIndex: 0,
areaStyle: {
opacity: 0.8,
@ -141,6 +143,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,38 +163,50 @@ 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: {
type: 'solid',
color: '#213259', // 线
color: '#25528f', // 线
width: '1' // 线
}
},
axisLabel: {
textStyle: {
align: 'center',
color: 'rgba(255,255,255,0.5)' //
}
},
splitLine: {
lineStyle: {
color: '#213259'
color: '#25528f'
}
},
data: nameList
@ -201,9 +225,13 @@ export default {
scale: true,
type: 'value',
name: '良品率/%',
max: 100,//
min: 0,//
interval: 20,//
nameTextStyle: {// y
color: '#fff',
color: 'rgba(255,255,255,0.5)', //
align: "left",
padding: [0, 0, 0, 8]
},
position: 'right',
alignTicks: true,
@ -211,19 +239,20 @@ export default {
show: true,
lineStyle: {
type: 'solid',
color: '#213259', // 线
color: '#25528f', // 线
width: '1' // 线
}
},
axisLabel: {
textStyle: {
color: '#ced1d5', //
formatter: '{value}%'
color: 'rgba(255,255,255,0.5)', //
formatter: '{value}%',
align:'left',
}
},
splitLine: {
lineStyle: {
color: '#213259'
color: '#25528f'
}
}
// type: 'value'
@ -245,9 +274,10 @@ export default {
type: 'value',
name: '产量/㎡', // y
nameTextStyle: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
// fontSize: 10,
align: "right",
padding:[0,4,0,0]
},
position: 'left',
alignTicks: true,
@ -255,19 +285,21 @@ export default {
show: true,
lineStyle: {
type: 'solid',
color: '#213259', // 线
color: '#25528f', // 线
width: '1' // 线
}
},
axisLabel: {
// padding: [0, 20, 0, 0],
textStyle: {
margin: 60,
color: 'rgba(255,255,255,0.5)', //
formatter: '{value} 片'
}
},
splitLine: {
lineStyle: {
color: '#213259'
color: '#25528f'
}
}
// type: 'value'
@ -286,7 +318,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-04-09 15:24:28
* @LastEditors: zhp
* @Description:
-->
@ -105,8 +105,9 @@ export default {
show: true, //
position: 'top', //
textStyle: { //
color: '#ced1d5',
fontSize: 12
color: 'rgba(255,255,255,0.5)', //
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 },
legend: {
itemWidth: 10,
itemHeight: 10,
top: '0%',
right: '20px',
data: ['产线产量', '产线良品率'],
textStyle: {
fontSize: 12 * this.beilv,
color: '#ced1d5'
}
},
grid: { top: 70, right: 20, bottom: 10, left: 10, containLabel: true },
// legend: {
// itemWidth: 10,
// itemHeight: 10,
// top: '2%',
// right: '30px',
// data: ['线', '线'],
// textStyle: {
// fontSize: 12 * this.beilv,
// 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: {
@ -216,9 +224,13 @@ export default {
scale: true,
type: 'value',
name: '良品率/%',
max: 100,//
min: 0,//
interval: 20,//
nameTextStyle: {// y
color: '#fff',
color: 'rgba(255,255,255,0.5)', //
align: "left",
padding: [0, 0, 0, 2]
},
position: 'right',
alignTicks: true,
@ -231,7 +243,7 @@ export default {
}
},
axisLabel: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
// formatter: '{value}'
formatter: '{value}%'
@ -261,8 +273,9 @@ export default {
type: 'value',
name: '产量/片', // y
nameTextStyle: {
color: "#fff",
color: 'rgba(255,255,255,0.5)', //
// fontSize: 10,
padding: [0, 4, 0, 0],
align: "right",
},
// position: 'left',
@ -278,7 +291,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: 'normal'
}
},
}
@ -132,7 +133,7 @@ export default {
type: 'shadow' // 线'line' | 'shadow'
}
},
grid: { top: 90, right: 60, bottom: 20, left: 30, containLabel: true },
grid: { top: 70, right: 40, bottom: 10, left: 40, containLabel: true },
// legend: {
// itemWidth: 10,
// itemHeight: 10,
@ -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',
fontSize: 10,
color: 'rgba(255,255,255,0.5)', //
fontSize: 12,
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-03 18:12:18
* @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']
@ -105,8 +114,11 @@ export default {
totalData.push(sum);
}
// }
// rawData[1].map((d, did) =>
// console.log((d / totalData[did]).toFixed(3))
// // totalData[did] <= 0 ? 0 : d / totalData[did]
// )
console.log('total', totalData)
this.chart = echarts.init(document.getElementById(this.id))
const series = [
'良品',
'废品',
@ -126,7 +138,7 @@ export default {
// },
color:colors[sid],
data: rawData.length != 0 ? rawData[sid].map((d, did) =>
totalData[did] <= 0 ? 0 : d / totalData[did]
totalData[did] <= 0 ? 0 : (d / totalData[did]).toFixed(4)
) : []
};
});
@ -137,6 +149,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) {
@ -144,15 +167,16 @@ export default {
let singleData = series.filter(function (item) {
return item.name == name
})
return name + parseFloat((singleData[0].data * 100).toFixed(3)) + '%'
return name + parseFloat((singleData[0].data * 100).toFixed(0)) + '%'
},
itemWidth: 12,
itemHeight: 12,
bottom: '20',
left: '20',
icon: 'rect',
icon: 'roundRect',
textStyle: {
color: '#ffffff'
color: 'rgba(255,255,255,.9)',
fontSize:12,
}
},
grid: {
@ -184,9 +208,9 @@ export default {
splitNumber: 50,
// boundaryGap: [20, 20],
textStyle: {
color: '#ffffff',
color: 'rgba(255,255,255,.9)',
verticalAlign: 'bottom',
fontSize: 12,
fontSize: 16,
align: 'left',
padding: [0, 0, 10, -5]
}
@ -212,9 +236,9 @@ export default {
splitNumber: 50,
// boundaryGap: [20, 20],
textStyle: {
color: '#ffffff',
color: 'rgba(255,255,255,.9)',
verticalAlign: 'bottom',
fontSize: 12,
fontSize: 16,
align: 'right',
padding: [0, 0, 10, -5]
}
@ -228,10 +252,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

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -33,38 +34,49 @@ import {
getcoreAlarmLogPage
} from '@/api/base/coreAlarmLog';
import {DICT_TYPE, getDictDatas, publicFormatter } from "@/utils/dict";
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'alarmTime',
label: '报警时间',
filter: parseTime
filter: parseTime,
width: 150,
showOverflowtooltip: true
},
{
prop: 'alarmSource',
label: '报警来源'
label: '报警来源',
width: 200,
showOverflowtooltip: true
},
{
prop: 'alarmType',
label: '报警类型'
label: '报警类型',
width: 180,
showOverflowtooltip: true
},
{
prop: 'alarmGrade',
label: '报警级别',
filter: publicFormatter(DICT_TYPE.EQU_ALARM_LEVEL)
filter: publicFormatter(DICT_TYPE.EQU_ALARM_LEVEL),
width: 120,
showOverflowtooltip: true
},
{
prop: 'alarmReason',
label: '报警原因'
label: '报警原因',
showOverflowtooltip: true
},
{
prop: 'alarmContent',
label: '报警详细'
label: '报警详细',
showOverflowtooltip: true
}
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -74,7 +86,7 @@ export default {
tableBtn: [].filter((v)=>v),
tableData: [],
listQuery: {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 0,
alarmSource: undefined,

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-20 16:20:39
* @LastEditTime: 2024-04-02 16:46:17
* @Description:
-->
<template>
@ -96,7 +96,7 @@ export default {
dataRule: {
code: [{ required: true, message: "客户编号不能为空", trigger: "blur" }],
name: [{ required: true, message: "客户名称不能为空", trigger: "blur" }],
contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
// contact: [{ required: true, message: "", trigger: "blur" }],
telephone: [
{ required: false, trigger: "blur", message: "手机号不能为空" },
{

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -45,41 +46,56 @@ import {
getCustomerPage,
deleteCustomer
} from '@/api/base/coreCustomer';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
width: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '客户名称'
label: '客户名称',
width: 150,
showOverflowtooltip: true
},
{
prop: 'code',
label: '客户编码'
label: '客户编码',
width: 150,
showOverflowtooltip: true
},
{
prop: 'contact',
label: '联系人'
label: '联系人',
width: 120,
showOverflowtooltip: true
},
{
prop: 'telephone',
label: '联系电话'
label: '联系电话',
width: 150,
showOverflowtooltip: true
},
{
prop: 'address',
label: '地址'
label: '地址',
width: 150,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
minWidth: 150,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -122,7 +138,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-customer:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-customer:create') ? 'button' : '',

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -45,6 +46,7 @@ import {
getCoreDepartmentPage,
deleteCoreDepartment
} from '@/api/base/coreDepartment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -71,7 +73,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -108,7 +110,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-department:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-department:create') ? 'button' : '',

View File

@ -64,8 +64,8 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="进日期" prop="enterTime" :rules="[]">
<el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择进日期"
<el-form-item label="进日期" prop="enterTime" :rules="[]">
<el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择进日期"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -78,7 +79,7 @@
queryParams: {
equipmentId: form.id,
pageNo: 1,
pageSize: 10,
pageSize: 20,
},
tableBtn: [
this.$auth.hasPermi('base:core-equipment-attr:update')
@ -118,6 +119,7 @@ import {
} from '@/api/base/equipment';
import Editor from '@/components/Editor';
import AssetsUpload from './components/AssetsUpload.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'Equipment',
@ -125,7 +127,7 @@ export default {
Editor,
EquipmentDrawer,
},
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
searchBarKeys: ['name', 'code'],
@ -154,11 +156,11 @@ export default {
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
minWidth: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '设备名称' },
{ width: 256, prop: 'code', label: '设备编码' },
{ prop: 'name', label: '设备名称', minWidth: 180, showOverflowtooltip: true },
{ minWidth: 250, prop: 'code', label: '设备编码' },
{ prop: 'equipmentTypeName', label: '设备类型' },
{ prop: 'enName', label: '英文名称' },
{ prop: 'abbr', label: '缩写' },
@ -209,7 +211,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: (this.$auth.hasPermi('base:core-equipment:export') || this.$auth.hasPermi('base:core-equipment:create')) ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-equipment:export')
@ -484,7 +486,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
code: '',
name: '',
special: false

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -51,13 +52,13 @@
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogForm from './dialogForm.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
// import { getAccessToken } from '@/utils/auth';
export default {
name: 'EquipmentLineBind',
components: { DialogForm },
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
basePath: '/base/core-equipment-bind-section',
@ -81,12 +82,13 @@ export default {
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
width: 150,
showOverflowtooltip: true,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'productionLineName', label: '产线名称' },
{ prop: 'workshopSectionName', label: '工段名称' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'productionLineName', label: '产线名称', width: 120, showOverflowtooltip: true },
{ prop: 'workshopSectionName', label: '工段名称', width: 120, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', width: 150, showOverflowtooltip: true },
{ prop: 'sort', label: '工段中排序' },
{
prop: 'lineDataType',
@ -124,7 +126,8 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-equipment-bind-section:create')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-equipment-bind-section:create')
@ -236,7 +239,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
equipmentName: null,
productionLineId: null,
},

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -50,6 +51,7 @@
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
createEquipmentType,
@ -65,7 +67,7 @@ import {
export default {
name: 'EquipmentType',
components: {},
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
searchBarKeys: ['name'],
@ -88,7 +90,7 @@ export default {
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
minWidth: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '类型名称' },
@ -109,7 +111,8 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-equipment-type:create')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-equipment-type:create')
@ -171,7 +174,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
name: '',
},
//

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -43,38 +44,51 @@ import basicPage from '../../core/mixins/basic-page';
import { parseTime } from '../../core/mixins/code-filter';
import { getHotMaterialPage, deleteHotMaterial } from '@/api/base/coreHotMaterial';
import { publicFormatter } from "@/utils/dict";
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
width: 180,
showOverflowtooltip: true
},
{
prop: 'name',
label: '原料名称'
label: '原料名称',
minWidth: 250,
showOverflowtooltip: true
},
{
prop: 'code',
label: '原料编码'
label: '原料编码',
width: 250,
showOverflowtooltip: true
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
filter: publicFormatter('unit_dict'),
width: 90,
showOverflowtooltip: true
},
{
prop: 'dailyCost',
label: '每日消耗量'
label: '每日消耗量',
width: 120,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
width: 120,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -123,7 +137,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-hot-material-check:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-hot-material-check:create') ? 'button' : '',

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -45,6 +46,7 @@ import {
getCoreMajorPage,
deleteCoreMajor
} from '@/api/base/coreMajor';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -71,7 +73,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -108,7 +110,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-major:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-major:create') ? 'button' : '',

View File

@ -2,15 +2,17 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-13 13:54:01
* @LastEditTime: 2024-03-27 13:47:24
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
:wrapper-closable="true"
class="drawer"
:before-close="beforeClose"
@closed="$emit('destroy')"
size="60%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
@ -262,6 +264,15 @@ export default {
},
mounted() {},
methods: {
beforeClose(done) {
if (!this.isdetail) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
}
},
clearArea() {
this.$set(this.dataForm, 'area', 0)
this.$set(this.dataForm, 'weight', 0)

View File

@ -9,11 +9,12 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:Width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -26,7 +27,8 @@
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList" />
@refreshDataList="getDataList"
@destroy="addOrUpdateVisible = false" />
</div>
</template>
@ -39,43 +41,58 @@ import {
getCoreProductPage,
deleteCoreProduct
} from '@/api/base/coreProduct';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '产品名称'
label: '产品名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'code',
label: '产品编码'
label: '产品编码',
minWidth: 190,
showOverflowtooltip: true
},
{
prop: 'productType',
label: '产品类型',
filter: publicFormatter('product_type')
filter: publicFormatter('product_type'),
minWidth: 180,
showOverflowtooltip: true
},
{
prop: 'specifications',
label: '规格'
label: '规格',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
filter: publicFormatter('unit_dict'),
minWidth: 90,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注',
minWidth: 120,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -124,7 +141,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-product:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-product:create') ? 'button' : '',

View File

@ -9,11 +9,12 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:minWidth="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -29,7 +30,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
minWidth="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
@ -48,34 +49,47 @@ import {
import { getStatus } from '@/api/core/base/productionLine';
import codeFilter from '../../core/mixins/code-filter';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'factoryName',
label: '工厂'
label: '工厂',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'roomNameDict',
label: '车间名称',
filter: publicFormatter('workshop')
filter: publicFormatter('workshop'),
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'name',
label: '产线名称'
label: '产线名称',
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'code',
label: '产线编码'
label: '产线编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'enabled',
label: '当前状态',
filter: codeFilter('lineStatus')
filter: codeFilter('lineStatus'),
minWidth: 120,
showOverflowtooltip: true
},
// {
// prop: 'tvalue',
@ -83,16 +97,20 @@ const tableProps = [
// },
{
prop: 'description',
label: '描述'
label: '描述',
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
minWidth: 120,
showOverflowtooltip: true
}
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -129,7 +147,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-production-line:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-production-line:create') ? 'button' : '',

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-22 10:27:43
* @LastEditTime: 2024-04-02 16:46:49
* @Description:
-->
<template>
@ -79,7 +79,7 @@ export default {
dataRule: {
code: [{ required: true, message: "供应商编号不能为空", trigger: "blur" }],
name: [{ required: true, message: "供应商名称不能为空", trigger: "blur" }],
contact: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
// contact: [{ required: true, message: "", trigger: "blur" }],
telephone: [
{ required: false, trigger: "blur", message: "手机号不能为空" },
{

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -45,41 +46,56 @@ import {
getCoreSupplierPage,
deleteCoreSupplier
} from '@/api/base/coreSupplier';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
width: 150,
showOverflowtooltip: true
},
{
prop: 'code',
label: '供应商编码'
label: '供应商编码',
width: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '供应商名称'
label: '供应商名称',
width: 180,
showOverflowtooltip: true
},
{
prop: 'contact',
label: '联系人'
label: '联系人',
width: 180,
showOverflowtooltip: true
},
{
prop: 'telephone',
label: '联系电话'
label: '联系电话',
width: 150,
showOverflowtooltip: true
},
{
prop: 'address',
label: '地址'
label: '地址',
width: 180,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
minWidth: 90,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -116,7 +132,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-supplier:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-supplier:create') ? 'button' : '',

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-22 08:53:20
* @LastEditTime: 2024-04-08 10:21:46
* @Description:
-->
<template>
@ -214,7 +214,9 @@ export default {
actualQuantity: this.dataForm.actualQuantity
}).then(response => {
this.$modal.msgSuccess("操作成功!工单状态稍后将会更新!");
this.saveData(tempList)
if (tempList.length > 0) {
this.saveData(tempList)
}
this.visible = false;
this.$emit("refreshDataList");
});

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-21 16:52:46
* @LastEditTime: 2024-04-10 16:16:31
* @Description:
-->
<template>
@ -182,7 +182,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="orderList">
:table-data="orderList"
:max-height="tableH">
<method-btn
v-if="!isdetail"
slot="handleBtn"
@ -200,23 +201,26 @@
@pagination="getList" /> -->
</div>
<div class="card" style="padding-bottom: 16px;">
<div class="boxTitle">
<span class="blueTitle"></span>
<span>预计用料信息</span>
<div v-if="this.$auth.hasPermiAnd(['base:material-product-bom-det:query', 'extend:process-flow:query'])">
<div class="card" style="padding-bottom: 16px;">
<div class="boxTitle">
<span class="blueTitle"></span>
<span>预计用料信息</span>
</div>
<base-table
:table-props="tableProps1"
:page="listQuery1.pageNo"
:limit="listQuery1.pageSize"
:table-data="materialList"
:max-height="tableH" />
<!-- <pagination
v-show="listQuery1.total > 0"
:total="listQuery1.total"
:page.sync="listQuery1.pageNo"
:limit.sync="listQuery1.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" /> -->
</div>
<base-table
:table-props="tableProps1"
:page="listQuery1.pageNo"
:limit="listQuery1.pageSize"
:table-data="materialList" />
<!-- <pagination
v-show="listQuery1.total > 0"
:total="listQuery1.total"
:page.sync="listQuery1.pageNo"
:limit.sync="listQuery1.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" /> -->
</div>
<!-- <div class="drawer-body__footer">
@ -235,6 +239,7 @@ import SmallTitle from './SmallTitle';
import { publicFormatter } from "@/utils/dict";
import { parseTime } from '@/utils/ruoyi'
import topTabVue from '../../order/base/orderManage/components/topTab.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableBtn = [
{
@ -292,9 +297,11 @@ const tableProps1 = [
];
export default {
mixins: [tableHeightMixin],
components: { SmallTitle, topTabVue },
data() {
return {
heightNum: 380,
tableBtn,
tableProps,
tableProps1,
@ -455,8 +462,8 @@ export default {
// this.listQuery.total = response.data.total;
});
// 使
console.log()
if (this.dataForm.id) {
console.log('111我看看', this.dataForm.materialMethod)
if (this.dataForm.id && this.$auth.hasPermiAnd(['base:material-product-bom-det:query', 'extend:process-flow:query'])) {
if (this.dataForm.materialMethod === 1) {
//
getlistByProductId({

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -62,7 +63,7 @@ import {
getCoreWOList
} from '@/api/base/coreWorkOrder';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -132,7 +133,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
components: {
AddWorkOrder,
AddOrUpdate,
@ -156,92 +157,105 @@ export default {
// showTip: '使'
// }
// : undefined,
{
type: 'active',
btnName: '激活',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
},
{
name: 'status',
type: 'equal',
value: 3
}
]
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'active',
btnName: '激活',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
},
{
name: 'status',
type: 'equal',
value: 3
}
]
}
}
},
{
type: 'pause',
btnName: '暂停',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
}
]
: undefined,
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'pause',
btnName: '暂停',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
}
]
}
}
},
{
type: 'nullify',
btnName: '作废',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
: undefined,
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'nullify',
btnName: '作废',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
},
{
type: 'finish',
btnName: '完成',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
},
{
name: 'status',
type: 'equal',
value: 3
}
]
: undefined,
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'finish',
btnName: '完成',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
},
{
name: 'status',
type: 'equal',
value: 3
}
]
}
}
},
{
type: 'stop',
btnName: '终止',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
},
{
name: 'status',
type: 'equal',
value: 3
}
]
: undefined,
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'stop',
btnName: '终止',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
},
{
name: 'status',
type: 'equal',
value: 3
}
]
}
}
},
this.$auth.hasPermi(`base:core-work-order:detail`)
: undefined,
this.$auth.hasPermiAnd([
'base:core-work-order:query',
'base:order:query'
])
? {
type: 'detail',
btnName: '查看详情',

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -46,20 +47,27 @@ import {
deleteCoreWorker
} from '@/api/base/coreWorker';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime
filter: parseTime,
width: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '姓名'
label: '姓名',
width: 120,
showOverflowtooltip: true
},
{
prop: 'code',
label: '员工号'
label: '员工号',
width: 150,
showOverflowtooltip: true
},
{
prop: 'sex',
@ -70,32 +78,44 @@ const tableProps = [
prop: 'entryTime',
label: '入职时间',
filter: (val) => val ? moment(val).format('yyyy-MM-DD') : '',
width: 120,
showOverflowtooltip: true
},
{
prop: 'telephone',
label: '联系电话'
label: '联系电话',
width: 150,
showOverflowtooltip: true
},
{
prop: 'status',
label: '状态',
filter: (val) => ['', '在职', '离职'][val]
filter: (val) => ['', '在职', '离职'][val],
width: 120,
showOverflowtooltip: true
},
{
prop: 'departmentName',
label: '部门'
label: '部门',
width: 120,
showOverflowtooltip: true
},
{
prop: 'majorName',
label: '专业'
label: '专业',
width: 150,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
width: 150,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -143,7 +163,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-worker:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-worker:create') ? 'button' : '',

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -45,6 +46,7 @@ import {
getCWSectionPage,
deleteCWSection
} from '@/api/base/coreWorkshopSection';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -70,12 +72,13 @@ const tableProps = [
},
{
prop: 'remark',
label: '备注'
label: '备注',
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -112,7 +115,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:core-workshop-section:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-workshop-section:create') ? 'button' : '',

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-21 15:21:32
* @LastEditTime: 2024-04-11 16:22:19
* @Description:
-->
<template>
@ -121,15 +121,15 @@
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<div class="attr-list" v-if="idAttrShow && this.$auth.hasPermi('base:material-attr:query')">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
物料属性
</small-title>
<div v-if="!isdetail" class="action_btn">
<div v-if="!isdetail && this.$auth.hasPermi('base:material-attr:create')" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
@ -182,16 +182,23 @@ import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add';
import { getDictDatas } from "@/utils/dict";
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
// const tableBtn = [
// this.$auth.hasPermiAnd([
// 'base:material-attr:create',
// 'base:material-attr:update'
// ]) ?
// {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:material-attr:delete') ?
// {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ];
const tableProps = [
{
prop: 'createTime',
@ -213,7 +220,23 @@ export default {
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableBtn: [
this.$auth.hasPermiAnd([
'base:material-attr:create',
'base:material-attr:update'
]) ?
{
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:material-attr:delete') ?
{
type: 'delete',
btnName: '删除',
}
: undefined,
],
tableProps,
addOrUpdateVisible: false,
urlOptions: {

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -40,6 +41,7 @@ import {
} from '@/api/base/material';
import { listData } from "@/api/system/dict/data";
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -75,7 +77,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -132,7 +134,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:material:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:material:create') ? 'button' : '',

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-03-21 14:39:52
* @LastEditTime: 2024-04-11 16:44:41
* @Description:
-->
<template>
@ -56,14 +56,14 @@
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<div class="attr-list" v-if="idAttrShow && this.$auth.hasPermiAnd(['base:material-product-bom:query', 'base:material-product-bom-det:query'])">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
BOM明细
</small-title>
<div v-if="!isdetail" class="action_btn">
<div v-if="!isdetail && this.$auth.hasPermi('base:material-product-bom:create')" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button>
@ -116,16 +116,16 @@ import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add';
import { publicFormatter } from '@/utils/dict';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
// const tableBtn = [
// {
// type: 'edit',
// btnName: '',
// },
// {
// type: 'delete',
// btnName: '',
// },
// ];
const tableProps = [
{
prop: 'createTime',
@ -160,7 +160,24 @@ export default {
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableBtn: [
this.$auth.hasPermiAnd([
'base:material-product-bom:update',
'base:material-product-bom-det:create',
'base:material-product-bom-det:update'
]) ?
{
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:material-product-bom:delete') ?
{
type: 'delete',
btnName: '删除',
}
: undefined,
],
tableProps,
addOrUpdateVisible: false,
urlOptions: {

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -38,6 +39,7 @@ import {
getMaterialPBPage,
deleteMaterialPB
} from '@/api/base/materialProductBom';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -55,7 +57,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
components: {
AddOrUpdate,
},
@ -108,7 +110,7 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:material:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:material:create') ? 'button' : '',

View File

@ -2,38 +2,21 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2024-02-28 10:38:34
* @LastEditTime: 2024-04-10 16:34:40
* @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="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList" />
</div>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<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" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
</div>
</template>
<script>
@ -41,6 +24,7 @@ import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
getPackingModel,
} from '@/api/base/printModel.js'
@ -91,7 +75,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -144,7 +128,7 @@ export default {
param: 'createTime',
},
{
type: 'button',
type: this.$auth.hasPermi('base:packaging-print-log:query') ? 'button' : '',
btnName: '搜索',
name: 'search',
color: 'primary',
@ -157,8 +141,8 @@ export default {
// btnName: '',
// name: 'reset',
// },
{
type: 'separate',
{
type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
@ -314,7 +298,7 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.pageSize = 20;
this.listQuery.workOrderId = val.workOrderId;
if (val.createTime && val.createTime.length != 0) {
this.listQuery.createTime = val.createTime
@ -329,7 +313,7 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};

View File

@ -2,13 +2,14 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-12-04 13:38:45
* @LastEditTime: 2024-04-03 15:08:38
* @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="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" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
@ -25,7 +26,9 @@ import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import printModelDesign from '../custom/index'
import { updatePackingModel,} from '@/api/base/printModel.js';
import { updatePackingModel, } from '@/api/base/printModel.js';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
deletePackingModel,
getPackingModelPage,
@ -59,7 +62,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -162,7 +165,7 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.pageSize = 20;
this.listQuery.packagingCode = val.packagingCode;
this.listQuery.createTime = val.createTime;
this.getDataList();
@ -170,7 +173,7 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};

View File

@ -2,38 +2,21 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-12-04 13:44:01
* @LastEditTime: 2024-04-03 15:09:06
* @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="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList" />
</div>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<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" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
</div>
</template>
<script>
@ -41,6 +24,7 @@ import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
deletePackingType,
getPackingTypePage,
@ -64,7 +48,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -154,7 +138,7 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.pageSize = 20;
this.listQuery.packagingCode = val.packagingCode;
this.listQuery.createTime = val.createTime;
this.getDataList();
@ -162,7 +146,7 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};

View File

@ -1,348 +1,368 @@
<template>
<div class="choicepart-container">
<navbar />
<div class="choicepart-wrapper">
<div class="choicepart-box" id="choicepartBox" :style="'transform:scale('+scale+');width:1710px;height:538px;'" v-show="showItem">
<div class="choicepart-line1">
<div
v-for="(item, index) in menuArr1"
:key="index"
class="choicepart-item"
@click="handelClick(item, item.choicepart)"
:style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
>
<div>
<img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
</div>
<div class="choicepart-item-title">{{item.meta.title}}</div>
</div>
</div>
<div class="choicepart-line2">
<div
v-for="(item, index) in menuArr2"
:key="index"
class="choicepart-item"
@click="handelClick(item, item.choicepart)"
:style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
>
<div>
<img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
</div>
<div class="choicepart-item-title">{{item.meta.title}}</div>
</div>
</div>
</div>
</div>
<div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
</div>
<div class="choicepart-container">
<navbar />
<div class="choicepart-wrapper">
<div
class="choicepart-box"
id="choicepartBox"
:style="'transform:scale(' + scale + ')'"
style="width: 1710px; height: 538px"
v-show="showItem">
<div class="choicepart-line1">
<div
v-for="(item, index) in menuArr1"
:key="index"
class="choicepart-item"
@click="handelClick(item, item.choicepart)"
:style="{
opacity: item.visible ? 1 : 0.4,
pointerEvents: item.visible ? 'auto' : 'none',
}">
<div>
<img
:src="
require(`../../assets/images/choicepart/${item.name}.png`)
"
alt="" />
</div>
<div class="choicepart-item-title">{{ item.meta.title }}</div>
</div>
</div>
<div class="choicepart-line2">
<div
v-for="(item, index) in menuArr2"
:key="index"
class="choicepart-item"
@click="handelClick(item, item.choicepart)"
:style="{
opacity: item.visible ? 1 : 0.4,
pointerEvents: item.visible ? 'auto' : 'none',
}">
<div>
<img
:src="
require(`../../assets/images/choicepart/${item.name}.png`)
"
alt="" />
</div>
<div class="choicepart-item-title">{{ item.meta.title }}</div>
</div>
</div>
</div>
</div>
<div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
</div>
</template>
<script>
import Navbar from './components/Navbar'
import { debounce } from '@/utils/debounce'
import Navbar from './components/Navbar';
import { debounce } from '@/utils/debounce';
export default {
components: { Navbar },
name: 'choicePart',
data() {
return {
boxReset: '',
scale: 1,
menuArr1: [
{
name: 'Core',
title: '基础核心',
visible: false,
meta: {
title: ''
}
},
{
name: 'Order',
title: '订单管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Equipment',
title: '设备管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Group',
title: '班组管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Quality',
title: '质量管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Warehouse',
title: '仓库管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Energy',
title: '能源管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Packaging',
title: '包装管理',
visible: false,
meta: {
title: ''
}
}
],
menuArr2: [
{
name: 'Material',
title: '物料管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Extend',
title: '工艺管理',
visible: false,
meta: {
title: ''
}
},
// {
// name: 'Delivery',
// title: '',
// visible: false,
// meta: {
// title: ''
// }
// },
{
name: 'Report',
title: '报表管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Cost',
title: '成本管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'SafetyEnvironmental',
title: '安环管理',
visible: false,
meta: {
title: ''
}
},
{
name: 'Databoard',
title: '数据驾驶舱',
visible: false,
meta: {
title: ''
}
},
{
name: 'System',
title: '系统管理',
visible: false,
meta: {
title: ''
}
}
],
showItem: false
}
},
// computed:{
// ...mapGetters(['sidebarRouters'])
// },
mounted() {
this.getMsg()
this.boxReset = debounce(() => {
this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
},
methods: {
getMsg() {
let menuList = this.$store.state.permission.sidebarRouters
console.log(menuList)
if (menuList.length > 0) {
for (let i = 0; i < menuList.length; i ++) {
for (let k = 0; k < 8; k++) {
if (menuList[i].name === this.menuArr1[k].name) {
this.menuArr1[k].visible = true
this.menuArr1[k].id = menuList[i].id
this.menuArr1[k].choicepart = i
this.menuArr1[k].children = menuList[i].children
this.menuArr1[k].meta = menuList[i].meta
}
}
for (let j = 0; j < 7; j++) {
if (menuList[i].name === this.menuArr2[j].name) {
this.menuArr2[j].visible = true
this.menuArr2[j].id = menuList[i].id
this.menuArr2[j].choicepart = i
this.menuArr2[j].children = menuList[i].children
this.menuArr2[j].meta = menuList[i].meta
}
}
}
}
console.log(this.menuArr1)
console.log(this.menuArr2)
},
handelClick(item, index) {
// this.$router.push({name: 'SystemUser'})
this.$store.dispatch('app/setChoicepart', index)
this.toRouter(item)
// if (item.meta.unuse) {
// this.$message.warning(this.$t(''))
// } else {
// this.toRouter(item)
// }
},
toRouter(item) {
console.log(item)
if (item.children) {
this.toRouter(item.children[0])
} else {
this.$router.push({ name: item.name })
}
},
resetSize() {
let _this = this
_this.showItem = false
_this.loading = true
let choicepartBox = document.querySelector('#choicepartBox')
let rw = parseFloat(window.innerWidth)
let rh = parseFloat(window.innerHeight)
let bw = parseFloat(choicepartBox.style.width)
let bh = parseFloat(choicepartBox.style.height)
let wx = 0.82/(bw / rw)
let hx = 0.56/(bh / rh)
_this.scale = wx > hx ? hx : wx
setTimeout(_this.showItemFun, 700)
},
showItemFun() {
this.loading = false
this.showItem = true
}
},
beforeDestroy() {
this.showItem = false
}
}
components: { Navbar },
name: 'choicePart',
data() {
return {
scale: 1,
menuArr1: [
{
name: 'Core',
title: '基础核心',
visible: false,
meta: {
title: '',
},
},
{
name: 'Order',
title: '订单管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Equipment',
title: '设备管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Group',
title: '班组管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Quality',
title: '质量管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Warehouse',
title: '仓库管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Energy',
title: '能源管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Packaging',
title: '包装管理',
visible: false,
meta: {
title: '',
},
},
],
menuArr2: [
{
name: 'Material',
title: '物料管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Extend',
title: '工艺管理',
visible: false,
meta: {
title: '',
},
},
// {
// name: 'Delivery',
// title: '',
// visible: false,
// meta: {
// title: ''
// }
// },
{
name: 'Report',
title: '报表管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Cost',
title: '成本管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'SafetyEnvironmental',
title: '安环管理',
visible: false,
meta: {
title: '',
},
},
{
name: 'Databoard',
title: '数据驾驶舱',
visible: false,
meta: {
title: '',
},
},
{
name: 'System',
title: '系统管理',
visible: false,
meta: {
title: '',
},
},
],
showItem: false,
};
},
// computed:{
// ...mapGetters(['sidebarRouters'])
// },
mounted() {
this.getMsg();
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
window.removeEventListener('resize', this.boxReset);
},
methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
getMsg() {
let menuList = this.$store.state.permission.sidebarRouters;
console.log(menuList);
if (menuList.length > 0) {
for (let i = 0; i < menuList.length; i++) {
for (let k = 0; k < 8; k++) {
if (menuList[i].name === this.menuArr1[k].name) {
this.menuArr1[k].visible = true;
this.menuArr1[k].id = menuList[i].id;
this.menuArr1[k].choicepart = i;
this.menuArr1[k].children = menuList[i].children;
this.menuArr1[k].meta = menuList[i].meta;
}
}
for (let j = 0; j < 7; j++) {
if (menuList[i].name === this.menuArr2[j].name) {
this.menuArr2[j].visible = true;
this.menuArr2[j].id = menuList[i].id;
this.menuArr2[j].choicepart = i;
this.menuArr2[j].children = menuList[i].children;
this.menuArr2[j].meta = menuList[i].meta;
}
}
}
}
console.log(this.menuArr1);
console.log(this.menuArr2);
},
handelClick(item, index) {
// this.$router.push({name: 'SystemUser'})
this.$store.dispatch('app/setChoicepart', index);
this.toRouter(item);
// if (item.meta.unuse) {
// this.$message.warning(this.$t(''))
// } else {
// this.toRouter(item)
// }
},
toRouter(item) {
console.log(item);
if (item.children) {
this.toRouter(item.children[0]);
} else {
this.$router.push({ name: item.name });
}
},
resetSize() {
let _this = this;
_this.showItem = false;
_this.loading = true;
let choicepartBox = document.querySelector('#choicepartBox');
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(choicepartBox.style.width);
let bh = parseFloat(choicepartBox.style.height);
let wx = 0.82 / (bw / rw);
let hx = 0.56 / (bh / rh);
_this.scale = wx > hx ? hx : wx;
setTimeout(_this.showItemFun, 700);
},
showItemFun() {
this.loading = false;
this.showItem = true;
},
},
beforeDestroy() {
this.showItem = false;
},
};
</script>
<style lang='scss' scoped>
.choicepart-container {
position: relative;
width: 100%;
height: 100%;
background: url('../../assets/images/choicepart/choicepart-back.png') repeat;
background-size: 100% 100%;
.choicepart-wrapper {
width: 100vw;
height: calc(100vh - 94px);
display: flex;
justify-content: center;
align-items: center;
}
.choicepart-box {
// transition: all 0.3s linear;
.choicepart-line1 {
width: 100%;
margin-bottom: 80px;
display: flex;
flex-flow: row nowrap;
}
.choicepart-line2 {
width: 100%;
display: flex;
flex-flow: row nowrap;
justify-content: center;
}
.choicepart-item {
width: 184px;
height: 224px;
background: url('../../assets/images/choicepart/choice-item-back.png') no-repeat;
background-size: 100% 100%;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
position: relative;
margin: 0 20px;
img {
width: 184px;
height: 224px;
}
.choicepart-item-title {
overflow: hidden;
padding: 0 10px;
text-overflow: ellipsis;
white-space: nowrap;
position: absolute;
bottom: 0;
left: 2px;
right: 2px;
text-align: center;
color: #fff;
font-size: 16px;
line-height: 40px;
height: 40px;
letter-spacing: 2px;
background-color: rgba($color: #0b58ff, $alpha: 0.45);
}
}
.choicepart-item:hover {
.choicepart-item-title {
background-color: rgba($color: #0b58ff, $alpha: 1);
}
}
}
.choicepart-footer {
position: absolute;
width: 100%;
color: #C7C7C7;
user-select: none;
font-size: 12px;
letter-spacing: 1px;
height: 30px;
display: grid;
place-content: center;
bottom: 0;
opacity: 0.5;
}
position: relative;
width: 100%;
height: 100%;
background: url('../../assets/images/choicepart/choicepart-back.png') repeat;
background-size: 100% 100%;
.choicepart-wrapper {
width: 100vw;
height: calc(100vh - 94px);
display: flex;
justify-content: center;
align-items: center;
}
.choicepart-box {
// transition: all 0.3s linear;
.choicepart-line1 {
width: 100%;
margin-bottom: 80px;
display: flex;
flex-flow: row nowrap;
}
.choicepart-line2 {
width: 100%;
display: flex;
flex-flow: row nowrap;
justify-content: center;
}
.choicepart-item {
width: 184px;
height: 224px;
background: url('../../assets/images/choicepart/choice-item-back.png')
no-repeat;
background-size: 100% 100%;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
position: relative;
margin: 0 20px;
img {
width: 184px;
height: 224px;
}
.choicepart-item-title {
overflow: hidden;
padding: 0 10px;
text-overflow: ellipsis;
white-space: nowrap;
position: absolute;
bottom: 0;
left: 2px;
right: 2px;
text-align: center;
color: #fff;
font-size: 16px;
line-height: 40px;
height: 40px;
letter-spacing: 2px;
background-color: rgba($color: #0b58ff, $alpha: 0.45);
}
}
.choicepart-item:hover {
.choicepart-item-title {
background-color: rgba($color: #0b58ff, $alpha: 1);
}
}
}
.choicepart-footer {
position: absolute;
width: 100%;
color: #c7c7c7;
user-select: none;
font-size: 12px;
letter-spacing: 1px;
height: 30px;
display: grid;
place-content: center;
bottom: 0;
opacity: 0.5;
}
}
</style>

View File

@ -106,6 +106,10 @@ export default {
activeIndex(val) {
this.initChart(val);
},
daterange(val) {
console.log('222', val)
this.templateOption.xAxis.data = val
},
},
methods: {
/**
@ -124,8 +128,8 @@ export default {
},
/** 初始化/设置 图表 */
initChart(val) {
console.log('tableData', this.tableData);
if (!this.chart) this.chart = echarts.init(this.$refs.chartDiv);
this.chart.clear();
switch (val) {
case 0:
const eqCt = this.tableData.map((row) => ({
@ -139,7 +143,7 @@ export default {
...this.templateOption,
yAxis: { ...this.templateOption.yAxis, name: '设备CT' },
series: eqCt,
});
}, true);
break;
case 1:
const eqTt = this.tableData.map((row) => ({
@ -153,7 +157,7 @@ export default {
...this.templateOption,
yAxis: { ...this.templateOption.yAxis, name: '设备TT' },
series: eqTt,
});
}, true);
break;
case 2:
const plCt = this.tableData.map((row) => ({
@ -167,7 +171,7 @@ export default {
...this.templateOption,
yAxis: { ...this.templateOption.yAxis, name: '产线CT' },
series: plCt,
});
}, true);
break;
case 3:
const plTt = this.tableData.map((row) => ({
@ -181,9 +185,10 @@ export default {
...this.templateOption,
yAxis: { ...this.templateOption.yAxis, name: '产线TT' },
series: plTt,
});
}, true);
break;
default:
this.activeIndex = 0
const eqCt2 = this.tableData.map((row) => ({
name: row.equName,
type: 'line',
@ -195,7 +200,7 @@ export default {
...this.templateOption,
yAxis: { ...this.templateOption.yAxis, name: '设备CT' },
series: eqCt2,
});
}, true);
}
},
},

View File

@ -18,13 +18,15 @@
:page="1"
:limit="999"
:table-props="tableProps"
:table-data="tableData" />
:table-data="tableData"
:max-height="tableH" />
<div v-if="tableData.length == 0" class="no-data-bg"></div>
</el-tab-pane>
<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
<div class="graph" style="height: 800px">
<!-- graph -->
<AnalysisChart
ref="analysisChart"
v-if="activeName == 'graph'"
:table-data="tableData"
:daterange="dateArr"></AnalysisChart>
@ -47,13 +49,14 @@ import BalanceChart from '../balanceChart';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import AnalysisChart from './chart.vue';
import { parseTime } from '@/utils/ruoyi'
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
components: {
BalanceChart,
AnalysisChart,
},
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
activeName: 'table',
@ -176,6 +179,11 @@ export default {
// const p = this.tableProps
// const d = this.tableData
// debugger;
if (this.activeName == 'graph') {
this.$nextTick(() => {
this.$refs['analysisChart'].initChart()
})
}
this.ready = true;
},

View File

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -41,6 +42,7 @@
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import {
deleteFactory,
getFactoryPage
@ -71,7 +73,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -123,7 +125,7 @@ export default {
// name: 'reset',
// },
{
type: 'separate',
type: this.$auth.hasPermi('base:core-factory:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:core-factory:create') ? 'button' : '',

View File

@ -17,7 +17,7 @@ export default {
},
tableData: [],
listQuery: {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
},

View File

@ -27,13 +27,16 @@
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
import { parseTime } from '../../mixins/code-filter';
import { getSchedulingMonitoringRecord1 } from '@/api/monitoring/teamProduction'
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'productionLineData24',
mixins: [tableHeightMixin],
components: {},
props: {},
data() {
return {
heightNum: 240,
urlOptions: {
getDataListURL: getPdlDataOneDay
},
@ -56,9 +59,9 @@ export default {
},
computed: {},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(240)
})
// window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(240)
// })
this.getList();
},
methods: {
@ -115,7 +118,7 @@ export default {
/** 把 list 里的数据转换成 tableProps 对应的格式 */
convertList(list) {
// let sectionArr= []
let temp = Object.values(list.datamap)
let temp = list.datamap ? Object.values(list?.datamap) : []
console.log('111', temp)
temp.forEach(item => {

View File

@ -32,6 +32,7 @@ import {
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -61,7 +62,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
@ -70,7 +71,6 @@ export default {
},
tableData: [],
tableProps,
tableH: this.tableHeight(260),
drawerVisible: false,
formConfig: [
{
@ -92,13 +92,15 @@ export default {
param: 'searchTime',
},
{
type: 'button',
type: this.$auth.hasPermi('extend:cost-energy-search:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('cost:energyCost:export')
type: this.$auth.hasPermi('extend:cost-energy-search:export')
? 'button'
: '',
btnName: '导出',
@ -111,9 +113,6 @@ export default {
},
components: {},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
getEnergyTypeListAll().then((response) => {
this.formConfig[0].selectOptions = response.data;
});

View File

@ -32,6 +32,7 @@ import {
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -71,7 +72,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
@ -80,7 +81,6 @@ export default {
},
tableData: [],
tableProps,
tableH: this.tableHeight(260),
drawerVisible: false,
formConfig: [
{
@ -116,13 +116,15 @@ export default {
defaultSelect: [],
},
{
type: 'button',
type: this.$auth.hasPermi('extend:cost-enery-auto-report:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('cost:energyCostHis:export')
type: this.$auth.hasPermi('extend:cost-enery-auto-report:export')
? 'button'
: '',
btnName: '导出',
@ -135,9 +137,6 @@ export default {
},
components: {},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);

View File

@ -12,7 +12,7 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
@ -53,6 +53,7 @@ import {
} from '@/api/cost/costMaterialSet';
import { getHotMaterialList } from '@/api/base/coreHotMaterial';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -91,7 +92,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
@ -99,15 +100,14 @@ export default {
deleteURL: deleteCostMaterialSet,
},
tableProps,
tableH: this.tableHeight(260),
tableBtn: [
this.$auth.hasPermi(`cost:rawMaterialConfig:update`)
this.$auth.hasPermi(`extend:cost-material-set:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`cost:rawMaterialConfig:delete`)
this.$auth.hasPermi(`extend:cost-material-set:delete`)
? {
type: 'delete',
btnName: '删除',
@ -124,16 +124,22 @@ export default {
filterable: true,
},
{
type: 'button',
type: this.$auth.hasPermi('extend:cost-material-set:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
type:
this.$auth.hasPermi('extend:cost-material-set:create') &&
this.$auth.hasPermi('extend:cost-material-set:query')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('cost:rawMaterialConfig:create')
type: this.$auth.hasPermi('extend:cost-material-set:create')
? 'button'
: '',
btnName: '新增',
@ -148,9 +154,6 @@ export default {
AddOrUpdate,
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
getHotMaterialList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});

View File

@ -32,6 +32,7 @@ import {
import { getHotMaterialList } from '@/api/base/coreHotMaterial';
import { publicFormatter } from '@/utils/dict';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -66,7 +67,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
@ -75,7 +76,6 @@ export default {
},
tableData: [],
tableProps,
tableH: this.tableHeight(260),
drawerVisible: false,
formConfig: [
{
@ -97,13 +97,15 @@ export default {
param: 'searchTime',
},
{
type: 'button',
type: this.$auth.hasPermi('extend:cost-material-search:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('cost:rawMaterialCost:export')
type: this.$auth.hasPermi('extend:cost-material-search:export')
? 'button'
: '',
btnName: '导出',
@ -116,9 +118,6 @@ export default {
},
components: {},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
getHotMaterialList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});

View File

@ -32,6 +32,7 @@ import {
import { getHotMaterialList } from '@/api/base/coreHotMaterial';
import { publicFormatter } from '@/utils/dict';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
@ -70,7 +71,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
@ -79,7 +80,6 @@ export default {
},
tableData: [],
tableProps,
tableH: this.tableHeight(260),
drawerVisible: false,
formConfig: [
{
@ -115,13 +115,15 @@ export default {
defaultSelect: [],
},
{
type: 'button',
type: this.$auth.hasPermi('extend:cost-material-auto-report:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('cost:rawMaterialCostHis:export')
type: this.$auth.hasPermi('extend:cost-material-auto-report:export')
? 'button'
: '',
btnName: '导出',
@ -134,9 +136,6 @@ export default {
},
components: {},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);

View File

@ -1,234 +1,258 @@
<template>
<div style="height: 370px;">
<NotMsg v-show="notMsg"/>
<div id="numRateChart" class="num-rate-chart" style="width:900px;height:420px;" v-show='!notMsg'></div>
</div>
<div style="height: 370px">
<NotMsg v-show="notMsg" />
<div
id="numRateChart"
class="num-rate-chart"
style="width: 900px; height: 420px"
v-show="!notMsg"></div>
</div>
</template>
<script>
import * as echarts from 'echarts';
import resize from './../mixins/resize'
import NotMsg from './../components/NotMsg'
import resize from './../mixins/resize';
import NotMsg from './../components/NotMsg';
export default {
name: 'NumRateChart',
mixins: [resize],
components:{ NotMsg },
data() {
return {
chart: null,
notMsg:true
}
},
computed: {
productline() {
return this.$store.state.websocket.productline
}
},
watch:{
productline: {
name: 'NumRateChart',
mixins: [resize],
components: { NotMsg },
data() {
return {
chart: null,
notMsg: true,
};
},
computed: {
productline() {
return this.$store.state.websocket.productline;
},
},
watch: {
productline: {
handler(newVal, oldVal) {
if (newVal === oldVal) {
return false
}
this.updateChart()
this.$emit('emitFun')
}
}
},
mounted() {
if (newVal === oldVal) {
return false;
}
this.updateChart();
this.$emit('emitFun');
},
},
},
mounted() {
this.$el.addEventListener('resize', () => {
console.log('resziing.....');
});
this.updateChart()
this.updateChart();
},
methods: {
updateChart() {
if (this.productline && this.productline.length > 0) {
this.notMsg = false
} else {
this.notMsg = true
return
}
let xData = []
let outputNum = []
let passRate = []
this.productline && this.productline.length > 0 && this.productline.map(item => {
if ((item.lineName).includes('D')) {
xData.push(item.lineName)
outputNum.push(item.outputNum)
passRate.push(item.passRate?item.passRate*100:null)
}
})
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose()
}
this.chart = echarts.init(document.getElementById('numRateChart'));
var option = {
grid: { top: 82, right: 60, bottom: 20, left: 90 },
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
className: "num-rate-chart-tooltip"
},
legend: {
itemWidth:10,
itemHeight:10,
top: '2.5%',
methods: {
updateChart() {
if (this.productline && this.productline.length > 0) {
this.notMsg = false;
} else {
this.notMsg = true;
return;
}
let xData = [];
let outputNum = [];
let passRate = [];
for (let i = 0; i < this.productline.length - 1; i++) {
//
for (let j = 0; j < this.productline.length - i - 1; j++) {
//
if (
this.productline[j].lineName.substr(
this.productline[j].lineName.length - 1,
1
) >
this.productline[j + 1].lineName.substr(
this.productline[j + 1].lineName.length - 1,
1
)
) {
//
let temp = this.productline[j];
this.productline[j] = this.productline[j + 1];
this.productline[j + 1] = temp;
}
}
}
this.productline &&
this.productline.length > 0 &&
this.productline.map((item) => {
if (item.lineName.includes('D')) {
xData.push(item.lineName);
outputNum.push(item.outputNum);
passRate.push(item.passRate);
}
});
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose();
}
this.chart = echarts.init(document.getElementById('numRateChart'));
var option = {
grid: { top: 82, right: 60, bottom: 20, left: 90 },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
className: 'num-rate-chart-tooltip',
},
legend: {
itemWidth: 10,
itemHeight: 10,
top: '2.5%',
right: '20px',
icon: 'rect',
data: [
{name:'产线产量',itemStyle:{color:'#364BFE'}},
{name:'良品率',itemStyle:{color:'#FFCB59'}}
],
textStyle: {
color: "#DFF1FE",
fontSize: 12,
}
},
xAxis: [
{
type: 'category',
data: xData,
axisLabel: {
color: "#fff",
fontSize: 12,
},
axisPointer: {
type: 'shadow'
},
axisTick: { show: false },
axisLine: {
lineStyle: {
width: 1,
color: "#213259",
},
},
}
],
yAxis: [
{
type: 'value',
name: '产量/片',
nameTextStyle: {
color: '#fff',
fontSize: 10,
align: 'right',
},
axisLabel: {
color: "#fff",
fontSize: 12,
formatter: '{value}'
},
axisLine: {
show: true,
lineStyle: {
color: "#213259",
},
},
splitLine: {
lineStyle: {
color: "#213259a0",
},
}
},
{
type: 'value',
name: '良品率',
nameTextStyle: {
color: '#fff',
fontSize: 10,
align: 'LEFT',
},
axisLabel: {
color: "#fff",
fontSize: 12,
formatter: () =>{
return value ? '{value} %': '-'
}
},
axisLine: {
show: true,
lineStyle: {
color: "#213259",
},
},
splitLine: {
lineStyle: {
color: "#213259a0",
},
}
}
],
series: [
{
name: '产线产量',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value;
}
},
barWidth: 20,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#5CB7FF' },
{ offset: 1, color: '#364BFE' }
])
},
data: outputNum
},
{
name: '良品率',
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value?value + '%':'-';
}
},
itemStyle: {
color: '#FFD160'
},
areaStyle: {
icon: 'rect',
data: [
{ name: '产线产量', itemStyle: { color: '#364BFE' } },
{ name: '良品率', itemStyle: { color: '#FFCB59' } },
],
textStyle: {
color: '#DFF1FE',
fontSize: 12,
},
},
xAxis: [
{
type: 'category',
data: xData,
axisLabel: {
color: '#fff',
fontSize: 12,
},
axisPointer: {
type: 'shadow',
},
axisTick: { show: false },
axisLine: {
lineStyle: {
width: 1,
color: '#213259',
},
},
},
],
yAxis: [
{
type: 'value',
name: '产量/片',
nameTextStyle: {
color: '#fff',
fontSize: 10,
align: 'right',
},
axisLabel: {
color: '#fff',
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: '#213259',
},
},
splitLine: {
lineStyle: {
color: '#213259a0',
},
},
},
{
type: 'value',
name: '良品率',
nameTextStyle: {
color: '#fff',
fontSize: 10,
align: 'LEFT',
},
axisLabel: {
color: '#fff',
fontSize: 12,
formatter: '{value}%',
},
axisLine: {
show: true,
lineStyle: {
color: '#213259',
},
},
splitLine: {
lineStyle: {
color: '#213259a0',
},
},
},
],
series: [
{
name: '产线产量',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value;
},
},
barWidth: 20,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#FFCB59' + "40" },
{ offset: 0.5, color: '#FFCB59' + "20" },
{ offset: 1, color: '#FFCB59' + "00" },
]),
},
lineStyle: {
width: 1
},
symbol: 'circle',
symbolSize: 5,
data: passRate
}
]
};
option && this.chart.setOption(option)
}
}
}
{ offset: 0, color: '#5CB7FF' },
{ offset: 1, color: '#364BFE' },
]),
},
data: outputNum,
},
{
name: '良品率',
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value ? value + '%' : '-';
},
},
itemStyle: {
color: '#FFD160',
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#FFCB59' + '40' },
{ offset: 0.5, color: '#FFCB59' + '20' },
{ offset: 1, color: '#FFCB59' + '00' },
]),
},
lineStyle: {
width: 1,
},
symbol: 'circle',
symbolSize: 5,
data: passRate,
},
],
};
option && this.chart.setOption(option);
},
},
};
</script>
<style scoped lang="scss">
.num-rate-chart {
width: 100%;
height: 100%;
top: -50px;
top: -50px;
}
</style>
<style>
.num-rate-chart-tooltip {
background: #0a2b4f77 !important;
border: none !important;
backdrop-filter: blur(12px);
}
.num-rate-chart-tooltip * {
color: #fff !important;
}
.num-rate-chart-tooltip {
background: #0a2b4f77 !important;
border: none !important;
backdrop-filter: blur(12px);
}
.num-rate-chart-tooltip * {
color: #fff !important;
}
</style>

View File

@ -1,66 +1,83 @@
<template>
<div style="flex: 1;">
<Container name="各工序缺陷汇总" size="middle" style="">
<TimePrompt class="timeShow" :timestr="timestr" />
<div style="padding: 5px 10px;">
<dv-scroll-board :config="config" style="width:575px;height:380px" ref='defectScrollBoard'/>
</div>
</Container>
</div>
<div style="flex: 1">
<Container
name="各工序缺陷汇总"
size="middle"
style="">
<TimePrompt
class="timeShow"
:timestr="timestr" />
<div style="padding: 5px 10px">
<dv-scroll-board
:config="config"
style="width: 575px; height: 380px"
ref="defectScrollBoard" />
</div>
</Container>
</div>
</template>
<script>
import Container from '../components/Container.vue';
import TimePrompt from '../components/TimePrompt';
import { switchShowTime } from '../utils'
import { switchShowTime } from '../utils';
export default {
name: 'DefectSum',
components: { Container, TimePrompt },
computed: {
defectSum() {
return this.$store.state.websocket.defectSum
}
},
data() {
return {
timestr: '',
config: {
header: ['序号', '产线', '工序','损耗片数','缺陷类型'],
headerBGC: 'rgba(32, 55, 96, 0.8)',
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
columnWidth: [60],
align: ['center'],
data: [],
// data: [[1, 'Y61', '','10','']],
rowNum: 10
}
}
},
mounted() {
this.timestr = switchShowTime('日')
},
watch:{
defectSum: {
name: 'DefectSum',
components: { Container, TimePrompt },
computed: {
defectSum() {
return this.$store.state.websocket.defectSum;
},
},
data() {
return {
timestr: '',
config: {
header: ['序号', '产线', '工序', '损耗片数', '缺陷类型'],
headerBGC: 'rgba(32, 55, 96, 0.8)',
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
columnWidth: [60],
align: ['center'],
data: [
//
[1, 'D61', '成型', '3片', '细长泡'],
[2, 'D62', '组合落板', '4片', '细长泡'],
[3, 'D61', '磨边', '6片', '开口泡'],
[4, 'D63', '清洗', '5片', '结石'],
[5, 'D64', '打孔', '2片', '结石'],
[6, 'D63', '成型', '7片', '开口泡'],
[7, 'D61', '上片', '8片', '结石'],
],
// data: [],
rowNum: 10,
},
};
},
mounted() {
this.timestr = switchShowTime('日');
},
watch: {
defectSum: {
handler(newVal, oldVal) {
let outArr = this.defectSum.map((item, index) => [
index+1,
item.productionLineName,
item.sectionName,
item.count,
item.inspectionTypeName
]);
this.config.data = outArr
this.$refs['defectScrollBoard'].updateRows(outArr)
this.timestr = switchShowTime('日')
}
}
}
}
let outArr = this.defectSum.map((item, index) => [
index + 1,
item.productionLineName,
item.sectionName,
item.count,
item.inspectionTypeName,
]);
this.config.data = outArr;
this.$refs['defectScrollBoard'].updateRows(outArr);
this.timestr = switchShowTime('日');
},
},
},
};
</script>
<style lang='scss' scoped>
.timeShow {
position: absolute;
top: 20px;
left: 240px;
position: absolute;
top: 20px;
left: 240px;
}
</style>

View File

@ -1,8 +1,11 @@
<template>
<div id='deepProcessingContainerB' ref='deepProcessingContainerB' style="width: 100%;height: 100%;">
<div
id="deepProcessingContainerB"
ref="deepProcessingContainerB"
style="width: 100%; height: 100%">
<div
id='deepProcessingContainer'
ref='deepProcessingContainer'
id="deepProcessingContainer"
ref="deepProcessingContainer"
class="deepProcessingBoard"
style="
position: absolute;
@ -16,15 +19,14 @@
flex-direction: column;
gap: 24px;
"
:style="{transform:'scale('+scaleNum+')'}">
<KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='深加工生产运行驾驶舱'/>
:style="{ transform: 'scale(' + scaleNum + ')' }">
<KHeader
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="深加工生产运行驾驶舱" />
<div
class="main-body"
style="
display: grid;
gap: 16px;
grid-template-rows: 462px 462px;
">
style="display: grid; gap: 16px; grid-template-rows: 462px 462px">
<TopThree />
<BottomTwo />
</div>
@ -47,16 +49,16 @@
import KHeader from '../components/Header';
import TopThree from './TopThree';
import BottomTwo from './BottomTwo';
import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'
import { getDcsMsg, getMesMsg } from './../utils/wsInterface'
import screenfull from 'screenfull';
import { debounce } from '@/utils/debounce';
import { getDcsMsg, getMesMsg } from './../utils/wsInterface';
export default {
name: 'deepProcessingBoard',
components: {
KHeader,
TopThree,
BottomTwo
BottomTwo,
},
// provide() {
// return {
@ -66,83 +68,90 @@ export default {
data() {
return {
isFullScreen: false,
scaleNum: 0.8
scaleNum: 0.8,
};
},
created() {
this.init()
this.init();
},
destroy() {
this.destroy()
this.destroy();
},
mounted() {
this.boxReset = debounce(() => {
this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
this.resetSize();
}, 300);
this.boxReset();
window.addEventListener('resize', () => {
this.boxReset();
});
// closeWebsocket()
// getDcsMsg()
// getMesMsg()
console.log('mounted...........')
},
mounted() {
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
console.log('destroyed...........')
window.removeEventListener('resize', this.boxReset);
this.destroy();
},
methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() {
this.isFullScreen = screenfull.isFullscreen
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change)
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change)
}
},
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
//
screenfullChange() {
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning'
})
return false
}
screenfull.toggle(this.$refs.deepProcessingContainerB)
},
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning',
});
return false;
}
screenfull.toggle(this.$refs.deepProcessingContainerB);
},
resetSize() {
let deepProcessingContainer = document.getElementById('deepProcessingContainer')
let rw = parseFloat(window.innerWidth)
let rh = parseFloat(window.innerHeight)
let bw = parseFloat(deepProcessingContainer.style.width)
let bh = parseFloat(deepProcessingContainer.style.height)
let wx = 0
let hx = 0
let deepProcessingContainer = document.getElementById(
'deepProcessingContainer'
);
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(deepProcessingContainer.style.width);
let bh = parseFloat(deepProcessingContainer.style.height);
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) {
console.log('全屏')
wx = rw / bw
hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
wx = rw / bw;
hx = rh / bh;
} else {
if (this.$store.state.app.sidebar.opened) {
wx = (rw-280) / bw
hx = (rh-116) / bh
}else{
wx = (rw-85) / bw
hx = (rh-116) / bh
wx = (rw - 280) / bw;
hx = (rh - 116) / bh;
} else {
wx = (rw - 85) / bw;
hx = (rh - 116) / bh;
}
}
this.scaleNum = wx
}
}
this.scaleNum = wx;
},
},
};
</script>

View File

@ -1,24 +1,23 @@
<!--
filename: MaterialCost.vue
author: liubin
date: 2023-12-06 09:09:27
description:
-->
<template>
<Container name="原料用量统计" size="middle" style="">
<div style="flex: 1; display: flex; gap: 8px;flex-direction: column;">
<Container
name="原料用量统计"
size="middle"
style="">
<div style="flex: 1; display: flex; gap: 8px; flex-direction: column">
<div
class="absolute"
style="
flex:3;
flex: 2;
padding: 12px 12px 0 12px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: repeat(4, 1fr);
gap: 8px;
">
<ShadowRect v-for="(item, index) in materialMsg1" :key="index" :rounded="false">
<ShadowRect
v-for="(item, index) in materialMsg"
:key="index"
:rounded="false">
<div
class="material"
style="
@ -30,43 +29,24 @@
align-items: center;
justify-content: center;
">
<span style="color: #0ee8e4; font-weight: 500; font-size: 32px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">
{{item.materialUsed}}
<span
style="
color: #0ee8e4;
font-weight: 500;
font-size: 32px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
">
{{ item.materialUsed }}
</span>
<span style="color: #fff; font-size: 16px; letter-spacing: 1px">
- {{item.materialName}}/kg-
</span>
</div>
</ShadowRect>
</div>
<div style="flex:1;
padding: 0 12px 12px 12px;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;">
<ShadowRect v-for="(item, index) in materialMsg2" :key="index" :rounded="false">
<div
class="material"
style="
flex: 1;
padding-bottom: 3px;
display: flex;
flex-direction: column;
gap: 4px;
align-items: center;
justify-content: center;
">
<span style="color: #0ee8e4; font-weight: 500; font-size: 32px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">
{{item.materialUsed}}
</span>
<span style="color: #fff; font-size: 16px; letter-spacing: 1px">
- {{item.materialName}}/kg-
- {{ item.materialName }}/kg-
</span>
</div>
</ShadowRect>
</div>
</div>
</Container>
</template>
@ -81,12 +61,9 @@ export default {
return {};
},
computed: {
materialMsg1() {
return this.$store.state.websocket.material.slice(0,9)
materialMsg() {
return this.$store.state.websocket.material;
},
materialMsg2() {
return this.$store.state.websocket.material.slice(9)
}
},
methods: {},
};

View File

@ -1,8 +1,11 @@
<template>
<div id='kilnContainerB' ref='kilnContainerB' style="width: 100%;height: 100%;">
<div
id="kilnContainerB"
ref="kilnContainerB"
style="width: 100%; height: 100%">
<div
id='kilnContainer'
ref='kilnContainer'
id="kilnContainer"
ref="kilnContainer"
class="KilnDataBoard"
style="
position: absolute;
@ -16,15 +19,22 @@
flex-direction: column;
gap: 24px;
"
:style="{transform:'scale('+scaleNum+')'}">
<KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='窑炉生产运行驾驶舱'/>
:style="{ transform: 'scale(' + scaleNum + ')' }">
<KHeader
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="窑炉生产运行驾驶舱" />
<div
class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div class="left-side" style="flex: 2">
<div
class="left-side"
style="flex: 2">
<LeftFour />
</div>
<div class="right-side" style="flex: 1">
<div
class="right-side"
style="flex: 1">
<RightTwo />
</div>
</div>
@ -36,8 +46,8 @@
import KHeader from '../components/Header';
import LeftFour from './LeftFour';
import RightTwo from './RightTwo.vue';
import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'
import screenfull from 'screenfull';
import { debounce } from '@/utils/debounce';
export default {
name: 'Kiln',
@ -46,10 +56,10 @@ export default {
LeftFour,
RightTwo,
},
computed:{
computed: {
sidebarStatus() {
return this.$store.state.app.sidebar.opened;
}
},
},
// provide() {
// return {
@ -59,84 +69,80 @@ export default {
data() {
return {
isFullScreen: false,
scaleNum: 0.8
scaleNum: 0.8,
};
},
watch: {
sidebarStatus() {
this.boxReset()
this.boxReset();
},
},
created() {
this.init()
},
destroy() {
this.destroy()
this.init();
},
mounted() {
this.boxReset = debounce(() => {
this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
window.removeEventListener('resize', this.boxReset);
this.destroy();
},
methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() {
this.isFullScreen = screenfull.isFullscreen
},
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change)
}
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change)
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
//
screenfullChange() {
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning'
})
return false
}
screenfull.toggle(this.$refs.kilnContainerB)
},
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning',
});
return false;
}
screenfull.toggle(this.$refs.kilnContainerB);
},
resetSize() {
let kilnContainerBox = document.getElementById('kilnContainer')
console.log(kilnContainerBox)
let rw = parseFloat(window.innerWidth)
let rh = parseFloat(window.innerHeight)
let bw = parseFloat(kilnContainerBox.style.width)
let bh = parseFloat(kilnContainerBox.style.height)
let wx = 0
let hx = 0
let kilnContainerBox = document.getElementById('kilnContainer');
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(kilnContainerBox.style.width);
let bh = parseFloat(kilnContainerBox.style.height);
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) {
console.log('全屏')
wx = rw / bw
hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
wx = rw / bw;
hx = rh / bh;
} else {
if (this.$store.state.app.sidebar.opened) {
wx = (rw-280) / bw
hx = (rh-116) / bh
}else{
wx = (rw-85) / bw
hx = (rh-116) / bh
wx = (rw - 280) / bw;
hx = (rh - 116) / bh;
} else {
wx = (rw - 85) / bw;
hx = (rh - 116) / bh;
}
}
this.scaleNum = wx
}
}
this.scaleNum = wx;
},
},
};
</script>

View File

@ -1,8 +1,11 @@
<template>
<div id='wholePlantContainerB' ref='wholePlantContainerB' style="width: 100%;height: 100%;">
<div
id="wholePlantContainerB"
ref="wholePlantContainerB"
style="width: 100%; height: 100%">
<div
id='wholePlantContainer'
ref='wholePlantContainer'
id="wholePlantContainer"
ref="wholePlantContainer"
class="wholePlantBoard"
style="
position: absolute;
@ -16,18 +19,27 @@
flex-direction: column;
gap: 24px;
"
:style="{transform:'scale('+scaleNum+')'}">
<KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='全厂总览驾驶舱'/>
:style="{ transform: 'scale(' + scaleNum + ')' }">
<KHeader
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="全厂总览驾驶舱" />
<div
class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div class="left-side" style="flex: 1">
<div
class="left-side"
style="flex: 1">
<LeftTwo />
</div>
<div class="middle-side" style="flex: 1">
<div
class="middle-side"
style="flex: 1">
<MiddleTwo />
</div>
<div class="right-side" style="flex: 1">
<div
class="right-side"
style="flex: 1">
<RightTwo />
</div>
</div>
@ -40,8 +52,8 @@ import KHeader from '../components/Header';
import LeftTwo from './LeftTwo';
import MiddleTwo from './MiddleTwo';
import RightTwo from './RightTwo';
import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'
import screenfull from 'screenfull';
import { debounce } from '@/utils/debounce';
export default {
name: 'wholePlantBoard',
@ -49,7 +61,7 @@ export default {
KHeader,
LeftTwo,
MiddleTwo,
RightTwo
RightTwo,
},
// provide() {
// return {
@ -59,80 +71,77 @@ export default {
data() {
return {
isFullScreen: false,
scaleNum: 0.8
scaleNum: 0.8,
};
},
created() {
this.init()
this.init();
},
destroy() {
this.destroy()
this.destroy();
},
mounted() {
this.boxReset = debounce(() => {
this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
console.log('mounted...........')
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
console.log('destroyed...........')
window.removeEventListener('resize', this.boxReset);
},
methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() {
this.isFullScreen = screenfull.isFullscreen
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change)
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change)
}
},
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
//
screenfullChange() {
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning'
})
return false
}
screenfull.toggle(this.$refs.wholePlantContainerB)
},
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning',
});
return false;
}
screenfull.toggle(this.$refs.wholePlantContainerB);
},
resetSize() {
let wholePlantContainerBox = document.getElementById('wholePlantContainer')
let rw = parseFloat(window.innerWidth)
let rh = parseFloat(window.innerHeight)
let bw = parseFloat(wholePlantContainerBox.style.width)
let bh = parseFloat(wholePlantContainerBox.style.height)
let wx = 0
let hx = 0
let wholePlantContainerBox = document.getElementById(
'wholePlantContainer'
);
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(wholePlantContainerBox.style.width);
let bh = parseFloat(wholePlantContainerBox.style.height);
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) {
console.log('全屏')
wx = rw / bw
hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
wx = rw / bw;
hx = rh / bh;
} else {
if (this.$store.state.app.sidebar.opened) {
wx = (rw-280) / bw
hx = (rh-116) / bh
}else{
wx = (rw-85) / bw
hx = (rh-116) / bh
wx = (rw - 280) / bw;
hx = (rh - 116) / bh;
} else {
wx = (rw - 85) / bw;
hx = (rh - 116) / bh;
}
}
this.scaleNum = wx
}
}
this.scaleNum = wx;
},
},
};
</script>

View File

@ -1,313 +1,324 @@
<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
<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="50%"
>
<add-or-update ref="addOrUpdate" @successSubmit="successSubmit" />
width="50%">
<add-or-update
ref="addOrUpdate"
@successSubmit="successSubmit" />
</base-dialog>
<!-- 装车 -->
<base-dialog
<!-- 装车 -->
<base-dialog
dialogTitle="装车"
:dialogVisible="centervisible2"
@cancel="handleCancel2"
@confirm="handleConfirm2"
:before-close="handleCancel2"
width="50%"
>
<loaded-page ref="loadedPage" @successSubmit="successSubmit2" />
width="50%">
<loaded-page
ref="loadedPage"
@successSubmit="successSubmit2" />
</base-dialog>
<!-- 发货详情 -->
<delivery-log-detail ref='deliveryLogDetail' v-if='showDetail' />
</div>
<!-- 发货详情 -->
<delivery-log-detail
ref="deliveryLogDetail"
v-if="showDetail" />
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { deliveryLogPage, deliveryLogDelete } from '@/api/base/delivery'
import AddOrUpdate from './components/addOrUpdate'
import LoadedPage from './components/loadedPage'
import DeliveryLogDetail from './components/deliveryLogDetail.vue'
import { parseTime } from '@/utils/ruoyi';
import { deliveryLogPage, deliveryLogDelete } from '@/api/base/delivery';
import AddOrUpdate from './components/addOrUpdate';
import LoadedPage from './components/loadedPage';
import DeliveryLogDetail from './components/deliveryLogDetail.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'orderName',
label: '订单名',
minWidth: 100,
showOverflowtooltip: true
},
{
prop: 'name',
label: '发货单名称',
minWidth: 100,
showOverflowtooltip: true
},
{
prop: 'deliveryTime',
label: '发货时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'code',
label: '发货单号',
showOverflowtooltip: true
},
{
prop: 'deliverPerName',
label: '发货负责人',
minWidth: 100
},
{
prop: 'principal',
label: '运输负责人',
minWidth: 100
},
{
prop: 'principalCall',
label: '运输联系方式',
minWidth: 110,
showOverflowtooltip: true
},
{
prop: 'principalCost',
label: '运输费用',
align: 'right'
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true
}
]
{
prop: 'orderName',
label: '订单名',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'name',
label: '发货单名称',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'deliveryTime',
label: '发货时间',
filter: parseTime,
minWidth: 160,
},
{
prop: 'code',
label: '发货单号',
showOverflowtooltip: true,
},
{
prop: 'deliverPerName',
label: '发货负责人',
minWidth: 100,
},
{
prop: 'principal',
label: '运输负责人',
minWidth: 100,
},
{
prop: 'principalCall',
label: '运输联系方式',
minWidth: 110,
showOverflowtooltip: true,
},
{
prop: 'principalCost',
label: '运输费用',
align: 'right',
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
];
export default {
name: "DeliveryLog",
data() {
return {
formConfig: [
{
type: 'input',
label: '订单名',
param: 'orderName',
defaultSelect: ''
},
{
type: 'input',
label: '发货单名称',
param: 'name'
},
{
type: 'input',
label: '发货单号',
param: 'code'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: this.$auth.hasPermi('extend:delivery-log:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('extend:delivery-log:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
//
queryParams: {
pageNo: 1,
pageSize: 20,
orderName: '',
code: '',
name: ''
},
tableProps,
list: [],
tableH: this.tableHeight(260),
total: 0,
tableBtn: [
this.$auth.hasPermi('extend:delivery-log:loaded')
? {
type: 'loaded',
btnName: '装车'
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
addOrEditTitle: '',
centervisible: false,
centervisible2: false,
showDetail: false
}
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1]
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1])
} else {
this.formConfig[0].defaultSelect = ''
}
this.queryParams.orderName = this.formConfig[0].defaultSelect
this.getList();
},
components: { AddOrUpdate, LoadedPage, DeliveryLogDetail },
watch: {
$route: 'initData'
},
methods: {
initData(to) {
if (to.name === 'DeliveryLog') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1]
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1])
} else {
this.formConfig[0].defaultSelect = ''
}
this.queryParams.orderName = this.formConfig[0].defaultSelect
this.getList()
}
},
getList() {
deliveryLogPage({...this.queryParams}).then(res => {
let arr = res.data.list || []
arr && arr.map(item => {
item.principalCost = item.principalCost.toFixed(2)
})
this.list = arr
this.total = res.data.total || 0
})
},
buttonClick(val) {
if (val.btnName === 'search') {
this.queryParams.name = val.name
this.queryParams.orderName = val.orderName
this.queryParams.code = val.code
this.getList()
} else {
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
})
}
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.centervisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id)
})
break
case 'delete':
this.handleDelete(val.data)
break
case 'loaded':
this.centervisible2 = true
this.$nextTick(() => {
this.$refs.loadedPage.init(val.data.id, val.data.code, val.data.orderId)
})
break
default:
this.showDetail = true
this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data)
})
}
},
//
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
//
handleDelete(val) {
this.$modal.confirm('是否确认删除发货单名为"' + val.name + '"的数据项?').then(function() {
return deliveryLogDelete({ id: val.id })
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
},
//
handleCancel2() {
this.$refs.loadedPage.formClear()
this.centervisible2 = false
},
handleConfirm2() {
this.$refs.loadedPage.submitForm()
},
successSubmit2() {
this.handleCancel2()
this.getList()
}
}
}
name: 'DeliveryLog',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '订单名',
param: 'orderName',
defaultSelect: '',
},
{
type: 'input',
label: '发货单名称',
param: 'name',
},
{
type: 'input',
label: '发货单号',
param: 'code',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('extend:delivery-log:create')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('extend:delivery-log:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
//
queryParams: {
pageNo: 1,
pageSize: 20,
orderName: '',
code: '',
name: '',
},
tableProps,
list: [],
total: 0,
tableBtn: [
this.$auth.hasPermi('extend:delivery-log:loaded')
? {
type: 'loaded',
btnName: '装车',
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:detail')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('extend:delivery-log:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
addOrEditTitle: '',
centervisible: false,
centervisible2: false,
showDetail: false,
};
},
created() {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1];
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1]);
} else {
this.formConfig[0].defaultSelect = '';
}
this.queryParams.orderName = this.formConfig[0].defaultSelect;
this.getList();
},
components: { AddOrUpdate, LoadedPage, DeliveryLogDetail },
watch: {
$route: 'initData',
},
methods: {
initData(to) {
if (to.name === 'DeliveryLog') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1];
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1]);
} else {
this.formConfig[0].defaultSelect = '';
}
this.queryParams.orderName = this.formConfig[0].defaultSelect;
this.getList();
}
},
getList() {
deliveryLogPage({ ...this.queryParams }).then((res) => {
let arr = res.data.list || [];
arr &&
arr.map((item) => {
item.principalCost = item.principalCost.toFixed(2);
});
this.list = arr;
this.total = res.data.total || 0;
});
},
buttonClick(val) {
if (val.btnName === 'search') {
this.queryParams.name = val.name;
this.queryParams.orderName = val.orderName;
this.queryParams.code = val.code;
this.getList();
} else {
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
}
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
break;
case 'delete':
this.handleDelete(val.data);
break;
case 'loaded':
this.centervisible2 = true;
this.$nextTick(() => {
this.$refs.loadedPage.init(
val.data.id,
val.data.code,
val.data.orderId
);
});
break;
default:
this.showDetail = true;
this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data);
});
}
},
//
handleCancel() {
this.$refs.addOrUpdate.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.addOrUpdate.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
//
handleDelete(val) {
this.$modal
.confirm('是否确认删除发货单名为"' + val.name + '"的数据项?')
.then(function () {
return deliveryLogDelete({ id: val.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess('操作成功');
})
.catch(() => {});
},
//
handleCancel2() {
this.$refs.loadedPage.formClear();
this.centervisible2 = false;
},
handleConfirm2() {
this.$refs.loadedPage.submitForm();
},
successSubmit2() {
this.handleCancel2();
this.getList();
},
},
};
</script>

View File

@ -1,130 +1,124 @@
<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"
/>
<!-- 详情抽屉 -->
<delivery-log-det-detail ref='deliveryLogDetail'/>
</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" />
<!-- 详情抽屉 -->
<delivery-log-det-detail ref="deliveryLogDetail" />
</div>
</template>
<script>
import { deliveryProgressPage } from '@/api/base/delivery'
import DeliveryLogDetDetail from './components/deliveryLogDetDetail.vue'
import { deliveryProgressPage } from '@/api/base/delivery';
import DeliveryLogDetDetail from './components/deliveryLogDetDetail.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'orderName',
label: '订单名',
showOverflowtooltip: true
},
{
prop: 'customerName',
label: '客户名称',
showOverflowtooltip: true
},
{
prop: 'unit',
label: '单位'
},
{
prop: 'orderNum',
label: '订单数量'
},
{
prop: 'num',
label: '发货数量'
},
{
prop: 'rate',
label: '累计发货比例(%)'
}
]
{
prop: 'orderName',
label: '订单名',
showOverflowtooltip: true,
},
{
prop: 'customerName',
label: '客户名称',
showOverflowtooltip: true,
},
{
prop: 'unit',
label: '单位',
},
{
prop: 'orderNum',
label: '订单数量',
},
{
prop: 'num',
label: '发货数量',
},
{
prop: 'rate',
label: '累计发货比例(%)',
},
];
export default {
name: "DeliveryLogDet",
data() {
return {
formConfig: [
{
type: 'input',
label: '订单名',
param: 'orderName'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
],
//
queryParams: {
pageNo: 1,
pageSize: 20,
orderName: ''
},
tableProps,
list: [],
tableH: this.tableHeight(260),
total: 0,
tableBtn: [
this.$auth.hasPermi('extend:delivery-log-det:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined
].filter((v) => v)
}
},
components: { DeliveryLogDetDetail },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
getList() {
deliveryProgressPage({...this.queryParams}).then(res => {
this.list = res.data.list || []
this.total = res.data.total || 0
})
},
buttonClick(val) {
this.queryParams.orderName = val.orderName
this.getList()
},
handleClick(val) {
console.log(val)
this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data)
})
}
}
}
name: 'DeliveryLogDet',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '订单名',
param: 'orderName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
//
queryParams: {
pageNo: 1,
pageSize: 20,
orderName: '',
},
tableProps,
list: [],
total: 0,
tableBtn: [
this.$auth.hasPermi('extend:delivery-log-det:detail')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
};
},
components: { DeliveryLogDetDetail },
created() {
this.getList();
},
methods: {
getList() {
deliveryProgressPage({ ...this.queryParams }).then((res) => {
this.list = res.data.list || [];
this.total = res.data.total || 0;
});
},
buttonClick(val) {
this.queryParams.orderName = val.orderName;
this.getList();
},
handleClick(val) {
console.log(val);
this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data);
});
},
},
};
</script>

View File

@ -1,148 +1,145 @@
<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,
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,120 @@
<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
@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 {
chartData: [],
timeDim: '',
tableProps: [],
list: [],
tableH: this.tableHeight(250) / 2,
};
},
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,256 @@
<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"
v-hasPermi="['analysis:qoq-analysis:export']"></span>
</el-form-item>
<el-form-item>
<el-button
v-hasPermi="['analysis:qoq-analysis:export']"
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(314),
};
},
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(314);
});
},
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,468 +1,542 @@
<template>
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form :inline="true" class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item label="能源类型" required>
<el-select v-model="queryParams.energyTypeId" placeholder="请选择" style="width: 100px;" size="small">
<el-option
v-for="item in energyTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<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.timeDim" placeholder="请选择" style="width: 80px;" size="small">
<el-option
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
:key="item.value"
:label="item.label"
:value="item.value"
size="small">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间范围" required>
<div v-show="queryParams.timeDim === '1'">
<el-date-picker
v-model="timeValue"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm"
value-format="timestamp"
:picker-options="pickerOptions"
popper-class="noneMinute"
@change="timeSelect"
size="small"
style='width:350px;'
>
</el-date-picker>
</div>
<div v-show="queryParams.timeDim === '2'">
<el-date-picker
v-model="dateValue"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
@change="timeSelect"
size="small"
style='width:350px;'
>
</el-date-picker>
</div>
<div v-show="queryParams.timeDim === '3'">
<el-date-picker
v-model="weekValue1"
type="week"
format="yyyy 第 WW 周"
style='width:170px;'
:picker-options="pickerOptionsWeek"
@change="startWeek"
size="small"
placeholder="选择周">
</el-date-picker>-
<el-date-picker
v-model="weekValue2"
type="week"
format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek"
style='width:170px;'
@change="endWeek"
size="small"
placeholder="选择周">
</el-date-picker>
</div>
<div v-show="queryParams.timeDim === '4'">
<el-date-picker
v-model="monthValue"
type="monthrange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
size="small"
style='width:350px;'
@change="timeSelect"
>
</el-date-picker>
</div>
<div v-show="queryParams.timeDim === '5'">
<el-date-picker
style='width:170px;'
v-model="yearValue1"
type="year"
:picker-options="pickerOptions"
value-format="timestamp"
placeholder="选择年"
size="small"
@change="startYear"
>
</el-date-picker>-
<el-date-picker
style='width:170px;'
v-model="yearValue2"
type="year"
:picker-options="pickerOptions"
value-format="timestamp"
placeholder="选择年"
size="small"
@change="endYear"
>
</el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button>
<span class="separateStyle"></span>
<el-button size="small" @click="resetBtn">重置</el-button>
</el-form-item>
</el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'>
{{ isExpand ? '收起' : '展开' }}
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
</span>
</div>
<div
class="searchBarBox"
ref="searchBarRef">
<el-form
:inline="true"
class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item
label="能源类型"
required>
<el-select
v-model="queryParams.energyTypeId"
placeholder="请选择"
size="small"
@change="chooseType"
filterable
style="width: 100%">
<el-option
v-for="item in energyTypeList"
:key="item.id"
:label="item.labelName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="energyType === 1"
label="对象选择"
required>
<el-cascader
v-model="objArr"
:options="objList"
:show-all-levels="false"
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
size="small"
@change="changeLine"
clearable></el-cascader>
</el-form-item>
<el-form-item
v-if="energyType === 2"
label="对象选择"
required>
<el-select
v-model="objId"
placeholder="请选择"
style="width: 250px"
filterable
size="small">
<el-option
v-for="item in objList"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="时间维度"
required>
<el-select
v-model="queryParams.timeDim"
placeholder="请选择"
style="width: 80px"
size="small">
<el-option
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
:key="item.value"
:label="item.label"
:value="item.value"
size="small"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="时间范围"
required>
<div v-show="queryParams.timeDim === '1'">
<el-date-picker
v-model="timeValue"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm"
value-format="timestamp"
:picker-options="pickerOptions"
popper-class="noneMinute"
@change="timeSelect"
size="small"
style="width: 350px"></el-date-picker>
</div>
<div v-show="queryParams.timeDim === '2'">
<el-date-picker
v-model="dateValue"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
@change="timeSelect"
size="small"
style="width: 350px"></el-date-picker>
</div>
<div v-show="queryParams.timeDim === '3'">
<el-date-picker
v-model="weekValue1"
type="week"
format="yyyy 第 WW 周"
style="width: 170px"
:picker-options="pickerOptionsWeek"
@change="startWeek"
size="small"
placeholder="选择周"></el-date-picker>
-
<el-date-picker
v-model="weekValue2"
type="week"
format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek"
style="width: 170px"
@change="endWeek"
size="small"
placeholder="选择周"></el-date-picker>
</div>
<div v-show="queryParams.timeDim === '4'">
<el-date-picker
v-model="monthValue"
type="monthrange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
size="small"
style="width: 350px"
@change="timeSelect"></el-date-picker>
</div>
<div v-show="queryParams.timeDim === '5'">
<el-date-picker
style="width: 170px"
v-model="yearValue1"
type="year"
:picker-options="pickerOptions"
value-format="timestamp"
placeholder="选择年"
size="small"
@change="startYear"></el-date-picker>
-
<el-date-picker
style="width: 170px"
v-model="yearValue2"
type="year"
:picker-options="pickerOptions"
value-format="timestamp"
placeholder="选择年"
size="small"
@change="endYear"></el-date-picker>
</div>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
@click="handBtn('search')">
查询
</el-button>
<el-button
size="small"
@click="resetBtn">
重置
</el-button>
<span
class="separateStyle"
v-hasPermi="['analysis:energy-analysis:query']"></span>
<el-button
v-hasPermi="['analysis:energy-analysis:query']"
type="primary"
size="small"
plain
@click="handBtn('exportBtn')">
导出
</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getEnergyTypeListAll } from "@/api/base/energyType"
import { getTree } from '@/api/base/factory'
import moment from 'moment'
import { getTree } from '@/api/analysis/energyAnalysis';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import moment from 'moment';
export default {
name: 'searchArea',
props: {
isFold: {//
type: Boolean,
default: false
}
},
data() {
return {
isExpand: false, //
//
queryParams: {
energyTypeId: null,
objId: null,
timeDim: null,
startTime: null,
endTime: null
},
objArr: [],
timeValue: [],// 7
dateValue: [],// 30
weekValue1: null,//24
weekValue2: null,
monthValue: [],//24
yearValue1: null,//10
yearValue2: null,
energyTypeList: [],
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.getTypeList()
this.getObjTree()
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value //
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000]
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || []
})
},
getObjTree() {
getTree().then(res => {
this.objList = res.data || []
})
},
//
timeSelect() {
switch (this.queryParams.timeDim) {
case '1':
if (!this.timeValue) {
this.$modal.msgError('时间范围不能为空')
return false
}
if (this.timeValue[1] - this.timeValue[0] > 7*24*3600000) {
this.$modal.msgError('最大时间范围为7天请重新选择')
this.timeValue = []
}
break
case '2':
if (!this.dateValue) {
this.$modal.msgError('时间范围不能为空')
return false
}
if (this.dateValue[1] - this.dateValue[0] > 29*24*3600000) {
this.$modal.msgError('最大时间范围为30天请重新选择') // 0:00:0023:59:59
this.dateValue = []
}
break
case '4':
if (!this.monthValue) {
this.$modal.msgError('时间范围不能为空')
return false
}
if (this.monthValue[1] - this.monthValue[0] > 729*24*3600000) {
this.$modal.msgError('最大时间范围为24个月请重新选择')//
this.monthValue = []
}
break
default:
}
},
//
startYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
this.yearValue1 = null
return false
}
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择')
this.yearValue1 = null
return false
}
}
},
endYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
this.yearValue2 = null
return false
}
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10*365*24*3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择')
this.yearValue2 = null
return false
}
}
},
//
startWeek() {
if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime()
let b = new Date(this.weekValue2).getTime()
if (a > b) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择')
this.weekValue1 = null
return false
}
if (b - a > 167*24*3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择')
this.weekValue1 = null
return false
}
}
},
endWeek() {
if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime()
let b = new Date(this.weekValue2).getTime()
if (a > b) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择')
this.weekValue2 = null
return false
}
if (b - a > 167*24*3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择')
this.weekValue2 = null
return false
}
}
},
//
search() {
if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型')
return false
}
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象')
return false
} else {
this.queryParams.objId = this.objArr[this.objArr.length-1]
}
if (!this.queryParams.timeDim) {
this.$modal.msgError('请选择时间维度')
return false
}
switch (this.queryParams.timeDim) {
case '1':
if (this.timeValue && this.timeValue.length > 0) {
this.queryParams.startTime = this.timeValue[0]
this.queryParams.endTime = this.timeValue[1] //
} else {
this.$modal.msgError('时间范围不能为空')
return false
}
break
case '2':
if (this.dateValue && this.dateValue.length > 0) {
this.queryParams.startTime = this.dateValue[0]
this.queryParams.endTime = this.dateValue[1] + 86399000 // 23:59:59
} else {
this.$modal.msgError('日范围不能为空')
return false
}
break
case '3':
if (this.weekValue1 && this.weekValue2) {
let a = moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00'
let b = moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59'
this.queryParams.startTime = new Date(a).getTime()
this.queryParams.endTime = new Date(b).getTime()
} else {
this.$modal.msgError('周范围不能为空')
return false
}
break
case '4'://
if (this.monthValue && this.monthValue.length > 0) {
this.queryParams.startTime = this.monthValue[0]
this.queryParams.endTime = this.transformTime(this.monthValue[1])
} else {
this.$modal.msgError('月范围不能为空')
return false
}
break
default://
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间')
return false
} else {
this.queryParams.startTime = this.yearValue1
this.queryParams.endTime = this.transformYear(this.yearValue2)
}
} else {
this.$modal.msgError('年范围不能为空')
return false
}
}
this.queryParams.startTime = this.queryParams.startTime + ''
this.queryParams.endTime = this.queryParams.endTime + ''
this.$emit('submit', this.queryParams)
},
//
resetBtn() {
this.queryParams.energyTypeId = null
this.queryParams.objId = null
this.objArr = []
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value //
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000]
},
transformTime(timeStamp) {//
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
},
switchMode() {//
this.isExpand = !this.isExpand
const element = this.$refs.searchBarRef
if (this.isExpand) {
element.classList.remove('divHeight')
} else {
element.classList.add('divHeight')
}
}
}
}
name: 'searchArea',
data() {
return {
//
queryParams: {
energyTypeId: null,
objId: null,
timeDim: null,
startTime: null,
endTime: null,
objType: 1, //12线3
},
objId: null,
objType: 1, //12线3,使
energyTypeList: [],
energyType: 0, //12
objArr: [],
timeValue: [], // 7
dateValue: [], // 30
weekValue1: null, //24
weekValue2: null,
monthValue: [], //24
yearValue1: null, //10
yearValue2: null,
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.getEnergyList();
this.getObjTree();
this.queryParams.timeDim = this.getDictDatas(
this.DICT_TYPE.TIME_DIM
)[0].value; //
this.timeValue = [
moment().startOf('day'),
moment().endOf('day') - 59 * 61 * 1000,
];
},
methods: {
getObjTree() {
getTree().then((res) => {
this.objList = res.data || [];
if (this.objList.length > 0) {
this.objId = this.objList[0].id;
}
});
},
//
getEnergyList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || [];
});
},
//
chooseType(id) {
let val;
this.energyTypeList.map((item) => {
if (item.id === id) {
val = item.name;
}
});
if (val == 1 || val == 2) {
this.energyType = 1;
} else {
this.energyType = 2;
}
},
// /线/
changeLine(val) {
this.objType = val.length || 0;
},
//
timeSelect() {
switch (this.queryParams.timeDim) {
case '1':
if (!this.timeValue) {
this.$modal.msgError('时间范围不能为空');
return false;
}
if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为7天请重新选择');
this.timeValue = [];
}
break;
case '2':
if (!this.dateValue) {
this.$modal.msgError('时间范围不能为空');
return false;
}
if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为30天请重新选择'); // 0:00:0023:59:59
this.dateValue = [];
}
break;
case '4':
if (!this.monthValue) {
this.$modal.msgError('时间范围不能为空');
return false;
}
if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24个月请重新选择'); //
this.monthValue = [];
}
break;
default:
}
},
//
startYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.yearValue1 = null;
return false;
}
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue1 = null;
return false;
}
}
},
endYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.yearValue2 = null;
return false;
}
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue2 = null;
return false;
}
}
},
//
startWeek() {
if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime();
if (a > b) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.weekValue1 = null;
return false;
}
if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue1 = null;
return false;
}
}
},
endWeek() {
if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime();
if (a > b) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.weekValue2 = null;
return false;
}
if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue2 = null;
return false;
}
}
},
//
handBtn(val) {
if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型');
return false;
}
if (this.energyType == 1) {
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象');
return false;
} else {
this.queryParams.objId = this.objArr[this.objArr.length - 1];
this.queryParams.objType = this.objType;
}
} else if (this.energyType == 2) {
if (!this.objId) {
this.$modal.msgError('请选择对象');
return false;
} else {
this.queryParams.objId = this.objId;
this.queryParams.objType = 1;
}
}
if (!this.queryParams.timeDim) {
this.$modal.msgError('请选择时间维度');
return false;
}
switch (this.queryParams.timeDim) {
case '1':
if (this.timeValue && this.timeValue.length > 0) {
this.queryParams.startTime = this.timeValue[0];
this.queryParams.endTime = this.timeValue[1]; //
} else {
this.$modal.msgError('时间范围不能为空');
return false;
}
break;
case '2':
if (this.dateValue && this.dateValue.length > 0) {
this.queryParams.startTime = this.dateValue[0];
this.queryParams.endTime = this.dateValue[1] + 86399000; // 23:59:59
} else {
this.$modal.msgError('日范围不能为空');
return false;
}
break;
case '3':
if (this.weekValue1 && this.weekValue2) {
let a =
moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00';
let b =
moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59';
this.queryParams.startTime = new Date(a).getTime();
this.queryParams.endTime = new Date(b).getTime();
} else {
this.$modal.msgError('周范围不能为空');
return false;
}
break;
case '4': //
if (this.monthValue && this.monthValue.length > 0) {
this.queryParams.startTime = this.monthValue[0];
this.queryParams.endTime = this.transformTime(this.monthValue[1]);
} else {
this.$modal.msgError('月范围不能为空');
return false;
}
break;
default: //
if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间');
return false;
} else {
this.queryParams.startTime = this.yearValue1;
this.queryParams.endTime = this.transformYear(this.yearValue2);
}
} else {
this.$modal.msgError('年范围不能为空');
return false;
}
}
this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '';
if (val === 'search') {
this.$emit('submit', this.queryParams);
} else {
this.$emit('export', this.queryParams);
}
},
//
resetBtn() {
this.queryParams.energyTypeId = null;
this.energyType = 0;
this.queryParams.objId = null;
this.objId = null;
this.objType = 1;
this.objArr = [];
this.queryParams.timeDim = this.getDictDatas(
this.DICT_TYPE.TIME_DIM
)[0].value; //
this.timeValue = [
moment().startOf('day'),
moment().endOf('day') - 59 * 61 * 1000,
];
},
transformTime(timeStamp) {
//
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;
}
/* 时间整点 */
.noneMinute .el-time-spinner__wrapper {
width: 100%;
width: 100%;
}
.noneMinute .el-scrollbar:nth-of-type(2) {
display: none;
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: 12px;
}
}
.searchBarBox .foldClass {
position: absolute;
top: 14px;
right: 0;
cursor: pointer;
font-size: 12px;
color:#0B58FF;
}
.searchBarBox .foldClass .iconfont {
font-size: 14px;
}
.divHeight {
height: 45px;
overflow: hidden;
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 12px;
}
.el-form-item {
margin-right: 10px;
margin-bottom: 4px;
}
}
.separateStyle {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
vertical-align: middle;
margin: 0 10px;
display: inline-block;
width: 1px;
height: 24px;
background: #e8e8e8;
vertical-align: middle;
margin: 0 10px;
}
</style>

View File

@ -1,94 +1,110 @@
<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
@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 {
chartData: [],
timeDim: '',
tableProps: [],
list: [],
};
},
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 = {};
if (this.timeDim === '3') {
let fName = arr[i].time.slice(0, 4);
let lName = arr[i].time.slice(4, 6);
obj.label = fName + ' 第 ' + lName + ' 周';
} else {
obj.label = arr[i].time;
}
obj.prop = 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'>
<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>
</style>

View File

@ -1,102 +1,119 @@
<template>
<div id="analysischartLine" style="width: 100%;height: 100%;"></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 []
}
}
},
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)
if (this.chartData.length === 0) {
return false
}
let xData = []
let arr = this.chartData[0].type
let keys = Object.keys(this.chartData[0])
let yData = []
for (let j = 0; j < arr.length; j++) {
for (let k = 0; k < keys.length; k++) {
if (keys[k].indexOf(arr[j] + '_上年同期') > -1 || keys[k].indexOf(arr[j] + '_能源消耗') > -1) {
let obj = {
name: '',
type: 'line',
data: []
}
obj.name = keys[k]
yData.push(obj)
}
}
}
for (let i = 0; i < this.chartData.length; i++) {
xData.push(this.chartData[i].time)
for (let p = 0; p < yData.length; p++) {
yData[p].data.push(this.chartData[i][yData[p].name])
}
}
var option = {
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF', '#FF6860', '#FF9747', '#B0EB42', '#D680FF', '#0043D2'],
legend: {
data: keys,
right: '1%'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '1%',
right: '1%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: xData
},
yAxis: {
type: 'value'
},
series: yData
};
name: 'LineChart',
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
chartHeight: this.tableHeight(250) / 2,
};
},
props: {
chartData: {
type: Array,
required: true,
default: () => {
return [];
},
},
},
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('analysischartLine');
this.chart = echarts.init(this.chartDom);
if (this.chartData.length === 0) {
return false;
}
let xData = [];
let arr = this.chartData[0].type;
let keys = Object.keys(this.chartData[0]);
let yData = [];
for (let j = 0; j < arr.length; j++) {
for (let k = 0; k < keys.length; k++) {
if (
keys[k].indexOf(arr[j] + '_上年同期') > -1 ||
keys[k].indexOf(arr[j] + '_能源消耗') > -1
) {
let obj = {
name: '',
type: 'line',
data: [],
};
obj.name = keys[k];
yData.push(obj);
}
}
}
for (let i = 0; i < this.chartData.length; i++) {
xData.push(this.chartData[i].time);
for (let p = 0; p < yData.length; p++) {
yData[p].data.push(this.chartData[i][yData[p].name]);
}
}
var option = {
color: [
'#FFDC94',
'#8EF0AB',
'#63BDFF',
'#288AFF',
'#7164FF',
'#FF6860',
'#FF9747',
'#B0EB42',
'#D680FF',
'#0043D2',
],
legend: {
data: keys,
right: '1%',
},
tooltip: {
trigger: 'axis',
},
grid: {
left: '1%',
right: '1%',
bottom: '3%',
containLabel: true,
},
xAxis: {
type: 'category',
data: xData,
},
yAxis: {
type: 'value',
},
series: yData,
};
option && this.chart.setOption(option);
}
}
}
option && this.chart.setOption(option);
},
},
};
</script>

View File

@ -1,205 +1,230 @@
<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"
v-hasPermi="['analysis:yoy-analysis:export']"></span>
</el-form-item>
<el-form-item>
<el-button
v-hasPermi="['analysis:yoy-analysis:export']"
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,143 +1,153 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-area @submit="getList" @exportD="exportData"/>
<div v-show='chartData.length'>
<div class="chartTitle">同比分析图</div>
<div style='width: 100%;height: 400px;'>
<line-chart ref="analysisLineChart" :chartData="chartData"/>
</div>
<!-- 表格 -->
<base-table
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
class="yoy-out-table"
/>
</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">
<div class="chartTitle">同比分析图</div>
<div style="width: 100%">
<line-chart
ref="analysisLineChart"
:chartData="chartData" />
</div>
<!-- 表格 -->
<base-table
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
class="yoy-out-table" />
</div>
<!-- 没有数据 -->
<div
class="no-data-bg"
v-show="!chartData.length"></div>
</div>
</template>
<script>
import { getYoy } from "@/api/analysis/energyAnalysis"
import subRate from "./components/subRate.vue"
import SearchArea from "./components/searchArea"
import LineChart from "./components/lineChart"
import FileSaver from "file-saver"
import * as XLSX from 'xlsx/xlsx.mjs'
import { getYoy } from '@/api/analysis/energyAnalysis';
import subRate from './components/subRate.vue';
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: 'YoyAnalysis',
components: { SearchArea, LineChart },
data() {
return {
chartData: [],
tableProps: [],
list: [],
tableH: this.tableHeight(640)
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(640)
})
},
methods: {
getList(params) {
getYoy({ ...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
if (obj.label.indexOf('同比')!= -1) {
obj.subcomponent = subRate
}
tempX[j].children.push(obj)
}
}
}
this.tableProps = [{prop: 'time',label: '时间'}].concat(tempX)
console.log(this.tableProps)
//
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(".yoy-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: 'YoyAnalysis',
components: { SearchArea, LineChart },
data() {
return {
chartData: [],
tableProps: [],
list: [],
tableH: this.tableHeight(250) / 2,
};
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(250) / 2;
});
},
methods: {
getList(params) {
getYoy({ ...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;
if (obj.label.indexOf('同比') != -1) {
obj.subcomponent = subRate;
}
tempX[j].children.push(obj);
}
}
}
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
console.log(this.tableProps);
//
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('.yoy-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('暂无数据导出');
}
},
},
};
</script>
<style lang='scss' scoped>
.yoy-out-table {
margin-top: 20px;
}
.chartTitle {
font-size: 16px;
color: #000;
font-size: 16px;
color: #000;
}
.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,197 +1,219 @@
<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-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</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">
<energy-plc-add
ref="energyPlc"
@successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
// import { publicFormatter } from '@/utils/dict'
import EnergyPlcAdd from './components/energyPlcAdd.vue'
import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc';
import EnergyPlcAdd from './components/energyPlcAdd.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'plcTableName',
label: '关联表名',
showOverflowtooltip: true
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '标识名',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'enName',
label: '英文标识名'
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true
}
]
{
prop: 'plcTableName',
label: '关联表名',
showOverflowtooltip: true,
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'name',
label: '标识名',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'enName',
label: '英文标识名',
},
{
prop: 'collection',
label: '是否采集',
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true,
},
];
export default {
name: "EnergyPlc",
components: { EnergyPlcAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
collectionList: [
{ value: 0, label: '否' },
{ value: 1, label: '是' }
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: 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.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlc.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr && arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyPlc.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlc.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function () {
return deleteEnergyPlc(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
}
name: 'EnergyPlc',
components: { EnergyPlcAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name',
},
{
type: this.$auth.hasPermi('base:energy-plc:query') ? 'button' : '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
collectionList: [
{ value: 0, label: '否' },
{ value: 1, label: '是' },
],
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlc.init();
});
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) {
item.collection = i.label;
}
});
});
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.energyPlc.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyPlc.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?')
.then(function () {
return deleteEnergyPlc(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

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,226 +1,264 @@
<template>
<div>
<el-drawer :title="drawerTitle" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'>
<div class="box">
<el-form :inline="true">
<el-form-item label="关联表名">
<el-input v-model="plcTableName" size='small' readonly></el-input>
</el-form-item>
<el-form-item label="对象">
<el-input v-model="objName" size='small' readonly></el-input>
</el-form-item>
<el-form-item v-if="showBtn">
<el-button type="success" size='small' plain @click="addNew">新增</el-button>
</el-form-item>
</el-form>
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</el-drawer>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-plc-param-add ref="energyPlcParam" @successSubmit="successSubmit" />
</base-dialog>
</div>
<div>
<el-drawer
:title="drawerTitle"
:visible.sync="visible"
size="70%"
@close="closeD"
:show-close="false">
<div class="box">
<el-form :inline="true">
<el-form-item label="关联表名">
<el-input
v-model="plcTableName"
size="small"
readonly
style="width: 250px"></el-input>
</el-form-item>
<el-form-item label="对象">
<el-input
v-model="objName"
size="small"
readonly
style="width: 250px"></el-input>
</el-form-item>
<el-form-item
v-if="showBtn"
v-hasPermi="['base:energy-plc-param:create']">
<el-button
type="success"
size="small"
plain
@click="addNew">
新增
</el-button>
</el-form-item>
</el-form>
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
</div>
</el-drawer>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-plc-param-add
ref="energyPlcParam"
@successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcParamPage, deleteEnergyPlcParam } from '@/api/base/energyPlcParam'
import EnergyPlcParamAdd from './energyPlcParamAdd'
import { publicFormatter } from '@/utils/dict'
import {
getEnergyPlcParamPage,
deleteEnergyPlcParam,
} from '@/api/base/energyPlcParam';
import EnergyPlcParamAdd from './energyPlcParamAdd';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'typeId',
label: '能源类型'
},
{
prop: 'plcParamName',
label: '参数列名'
},
{
prop: 'name',
label: '参数名称'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit')
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述'
}
]
{
prop: 'typeId',
label: '能源类型',
filter: publicFormatter('energy_type'),
},
{
prop: 'plcParamName',
label: '参数列名',
},
{
prop: 'name',
label: '参数名称',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'collection',
label: '是否采集',
},
{
prop: 'description',
label: '描述',
},
];
export default {
name: 'EnergyPlcParam',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return []
}
}
},
data() {
return {
visible: false,
drawerTitle: '',
tableProps,
tableData: [],
tableBtn: [],
tableH: this.tableHeight(115),
total: 0,
queryParams: {
pageNo: 1,
pageSize: 30,
connectId: null
},
plcTableName: '',
objName: '',
//
addOrEditTitle: "",
//
centervisible: false,
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
],
showBtn: true
}
},
components: { EnergyPlcParamAdd },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(115)
})
},
methods: {
init(data,title) {
this.visible = true
this.queryParams.connectId = data.id
this.plcTableName = data.plcTableName
this.objName = data.objName
this.getList()
if (title === 'detail') {
this.drawerTitle = '查看参数'
this.showBtn = false
this.tableBtn = []
} else {
this.drawerTitle = '参数绑定'
this.showBtn = true
this.tableBtn = [
{
type: 'edit',
btnName: '编辑'
},
{
type: 'delete',
btnName: '删除'
}
]
}
},
getList() {
getEnergyPlcParamPage({...this.queryParams}).then((res) => {
let arr = res.data.list || []
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
this.energyTypeList.map(j => {
if (item.typeId === j.id) {
item.typeId = j.name
}
})
})
this.tableData = arr
this.total = res.data.total;
})
},
//
addNew() {
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: ''})
})
},
handleCancel() {
this.$refs.energyPlcParam.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlcParam.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: val.data.id})
})
break
default:
this.handleDelete(val.data)
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?').then(function() {
return deleteEnergyPlcParam(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
closeD() {
this.$emit('closeDrawer')
}
}
}
name: 'EnergyPlcParam',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return [];
},
},
},
data() {
return {
visible: false,
drawerTitle: '',
tableProps,
tableData: [],
tableBtn: [],
tableH: this.tableHeight(115),
total: 0,
queryParams: {
pageNo: 1,
pageSize: 30,
connectId: null,
},
plcTableName: '',
objName: '',
//
addOrEditTitle: '',
//
centervisible: false,
collectionList: [
{ value: 0, label: '否' },
{ value: 1, label: '是' },
],
showBtn: true,
};
},
components: { EnergyPlcParamAdd },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(115);
});
},
methods: {
init(data, title) {
this.visible = true;
this.queryParams.connectId = data.id;
this.plcTableName = data.plcTableName;
this.objName = data.objName;
this.getList();
if (title === 'detail') {
this.drawerTitle = '查看参数';
this.showBtn = false;
this.tableBtn = [];
} else {
this.drawerTitle = '参数绑定';
this.showBtn = true;
this.tableBtn = [
this.$auth.hasPermi('base:energy-plc-param:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc-param:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v);
}
},
getList() {
getEnergyPlcParamPage({ ...this.queryParams }).then((res) => {
let arr = res.data.list || [];
arr &&
arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) {
item.collection = i.label;
}
});
this.energyTypeList.map((j) => {
if (item.typeId === j.id) {
item.typeId = j.name;
}
});
});
this.tableData = arr;
this.total = res.data.total;
});
},
//
addNew() {
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlcParam.init({
connectId: this.queryParams.connectId,
id: '',
});
});
},
handleCancel() {
this.$refs.energyPlcParam.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyPlcParam.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlcParam.init({
connectId: this.queryParams.connectId,
id: val.data.id,
});
});
break;
default:
this.handleDelete(val.data);
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?')
.then(function () {
return deleteEnergyPlcParam(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
closeD() {
this.$emit('closeDrawer');
},
},
};
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
padding: 0 32px;
}
</style>

View File

@ -1,132 +1,163 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="能源类型" prop="typeId">
<el-select v-model="form.typeId" placeholder="请选择" style="width: 100%;" filterable>
<el-option
v-for="item in energyListType"
: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="plcParamName">
<el-input v-model="form.plcParamName"></el-input>
</el-form-item>
</el-col>
</el-row>
<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="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-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否采集" prop="collection">
<el-switch v-model="form.collection"></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="typeId">
<el-select
v-model="form.typeId"
placeholder="请选择"
style="width: 100%"
filterable>
<el-option
v-for="item in energyListType"
:key="item.id"
:label="item.labelName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="参数列名"
prop="plcParamName">
<el-input v-model="form.plcParamName"></el-input>
</el-form-item>
</el-col>
</el-row>
<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="unit">
<el-select
v-model="form.unit"
placeholder="请选择"
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-row>
<el-row>
<el-col :span="12">
<el-form-item
label="是否采集"
prop="collection">
<el-switch v-model="form.collection"></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>
</template>
<script>
import { getEnergyPlcParam, updateEnergyPlcParam, createEnergyPlcParam } from '@/api/base/energyPlcParam'
import { getEnergyTypeListAll } from '@/api/base/energyType'
import {
getEnergyPlcParam,
updateEnergyPlcParam,
createEnergyPlcParam,
} from '@/api/base/energyPlcParam';
import { getEnergyTypeListAll } from '@/api/base/energyType';
export default {
name: 'EnergyPlcParamAdd',
data() {
return {
form: {
id: '',
typeId: '',
plcParamName: '',
name: '',
unit: '',
description: '',
collection: true,
connectId: ''
},
energyListType: [],
isEdit: false, //
rules: {
typeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
plcParamName: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
name: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }]
}
}
},
methods: {
init(param) {
this.form.connectId = param.connectId
getEnergyTypeListAll().then((res) => {
this.energyListType = res.data || []
})
if (param.id) {
this.isEdit = true
this.form.id = param.id
getEnergyPlcParam(this.form.id).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.collection = this.form.collection === 0 ? false : true
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form.collection = this.form.collection === false ? 0 : 1
if (this.isEdit) {
//
updateEnergyPlcParam({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyPlcParam({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
name: 'EnergyPlcParamAdd',
data() {
return {
form: {
id: '',
typeId: '',
plcParamName: '',
name: '',
unit: '',
description: '',
collection: true,
connectId: '',
},
energyListType: [],
isEdit: false, //
rules: {
typeId: [
{ required: true, message: '能源类型不能为空', trigger: 'change' },
],
plcParamName: [
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(param) {
this.form.connectId = param.connectId;
getEnergyTypeListAll().then((res) => {
this.energyListType = res.data || [];
});
if (param.id) {
this.isEdit = true;
this.form.id = param.id;
getEnergyPlcParam(this.form.id).then((res) => {
if (res.code === 0) {
this.form = res.data;
this.form.collection = this.form.collection === 0 ? false : true;
}
});
} else {
this.isEdit = false;
this.form.id = '';
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form.collection = this.form.collection === false ? 0 : 1;
if (this.isEdit) {
//
updateEnergyPlcParam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
createEnergyPlcParam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
this.isEdit = false;
},
},
};
</script>

View File

@ -1,236 +1,284 @@
<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';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
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: '对象',
minWidth: 130,
showOverflowtooltip: true,
},
{
prop: 'objCode',
label: '对象编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'plcTableName',
label: '关联表名',
},
{
prop: 'plcTableCode',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'cnName',
label: '标识名',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'varNum',
label: '绑定参数数量',
width: 110,
},
];
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 },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'cnName',
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:create')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermiAnd([
'base:energy-plc-param:query',
'base:energy-type:query',
])
? {
type: 'connect',
btnName: '绑定',
}
: undefined,
this.$auth.hasPermi('base:energy-plc-param:query')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermiAnd([
'base:energy-plc-connect:update',
'base:energy-plc-connect:query',
])
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc-connect:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
cnName: null,
},
paramVisible: false,
energyTypeList: [],
objList: [],
};
},
created() {
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

@ -0,0 +1,147 @@
<template>
<div class="energyQuantityManualAddTable">
<el-table
:data="renderData"
border
style="width: 100%"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}">
<el-table-column
prop="tableName"
label="表名*">
<template slot-scope="scope">
<div class="tableInner">
<el-select
v-model="scope.row.tableName"
placeholder="请选择"
style="width: 100%"
@change="changeSelect(scope.row, 'tableName')">
<el-option
v-for="item in tableNameList"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</div>
</template>
</el-table-column>
<el-table-column
prop="readingQuantity"
label="抄表数*">
<template slot-scope="scope">
<div class="tableInner">
<el-input-number
v-model="scope.row.readingQuantity"
:min="0"
:max="999999999"
style="width: 100%"
:controls="false"
@change="changeInput(scope.row, 'readingQuantity')"
:precision="2"></el-input-number>
</div>
</template>
</el-table-column>
</el-table>
<el-button
v-show="!isEdit"
class="addButton"
icon="el-icon-plus"
@click="emitButtonClick">
新增
</el-button>
</div>
</template>
<script>
export default {
name: 'AddTable',
props: {
tableData: {
type: Array,
required: true,
default: () => {
return [];
},
},
tableNameList: {
type: Array,
required: true,
default: () => {
return [];
},
},
isEdit: {
type: Boolean,
required: true,
default: () => {
return false;
},
},
},
data() {
return {};
},
computed: {
renderData() {
return this.tableData.map((item, index) => {
return {
...item,
_pageIndex: index + 1,
};
});
},
},
methods: {
emitButtonClick() {
this.$emit('emitButtonClick');
},
changeInput(val1, val2) {
val1.prop = val2;
this.$emit('emitFun', val1);
},
changeSelect(val1, val2) {
val1.prop = val2;
this.$emit('emitFun', val1);
},
},
};
</script>
<style lang='scss' scoped>
.energyQuantityManualAddTable {
.el-table .el-table__cell {
padding: 0;
height: 35px;
}
.addButton {
width: 100%;
height: 35px;
border-top: none;
color: #0b58ff;
border-color: #ebeef5;
border-radius: 0;
}
.addButton:hover {
color: #0b58ff;
border-color: #ebeef5;
background-color: #fff;
}
.addButton:focus {
border-color: #ebeef5;
background-color: #fff;
}
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
}
</style>
<style lang='scss'>
.energyQuantityManualAddTable {
.el-table .el-table__cell {
padding: 0;
height: 35px;
}
}
</style>

View File

@ -1,38 +0,0 @@
<template>
<div class="tableInner">
<!-- <el-input v-model="list[itemProp]" @blur="changeInput" /> -->
<el-input-number v-model="list[itemProp]" @change="changeInput" :min="0" :max="999999999" style='width: 100%;' :controls='false' :precision='2'></el-input-number>
</div>
</template>
<script>
export default {
name: 'InputArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -1,44 +0,0 @@
<template>
<div class="tableInner">
<el-select v-model="list[itemProp]" placeholder="请选择" style="width: 100%;" @change="changeSelect">
<el-option
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'SelectArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeSelect() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -1,167 +1,213 @@
<template>
<el-form ref="energyQuantityManualForm" :rules="rules" label-width="90px" :model="form">
<el-row :gutter="20">
<el-col :span='12'>
<el-form-item label="能源类型" prop="energyTypeId">
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable>
<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'>
<el-form-item label="抄表日期" prop="recordTime">
<el-date-picker v-model="form.recordTime" type="date" format="yyyy-MM-dd" value-format="timestamp"
placeholder="选择日期" style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='24'>
<base-table border :table-props="tableProps" :table-data="tableData" :add-button-show="addButtonShow"
@emitFun="inputChange" @emitButtonClick="emitButtonClick" />
</el-col>
</el-row>
</el-form>
<el-form
ref="energyQuantityManualForm"
:rules="rules"
label-width="90px"
:model="form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="能源类型"
prop="energyTypeId">
<el-select
v-model="form.energyTypeId"
placeholder="请选择"
style="width: 100%"
@change="selEnergyType"
filterable>
<el-option
v-for="item in this.energyTypeList"
:key="item.id"
:label="item.labelName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="抄表日期"
prop="recordTime">
<el-date-picker
v-model="form.recordTime"
type="date"
format="yyyy-MM-dd"
value-format="timestamp"
placeholder="选择日期"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<add-table
:table-data="tableData"
:table-name-list="tableNameList"
:isEdit="isEdit"
@emitFun="inputChange"
@emitButtonClick="emitButtonClick" />
</el-col>
</el-row>
</el-form>
</template>
<script>
import { energyQuantityManualCreate, energyQuantityManualUpdate, energyQuantityManualGet } from '@/api/base/energyQuantityManual'
import moment from 'moment'
import InputArea from './InputArea'
import SelectArea from './SelectArea'
const tableProps = [
{
prop: 'tableName',
label: '表名*',
subcomponent: SelectArea
},
{
prop: 'readingQuantity',
label: '抄表数*',
subcomponent: InputArea
}
]
import {
energyQuantityManualCreate,
energyQuantityManualUpdate,
energyQuantityManualGet,
} from '@/api/base/energyQuantityManual';
import moment from 'moment';
import AddTable from './AddTable';
import { energyTableGet } from '@/api/base/energyQuantityManual';
export default {
name: 'EnergyQuantityManualAdd',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return []
}
}
},
data() {
return {
tableProps,
tableData: [],
addButtonShow: '新增',
form: {
id: '',
energyTypeId: '',
unit: '',
recordTime: ''
},
rules: {
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
recordTime: [{ required: true, message: '抄表日期不能为空', trigger: 'change' }]
},
isEdit: false
}
},
methods: {
init(params) {
this.form.recordTime = moment().valueOf()
if (params.type === 'add') {
this.isEdit = false
} else if (params.type === 'meterReading') {
this.isEdit = false
this.form.energyTypeId = params.energyTypeId
let obj = {}
obj.tableName = params.tableName + ''
obj.readingQuantity = 0
this.tableData.push(obj)
} else {
this.isEdit = true
this.form.id = params.id
this.addButtonShow = ''
energyQuantityManualGet({ id: this.form.id }).then(res => {
if (res.code === 0) {
this.form.energyTypeId = res.data.energyTypeId
this.form.recordTime = res.data.recordTime ? res.data.recordTime : null
let obj = {}
obj.tableName = res.data.tableName ? res.data.tableName + '' : ''
obj.readingQuantity = res.data.readingQuantity
this.tableData.push(obj)
}
})
}
},
inputChange(val) {
this.tableData[val._pageIndex - 1][val.prop] = val[val.prop]
},
emitButtonClick() {
let obj = {}
obj.tableName = ''
obj.readingQuantity = 0
this.tableData.push(obj)
},
submitForm() {
this.$refs['energyQuantityManualForm'].validate((valid) => {
if (valid) {
//
if (this.tableData.length === 0) {
this.$modal.msgError("抄表数据不能为空");
return false
} else {
for (let item of this.tableData) {
console.log(item)
if (!item.tableName || (!item.readingQuantity && item.readingQuantity !== 0)) {
this.$modal.msgError("抄表数据有空值,请检查");
return false
}
}
}
if (this.isEdit) {
//
energyQuantityManualUpdate({
id: this.form.id,
energyTypeId: this.form.energyTypeId,
recordTime: this.form.recordTime,
tableName: this.tableData[0].tableName,
readingQuantity: this.tableData[0].readingQuantity
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
energyQuantityManualCreate({
energyTypeId: this.form.energyTypeId,
recordTime: this.form.recordTime,
data: this.tableData
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.energyQuantityManualForm.resetFields()
this.form.unit = ''
this.isEdit = false
this.addButtonShow = '新增'
this.tableData = []
}
}
}
name: 'EnergyQuantityManualAdd',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return [];
},
},
},
data() {
return {
tableData: [],
tableNameList: [], //list
addButtonShow: '新增',
form: {
id: '',
energyTypeId: '',
unit: '',
recordTime: '',
},
rules: {
energyTypeId: [
{ required: true, message: '能源类型不能为空', trigger: 'change' },
],
recordTime: [
{ required: true, message: '抄表日期不能为空', trigger: 'change' },
],
},
isEdit: false,
};
},
components: { AddTable },
methods: {
init(params) {
this.form.recordTime = moment().valueOf();
if (params.type === 'add') {
this.isEdit = false;
} else if (params.type === 'meterReading') {
this.isEdit = false;
this.form.energyTypeId = params.energyTypeId;
this.selEnergyType(this.form.energyTypeId);
let obj = {};
obj.tableName = params.tableName + '';
obj.readingQuantity = 0;
this.tableData.push(obj);
} else {
this.isEdit = true;
this.form.id = params.id;
this.addButtonShow = '';
energyQuantityManualGet({ id: this.form.id }).then((res) => {
if (res.code === 0) {
this.form.energyTypeId = res.data.energyTypeId;
this.selEnergyType(this.form.energyTypeId);
this.form.recordTime = res.data.recordTime
? res.data.recordTime
: null;
let obj = {};
obj.tableName = res.data.tableName ? res.data.tableName + '' : '';
obj.readingQuantity = res.data.readingQuantity;
this.tableData.push(obj);
}
});
}
},
inputChange(val) {
this.tableData[val._pageIndex - 1][val.prop] = val[val.prop];
console.log(this.tableData);
},
emitButtonClick() {
if (!this.form.energyTypeId) {
this.$modal.msgWarning('请先选择能源类型');
return false;
}
let obj = {};
obj.tableName = '';
obj.readingQuantity = 0;
this.tableData.push(obj);
},
selEnergyType(id) {
//
this.tableData = [];
this.tableNameList = [];
energyTableGet({ energyTypeId: id }).then((res) => {
this.tableNameList = res.data.tableObjs || [];
if (this.tableNameList.length === 0) {
this.$modal.msgWarning(
'当前能源类型暂无配置表名,请先到《表名配置》页面配置'
);
}
});
},
submitForm() {
this.$refs['energyQuantityManualForm'].validate((valid) => {
if (valid) {
//
if (this.tableData.length === 0) {
this.$modal.msgError('抄表数据不能为空');
return false;
} else {
for (let item of this.tableData) {
console.log(item);
if (
!item.tableName ||
(!item.readingQuantity && item.readingQuantity !== 0)
) {
this.$modal.msgError('抄表数据有空值,请检查');
return false;
}
}
}
if (this.isEdit) {
//
energyQuantityManualUpdate({
id: this.form.id,
energyTypeId: this.form.energyTypeId,
recordTime: this.form.recordTime,
tableName: this.tableData[0].tableName,
readingQuantity: this.tableData[0].readingQuantity,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
energyQuantityManualCreate({
energyTypeId: this.form.energyTypeId,
recordTime: this.form.recordTime,
data: this.tableData,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.energyQuantityManualForm.resetFields();
this.form.unit = '';
this.isEdit = false;
this.addButtonShow = '新增';
this.tableData = [];
},
},
};
</script>

View File

@ -1,271 +1,336 @@
<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" @selection-change="selectChange">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" 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-quantity-manual-add ref="energyQuantityManualAdd" :energyTypeList="energyTypeList"
@successSubmit="successSubmit" />
</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"
@selection-change="selectChange">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
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-quantity-manual-add
ref="energyQuantityManualAdd"
:energyTypeList="energyTypeList"
@successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { energyQuantityManualPage, energyQuantityManualDelete, energyQuantityManualExport } from "@/api/base/energyQuantityManual"
import { getEnergyTypeListAll } from "@/api/base/energyType"
import { publicFormatter } from '@/utils/dict'
import { parseTime, parseTimeTable } from '@/utils/ruoyi'
// import FileSaver from "file-saver"
// import * as XLSX from 'xlsx/xlsx.mjs'
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd'
import moment from 'moment'
import {
energyQuantityManualPage,
energyQuantityManualDelete,
energyQuantityManualExport,
} from '@/api/base/energyQuantityManual';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import { parseTimeTable } from '@/utils/ruoyi';
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'energyType',
label: '能源类型',
minWidth: 110,
showOverflowtooltip: true
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit'),
minWidth: 110
},
{
prop: 'tableName',
label: '能源表名',
filter: publicFormatter('table_name'),
minWidth: 110,
showOverflowtooltip: true
},
{
prop: 'recordTime',
label: '抄表日期',
filter: parseTimeTable('{y}-{m}-{d}'),
minWidth: 110
},
{
prop: 'readingQuantity',
label: '抄表值'
},
{
prop: 'useQty',
label: '差值'
}
]
{
prop: 'energyTypeLabel',
label: '能源类型',
minWidth: 110,
showOverflowtooltip: true,
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
minWidth: 110,
},
{
prop: 'tableName',
label: '能源表名',
filter: publicFormatter('table_name'),
minWidth: 110,
showOverflowtooltip: true,
},
{
prop: 'recordTime',
label: '抄表日期',
filter: parseTimeTable('{y}-{m}-{d}'),
minWidth: 110,
},
{
prop: 'readingQuantity',
label: '抄表值',
},
{
prop: 'useQty',
label: '差值',
},
];
export default {
name: "EnergyQuantityManual",
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true
},
{
type: 'datePicker',
label: '抄表日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: []
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-quantity-manual:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
},
{
type: this.$auth.hasPermi('base:energy-quantity-manual:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
tableBtn: [
this.$auth.hasPermi('base:energy-quantity-manual:create')
? {
type: 'meterReading',
btnName: '抄表'
}
: undefined,
this.$auth.hasPermi('base:energy-quantity-manual:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-quantity-manual:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
recordTime: []
},
energyTypeList: [],
exportList: [],
addOrEditTitle: '',
centervisible: false,
};
},
components: { EnergyQuantityManualAdd },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf()
let start = moment(moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')).valueOf()
this.formConfig[1].defaultSelect = [start, end]
this.queryParams.recordTime[0] = start
this.queryParams.recordTime[1] = end
this.getList();
this.getTypeList()
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.recordTime[0] = val.timeVal ? moment(moment(val.timeVal[0]).format('YYYY-MM-DD 00:00:00')).valueOf() : null
this.queryParams.recordTime[1] = val.timeVal ? moment(moment(val.timeVal[1]).format('YYYY-MM-DD 23:59:59')).valueOf() : null
switch (val.btnName) {
case 'search':
this.getList()
break
case 'add':
this.addOrEditTitle = '新增'
this.centervisible = true
let params = {}
params.type = 'add'
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(params)
})
break
default:
this.$modal.confirm('是否确认导出').then(() => {
return energyQuantityManualExport({ energyTypeId: this.queryParams.energyTypeId, recordTime: this.queryParams.recordTime });
}).then(response => {
this.$download.excel(response, '能源报表.xls');
}).catch(() => { })
}
},
/** 查询列表 */
getList() {
energyQuantityManualPage(this.queryParams).then(response => {
let arr = response.data.list || []
arr && arr.map(item => {
item.amount = item.amount ? (!isNaN(parseFloat(item.amount)) && isFinite(item.amount) ? item.amount.toFixed(2) : '') : ''
})
this.list = arr
this.total = response.data.total;
this.exportList = []
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || []
this.energyTypeList = res.data || []
})
},
selectChange(val) {
console.log(val)
this.exportList = val
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.centervisible = true
let paramA = {}
paramA.type = 'edit'
paramA.id = val.data.id
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramA)
})
break
case 'meterReading':
this.addOrEditTitle = '新增'
this.centervisible = true
let paramB = {}
paramB.type = 'meterReading'
paramB.energyTypeId = val.data.energyTypeId
paramB.tableName = val.data.tableName
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramB)
})
break
default:
this.handleDelete(val.data)
}
},
//
handleCancel() {
this.$refs.energyQuantityManualAdd.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyQuantityManualAdd.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row.id)
this.$modal.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?').then(function () {
return energyQuantityManualDelete({ id: row.id });
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
}
name: 'EnergyQuantityManual',
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
labelField: 'labelName',
selectOptions: [],
param: 'energyTypeId',
filterable: true,
},
{
type: 'datePicker',
label: '抄表日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
},
{
type: this.$auth.hasPermi('base:energy-quantity-manual:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermiOr([
'base:energy-quantity-manual:export',
'base:energy-quantity-manual:create',
])
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('base:energy-quantity-manual:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true,
},
{
type: this.$auth.hasPermi('base:energy-quantity-manual:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
//
total: 0,
//
list: [],
tableBtn: [
this.$auth.hasPermiAnd([
'base:energy-quantity-manual:query',
'base:energy-quantity-manual:create',
])
? {
type: 'meterReading',
btnName: '抄表',
}
: undefined,
this.$auth.hasPermiAnd([
'base:energy-quantity-manual:update',
'base:energy-quantity-manual:query',
])
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-quantity-manual:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
recordTime: [],
},
energyTypeList: [],
exportList: [],
addOrEditTitle: '',
centervisible: false,
};
},
components: { EnergyQuantityManualAdd },
mixins: [tableHeightMixin],
created() {
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf();
let start = moment(
moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
).valueOf();
this.formConfig[1].defaultSelect = [start, end];
this.queryParams.recordTime[0] = start;
this.queryParams.recordTime[1] = end;
this.getList();
this.getTypeList();
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.recordTime[0] = val.timeVal
? moment(moment(val.timeVal[0]).format('YYYY-MM-DD 00:00:00')).valueOf()
: null;
this.queryParams.recordTime[1] = val.timeVal
? moment(moment(val.timeVal[1]).format('YYYY-MM-DD 23:59:59')).valueOf()
: null;
switch (val.btnName) {
case 'search':
this.getList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.centervisible = true;
let params = {};
params.type = 'add';
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(params);
});
break;
default:
this.$modal
.confirm('是否确认导出')
.then(() => {
return energyQuantityManualExport({
energyTypeId: this.queryParams.energyTypeId,
recordTime: this.queryParams.recordTime,
});
})
.then((response) => {
this.$download.excel(response, '能源报表.xls');
})
.catch(() => {});
}
},
/** 查询列表 */
getList() {
energyQuantityManualPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
item.amount = item.amount
? !isNaN(parseFloat(item.amount)) && isFinite(item.amount)
? item.amount.toFixed(2)
: ''
: '';
this.getDictDatas('energy_type').map((subItem) => {
if (item.energyType === subItem.value) {
item.energyTypeLabel = subItem.label;
}
});
});
this.list = arr;
this.total = response.data.total;
this.exportList = [];
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [];
this.energyTypeList = res.data || [];
});
},
selectChange(val) {
console.log(val);
this.exportList = val;
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.centervisible = true;
let paramA = {};
paramA.type = 'edit';
paramA.id = val.data.id;
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramA);
});
break;
case 'meterReading':
this.addOrEditTitle = '新增';
this.centervisible = true;
let paramB = {};
paramB.type = 'meterReading';
paramB.energyTypeId = val.data.energyTypeId;
paramB.tableName = val.data.tableName;
this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramB);
});
break;
default:
this.handleDelete(val.data);
}
},
//
handleCancel() {
this.$refs.energyQuantityManualAdd.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyQuantityManualAdd.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row.id);
this.$modal
.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
.then(function () {
return energyQuantityManualDelete({ id: row.id });
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,220 +1,256 @@
<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"
:selectWidth="55" :max-height="tableH" @selection-change="selectChange" />
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" />
</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"
:selectWidth="55"
:max-height="tableH"
@selection-change="selectChange" />
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
</div>
</template>
<script>
import { getEnergyQuantityRealtimePage } from "@/api/base/energyQuantityRealtime"
import { getEnergyTypeListAll } from "@/api/base/energyType"
// import { publicFormatter } from '@/utils/dict'
import FileSaver from "file-saver"
import * as XLSX from 'xlsx/xlsx.mjs'
import { getEnergyQuantityRealtimePage } from '@/api/base/energyQuantityRealtime';
import { getEnergyTypeListAll } from '@/api/base/energyType';
// import { publicFormatter } from '@/utils/dict';
import FileSaver from 'file-saver';
import * as XLSX from 'xlsx/xlsx.mjs';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'objName',
label: '统计对象',
showOverflowtooltip: true
},
{
prop: 'objCode',
label: '对象编码',
showOverflowtooltip: true
},
{
prop: 'energyTypeName',
label: '能源类型',
showOverflowtooltip: true
},
{
prop: 'startValue',
label: '初始值'
},
{
prop: 'endValue',
label: '当前值'
},
{
prop: 'diffValue',
label: '差值'
},
{
prop: 'amount',
label: '金额'
}
]
{
prop: 'objName',
label: '统计对象',
showOverflowtooltip: true,
},
{
prop: 'objCode',
label: '对象编码',
showOverflowtooltip: true,
},
{
prop: 'energyTypeLabel',
label: '能源类型',
showOverflowtooltip: true,
},
{
prop: 'startValue',
label: '初始值',
},
{
prop: 'endValue',
label: '当前值',
},
{
prop: 'diffValue',
label: '差值',
},
{
prop: 'amount',
label: '金额',
},
];
export default {
name: "EnergyQuantityRealtime",
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true
},
{
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('base:energy-quantity-realtime:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
}
],
tableProps,
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
startTime: null,
endTime: null
},
energyTypeList: [],
exportList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&')
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
} else {
this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()]
}
this.queryParams.startTime = this.formConfig[1].defaultSelect[0]
this.queryParams.endTime = this.formConfig[1].defaultSelect[1]
this.getList();
this.getTypeList()
},
watch: {
$route: 'initData'
},
methods: {
initData(to) {
if (to.name === 'EnergyQuantityRealtime') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&')
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
} else {
this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()]
}
this.queryParams.startTime = this.formConfig[1].defaultSelect[0]
this.queryParams.endTime = this.formConfig[1].defaultSelect[1]
this.getList()
}
},
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
switch (val.btnName) {
case 'search':
this.getList()
break
default:
this.exportTable()
}
},
/** 查询列表 */
getList() {
getEnergyQuantityRealtimePage(this.queryParams).then(response => {
let arr = response.data.list || []
arr && arr.map(item => {
item.amount = item.amount ? (!isNaN(parseFloat(item.amount)) && isFinite(item.amount) ? item.amount.toFixed(2) : '') : ''
})
this.list = arr
this.total = response.data.total;
this.exportList = []
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || []
this.energyTypeList = res.data || []
})
},
selectChange(val) {
console.log(val)
this.exportList = val
},
//
exportTable() {
if (this.exportList.length > 0) {
let body = this.exportList.map((x) => [
x.objName,
x.objCode,
x.energyTypeName,
x.startValue,
x.endValue,
x.diffValue,
x.amount
])
let header = []
this.tableProps.map((y) => {
header.push(y.label)
})
body.unshift(header)
console.log(body)
const filename = '能源抄表.xlsx'
const ws_name = 'Sheet1'
const wb = XLSX.utils.book_new()
const ws = XLSX.utils.aoa_to_sheet(body)
XLSX.utils.book_append_sheet(wb, ws, ws_name)
let wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'array'
})
FileSaver.saveAs(
new Blob([wbout], {
type: 'application/octet-stream'
}),
filename
)
} else {
this.$modal.msgWarning('请勾选需要导出的数据')
}
}
}
name: 'EnergyQuantityRealtime',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
labelField: 'labelName',
selectOptions: [],
param: 'energyTypeId',
filterable: true,
},
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350,
},
{
type: this.$auth.hasPermi('base:energy-quantity-realtime:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:energy-quantity-realtime:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true,
},
],
tableProps,
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
startTime: null,
endTime: null,
},
energyTypeList: [],
exportList: [],
};
},
created() {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&');
this.formConfig[1].defaultSelect = [
arr[0].split('=')[1],
arr[1].split('=')[1],
];
} else {
this.formConfig[1].defaultSelect = [
Date.now() - 7 * 24 * 3600000,
Date.now(),
];
}
this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
this.getList();
this.getTypeList();
},
watch: {
$route: 'initData',
},
methods: {
initData(to) {
if (to.name === 'EnergyQuantityRealtime') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&');
this.formConfig[1].defaultSelect = [
arr[0].split('=')[1],
arr[1].split('=')[1],
];
} else {
this.formConfig[1].defaultSelect = [
Date.now() - 7 * 24 * 3600000,
Date.now(),
];
}
this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
this.getList();
}
},
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
switch (val.btnName) {
case 'search':
this.getList();
break;
default:
this.exportTable();
}
},
/** 查询列表 */
getList() {
getEnergyQuantityRealtimePage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
item.amount = item.amount
? !isNaN(parseFloat(item.amount)) && isFinite(item.amount)
? item.amount.toFixed(2)
: ''
: '';
this.getDictDatas('energy_type').map((subItem) => {
if (item.energyTypeName === subItem.value) {
item.energyTypeLabel = subItem.label;
}
});
});
this.list = arr;
this.total = response.data.total;
this.exportList = [];
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [];
this.energyTypeList = res.data || [];
});
},
selectChange(val) {
console.log(val);
this.exportList = val;
},
//
exportTable() {
if (this.exportList.length > 0) {
let body = this.exportList.map((x) => [
x.objName,
x.objCode,
x.energyTypeLabel,
x.startValue,
x.endValue,
x.diffValue,
x.amount,
]);
let header = [];
this.tableProps.map((y) => {
header.push(y.label);
});
body.unshift(header);
console.log(body);
const filename = '能源抄表.xlsx';
const ws_name = 'Sheet1';
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(body);
XLSX.utils.book_append_sheet(wb, ws, ws_name);
let wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'array',
});
FileSaver.saveAs(
new Blob([wbout], {
type: 'application/octet-stream',
}),
filename
);
} else {
this.$modal.msgWarning('请勾选需要导出的数据');
}
},
},
};
</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,195 @@
<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';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
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: 'energyTypeLabel',
label: '能源类型',
},
{
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 },
mixins: [tableHeightMixin],
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),
heightNum: 220,
pricingMethodList: [
{ value: 0, label: '分时间段计价' },
{ value: 1, label: '分使用量计价' },
{ value: 2, label: '单一计价' },
],
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 100,
},
};
},
created() {
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.getDictDatas('energy_type').map((subItem) => {
if (item.name === subItem.value) {
item.energyTypeLabel = subItem.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) {
console.log(row);
this.$modal
.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
.then(function () {
return deleteEnergyType(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,76 @@
<template>
<el-form
ref="form"
label-width="100px"
:model="form">
<el-form-item
label="能源类型"
prop="energyType">
<el-input v-model="form.energyType"></el-input>
</el-form-item>
<el-form-item
label="能源表名"
prop="tableIds">
<el-select
v-model="form.tableIds"
placeholder="请选择"
style="width: 100%"
:multiple="true"
filterable>
<el-option
v-for="dict in getDictDatas('table_name')"
:key="dict.id"
:label="dict.label"
:value="dict.id" />
</el-select>
</el-form-item>
</el-form>
</template>
<script>
import {
energyTableGet,
energyTableUpdate,
} from '@/api/base/energyQuantityManual';
export default {
name: 'TableNameConfigUpdate',
data() {
return {
form: {
energyType: '',
energyTypeId: '',
tableIds: [],
},
};
},
methods: {
init(id) {
energyTableGet({ energyTypeId: id }).then((res) => {
this.form.energyType = res.data.energyType || '';
this.form.energyTypeId = res.data.energyTypeId || '';
this.form.tableIds =
res.data.tableObjs &&
res.data.tableObjs.map((item) => {
return item.id;
});
});
},
submitForm() {
this.$refs['form'].validate((valid) => {
//
energyTableUpdate({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
});
},
formClear() {
this.form.energyType = '';
this.form.energyTypeId = '';
this.form.tableIds = [];
this.isEdit = false;
},
},
};
</script>

View File

@ -0,0 +1,111 @@
<template>
<div class="app-container">
<!-- 列表 -->
<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="编辑"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<table-name-config-update
ref="tableNameConfigU"
@successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { energyTablePage } from '@/api/base/energyQuantityManual';
import { publicFormatter } from '@/utils/dict';
import tableNameConfigUpdate from './components/tableNameConfigUpdate.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'energyType',
label: '能源类型',
width: 200,
filter: publicFormatter('energy_type'),
},
{
prop: 'tableName',
label: '能源表名',
},
];
export default {
name: 'TableNameConfig',
components: { tableNameConfigUpdate },
data() {
return {
tableProps,
tableBtn: [
this.$auth.hasPermiAnd([
'base:energy-table:query',
'base:energy-table:update',
])
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
list: [],
queryParams: {
pageNo: 1,
pageSize: 100,
},
heightNum: 165,
centervisible: false,
};
},
mixins: [tableHeightMixin],
created() {
this.getList();
},
methods: {
getList() {
energyTablePage({ ...this.queryParams }).then((res) => {
let temp = res.data.list || [];
this.list = temp.map((item) => {
return {
energyType: item.energyType,
energyTypeId: item.energyTypeId,
tableName: item.tables.join('、'),
};
});
});
},
handleClick(val) {
console.log('编辑');
this.centervisible = true;
this.$nextTick(() => {
this.$refs.tableNameConfigU.init(val.data.energyTypeId);
});
},
handleCancel() {
this.$refs.tableNameConfigU.formClear();
this.centervisible = false;
},
handleConfirm() {
this.$refs.tableNameConfigU.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
},
};
</script>

View File

@ -1,282 +1,371 @@
<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' }"
@change="selectObj"
clearable></el-cascader>
</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.labelName"
:value="item.id"></el-option>
</el-select>
</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 tableNameList"
: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="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';
import { energyTableGet } from '@/api/base/energyQuantityManual';
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,
tableName: '',
},
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' },
],
},
tableNameList: [],
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.tableName = this.form.tableName
? this.form.tableName + ''
: '';
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.method == 2) {
this.form.tableName = '';
this.getTableNameList(this.form.energyTypeId);
}
},
// list
getTableNameList(id) {
energyTableGet({ energyTypeId: id }).then((res) => {
this.tableNameList = res.data.tableObjs || [];
if (this.tableNameList.length === 0) {
this.$modal.msgWarning(
'当前能源类型暂无配置表名,请先到《表名配置》页面配置'
);
}
});
},
//
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;
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;
}
</style>

View File

@ -1,269 +1,289 @@
<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/analysis/energyAnalysis';
import { publicFormatter } from '@/utils/dict';
import EnergyLimitAdd from './components/energyLimitAdd';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
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: '监控对象',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'objCode',
label: '对象编码',
minWidth: 140,
showOverflowtooltip: true,
},
{
prop: 'tableName',
label: '能源表名',
filter: publicFormatter('table_name'),
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'energyType',
label: '能源类型',
filter: publicFormatter('energy_type'),
showOverflowtooltip: true,
},
{
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 },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
labelField: 'labelName',
param: 'energyTypeId',
},
{
type: 'select',
label: '指标类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
labelField: 'label',
valueField: 'value',
param: 'limitType',
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create')
? '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),
//
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() {
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) {
console.log(row);
this.$modal
.confirm('是否确认删除第"' + row._pageIndex + '"条数据项?')
.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,248 +1,270 @@
<template>
<div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="自动抄表" name="auto"></el-tab-pane>
<el-tab-pane label="手动抄表" name="manual"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'auto'">
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
:max-height="tableH" />
</div>
<div v-if="activeName === 'manual'">
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps2"
:table-data="list2" :max-height="tableH" />
</div>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" />
</div>
<div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-tabs
v-model="activeName"
@tab-click="toggleTab">
<el-tab-pane
label="自动抄表"
name="auto"></el-tab-pane>
<el-tab-pane
label="手动抄表"
name="manual"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'auto'">
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</div>
<div v-if="activeName === 'manual'">
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps2"
:table-data="list2"
:max-height="tableH" />
</div>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
</div>
</template>
<script>
import { getEnergyOverlimitLogPage } from "@/api/monitoring/energyOverlimitLog";
import { getEnergyTypeListAll } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi'
import { getEnergyOverlimitLogPage } from '@/api/monitoring/energyOverlimitLog';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'objName',
label: '监控对象'
},
{
prop: 'objCode',
label: '对象编码'
},
{
prop: 'energyType',
label: '能源类型'
},
{
prop: 'type',
label: '监控模式'
},
{
prop: 'paramName',
label: '监控参数'
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type')
},
{
prop: 'realityValue',
label: '实际值'
},
{
prop: 'limitValue',
label: '阈值'
},
{
prop: 'overValue',
label: '超出值'
},
{
prop: 'time',
label: '提醒时间',
filter: parseTime,
minWidth: 160
}
]
{
prop: 'objName',
label: '监控对象',
},
{
prop: 'objCode',
label: '对象编码',
},
{
prop: 'energyType',
label: '能源类型',
filter: publicFormatter('energy_type'),
},
{
prop: 'type',
label: '监控模式',
},
{
prop: 'paramName',
label: '监控参数',
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type'),
},
{
prop: 'realityValue',
label: '实际值',
},
{
prop: 'limitValue',
label: '阈值',
},
{
prop: 'overValue',
label: '超出值',
},
{
prop: 'time',
label: '提醒时间',
filter: parseTime,
minWidth: 160,
},
];
const tableProps2 = [
{
prop: 'energyType',
label: '能源类型'
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type')
},
{
prop: 'realityValue',
label: '实际值'
},
{
prop: 'limitValue',
label: '阈值'
},
{
prop: 'overValue',
label: '超出值'
},
{
prop: 'time',
label: '提醒时间',
filter: parseTime,
minWidth: 160
}
]
{
prop: 'energyType',
label: '能源类型',
filter: publicFormatter('energy_type'),
},
{
prop: 'limitType',
label: '指标类型',
filter: publicFormatter('monitor_index_type'),
},
{
prop: 'realityValue',
label: '实际值',
},
{
prop: 'limitValue',
label: '阈值',
},
{
prop: 'overValue',
label: '超出值',
},
{
prop: 'time',
label: '提醒时间',
filter: parseTime,
minWidth: 160,
},
];
export default {
name: "EnergyOverlimitLog",
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: 'indexType'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
],
activeName: 'auto',
tableProps,
tableProps2,
tableH: this.tableHeight(260),
total: 0,
list: [],
list2: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
indexType: '',
method: '1'
},
typeList: [
{ id: 1, name: '合并' },
{ id: 2, name: '详细' }
]
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getTypeList()
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.indexType = val.indexType
this.getList()
},
/** 查询列表 */
getList() {
getEnergyOverlimitLogPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr && arr.map((item) => {
this.typeList.map((i) => {
if (item.type === i.id) {
item.type = i.name
}
})
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 = ''
}
})
if (this.queryParams.method === '1') {
this.list = arr
this.list2 = []
} else {
this.list2 = arr
this.list1 = []
}
this.total = response.data.total;
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
console.log(res)
this.formConfig[0].selectOptions = res.data || []
})
},
toggleTab() {
if (this.activeName === 'auto') {
this.queryParams.method = '1'
} else {
this.queryParams.method = '2'
}
this.queryParams.pageNo = 1
this.getList()
}
}
name: 'EnergyOverlimitLog',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
labelField: 'labelName',
selectOptions: [],
param: 'energyTypeId',
},
{
type: 'select',
label: '指标类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
labelField: 'label',
valueField: 'value',
param: 'indexType',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
activeName: 'auto',
tableProps,
tableProps2,
total: 0,
list: [],
list2: [],
heightNum: 300,
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
indexType: '',
method: '1',
},
typeList: [
{ id: 1, name: '合并' },
{ id: 2, name: '详细' },
],
};
},
created() {
this.getList();
this.getTypeList();
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.indexType = val.indexType;
this.getList();
},
/** 查询列表 */
getList() {
getEnergyOverlimitLogPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.typeList.map((i) => {
if (item.type === i.id) {
item.type = i.name;
}
});
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 = '';
}
});
if (this.queryParams.method === '1') {
this.list = arr;
this.list2 = [];
} else {
this.list2 = arr;
this.list1 = [];
}
this.total = response.data.total;
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
console.log(res);
this.formConfig[0].selectOptions = res.data || [];
});
},
toggleTab() {
if (this.activeName === 'auto') {
this.queryParams.method = '1';
} else {
this.queryParams.method = '2';
}
this.queryParams.pageNo = 1;
this.getList();
},
},
};
</script>
<style lang='scss'>
.energyOverlimitLog {
.el-tabs__nav::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.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.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More