Compare commits

..

No commits in common. "15afbcd6127cbc782c632fada3cac3162f2eea88" and "db7d4745ddbd75bf526f88f9ee9b0b779121b48d" have entirely different histories.

193 changed files with 13971 additions and 17121 deletions

View File

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

View File

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

View File

@ -1,4 +1,4 @@
# 公司线上环境33服务器 # 生产环境配置
ENV = 'production' ENV = 'production'
# 页面标题 # 页面标题
@ -7,12 +7,15 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/生产环境 # 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api' 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' VUE_APP_JIMU_API = 'http://192.168.0.33:48082'
# socket地址 # socket地址
VUE_APP_Socket_API = 'ws://192.168.0.33:48082' 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,22 +34,4 @@ export function getQoq(data) {
method: 'post', method: 'post',
data: data data: data
}) })
}
// 获取能源设备树
export function getTree() {
return request({
url: '/analysis/energy-analysis/getTree',
method: 'get'
})
}
// 导出(走势分析)
export function exportTrend(data) {
return request({
url: '/analysis/energy-analysis/exportTrend',
method: 'post',
responseType: 'blob',
data: data
})
} }

View File

@ -53,28 +53,4 @@ export function energyQuantityManualExport(data) {
data: data, data: data,
responseType: 'blob' 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,4 +68,3 @@ export function exportEnergyTypeExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-07-19 15:18:30 * @Date: 2021-07-19 15:18:30
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2024-04-03 10:54:53 * @LastEditTime: 2024-03-28 15:28:07
* @Description: * @Description:
--> -->
<template> <template>
@ -16,11 +16,11 @@
许昌安彩AGV原片周转看板 许昌安彩AGV原片周转看板
<h3 class="unit">单位河南汇融数字科技有限公司</h3> <h3 class="unit">单位河南汇融数字科技有限公司</h3>
<h3 class="time">{{ times }}</h3> <h3 class="time">{{ times }}</h3>
<!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px', fontSize: '32px' }" <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px', fontSize: '32px' }"
@click="changeFullScreen"> @click="changeFullScreen">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" /> <svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" /> <svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button> --> </el-button>
</el-row> </el-row>
<el-row class="container-main flex-col" type="flex"> <el-row class="container-main flex-col" type="flex">
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15 * beilv" type="flex" class="flex-1"> <el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15 * beilv" type="flex" class="flex-1">
@ -34,16 +34,14 @@
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12"> <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
<base-container :beilv="1" :size="'eqStatus'" :title="'周转进度'" :title-icon="'order'" :back="'energy'"> <base-container :beilv="1" :size="'eqStatus'" :title="'周转进度'" :title-icon="'order'" :back="'energy'">
<div class="order" style="width:100%; overflow: hidden scroll;height: 350px;"> <div class="order" style="width:100%; overflow: hidden scroll;height: 350px;">
<el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: .5em"> <el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: 1em">
<!-- <p v-if="op.outRate === 1" class="now-secondary-title" <p v-if="op.outRate === 1" class="now-secondary-title" style="color:#4679FD">
style="font-size: 14px; opacity: calc(.6);color:#4679FD">
<i class="el-icon-check" /> <i class="el-icon-check" />
{{ op.name }} {{ op.name }}
</p> --> </p>
<!-- <p class="now-secondary-title">{{ op.name }}</p> --> <p v-else class="now-secondary-title">{{ op.name }}</p>
<p class="now-secondary-title" style="font-size: 14px;opacity: calc(.6);">{{ op.name }}</p> <el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white"
<el-progress style="width: 935px;" text-color="rgba(255, 255, 255, .6)" :stroke-width="10" :percentage="op.outRate * 100" class="custom-progress-bar" />
define-back-color="rgba(32, 57, 96, 1)" :percentage="op.outRate * 100" class="custom-progress-bar" />
</el-row> </el-row>
</div> </div>
</base-container> </base-container>
@ -498,7 +496,7 @@ export default {
seconds = "0" + seconds; seconds = "0" + seconds;
} }
// //
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds; this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}, },
windowWidth(value) { windowWidth(value) {
this.clientWidth = value this.clientWidth = value
@ -532,6 +530,11 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.visual-container { .visual-container {
width: 1920px; width: 1920px;
height: 1080px; height: 1080px;
@ -553,7 +556,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: 1px; letter-spacing: 0px;
} }
.time { .time {
position: absolute; position: absolute;
@ -561,7 +564,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: .72px; letter-spacing: 0px;
} }
.title-button { .title-button {
color: #00fff0; color: #00fff0;
@ -604,14 +607,6 @@ export default {
::v-deep .el-progress-bar__inner { ::v-deep .el-progress-bar__inner {
background-color: unset; background-color: unset;
background-image: linear-gradient(to right, #4573fe, #47f8dc); background-image: linear-gradient(to right, #4573fe, #47f8dc);
}
::v-deep .el-progress__text {
width: 50px;
margin-top: -70px;
margin-left: 834px;
text-align: right;
// background-color: unset;
// background-image: linear-gradient(to right, #4573fe, #47f8dc);
} }
.visual-select { .visual-select {
position: absolute; position: absolute;

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-01-29 16:50:26 * @Date: 2024-01-29 16:50:26
* @LastEditTime: 2024-04-11 09:55:04 * @LastEditTime: 2024-03-28 16:35:49
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -17,11 +17,11 @@
许昌安彩冷端看板 许昌安彩冷端看板
<h3 class="unit">单位河南汇融数字科技有限公司</h3> <h3 class="unit">单位河南汇融数字科技有限公司</h3>
<h3 class="time">{{ times }}</h3> <h3 class="time">{{ times }}</h3>
<!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}" <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
@click="changeFullScreen"> @click="changeFullScreen">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" /> <svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" /> <svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button> --> </el-button>
</el-row> </el-row>
<el-row class="container-main flex-col" type="flex"> <el-row class="container-main flex-col" type="flex">
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1"> <el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1">
@ -40,13 +40,6 @@
<top-radio-group /> <top-radio-group />
</div> --> </div> -->
<!-- 像下面这样表格里的limit值也许可以用js动态计算出来 --> <!-- 像下面这样表格里的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" <double-y-chart ref="productChart" :id="'doubleYChart'" :name-list="cxNameList" :data-list="cxDataList"
:height="359" :show-legend="true" /> :height="359" :show-legend="true" />
</base-container> </base-container>
@ -71,11 +64,11 @@
</div> --> </div> -->
<!-- <el-row :gutter="9"> --> <!-- <el-row :gutter="9"> -->
<!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> --> <!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> -->
<pile-bar-chart id=" 'one' " style="margin-top: -5px;" ref="firstPileChart" :height="80" /> <pile-bar-chart style="margin-bottom: -15px" ref="firstPileChart" :height="90" />
<second-pile-bar-chart id=" 'second' " ref="secondPileChart" :height="90" /> <second-pile-bar-chart style="margin-bottom: -15px" id=" 'second' " ref="secondPileChart" :height="90" />
<third-pile-bar-chart id=" 'third' " ref="thirdPileChart" :height="90" /> <third-pile-bar-chart style="margin-bottom: -15px" id=" 'third' " ref="thirdPileChart" :height="90" />
<fourth-pile-bar-chart id=" 'fourth' " ref="fourthPileChart" :height="90" /> <fourth-pile-bar-chart style="margin-bottom: -15px" id=" 'fourth' " ref="fourthPileChart" :height="90" />
<fifth-pile-bar-chart style="margin-top: -5px;" id=" 'fifth' " ref="fifthPileChart" :height="90" /> <fifth-pile-bar-chart style="margin-bottom: -15px" id=" 'fifth' " ref="fifthPileChart" :height="100" />
<!-- <pile-bar-chart ref="secondPileChart" <!-- <pile-bar-chart ref="secondPileChart"
:height="90" /> :height="90" />
<pile-bar-chart ref="thirdPileChart" <pile-bar-chart ref="thirdPileChart"
@ -251,7 +244,6 @@ export default {
funWs: undefined, funWs: undefined,
SJGws: undefined, SJGws: undefined,
funWsData: {}, funWsData: {},
coldDetData:[],
SJGWsData: {}, SJGWsData: {},
cxNameList:[], cxNameList:[],
cxDataList:[], cxDataList:[],
@ -310,7 +302,6 @@ export default {
window.location.reload() window.location.reload()
}, 86400000) }, 86400000)
// this.getData() // this.getData()
// this.getReaiData()
}, },
destroyed() { destroyed() {
this.CutWebsocketClose() this.CutWebsocketClose()
@ -323,7 +314,85 @@ export default {
} }
}, },
mounted() { mounted() {
this.getProductData() 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.$refs.productChart.initChart(nameList, yieldList, sumAreaList) // this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
this.getTimes() this.getTimes()
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss')); // console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
@ -345,131 +414,6 @@ export default {
} }
}, },
methods: { 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() { // getData() {
// let detData = [ // let detData = [
// { // {
@ -500,10 +444,8 @@ export default {
// `<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</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)"><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.realEqConfig.data = this.realEqList
// this.$refs['realEqScrollBoard'].updateRows(this.realEqList) // this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
// // })
// }, // },
CutWebsocketClose(e) { CutWebsocketClose(e) {
this.Cutws.ws.onclose = (event) => { console.log(event );} this.Cutws.ws.onclose = (event) => { console.log(event );}
@ -553,7 +495,7 @@ export default {
seconds = "0" + seconds; seconds = "0" + seconds;
} }
// //
this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds; this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}, },
SJGInitWebSocket() { SJGInitWebSocket() {
let date = new Date().valueOf() let date = new Date().valueOf()
@ -583,9 +525,10 @@ export default {
]) ])
} }
this.realEqConfig.data = this.realEqList this.realEqConfig.data = this.realEqList
// this.$nextTick(() => { this.$nextTick(() => {
this.$refs['realEqScrollBoard'].updateRows(this.realEqList) this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
// })
})
}; };
// if (typeof (WebSocket) === 'undefined') { // if (typeof (WebSocket) === 'undefined') {
// alert('WebSocket') // alert('WebSocket')
@ -617,23 +560,19 @@ export default {
this.cutWsData = event?.data ? JSON.parse(event?.data) : {} this.cutWsData = event?.data ? JSON.parse(event?.data) : {}
if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'table') { if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'table') {
let cutArr = this.cutWsData.productHourData.map((item, index) => [ let cutArr = this.cutWsData.productHourData.map((item, index) => [
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''} `<span style="color:rgba(255,255,255,0.7)" >${index + 1 || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)" >${item.lineName || ''} `<span style="color:rgba(255,255,255,0.7)" >${item.lineName || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.formatTime(item.time) || ''}</span>`, `<span style="color:rgba(255,255,255,0.7)">${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.7)">${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.7)">${item.productArea + '㎡' || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.wasteArea) + '㎡' || ''}</span>`, `<span style="color:rgba(255,255,255,0.7)">${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(2) > 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</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>` <div style = "${(item.product * 100).toFixed(2) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div>`
]) ])
this.cutConfig.data = cutArr this.cutConfig.data = cutArr
// this.$nextTick(() => { this.$refs['cutScrollBoard'].updateRows(cutArr)
this.$refs['cutScrollBoard'].updateRows(cutArr)
// })
// this.cutConfig.data = cutArr
// this.$refs['cutScrollBoard'].updateRows(cutArr)
} else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') { } else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') {
let nameList = [] let nameList = []
let nameWasteList = [] let nameWasteList = []
@ -642,25 +581,22 @@ export default {
let wasteList = [] let wasteList = []
let sumAreaList = [] let sumAreaList = []
let yieldList = [] let yieldList = []
this.coldDetData = this.cutWsData.coldDetData
// this.cutTableDataList = // this.cutTableDataList =
this.cutWsData.coldDetData.forEach((ele, index) => { this.cutWsData.coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName) nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡') topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea)
productList.push(ele.productArea) productList.push(ele.productArea)
wasteList.push(ele.wastArea) wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + this.NumFormat(ele.wastArea) + '㎡') nameWasteList.push('缺陷面积:' + ele.wastArea)
sumAreaList.push(ele.sumArea) sumAreaList.push(ele.sumArea)
yieldList.push(parseFloat((ele.yield * 100).toFixed(0))) yieldList.push(parseFloat((ele.yield * 100).toFixed(3)))
})
this.$nextTick(() => {
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
this.$refs.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') { // if (typeof (WebSocket) === 'undefined') {
@ -696,18 +632,17 @@ export default {
for (let i in this.funWsData.data.annealFanInfo) { for (let i in this.funWsData.data.annealFanInfo) {
index++, index++,
arr.push([ arr.push([
`<span style="color:rgba(255,255,255,0.5)" >${index || ''} `
<span style="color:rgba(255,255,255,0.5)" >${index || ''}
</span>`, </span>`,
// `<span style="color:rgba(255,255,255,0.5)" >${i || ''} `<span style="color:rgba(255,255,255,0.5)" >${i || ''}
// </span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)">${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="${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>`, `<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.annealFunConfig.data = arr this.annealFunConfig.data = arr
// this.$nextTick(() => { this.$refs['annealFunScrollBoard'].updateRows(arr)
this.$refs['annealFunScrollBoard'].updateRows(arr)
// })
} }
if (this.funWsData.type === 'FanInfo') { if (this.funWsData.type === 'FanInfo') {
let arr = [] let arr = []
@ -715,16 +650,14 @@ export default {
for (let i in this.funWsData.data.fanInfo) { for (let i in this.funWsData.data.fanInfo) {
index++, index++,
arr.push([ arr.push([
`<span style="color:rgba(255,255,255,0.5)" >${index || ''} `<span style="color:rgba(255,255,255,0.5)" >${index || ''}</span>`,
</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)">${item.name || ''}</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>`, `<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.funConfig.data = arr this.funConfig.data = arr
// this.$nextTick(() => { this.$refs['funScrollBoard'].updateRows(arr)
this.$refs['funScrollBoard'].updateRows(arr)
// })
} }
}; };
// if (typeof (WebSocket) === 'undefined') { // if (typeof (WebSocket) === 'undefined') {
@ -745,25 +678,6 @@ export default {
// this.funWebsocket.onclose = this.funWebsocketClose // 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() { // funWebsocketOnOpen() {
// console.log('socket') // console.log('socket')
// this.SJGWebsocket.onmessage() // this.SJGWebsocket.onmessage()
@ -858,47 +772,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <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 { .visual-container {
width: 1920px; width: 1920px;
height: 1080px; height: 1080px;
@ -920,7 +794,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: 1px; letter-spacing: 0px;
} }
.time { .time {
@ -929,7 +803,7 @@ export default {
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
top: 25px; top: 25px;
font-size: 20px; font-size: 20px;
letter-spacing: .72px; letter-spacing: 0px;
} }
.title-button { .title-button {

View File

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

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2022-01-21 14:43:06 * @Date: 2022-01-21 14:43:06
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2024-04-03 16:33:24 * @LastEditTime: 2024-03-28 16:45:24
* @Description: * @Description:
--> -->
<template> <template>
@ -85,6 +85,7 @@ export default {
defaultConfig: { defaultConfig: {
// legend // legend
legend: { legend: {
orient: 'vertical',
left: '75%', left: '75%',
bottom: 0, bottom: 0,
itemHeight: 10, itemHeight: 10,
@ -157,9 +158,6 @@ export default {
methods: { methods: {
initChart() { initChart() {
this.chart = echarts.init(document.getElementById(this.id)) this.chart = echarts.init(document.getElementById(this.id))
this.$nextTick(() => {
this.chart.resize();
});
this.chart.setOption({ this.chart.setOption({
title: this.showCenterTitle title: this.showCenterTitle
? { ? {
@ -196,7 +194,7 @@ export default {
// //
...this.defaultConfig.legend, ...this.defaultConfig.legend,
// //
// ...this.legendConfig ...this.legendConfig
}, },
color: this.barColor, color: this.barColor,
series: [ series: [

View File

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

View File

@ -2,13 +2,13 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-09-21 09:06:28 * @Date: 2023-09-21 09:06:28
* @LastEditTime: 2024-04-09 15:24:39 * @LastEditTime: 2024-03-25 18:34:58
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div> <div>
<div :id="id" class="coldProductChart" :style="{ height: '390px', width: width }" /> <div :id="id" class="productChart" :style="{ height: '390px', width: width }" />
</div> </div>
</template> </template>
@ -71,9 +71,9 @@ export default {
mounted() { mounted() {
console.log('mounted') console.log('mounted')
console.log('borderRadius: ', this.borderRadius) console.log('borderRadius: ', this.borderRadius)
this.$el.addEventListener('resize', () => { // this.$nextTick(() => {
console.log('resziing.....'); // this.initChart()
}); // })
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {
@ -100,9 +100,8 @@ export default {
show: true, // show: true, //
position: 'top', // position: 'top', //
textStyle: { // textStyle: { //
color: 'rgba(255,255,255,0.5)', // color: '#ced1d5',
fontSize: 12, fontSize: 12
fontWight: 'bolder'
} }
}, },
} }
@ -115,7 +114,6 @@ export default {
name: '产线良品率', name: '产线良品率',
symbol: 'circle', // symbol: 'circle', //
type: 'line', type: 'line',
// symbolSize: 7,
yAxisIndex: 0, yAxisIndex: 0,
areaStyle: { areaStyle: {
opacity: 0.8, opacity: 0.8,
@ -143,16 +141,6 @@ export default {
] ]
// const colors = ['#5470C6', '#91CC75', '#EE6666'] // const colors = ['#5470C6', '#91CC75', '#EE6666']
this.chart = echarts.init(document.getElementById(this.id)) this.chart = echarts.init(document.getElementById(this.id))
let isFinished = false // isFinished
this.chart.on('finished', _ => {
if (!isFinished) {
console.log('我只执行一次')
isFinished = true
// this.isLoading = false //loading
this.chart.resize() //charts
}
console.log(113, 'finished')
})
this.chart.setOption({ this.chart.setOption({
// color: colors, // color: colors,
tooltip: { tooltip: {
@ -163,50 +151,38 @@ export default {
}, },
grid: { grid: {
left: "3%", left: "3%",
right: "10%", right: "5%",
bottom: "3%", bottom: "3%",
containLabel: true containLabel: true
}, },
// legend: { legend: {
// itemWidth: 10, itemWidth: 10,
// itemHeight: 10, itemHeight: 10,
// top: '5', top: '20',
// right: '20px', // right: '20px',
// data: [ data: ['产线产量', '产线良品率'],
// // { icon: 'rect', name: '访' }, textStyle: {
// { icon: 'roundRect', name: '线' }, fontSize: 12 * this.beilv,
// // { color: '#ced1d5'
// // icon: 'circle', name: '线', }
// // itemWidth: 7, },
// // itemHeight: 7,
// // },
// ],
// textStyle: {
// fontSize: 12 * this.beilv,
// color: '#ced1d5'
// }
// },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#25528f', // 线 color: '#213259', // 线
width: '1' // 线 width: '1' // 线
} }
}, },
axisLabel: { axisLabel: {
textStyle: { textStyle: {
align: 'center',
color: 'rgba(255,255,255,0.5)' // color: 'rgba(255,255,255,0.5)' //
} }
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#25528f' color: '#213259'
} }
}, },
data: nameList data: nameList
@ -225,13 +201,9 @@ export default {
scale: true, scale: true,
type: 'value', type: 'value',
name: '良品率/%', name: '良品率/%',
max: 100,//
min: 0,//
interval: 20,//
nameTextStyle: {// y nameTextStyle: {// y
color: 'rgba(255,255,255,0.5)', // color: '#fff',
align: "left", align: "left",
padding: [0, 0, 0, 8]
}, },
position: 'right', position: 'right',
alignTicks: true, alignTicks: true,
@ -239,20 +211,19 @@ export default {
show: true, show: true,
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#25528f', // 线 color: '#213259', // 线
width: '1' // 线 width: '1' // 线
} }
}, },
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: 'rgba(255,255,255,0.5)', // color: '#ced1d5', //
formatter: '{value}%', formatter: '{value}%'
align:'left',
} }
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#25528f' color: '#213259'
} }
} }
// type: 'value' // type: 'value'
@ -274,10 +245,9 @@ export default {
type: 'value', type: 'value',
name: '产量/㎡', // y name: '产量/㎡', // y
nameTextStyle: { nameTextStyle: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
// fontSize: 10, // fontSize: 10,
align: "right", align: "right",
padding:[0,4,0,0]
}, },
position: 'left', position: 'left',
alignTicks: true, alignTicks: true,
@ -285,21 +255,19 @@ export default {
show: true, show: true,
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#25528f', // 线 color: '#213259', // 线
width: '1' // 线 width: '1' // 线
} }
}, },
axisLabel: { axisLabel: {
// padding: [0, 20, 0, 0],
textStyle: { textStyle: {
margin: 60,
color: 'rgba(255,255,255,0.5)', // color: 'rgba(255,255,255,0.5)', //
formatter: '{value} 片' formatter: '{value} 片'
} }
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#25528f' color: '#213259'
} }
} }
// type: 'value' // type: 'value'
@ -318,8 +286,7 @@ export default {
} }
</script> </script>
<style> <style>
.productChart{
.coldProductChart{
top: -10px; top: -10px;
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-09-21 09:06:28 * @Date: 2023-09-21 09:06:28
* @LastEditTime: 2024-04-09 15:24:28 * @LastEditTime: 2024-03-28 16:31:20
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -105,9 +105,8 @@ export default {
show: true, // show: true, //
position: 'top', // position: 'top', //
textStyle: { // textStyle: { //
color: 'rgba(255,255,255,0.5)', // color: '#ced1d5',
fontSize: 12, fontSize: 12
fontWight:'bolder'
} }
}, },
} }
@ -143,7 +142,7 @@ export default {
} }
}, },
// data: passRateList // data: passRateList
data: passRateList data: []
} }
] ]
// const colors = ['#5470C6', '#91CC75', '#EE6666'] // const colors = ['#5470C6', '#91CC75', '#EE6666']
@ -167,23 +166,19 @@ export default {
type: 'cross' type: 'cross'
} }
}, },
grid: { top: 70, right: 20, bottom: 10, left: 10, containLabel: true }, grid: { top: 90, right: 60, bottom: 20, left: 20, containLabel: true },
// legend: { legend: {
// itemWidth: 10, itemWidth: 10,
// itemHeight: 10, itemHeight: 10,
// top: '2%', top: '0%',
// right: '30px', right: '20px',
// data: ['线', '线'], data: ['产线产量', '产线良品率'],
// textStyle: { textStyle: {
// fontSize: 12 * this.beilv, fontSize: 12 * this.beilv,
// color: '#ced1d5', color: '#ced1d5'
// fontWight: 'bolder' }
// } },
// },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
@ -192,11 +187,8 @@ export default {
width: '1' // 线 width: '1' // 线
} }
}, },
textStyle: {
fontWight: 'bolder'
},
axisLabel: { axisLabel: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
// textStyle: { // textStyle: {
@ -224,13 +216,9 @@ export default {
scale: true, scale: true,
type: 'value', type: 'value',
name: '良品率/%', name: '良品率/%',
max: 100,//
min: 0,//
interval: 20,//
nameTextStyle: {// y nameTextStyle: {// y
color: 'rgba(255,255,255,0.5)', // color: '#fff',
align: "left", align: "left",
padding: [0, 0, 0, 2]
}, },
position: 'right', position: 'right',
alignTicks: true, alignTicks: true,
@ -243,7 +231,7 @@ export default {
} }
}, },
axisLabel: { axisLabel: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
formatter: '{value}%' formatter: '{value}%'
@ -273,9 +261,8 @@ export default {
type: 'value', type: 'value',
name: '产量/片', // y name: '产量/片', // y
nameTextStyle: { nameTextStyle: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
// fontSize: 10, // fontSize: 10,
padding: [0, 4, 0, 0],
align: "right", align: "right",
}, },
// position: 'left', // position: 'left',
@ -291,7 +278,7 @@ export default {
axisLabel: { axisLabel: {
// textStyle: { // textStyle: {
// color: 'rgba(255,255,255,0.5)', // // color: 'rgba(255,255,255,0.5)', //
color: 'rgba(255,255,255,0.5)', // color: "#fff",
// show: true, // show: true,
lineStyle: { lineStyle: {
color: "#25528f", color: "#25528f",

View File

@ -111,9 +111,8 @@ export default {
show: true, // show: true, //
position: 'top', // position: 'top', //
textStyle: { // textStyle: { //
color: 'rgba(255,255,255,0.5)', // color: '#ced1d5',
fontSize: 12, fontSize: 12
fontWeight: 'normal'
} }
}, },
} }
@ -133,7 +132,7 @@ export default {
type: 'shadow' // 线'line' | 'shadow' type: 'shadow' // 线'line' | 'shadow'
} }
}, },
grid: { top: 70, right: 40, bottom: 10, left: 40, containLabel: true }, grid: { top: 90, right: 60, bottom: 20, left: 30, containLabel: true },
// legend: { // legend: {
// itemWidth: 10, // itemWidth: 10,
// itemHeight: 10, // itemHeight: 10,
@ -145,9 +144,6 @@ export default {
// } // }
// }, // },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
@ -156,11 +152,8 @@ export default {
width: '1' // 线 width: '1' // 线
} }
}, },
textStyle: {
fontWeight: 'bolder'
},
axisLabel: { axisLabel: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
}, },
@ -174,13 +167,13 @@ export default {
yAxis: { yAxis: {
name: '单位kwh', name: '单位kwh',
nameTextStyle: { nameTextStyle: {
color: 'rgba(255,255,255,0.5)', // color: '#fff',
fontSize: 12, fontSize: 10,
align: 'right', align: 'right',
}, },
type: 'value', type: 'value',
axisLabel: { axisLabel: {
color: 'rgba(255,255,255,0.5)', // color: "#fff",
fontSize: 12, fontSize: 12,
// formatter: '{value}/kwh' // formatter: '{value}/kwh'
}, },

View File

@ -1,13 +1,13 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-12-27 13:54:52 * @Date: 2023-12-27 13:54:52
* @LastEditTime: 2024-04-03 18:12:18 * @LastEditTime: 2024-03-28 16:30:14
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div> <div>
<div :id="id" :style="{ height:'75px', width: width }" /> <div :id="id" class="productChart" :style="{ height: height + 'px', width: width }" />
</div> </div>
</template> </template>
@ -71,10 +71,7 @@ export default {
} }
}, },
mounted() { mounted() {
// console.log('mounted') console.log('mounted')
window.addEventListener('resize', () => {
this.resize()
})
// console.log('borderRadius: ', this.borderRadius) // console.log('borderRadius: ', this.borderRadius)
// console.log('33333', this.dataList) // console.log('33333', this.dataList)
// let arr = [] // let arr = []
@ -94,12 +91,6 @@ export default {
this.chart = null this.chart = null
}, },
methods: { methods: {
resize() {
this.chart.resize({
width: 'auto',
height: 90
});;
},
initChart(nameList, topNameList, nameWasteList, passRateList, wasteList) { initChart(nameList, topNameList, nameWasteList, passRateList, wasteList) {
let rawData = [] let rawData = []
let colors = ['#0fdedb', '#2359ec'] let colors = ['#0fdedb', '#2359ec']
@ -114,11 +105,8 @@ export default {
totalData.push(sum); 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) console.log('total', totalData)
this.chart = echarts.init(document.getElementById(this.id))
const series = [ const series = [
'良品', '良品',
'废品', '废品',
@ -138,7 +126,7 @@ export default {
// }, // },
color:colors[sid], color:colors[sid],
data: rawData.length != 0 ? rawData[sid].map((d, did) => data: rawData.length != 0 ? rawData[sid].map((d, did) =>
totalData[did] <= 0 ? 0 : (d / totalData[did]).toFixed(4) totalData[did] <= 0 ? 0 : d / totalData[did]
) : [] ) : []
}; };
}); });
@ -149,17 +137,6 @@ export default {
// width, // width,
// height // height
// }) // })
this.chart = echarts.init(document.getElementById(this.id))
let isFinished = false // isFinished
this.chart.on('finished', _ => {
if (!isFinished) {
console.log('我只执行一次')
isFinished = true
// this.isLoading = false //loading
this.chart.resize() //charts
}
console.log(113, 'finished')
})
this.chart.setOption({ this.chart.setOption({
legend: { legend: {
formatter: function (name) { formatter: function (name) {
@ -167,16 +144,15 @@ export default {
let singleData = series.filter(function (item) { let singleData = series.filter(function (item) {
return item.name == name return item.name == name
}) })
return name + parseFloat((singleData[0].data * 100).toFixed(0)) + '%' return name + parseFloat((singleData[0].data * 100).toFixed(3)) + '%'
}, },
itemWidth: 12, itemWidth: 12,
itemHeight: 12, itemHeight: 12,
bottom: '20', bottom: '20',
left: '20', left: '20',
icon: 'roundRect', icon: 'rect',
textStyle: { textStyle: {
color: 'rgba(255,255,255,.9)', color: '#ffffff'
fontSize:12,
} }
}, },
grid: { grid: {
@ -208,9 +184,9 @@ export default {
splitNumber: 50, splitNumber: 50,
// boundaryGap: [20, 20], // boundaryGap: [20, 20],
textStyle: { textStyle: {
color: 'rgba(255,255,255,.9)', color: '#ffffff',
verticalAlign: 'bottom', verticalAlign: 'bottom',
fontSize: 16, fontSize: 12,
align: 'left', align: 'left',
padding: [0, 0, 10, -5] padding: [0, 0, 10, -5]
} }
@ -236,9 +212,9 @@ export default {
splitNumber: 50, splitNumber: 50,
// boundaryGap: [20, 20], // boundaryGap: [20, 20],
textStyle: { textStyle: {
color: 'rgba(255,255,255,.9)', color: '#ffffff',
verticalAlign: 'bottom', verticalAlign: 'bottom',
fontSize: 16, fontSize: 12,
align: 'right', align: 'right',
padding: [0, 0, 10, -5] padding: [0, 0, 10, -5]
} }
@ -252,15 +228,10 @@ export default {
}, },
series:series series:series
}) })
this.$nextTick(() => { this.chart.resize({
setTimeout(() => { width: 'auto',
this.resize() height: 90
},1000); });;
})
// this.chart.resize({
// width: 'auto',
// height: 90
// });;
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,14 +2,13 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 14:55:51 * @Date: 2023-08-01 14:55:51
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2024-04-03 15:08:38 * @LastEditTime: 2023-12-04 13:38:45
* @Description: * @Description:
--> -->
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
:table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
@ -26,9 +25,7 @@ import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page'; import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter'; import { parseTime } from '../mixins/code-filter';
import printModelDesign from '../custom/index' 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 { import {
deletePackingModel, deletePackingModel,
getPackingModelPage, getPackingModelPage,
@ -62,7 +59,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage, tableHeightMixin], mixins: [basicPage],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -165,7 +162,7 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20; this.listQuery.pageSize = 10;
this.listQuery.packagingCode = val.packagingCode; this.listQuery.packagingCode = val.packagingCode;
this.listQuery.createTime = val.createTime; this.listQuery.createTime = val.createTime;
this.getDataList(); this.getDataList();
@ -173,7 +170,7 @@ export default {
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery = { this.listQuery = {
pageSize: 20, pageSize: 10,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,124 +1,130 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick"
<!-- 列表 --> />
<base-table <!-- 列表 -->
:page="queryParams.pageNo" <base-table
:limit="queryParams.pageSize" :page="queryParams.pageNo"
:table-props="tableProps" :limit="queryParams.pageSize"
:table-data="list" :table-props="tableProps"
:max-height="tableH"> :table-data="list"
<method-btn :max-height="tableH"
v-if="tableBtn.length" >
slot="handleBtn" <method-btn
:width="80" v-if="tableBtn.length"
label="操作" slot="handleBtn"
:method-list="tableBtn" :width="80"
@clickBtn="handleClick" /> label="操作"
</base-table> :method-list="tableBtn"
<pagination @clickBtn="handleClick"
:page.sync="queryParams.pageNo" />
:limit.sync="queryParams.pageSize" </base-table>
:total="total" <pagination
@pagination="getList" /> :page.sync="queryParams.pageNo"
<!-- 详情抽屉 --> :limit.sync="queryParams.pageSize"
<delivery-log-det-detail ref="deliveryLogDetail" /> :total="total"
</div> @pagination="getList"
/>
<!-- 详情抽屉 -->
<delivery-log-det-detail ref='deliveryLogDetail'/>
</div>
</template> </template>
<script> <script>
import { deliveryProgressPage } from '@/api/base/delivery'; import { deliveryProgressPage } from '@/api/base/delivery'
import DeliveryLogDetDetail from './components/deliveryLogDetDetail.vue'; import DeliveryLogDetDetail from './components/deliveryLogDetDetail.vue'
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'orderName', prop: 'orderName',
label: '订单名', label: '订单名',
showOverflowtooltip: true, showOverflowtooltip: true
}, },
{ {
prop: 'customerName', prop: 'customerName',
label: '客户名称', label: '客户名称',
showOverflowtooltip: true, showOverflowtooltip: true
}, },
{ {
prop: 'unit', prop: 'unit',
label: '单位', label: '单位'
}, },
{ {
prop: 'orderNum', prop: 'orderNum',
label: '订单数量', label: '订单数量'
}, },
{ {
prop: 'num', prop: 'num',
label: '发货数量', label: '发货数量'
}, },
{ {
prop: 'rate', prop: 'rate',
label: '累计发货比例(%)', label: '累计发货比例(%)'
}, }
]; ]
export default { export default {
name: 'DeliveryLogDet', name: "DeliveryLogDet",
mixins: [tableHeightMixin], data() {
data() { return {
return { formConfig: [
formConfig: [ {
{ type: 'input',
type: 'input', label: '订单名',
label: '订单名', param: 'orderName'
param: 'orderName', },
}, {
{ type: 'button',
type: 'button', btnName: '查询',
btnName: '查询', name: 'search',
name: 'search', color: 'primary'
color: 'primary', }
}, ],
], //
// queryParams: {
queryParams: { pageNo: 1,
pageNo: 1, pageSize: 20,
pageSize: 20, orderName: ''
orderName: '', },
}, tableProps,
tableProps, list: [],
list: [], tableH: this.tableHeight(260),
total: 0, total: 0,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('extend:delivery-log-det:detail') this.$auth.hasPermi('extend:delivery-log-det:detail')
? { ? {
type: 'detail', type: 'detail',
btnName: '详情', btnName: '详情'
} }
: undefined, : undefined
].filter((v) => v), ].filter((v) => v)
}; }
}, },
components: { DeliveryLogDetDetail }, components: { DeliveryLogDetDetail },
created() { created() {
this.getList(); window.addEventListener('resize', () => {
}, this.tableH = this.tableHeight(260)
methods: { })
getList() { this.getList();
deliveryProgressPage({ ...this.queryParams }).then((res) => { },
this.list = res.data.list || []; methods: {
this.total = res.data.total || 0; getList() {
}); deliveryProgressPage({...this.queryParams}).then(res => {
}, this.list = res.data.list || []
buttonClick(val) { this.total = res.data.total || 0
this.queryParams.orderName = val.orderName; })
this.getList(); },
}, buttonClick(val) {
handleClick(val) { this.queryParams.orderName = val.orderName
console.log(val); this.getList()
this.$nextTick(() => { },
this.$refs.deliveryLogDetail.init(val.data); handleClick(val) {
}); console.log(val)
}, this.$nextTick(() => {
}, this.$refs.deliveryLogDetail.init(val.data)
}; })
}
}
}
</script> </script>

View File

@ -1,145 +1,148 @@
<template> <template>
<div <div
id="analysischartBar" id="analysischartBar"
style="width: 100%" style="width: 100%"
:style="{ height: chartHeight + 'px' }"></div> :style="{ height: chartHeight + 'px' }"
></div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
import resize from '@/utils/chartMixins/resize'; import resize from '@/utils/chartMixins/resize'
export default { export default {
name: 'BarChart', name: "BarChart",
mixins: [resize], mixins: [resize],
data() { data() {
return { return {
chartDom: '', chartDom: '',
chart: '', chart: '',
chartHeight: this.tableHeight(250) / 2, chartHeight: this.tableHeight(214) - 70
}; }
}, },
props: { props: {
chartData: { chartData: {
type: Array, type: Array,
required: true, required: true,
default: () => { default: () => {
return []; return []
}, }
}, },
timeDim: { timeDim: {
type: String, type: String,
default: '', default: ''
}, }
}, },
watch: { watch: {
chartData: function () { chartData: function () {
this.getChart(); this.getChart()
}, }
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.chartHeight = this.tableHeight(250) / 2; this.chartHeight = this.tableHeight(214) - 70
}); })
}, },
methods: { methods: {
getChart() { getChart() {
if ( if (
this.chart !== null && this.chart !== null &&
this.chart !== '' && this.chart !== '' &&
this.chart !== undefined this.chart !== undefined
) { ) {
this.chart.dispose(); // Dom this.chart.dispose() // Dom
} }
this.chartDom = document.getElementById('analysischartBar'); this.chartDom = document.getElementById('analysischartBar')
this.chart = echarts.init(this.chartDom); this.chart = echarts.init(this.chartDom)
let tempArr = []; let tempArr = []
let xData = []; let xData = []
let yData = []; let yData = []
let legendData = []; let legendData = []
if (this.chartData.length === 0) { if (this.chartData.length === 0) {
return false; return false
} else { } else {
tempArr = this.chartData[0].trendRespVOList; tempArr = this.chartData[0].trendRespVOList
} }
for (let k = 0; k < tempArr.length; k++) { for (let k = 0; k < tempArr.length; k++) {
let time = ''; let time = ''
if (this.timeDim === '3') { if (this.timeDim === '3') {
let year = tempArr[k].time.slice(0, 4); let year = tempArr[k].time.slice(0,4)
let weak = tempArr[k].time.slice(4, 6); let weak = tempArr[k].time.slice(4,6)
time = year + ' 第 ' + weak + ' 周'; time = year+' 第 '+weak+' 周'
} else { } else {
time = tempArr[k].time; time = tempArr[k].time
} }
xData.push(time); xData.push(time)
} }
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
let obj = { let obj = {
name: this.chartData[i].objName + this.chartData[i].objCode, name: this.chartData[i].objName + this.chartData[i].objCode,
type: 'bar', type: 'bar',
barMaxWidth: 20, barMaxWidth: 20,
data: [], label: {
}; show: true,
legendData.push(this.chartData[i].objName + this.chartData[i].objCode); position: 'top'
let temp = this.chartData[i].trendRespVOList; },
for (let j = 0; j < temp.length; j++) { data: []
let num = temp[j].useNum ? temp[j].useNum.toFixed(2) : ''; }
obj.data.push(num); legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
} let temp = this.chartData[i].trendRespVOList
yData.push(obj); for (let j = 0; j < temp.length; j++) {
} let num = temp[j].useNum ? temp[j].useNum : ''
var option = { obj.data.push(num)
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF'], }
tooltip: { yData.push(obj)
trigger: 'axis', }
axisPointer: { var option = {
type: 'shadow', color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
}, tooltip: {
formatter: function (params) { trigger: 'axis',
return ( axisPointer: {
params[0].axisValue + type: 'shadow'
`<br>` + },
params formatter: function(params) {
.map((item) => { return (
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`; params[0].axisValue +
let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`; `<br>` +
let value = item.value ? item.value : '-'; params.map((item) => {
let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`; let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`
return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px"> 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>${str}${seriesNameStr}</span>
<span>${valueStr}</span> <span>${valueStr}</span>
</span>`; </span>`
}) }).join(``)
.join(``) )
); }
}, },
}, grid: {
grid: { left: '4%',
left: '4%', right: '1%',
right: '1%', bottom: '1%',
bottom: '1%', containLabel: true
containLabel: true, },
}, legend: {
legend: { data: legendData,
data: legendData, right: '1%',
right: '1%', icon: 'rect',
icon: 'rect', itemHeight: 8,
itemHeight: 8, itemWidth: 8
itemWidth: 8, },
}, xAxis: {
xAxis: { type: 'category',
type: 'category', data: xData,
data: xData, axisLabel: {
axisLabel: { rotate: "45"
rotate: '45', }
}, },
}, yAxis: {
yAxis: { type: 'value'
type: 'value', },
}, series: yData
series: yData, };
};
option && this.chart.setOption(option); option && this.chart.setOption(option);
}, }
}, }
}; }
</script> </script>

View File

@ -0,0 +1,126 @@
<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,120 +1,96 @@
<template> <template>
<div <div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
class="app-container contrastAnalysisBox" <!-- 搜索工作栏 -->
id="contrastAnalysisBox"> <search-area :isFold="isFold" @submit="getList"/>
<!-- 搜索工作栏 --> <el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
<search-area <el-tab-pane label="柱状图" name="bar">
@submit="getList" <bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
@export="exportExl" /> </el-tab-pane>
<div v-show="chartData.length"> <el-tab-pane label="折线图" name="line">
<bar-chart <line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
ref="analysisBarChart" </el-tab-pane>
:chartData="chartData" </el-tabs>
:timeDim="timeDim" /> <!-- 没有数据 -->
<base-table <div class="no-data-bg" v-show='!chartData.length'></div>
:table-props="tableProps" </div>
:table-data="list"
:max-height="tableH"
class="contrast-out-table" />
</div>
<!-- 没有数据 -->
<div
class="no-data-bg"
v-show="!chartData.length"></div>
</div>
</template> </template>
<script> <script>
import { getCompare } from '@/api/analysis/energyAnalysis'; import { getCompare } from "@/api/analysis/energyAnalysis"
import SearchArea from './components/searchArea'; import SearchArea from "./components/searchArea"
import BarChart from './components/barChart'; import BarChart from "./components/barChart"
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import LineChart from "./components/lineChart"
import FileSaver from 'file-saver';
import * as XLSX from 'xlsx/xlsx.mjs';
// import moment from 'moment' // import moment from 'moment'
export default { export default {
name: 'ContrastAnalysis', name: 'ContrastAnalysis',
components: { SearchArea, BarChart }, components: { SearchArea, BarChart, LineChart },
mixins: [tableHeightMixin], data() {
data() { return {
return { isFold: false,
chartData: [], activeName: 'bar',
timeDim: '', chartData: [],
tableProps: [], timeDim: ''
list: [], }
tableH: this.tableHeight(250) / 2, },
}; mounted() {
}, window.addEventListener('resize', () => {
methods: { this.tableH = this.tableHeight(260)
_setTableHeight() { this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
this.tableH = this.tableHeight(250) / 2; // console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
}, })
getList(params) { this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
this.timeDim = params.timeDim; },
getCompare({ ...params }).then((res) => { methods: {
if (res.code === 0) { getList(params) {
this.getTableList(res.data || []); this.timeDim = params.timeDim
this.chartData = res.data || []; getCompare({ ...params }).then((res) => {
} else { console.log(res)
this.chartData = []; if (res.code === 0) {
} this.chartData = res.data || []
}); } else {
}, this.chartData = []
getTableList(arr) { }
this.tableProps = []; })
this.list = []; },
let tempX = []; switchChart() {
let timeArr = arr[0].trendRespVOList || []; if (this.activeName === 'bar') {
this.list = timeArr.map((item) => { this.$nextTick((res) => {
return { time: item.time }; this.$refs.analysisBarChart.getChart()
}); })
for (let i = 0; i < arr.length; i++) { } else {
let obj = {}; this.$nextTick((res) => {
obj.prop = arr[i].objId; this.$refs.analysisLineChart.getChart()
obj.label = arr[i].objName; })
obj.minWidth = 100; }
tempX.push(obj); }
let tiemList = arr[i].trendRespVOList; }
for (let j = 0; j < tiemList.length; j++) { }
this.list[j][arr[i].objId] = tiemList[j].useNum
? tiemList[j].useNum.toFixed(2)
: null;
}
}
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
},
//
exportExl() {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(
document.querySelector('.contrast-out-table')
);
let fileName = '对比分析.xlsx';
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array',
});
try {
FileSaver.saveAs(
new Blob([wbout], { type: 'application/octet-stream' }),
fileName
);
this.$message.success('导出成功');
} catch (e) {
if (typeof console !== 'undefined') console.log(e, wbout);
}
return wbout;
} else {
this.$modal.msgWarning('暂无数据导出');
}
},
},
};
</script> </script>
<style lang='scss'> <style lang='scss'>
.contrastAnalysisBox { .contrastAnalysisBox {
.contrast-out-table { .el-tabs__nav::after {
margin-top: 20px; 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);
}
} }
</style> </style>

View File

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

View File

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

View File

@ -1,102 +1,103 @@
<template> <template>
<div <div
id="analysischartLine" id="analysischartLine"
style="width: 100%" style="width: 100%"
:style="{ height: chartHeight + 'px' }"></div> :style="{ height: chartHeight + 'px' }"
></div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
import resize from '@/utils/chartMixins/resize'; import resize from '@/utils/chartMixins/resize'
export default { export default {
name: 'LineChart', name: "LineChart",
mixins: [resize], mixins: [resize],
data() { data() {
return { return {
chartDom: '', chartDom: '',
chart: '', chart: '',
chartHeight: this.tableHeight(314), chartHeight: this.tableHeight(214) - 70
}; }
}, },
props: { props: {
chartData: { chartData: {
type: Array, type: Array,
required: true, required: true,
default: () => { default: () => {
return []; return []
}, }
}, },
timeDim: { timeDim: {
type: String, type: String,
default: '', default: ''
}, }
}, },
watch: { watch: {
chartData: function () { chartData: function () {
this.getChart(); this.getChart()
}, }
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.chartHeight = this.tableHeight(314); this.chartHeight = this.tableHeight(214) - 70
}); })
}, },
methods: { methods: {
getChart() { getChart() {
if ( if (
this.chart !== null && this.chart !== null &&
this.chart !== '' && this.chart !== '' &&
this.chart !== undefined this.chart !== undefined
) { ) {
this.chart.dispose(); // Dom this.chart.dispose() // Dom
} }
this.chartDom = document.getElementById('analysischartLine'); this.chartDom = document.getElementById('analysischartLine')
this.chart = echarts.init(this.chartDom); this.chart = echarts.init(this.chartDom)
let xData = []; let xData = []
let yData = []; let yData = []
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
let time = ''; let time = ""
if (this.timeDim === '3') { if (this.timeDim === '3') {
let year = this.chartData[i].time.slice(0, 4); let year = this.chartData[i].time.slice(0,4)
let weak = this.chartData[i].time.slice(4, 6); let weak = this.chartData[i].time.slice(4,6)
time = year + ' 第 ' + weak + ' 周'; time = year+' 第 '+weak+' 周'
} else { } else {
time = this.chartData[i].time; time = this.chartData[i].time
} }
xData.push(time); xData.push(time)
yData.push(this.chartData[i].useNum); yData.push(this.chartData[i].useNum)
} }
var option = { var option = {
color: ['#288AFF'], color:['#288AFF'],
tooltip: { // tooltip: {
trigger: 'axis', // trigger: 'axis'
}, // },
grid: { grid: {
left: '4%', left: '4%',
right: '1%', right: '1%',
bottom: '1%', bottom: '1%',
containLabel: true, containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: xData, data: xData,
axisLabel: { axisLabel: {
rotate: '45', rotate: "45"
}, }
}, },
yAxis: { yAxis: {
type: 'value', type: 'value'
}, },
series: [ series: [
{ {
data: yData, data: yData,
type: 'line', type: 'line'
}, }
], ]
}; };
option && this.chart.setOption(option); option && this.chart.setOption(option);
}, }
}, }
}; }
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,219 +1,197 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 -->
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig" <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
ref="searchBarForm" <!-- 列表 -->
@headBtnClick="buttonClick" /> <base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
<!-- 列表 --> :max-height="tableH">
<base-table <method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
:page="queryParams.pageNo" @clickBtn="handleClick" />
:limit="queryParams.pageSize" </base-table>
:table-props="tableProps" <pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
:table-data="list" @pagination="getList" />
:max-height="tableH"> <!-- 新增 -->
<method-btn <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
v-if="tableBtn.length" @confirm="handleConfirm" :before-close="handleCancel">
slot="handleBtn" <energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
:width="80" </base-dialog>
label="操作" </div>
: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> </template>
<script> <script>
import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc'; import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
import EnergyPlcAdd from './components/energyPlcAdd.vue'; // import { publicFormatter } from '@/utils/dict'
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import EnergyPlcAdd from './components/energyPlcAdd.vue'
const tableProps = [ const tableProps = [
{ {
prop: 'plcTableName', prop: 'plcTableName',
label: '关联表名', label: '关联表名',
showOverflowtooltip: true, showOverflowtooltip: true
}, },
{ {
prop: 'code', prop: 'code',
label: '关联表编码', label: '关联表编码',
minWidth: 150, minWidth: 150,
showOverflowtooltip: true, showOverflowtooltip: true
}, },
{ {
prop: 'name', prop: 'name',
label: '标识名', label: '标识名',
minWidth: 150, minWidth: 150,
showOverflowtooltip: true, showOverflowtooltip: true
}, },
{ {
prop: 'enName', prop: 'enName',
label: '英文标识名', label: '英文标识名'
}, },
{ {
prop: 'collection', prop: 'collection',
label: '是否采集', label: '是否采集'
}, },
{ {
prop: 'description', prop: 'description',
label: '描述', label: '描述',
showOverflowtooltip: true, showOverflowtooltip: true
}, }
]; ]
export default { export default {
name: 'EnergyPlc', name: "EnergyPlc",
components: { EnergyPlcAdd }, components: { EnergyPlcAdd },
mixins: [tableHeightMixin], data() {
data() { return {
return { formConfig: [
formConfig: [ {
{ type: 'input',
type: 'input', label: '标识名',
label: '标识名', placeholder: '标识名',
placeholder: '标识名', param: 'name'
param: 'name', },
}, {
{ type: 'button',
type: this.$auth.hasPermi('base:energy-plc:query') ? 'button' : '', btnName: '查询',
btnName: '查询', name: 'search',
name: 'search', color: 'primary'
color: 'primary', },
}, {
{ type: 'separate'
type: this.$auth.hasPermi('base:energy-plc:create') ? 'separate' : '', },
}, {
{ type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '', btnName: '新增',
btnName: '新增', name: 'add',
name: 'add', color: 'success',
color: 'success', plain: true
plain: true, }
}, ],
], tableProps,
tableProps, tableBtn: [
tableBtn: [ this.$auth.hasPermi('base:energy-plc:update')
this.$auth.hasPermi('base:energy-plc:update') ? {
? { type: 'edit',
type: 'edit', btnName: '编辑'
btnName: '编辑', }
} : undefined,
: undefined, this.$auth.hasPermi('base:energy-plc:delete')
this.$auth.hasPermi('base:energy-plc:delete') ? {
? { type: 'delete',
type: 'delete', btnName: '删除'
btnName: '删除', }
} : undefined
: undefined, ].filter((v) => v),
].filter((v) => v), tableH: this.tableHeight(260),
collectionList: [ collectionList: [
{ value: 0, label: '否' }, { value: 0, label: '否' },
{ value: 1, label: '是' }, { value: 1, label: '是' }
], ],
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
addOrEditTitle: '', addOrEditTitle: "",
// //
centervisible: false, centervisible: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
name: null, name: null
}, }
}; };
}, },
created() { created() {
this.getList(); window.addEventListener('resize', () => {
}, this.tableH = this.tableHeight(260)
methods: { })
buttonClick(val) { this.getList();
switch (val.btnName) { },
case 'search': methods: {
this.queryParams.pageNo = 1; buttonClick(val) {
this.queryParams.name = val.name; switch (val.btnName) {
this.getList(); case 'search':
break; this.queryParams.pageNo = 1;
default: this.queryParams.name = val.name
this.addOrEditTitle = '新增'; this.getList()
this.centervisible = true; break
this.$nextTick(() => { default:
this.$refs.energyPlc.init(); this.addOrEditTitle = '新增'
}); this.centervisible = true
} this.$nextTick(() => {
}, this.$refs.energyPlc.init()
/** 查询列表 */ })
getList() { }
getEnergyPlcPage(this.queryParams).then((response) => { },
let arr = response.data.list || []; /** 查询列表 */
arr && getList() {
arr.map((item) => { getEnergyPlcPage(this.queryParams).then(response => {
this.collectionList.map((i) => { let arr = response.data.list || [];
if (item.collection === i.value) { arr && arr.map(item => {
item.collection = i.label; this.collectionList.map(i => {
} if (item.collection === i.value) {
}); item.collection = i.label
}); }
this.list = arr; })
this.total = response.data.total; })
}); this.list = arr
}, this.total = response.data.total;
handleClick(val) { });
switch (val.type) { },
case 'edit': handleClick(val) {
this.addOrEditTitle = '编辑'; switch (val.type) {
this.$nextTick(() => { case 'edit':
this.$refs.energyPlc.init(val.data.id); this.addOrEditTitle = '编辑'
}); this.$nextTick(() => {
this.centervisible = true; this.$refs.energyPlc.init(val.data.id)
break; })
default: this.centervisible = true
this.handleDelete(val.data); break
} default:
}, this.handleDelete(val.data)
handleCancel() { }
this.$refs.energyPlc.formClear(); },
this.centervisible = false; handleCancel() {
this.addOrEditTitle = ''; this.$refs.energyPlc.formClear()
}, this.centervisible = false
handleConfirm() { this.addOrEditTitle = ''
this.$refs.energyPlc.submitForm(); },
}, handleConfirm() {
successSubmit() { this.$refs.energyPlc.submitForm()
this.handleCancel(); },
this.getList(); successSubmit() {
}, this.handleCancel()
/** 删除按钮操作 */ this.getList()
handleDelete(row) { },
this.$modal /** 删除按钮操作 */
.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?') handleDelete(row) {
.then(function () { this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function () {
return deleteEnergyPlc(row.id); return deleteEnergyPlc(row.id);
}) }).then(() => {
.then(() => { this.queryParams.pageNo = 1;
this.queryParams.pageNo = 1; this.getList();
this.getList(); this.$modal.msgSuccess("删除成功");
this.$modal.msgSuccess('删除成功'); }).catch(() => { });
}) }
.catch(() => {}); }
},
},
}; };
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,147 +0,0 @@
<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

@ -0,0 +1,38 @@
<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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,76 +0,0 @@
<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

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

View File

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

View File

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

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