Compare commits

...

94 Commits

Author SHA1 Message Date
zwq
d3d93acd0f 修改成本新的权限字段 2024-04-10 14:48:37 +08:00
a4fceeb981 Merge pull request 'projects/mesxc-zjl' (#321) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #321
2024-04-09 13:09:55 +08:00
84468cc883 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-09 13:06:21 +08:00
ea04d55fc1 驾驶舱 2024-04-09 13:04:40 +08:00
ef1078360a Merge pull request '更新成本' (#319) from projects/mesxc-zwq into projects/mesxc-test
Reviewed-on: #319
2024-04-09 11:06:14 +08:00
zwq
60f6c3a8fe 更新成本 2024-04-09 11:05:37 +08:00
a4b340ac5d Merge pull request 'projects/mesxc-dy' (#318) from projects/mesxc-dy into projects/mesxc-test
Reviewed-on: #318
2024-04-09 08:18:01 +08:00
helloDy
2592551e66 Merge branch 'projects/mesxc-test' into projects/mesxc-dy 2024-04-08 17:03:21 +08:00
helloDy
1fde96e677 工单bug,改动 2024-04-08 17:02:55 +08:00
0b16e1fe0d Merge pull request '驾驶舱修改' (#317) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #317
2024-04-08 16:39:30 +08:00
abcec3bcdc Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-08 16:38:59 +08:00
bdd14eec70 驾驶舱修改 2024-04-08 16:38:12 +08:00
44e7e219a4 Merge pull request 'projects/mesxc-zhp' (#316) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #316
2024-04-08 16:37:26 +08:00
‘937886381’
ec51beb8ea Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-08 15:14:37 +08:00
‘937886381’
433618e71d 修改bug 2024-04-08 15:13:52 +08:00
812b72f10d Merge pull request 'projects/mesxc-zhp' (#315) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #315
2024-04-08 15:11:34 +08:00
‘937886381’
05f10ab51d Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-08 14:49:46 +08:00
‘937886381’
e7828fd277 修改bug 2024-04-08 14:49:20 +08:00
58457487d1 Merge pull request 'projects/mesxc-zhp' (#314) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #314
2024-04-08 14:09:52 +08:00
‘937886381’
6c54c223c5 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-08 13:55:56 +08:00
‘937886381’
b2cc509f8e 权限 2024-04-08 13:55:22 +08:00
b6236e89b1 Merge pull request '1' (#313) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #313
2024-04-08 12:26:34 +08:00
cbc7cbc574 1 2024-04-08 12:25:44 +08:00
b5b952e1cc Merge pull request 'projects/mesxc-zjl' (#312) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #312
2024-04-08 10:44:09 +08:00
33ed9f15fa Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-08 10:42:42 +08:00
c85c6e4323 能源 2024-04-08 10:41:43 +08:00
30d22b34e1 Merge pull request '成本按钮权限' (#311) from projects/mesxc-zwq into projects/mesxc-test
Reviewed-on: #311
2024-04-08 09:05:52 +08:00
zwq
3d3fa2ccee 成本按钮权限 2024-04-08 09:05:10 +08:00
f960ece594 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-07 16:14:52 +08:00
949675b3a2 1 2024-04-07 16:13:57 +08:00
f52815abe6 Merge pull request 'projects/mesxc-zhp' (#310) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #310
2024-04-07 16:09:32 +08:00
‘937886381’
ac4cea0c7e Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-07 16:07:30 +08:00
‘937886381’
93fea84c79 修改bug 2024-04-07 16:07:04 +08:00
a06682de3f Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-07 15:41:17 +08:00
e1773dae03 1 2024-04-07 15:39:26 +08:00
f6d866907c Merge pull request 'projects/mesxc-zjl' (#309) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #309
2024-04-07 12:19:50 +08:00
7fe8d7e72c 能源手动抄表 2024-04-07 12:18:52 +08:00
1e4a33a703 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-07 08:40:39 +08:00
d1ad913bab Merge pull request 'projects/mesxc-zhp' (#308) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #308
2024-04-03 18:14:55 +08:00
‘937886381’
38edf00925 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-03 18:13:55 +08:00
‘937886381’
bf231f7157 修改ui 2024-04-03 18:13:31 +08:00
04e2471a54 Merge pull request 'projects/mesxc-zhp' (#307) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #307
2024-04-03 17:37:34 +08:00
‘937886381’
9e2ce5f636 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-03 17:20:40 +08:00
‘937886381’
8a54c046d9 修改ui 2024-04-03 17:20:14 +08:00
3fa702cc12 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-03 16:45:18 +08:00
8ebff703ee Merge pull request 'projects/mesxc-zhp' (#306) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #306
2024-04-03 16:36:41 +08:00
‘937886381’
02e267e647 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-03 16:34:39 +08:00
‘937886381’
a6ffba4cf8 修改bug 2024-04-03 16:34:15 +08:00
3de4d5c5f2 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-03 16:33:32 +08:00
c6c2d1c3b1 Merge pull request 'projects/mesxc-zhp' (#305) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #305
2024-04-03 16:31:31 +08:00
‘937886381’
1bbd749094 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-03 16:30:35 +08:00
‘937886381’
073b4b8e20 修改bug 2024-04-03 16:30:09 +08:00
3ec82a6a41 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-03 16:27:32 +08:00
7c83268e0c 能源类型 2024-04-03 16:05:27 +08:00
49cb1e6877 Merge pull request 'projects/mesxc-zhp' (#304) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #304
2024-04-03 16:04:07 +08:00
‘937886381’
481dde003a Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-03 16:01:37 +08:00
‘937886381’
43e54e8ee7 修改bug 2024-04-03 16:01:11 +08:00
28dbe075a4 Merge pull request 'projects/mesxc-dy' (#303) from projects/mesxc-dy into projects/mesxc-test
Reviewed-on: #303
2024-04-03 15:11:41 +08:00
helloDy
4571786780 merge 2024-04-03 11:22:32 +08:00
helloDy
21cef13168 table chart 2024-04-03 11:21:37 +08:00
5f5e0ffc69 Merge pull request '1' (#302) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #302
2024-04-03 09:02:11 +08:00
4d0841bd32 1 2024-04-03 09:01:43 +08:00
b6d3b17300 Merge pull request 'projects/mesxc-zjl' (#301) from projects/mesxc-zjl into projects/mesxc-test
Reviewed-on: #301
2024-04-02 16:56:20 +08:00
dad71db912 Merge branch 'projects/mesxc-test' into projects/mesxc-zjl 2024-04-02 16:55:29 +08:00
94c7f803cc 能源需求修改 2024-04-02 16:54:36 +08:00
0dae8cd16d Merge pull request 'projects/mesxc-zhp' (#300) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #300
2024-04-02 15:03:51 +08:00
‘937886381’
1fd547893f 修改bug 2024-04-02 15:01:56 +08:00
‘937886381’
ad5812df96 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-02 14:56:28 +08:00
‘937886381’
c01106e389 修改bug 2024-04-02 14:56:02 +08:00
021182e873 Merge pull request 'projects/mesxc-zhp' (#298) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #298
2024-04-02 13:57:53 +08:00
‘937886381’
71834ef906 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-02 13:56:55 +08:00
‘937886381’
412ec6ab0c 修改bug 2024-04-02 13:56:23 +08:00
9aca4874c1 Merge pull request 'projects/mesxc-zhp' (#297) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #297
2024-04-02 09:50:34 +08:00
‘937886381’
c9d25e5e88 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-02 09:48:24 +08:00
‘937886381’
610090c2a0 修改bug 2024-04-02 09:47:52 +08:00
83917eaf4a Merge pull request 'projects/mesxc-zhp' (#296) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #296
2024-04-01 09:31:29 +08:00
‘937886381’
d64e9b9535 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-04-01 09:26:16 +08:00
‘937886381’
b0f44c2332 修改ui 2024-04-01 09:25:54 +08:00
8ae9efe4bd Merge pull request 'projects/mesxc-zhp' (#295) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #295
2024-03-29 17:07:44 +08:00
‘937886381’
15358fd7e2 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-03-29 17:02:11 +08:00
‘937886381’
dfabc9ed23 修改ui 2024-03-29 17:01:51 +08:00
78f6165cfc Merge pull request 'projects/mesxc-zhp' (#294) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #294
2024-03-29 17:01:37 +08:00
‘937886381’
7944824ffe Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-03-29 16:59:36 +08:00
984cf2e7d5 Merge pull request 'projects/mesxc-lb' (#293) from projects/mesxc-lb into projects/mesxc-test
Reviewed-on: #293
2024-03-29 16:58:46 +08:00
‘937886381’
07bc6aab69 Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-03-29 16:56:44 +08:00
‘937886381’
7a14b2846a 修改bug 2024-03-29 16:56:21 +08:00
lb
db7d4745dd Merge branch 'projects/mesxc-test' into projects/mesxc-lb 2024-03-29 16:55:52 +08:00
lb
6b99175574 update again 2024-03-29 16:30:37 +08:00
helloDy
34aeb029b5 Merge branch 'projects/mesxc-test' into projects/mesxc-dy 2024-03-29 14:38:26 +08:00
helloDy
caf614ca35 操作 2024-03-29 14:14:21 +08:00
b8f9d3626f Merge pull request 'projects/mesxc-zhp' (#292) from projects/mesxc-zhp into projects/mesxc-test
Reviewed-on: #292
2024-03-29 09:57:09 +08:00
‘937886381’
c8913f192c Merge branch 'projects/mesxc-test' into projects/mesxc-zhp 2024-03-29 09:51:47 +08:00
‘937886381’
0fa651fccf 修改bug 2024-03-29 09:51:19 +08:00
gtz
33782e189c add_infra_job_log_route 2024-03-28 18:57:44 +08:00
167 changed files with 14573 additions and 12302 deletions

View File

@@ -1,8 +1,8 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-03-25 15:59:53 # @LastEditTime: 2024-04-08 16:46:49
# @LastEditors: zhp # @LastEditors: DY
# @Description: # @Description:
### ###
# 开发环境配置 # 开发环境配置
@@ -13,20 +13,22 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26: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://10.70.2.2:8080'
# VUE_APP_BASE_API = 'http://192.168.1.20:48080' # VUE_APP_BASE_API = 'http://192.168.1.20:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082' # VUE_APP_BASE_API = 'http://192.168.1.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082' # VUE_APP_BASE_API = 'http://192.168.1.8:48082'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080' # VUE_APP_BASE_API = 'http://192.168.4.173:9001'
# VUE_APP_BASE_API = 'http://192.168.1.104:48082' # VUE_APP_BASE_API = 'http://192.168.1.104:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# VUE_APP_BASE_API = 'http://192.168.1.47:48082' # VUE_APP_BASE_API = 'http://192.168.1.47:48082'
# socket地址 # socket地址
VUE_APP_Socket_API = 'ws://10.70.2.2:8080' # 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_Socket_API = 'ws://192.168.0.33:48082'
VUE_APP_Socket_Dcs_API = 'ws://192.168.0.33:8080'
# 积木报表指向地址 # 积木报表指向地址
VUE_APP_JIMU_API = 'http://10.70.2.22:8080' VUE_APP_JIMU_API = 'http://10.70.2.22:8080'

View File

@@ -35,3 +35,21 @@ export function getQoq(data) {
data: data data: data
}) })
} }
// 获取能源设备树
export function getTree() {
return request({
url: '/analysis/energy-analysis/getTree',
method: 'get'
})
}
// 导出(走势分析)
export function exportTrend(data) {
return request({
url: '/analysis/energy-analysis/exportTrend',
method: 'post',
responseType: 'blob',
data: data
})
}

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@@ -12,7 +12,7 @@
:label-width="`${labelWidth}px`" :label-width="`${labelWidth}px`"
:size="size" :size="size"
:label-position="labelPosition" :label-position="labelPosition"
v-loading="formLoading"> v-loading="0 && formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex"> <el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length"> <el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules"> <el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">

View File

@@ -5,6 +5,7 @@ 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() {
@@ -12,7 +13,8 @@ export default {
}, },
methods: { methods: {
_setTableHeight() { _setTableHeight() {
this.tableH = this.tableHeight(260); this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
// this.tableH = this.tableHeight(260);
}, },
}, },
}; };

View File

@@ -32,6 +32,7 @@ const actions = {
} }
// 处理 dictValue 层级 // 处理 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,6 +97,8 @@ export const DICT_TYPE = {
TABLE_NAME: 'table_name', TABLE_NAME: 'table_name',
METHOD: 'method', METHOD: 'method',
PUSH: 'push', PUSH: 'push',
ENERGY_TYPE: 'energy_type',
// ============== ORDER - 订单模块 ============= // ============== ORDER - 订单模块 =============
ORDER_STATUS: 'order_status', ORDER_STATUS: 'order_status',

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-03-28 15:28:07 * @LastEditTime: 2024-04-03 10:54:53
* @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,14 +34,16 @@
<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: 1em"> <el-row v-for="op in orderProcessList" :key="op.id" style="margin-bottom: .5em">
<p v-if="op.outRate === 1" class="now-secondary-title" style="color:#4679FD"> <!-- <p v-if="op.outRate === 1" class="now-secondary-title"
style="font-size: 14px; opacity: calc(.6);color:#4679FD">
<i class="el-icon-check" /> <i class="el-icon-check" />
{{ op.name }} {{ op.name }}
</p> </p> -->
<p v-else class="now-secondary-title">{{ op.name }}</p> <!-- <p class="now-secondary-title">{{ op.name }}</p> -->
<el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white" <p class="now-secondary-title" style="font-size: 14px;opacity: calc(.6);">{{ op.name }}</p>
:percentage="op.outRate * 100" class="custom-progress-bar" /> <el-progress style="width: 935px;" text-color="rgba(255, 255, 255, .6)" :stroke-width="10"
define-back-color="rgba(32, 57, 96, 1)" :percentage="op.outRate * 100" class="custom-progress-bar" />
</el-row> </el-row>
</div> </div>
</base-container> </base-container>
@@ -496,7 +498,7 @@ export default {
seconds = "0" + seconds; seconds = "0" + seconds;
} }
//拼接格式化当前时间 //拼接格式化当前时间
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
}, },
windowWidth(value) { windowWidth(value) {
this.clientWidth = value this.clientWidth = value
@@ -530,11 +532,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.visual-container { .visual-container {
width: 1920px; width: 1920px;
height: 1080px; height: 1080px;
@@ -556,7 +553,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: 1px;
} }
.time { .time {
position: absolute; position: absolute;
@@ -564,7 +561,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: .72px;
} }
.title-button { .title-button {
color: #00fff0; color: #00fff0;
@@ -607,6 +604,14 @@ 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-03-28 16:35:49 * @LastEditTime: 2024-04-07 16:05:59
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@@ -17,11 +17,11 @@
许昌安彩冷端看板 许昌安彩冷端看板
<h3 class="unit">单位河南汇融数字科技有限公司</h3> <h3 class="unit">单位河南汇融数字科技有限公司</h3>
<h3 class="time">{{ times }}</h3> <h3 class="time">{{ times }}</h3>
<el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}" <!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
@click="changeFullScreen"> @click="changeFullScreen">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" /> <svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" /> <svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button> </el-button> -->
</el-row> </el-row>
<el-row class="container-main flex-col" type="flex"> <el-row class="container-main flex-col" type="flex">
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1"> <el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1">
@@ -40,6 +40,13 @@
<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>
@@ -64,11 +71,11 @@
</div> --> </div> -->
<!-- <el-row :gutter="9"> --> <!-- <el-row :gutter="9"> -->
<!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> --> <!-- <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="24"> -->
<pile-bar-chart style="margin-bottom: -15px" ref="firstPileChart" :height="90" /> <pile-bar-chart id=" 'one' " style="margin-top: -5px;" ref="firstPileChart" :height="80" />
<second-pile-bar-chart style="margin-bottom: -15px" id=" 'second' " ref="secondPileChart" :height="90" /> <second-pile-bar-chart id=" 'second' " ref="secondPileChart" :height="90" />
<third-pile-bar-chart style="margin-bottom: -15px" id=" 'third' " ref="thirdPileChart" :height="90" /> <third-pile-bar-chart id=" 'third' " ref="thirdPileChart" :height="90" />
<fourth-pile-bar-chart style="margin-bottom: -15px" id=" 'fourth' " ref="fourthPileChart" :height="90" /> <fourth-pile-bar-chart id=" 'fourth' " ref="fourthPileChart" :height="90" />
<fifth-pile-bar-chart style="margin-bottom: -15px" id=" 'fifth' " ref="fifthPileChart" :height="100" /> <fifth-pile-bar-chart style="margin-top: -5px;" id=" 'fifth' " ref="fifthPileChart" :height="90" />
<!-- <pile-bar-chart ref="secondPileChart" <!-- <pile-bar-chart ref="secondPileChart"
:height="90" /> :height="90" />
<pile-bar-chart ref="thirdPileChart" <pile-bar-chart ref="thirdPileChart"
@@ -244,6 +251,7 @@ export default {
funWs: undefined, funWs: undefined,
SJGws: undefined, SJGws: undefined,
funWsData: {}, funWsData: {},
coldDetData:[],
SJGWsData: {}, SJGWsData: {},
cxNameList:[], cxNameList:[],
cxDataList:[], cxDataList:[],
@@ -302,6 +310,7 @@ export default {
window.location.reload() window.location.reload()
}, 86400000) }, 86400000)
// this.getData() // this.getData()
// this.getReaiData()
}, },
destroyed() { destroyed() {
this.CutWebsocketClose() this.CutWebsocketClose()
@@ -314,16 +323,39 @@ export default {
} }
}, },
mounted() { mounted() {
this.getProductData()
// this.$refs.productChart.initChart(nameList, yieldList, sumAreaList)
this.getTimes()
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
this.funInitWebSocket()
if (!this.wsIsOpen) {
getDcsMsg()
this.wsIsOpen = true
console.log('开启websocket==========')
}
this.CutInitWebSocket()
this.SJGInitWebSocket()
const _this = this;
_this.beilv2 = document.documentElement.clientWidth / 1920
window.onresize = () => {
return (() => {
_this.clientWidth = `${document.documentElement.clientWidth}`
this.beilv2 = _this.clientWidth / 1920
})()
}
},
methods: {
getProductData() {
let nameList = [] let nameList = []
let nameWasteList = [] let nameWasteList = []
let topNameList = [] let topNameList = []
let productList = [] let productList = []
let wasteList = [] let wasteList = []
let yieldList = [] let yieldList = []
// let sumAreaList = [] let sumAreaList = []
// let yieldList = [] // let yieldList = []
// this.cutTableDataList = // this.cutTableDataList =
let coldDetData = [ this.coldDetData = [
{ {
"first": 0.8834, "first": 0.8834,
"lineName": "Y61", "lineName": "Y61",
@@ -375,45 +407,69 @@ export default {
"yield": 0.9133 "yield": 0.9133
} }
] ]
coldDetData.forEach((ele, index) => { this.coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName) nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea) topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
productList.push(ele.productArea) productList.push(ele.productArea)
wasteList.push(ele.wastArea) wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea) nameWasteList.push('缺陷面积:' + this.NumFormat(ele.wastArea) + '㎡')
yieldList.push({ // yieldList.push({
name: '良品', // name: '良品',
yield:ele.yield // yield:ele.yield
}) // })
// sumAreaList.push(ele.sumArea) sumAreaList.push(ele.sumArea)
// yieldList.push((ele.yield * 100).toFixed(3)) yieldList.push((ele.yield * 100).toFixed(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.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]]) this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
this.$refs.thirdPileChart.initChart(nameList, [topNameList[2]], [nameWasteList[2]], [productList[2]], [wasteList[2]]) this.$refs.thirdPileChart.initChart(nameList, [topNameList[2]], [nameWasteList[2]], [productList[2]], [wasteList[2]])
this.$refs.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]]) this.$refs.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]])
this.$refs.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]]) this.$refs.fifthPileChart.initChart(nameList, [topNameList[4]], [nameWasteList[4]], [productList[4]], [wasteList[4]])
// this.$refs.productChart.initChart(nameList, yieldList, sumAreaList) })
this.getTimes()
// console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
this.funInitWebSocket()
if (!this.wsIsOpen) {
getDcsMsg()
this.wsIsOpen = true
console.log('开启websocket==========')
}
this.CutInitWebSocket()
this.SJGInitWebSocket()
const _this = this;
_this.beilv2 = document.documentElement.clientWidth / 1920
window.onresize = () => {
return (() => {
_this.clientWidth = `${document.documentElement.clientWidth}`
this.beilv2 = _this.clientWidth / 1920
})()
}
}, },
methods: { // 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 = [
// { // {
@@ -444,8 +500,10 @@ export default {
// `<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`, // `<span style="color:rgba(255,255,255,0.5)">${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 );}
@@ -495,7 +553,7 @@ export default {
seconds = "0" + seconds; seconds = "0" + seconds;
} }
//拼接格式化当前时间 //拼接格式化当前时间
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; this.times = year + "." + month + "." + day + " " + hours + ":" + minutes + ":" + seconds;
}, },
SJGInitWebSocket() { SJGInitWebSocket() {
let date = new Date().valueOf() let date = new Date().valueOf()
@@ -525,10 +583,9 @@ export default {
]) ])
} }
this.realEqConfig.data = this.realEqList this.realEqConfig.data = this.realEqList
this.$nextTick(() => { // this.$nextTick(() => {
this.$refs['realEqScrollBoard'].updateRows(this.realEqList) this.$refs['realEqScrollBoard'].updateRows(this.realEqList)
// })
})
}; };
// if (typeof (WebSocket) === 'undefined') { // if (typeof (WebSocket) === 'undefined') {
// alert('您的浏览器不支持WebSocket') // alert('您的浏览器不支持WebSocket')
@@ -560,19 +617,23 @@ 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.7)" >${index + 1 || ''} `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.7)" >${item.lineName || ''} `<span style="color:rgba(255,255,255,0.5)" >${item.lineName || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.7)">${this.formatTime(item.time) || ''}</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.getSize(item.size) || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.getSize(item.size) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.7)">${item.productArea + '㎡' || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.productArea) + '㎡' || ''}</span>`,
`<span style="color:rgba(255,255,255,0.7)">${item.wasteArea + '㎡' || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.wasteArea) + '㎡' || ''}</span>`,
`<div style = "${(item.product * 100).toFixed(2) > 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(2) + '%' || ''}</div> `<div style = "${(item.product * 100).toFixed(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:rgba(255, 209, 96, 1)' : '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>`
]) ])
this.cutConfig.data = cutArr this.cutConfig.data = cutArr
// this.$nextTick(() => {
this.$refs['cutScrollBoard'].updateRows(cutArr) this.$refs['cutScrollBoard'].updateRows(cutArr)
// })
// this.cutConfig.data = cutArr
// this.$refs['cutScrollBoard'].updateRows(cutArr)
} else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') { } else if (this.cutWsData.type === 'cutting' && this.cutWsData.name === 'chart' && this.cutWsData.dateType === 'day') {
let nameList = [] let nameList = []
let nameWasteList = [] let nameWasteList = []
@@ -581,22 +642,25 @@ export default {
let wasteList = [] let wasteList = []
let sumAreaList = [] let sumAreaList = []
let yieldList = [] let yieldList = []
this.coldDetData = this.cutWsData.coldDetData
// this.cutTableDataList = // this.cutTableDataList =
this.cutWsData.coldDetData.forEach((ele, index) => { this.cutWsData.coldDetData.forEach((ele, index) => {
nameList.push(ele.lineName) nameList.push(ele.lineName)
topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea) topNameList.push('产线: ' + ele.lineName + ' ' + '总面积:' + ele.sumArea + '㎡')
productList.push(ele.productArea) productList.push(ele.productArea)
wasteList.push(ele.wastArea) wasteList.push(ele.wastArea)
nameWasteList.push('缺陷面积:' + ele.wastArea) nameWasteList.push('缺陷面积:' + this.NumFormat(ele.wastArea) + '㎡')
sumAreaList.push(ele.sumArea) sumAreaList.push(ele.sumArea)
yieldList.push(parseFloat((ele.yield * 100).toFixed(3))) yieldList.push(parseFloat((ele.yield * 100).toFixed(0)))
}) })
this.$nextTick(() => {
this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]]) this.$refs.firstPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]])
this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]]) this.$refs.secondPileChart.initChart(nameList, [topNameList[1]], [nameWasteList[1]], [productList[1]], [wasteList[1]])
this.$refs.thirdPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]]) this.$refs.thirdPileChart.initChart(nameList, [topNameList[2]], [nameWasteList[2]], [productList[2]], [wasteList[2]])
this.$refs.fourthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]]) this.$refs.fourthPileChart.initChart(nameList, [topNameList[3]], [nameWasteList[3]], [productList[3]], [wasteList[3]])
this.$refs.fifthPileChart.initChart(nameList, [topNameList[0]], [nameWasteList[0]], [productList[0]], [wasteList[0]]) 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)
})
} }
}; };
// if (typeof (WebSocket) === 'undefined') { // if (typeof (WebSocket) === 'undefined') {
@@ -632,17 +696,18 @@ export default {
for (let i in this.funWsData.data.annealFanInfo) { for (let i in this.funWsData.data.annealFanInfo) {
index++, index++,
arr.push([ arr.push([
` `<span style="color:rgba(255,255,255,0.5)" >${index || ''}
<span style="color:rgba(255,255,255,0.5)" >${index || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)" >${i || ''} // `<span style="color:rgba(255,255,255,0.5)" >${i || ''}
</span>`, // </span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${i || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)"><div style="${item.run == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${item.run || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)"><div style="${this.funWsData.data.annealFanInfo[i] == '运行' ? 'box-shadow: 0px 0px 2px 1px #2760FF;width:6px;height:6px;border-radius: 50%;background-color: #2760FF;float:left;margin:10px 10px 0 0 ' : 'box-shadow: 0px 0px 2px 1px #FFBD02;width:6px;height:6px;border-radius: 50%; background-color: #FFBD02;float:left;margin:10px 10px 0 0 '}"></div> ${this.funWsData.data.annealFanInfo[i] || ''}</span>`,
]) ])
} }
this.annealFunConfig.data = arr this.annealFunConfig.data = arr
// this.$nextTick(() => {
this.$refs['annealFunScrollBoard'].updateRows(arr) this.$refs['annealFunScrollBoard'].updateRows(arr)
// })
} }
if (this.funWsData.type === 'FanInfo') { if (this.funWsData.type === 'FanInfo') {
let arr = [] let arr = []
@@ -650,14 +715,16 @@ export default {
for (let i in this.funWsData.data.fanInfo) { for (let i in this.funWsData.data.fanInfo) {
index++, index++,
arr.push([ arr.push([
`<span style="color:rgba(255,255,255,0.5)" >${index || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)" >${index || ''}
</span>`,
`<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') {
@@ -678,6 +745,25 @@ 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()
@@ -772,7 +858,47 @@ 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;
@@ -794,7 +920,7 @@ export default {
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: 1px;
} }
.time { .time {
@@ -803,7 +929,7 @@ export default {
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.80);
top: 25px; top: 25px;
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: .72px;
} }
.title-button { .title-button {

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-03-28 16:45:24 * @LastEditTime: 2024-04-03 16:33:24
* @Description: * @Description:
--> -->
<template> <template>
@@ -85,7 +85,6 @@ export default {
defaultConfig: { defaultConfig: {
// 默认的legend配置 // 默认的legend配置
legend: { legend: {
orient: 'vertical',
left: '75%', left: '75%',
bottom: 0, bottom: 0,
itemHeight: 10, itemHeight: 10,
@@ -158,6 +157,9 @@ export default {
methods: { methods: {
initChart() { initChart() {
this.chart = echarts.init(document.getElementById(this.id)) this.chart = echarts.init(document.getElementById(this.id))
this.$nextTick(() => {
this.chart.resize();
});
this.chart.setOption({ this.chart.setOption({
title: this.showCenterTitle title: this.showCenterTitle
? { ? {
@@ -194,7 +196,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-27 10:26:35 * @LastEditTime: 2024-03-29 14:47:29
* @Description: file content * @Description: file content
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue * @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
--> -->
@@ -164,7 +164,7 @@ export default {
width: 100%; width: 100%;
// background-color: rgba($color: #061027, $alpha: 0.15); // background-color: rgba($color: #061027, $alpha: 0.15);
position: relative; position: relative;
opacity: calc(.8); // opacity: calc(.8);
// border: 2px solid; // border: 2px solid;
// background: url('../../../../assets/img/energy.png') no-repeat; // background: url('../../../../assets/img/energy.png') no-repeat;
// background-size: 100% 100%; // background-size: 100% 100%;
@@ -274,6 +274,8 @@ export default {
width: 100%; width: 100%;
color: #ffffff; color: #ffffff;
font-size: 24px; font-size: 24px;
font-weight: normal;
letter-spacing: .8px;
padding: 0.67em 0.67em 0.3em 0.67em; padding: 0.67em 0.67em 0.3em 0.67em;
display: flex; display: flex;
} }

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-03-25 18:34:58 * @LastEditTime: 2024-04-03 16:28:40
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div> <div>
<div :id="id" class="productChart" :style="{ height: '390px', width: width }" /> <div :id="id" class="coldProductChart" :style="{ height: '390px', width: width }" />
</div> </div>
</template> </template>
@@ -71,9 +71,9 @@ export default {
mounted() { mounted() {
console.log('mounted') console.log('mounted')
console.log('borderRadius: ', this.borderRadius) console.log('borderRadius: ', this.borderRadius)
// this.$nextTick(() => { this.$el.addEventListener('resize', () => {
// this.initChart() console.log('resziing.....');
// }) });
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {
@@ -100,8 +100,9 @@ export default {
show: true, //开启显示 show: true, //开启显示
position: 'top', //在上方显示 position: 'top', //在上方显示
textStyle: { //数值样式 textStyle: { //数值样式
color: '#ced1d5', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12 fontSize: 12,
fontWight: 'bolder'
} }
}, },
} }
@@ -114,6 +115,7 @@ export default {
name: '产线良品率', name: '产线良品率',
symbol: 'circle', //变为实心圆 symbol: 'circle', //变为实心圆
type: 'line', type: 'line',
// symbolSize: 7,
yAxisIndex: 0, yAxisIndex: 0,
areaStyle: { areaStyle: {
opacity: 0.8, opacity: 0.8,
@@ -141,6 +143,16 @@ export default {
] ]
// const colors = ['#5470C6', '#91CC75', '#EE6666'] // const colors = ['#5470C6', '#91CC75', '#EE6666']
this.chart = echarts.init(document.getElementById(this.id)) this.chart = echarts.init(document.getElementById(this.id))
let isFinished = false //标记 isFinished
this.chart.on('finished', _ => {
if (!isFinished) {
console.log('我只执行一次')
isFinished = true
// this.isLoading = false //关闭loading
this.chart.resize() //重新渲染charts大小
}
console.log(113, 'finished')
})
this.chart.setOption({ this.chart.setOption({
// color: colors, // color: colors,
tooltip: { tooltip: {
@@ -151,38 +163,50 @@ export default {
}, },
grid: { grid: {
left: "3%", left: "3%",
right: "5%", right: "10%",
bottom: "3%", bottom: "3%",
containLabel: true containLabel: true
}, },
legend: { // legend: {
itemWidth: 10, // itemWidth: 10,
itemHeight: 10, // itemHeight: 10,
top: '20', // top: '5',
// right: '20px', // right: '20px',
data: ['产线产量', '产线良品率'], // data: [
textStyle: { // // { icon: 'rect', name: '直接访问' },
fontSize: 12 * this.beilv, // { icon: 'roundRect', name: '产线产量' },
color: '#ced1d5' // // {
} // // icon: 'circle', name: '产线良品率',
}, // // itemWidth: 7,
// // itemHeight: 7,
// // },
// ],
// textStyle: {
// fontSize: 12 * this.beilv,
// color: '#ced1d5'
// }
// },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#213259', // 左边线的颜色 color: '#25528f', // 左边线的颜色
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: '#213259' color: '#25528f'
} }
}, },
data: nameList data: nameList
@@ -202,8 +226,9 @@ export default {
type: 'value', type: 'value',
name: '良品率/%', name: '良品率/%',
nameTextStyle: {// y轴上方单位的颜色 nameTextStyle: {// y轴上方单位的颜色
color: '#fff', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
align: "left", align: "left",
padding: [0, 0, 0, 8]
}, },
position: 'right', position: 'right',
alignTicks: true, alignTicks: true,
@@ -211,19 +236,20 @@ export default {
show: true, show: true,
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#213259', // 左边线的颜色 color: '#25528f', // 左边线的颜色
width: '1' // 坐标线的宽度 width: '1' // 坐标线的宽度
} }
}, },
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: '#ced1d5', // 坐标值得具体的颜色 color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
formatter: '{value}%' formatter: '{value}%',
align:'left',
} }
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#213259' color: '#25528f'
} }
} }
// type: 'value' // type: 'value'
@@ -245,9 +271,10 @@ export default {
type: 'value', type: 'value',
name: '产量/㎡', // y轴上方的单位 name: '产量/㎡', // y轴上方的单位
nameTextStyle: { nameTextStyle: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
// fontSize: 10, // fontSize: 10,
align: "right", align: "right",
padding:[0,4,0,0]
}, },
position: 'left', position: 'left',
alignTicks: true, alignTicks: true,
@@ -255,19 +282,21 @@ export default {
show: true, show: true,
lineStyle: { lineStyle: {
type: 'solid', type: 'solid',
color: '#213259', // 左边线的颜色 color: '#25528f', // 左边线的颜色
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: '#213259' color: '#25528f'
} }
} }
// type: 'value' // type: 'value'
@@ -286,7 +315,8 @@ 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-03-28 16:31:20 * @LastEditTime: 2024-04-03 17:09:12
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@@ -105,8 +105,9 @@ export default {
show: true, //开启显示 show: true, //开启显示
position: 'top', //在上方显示 position: 'top', //在上方显示
textStyle: { //数值样式 textStyle: { //数值样式
color: '#ced1d5', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12 fontSize: 12,
fontWight:'bolder'
} }
}, },
} }
@@ -142,7 +143,7 @@ export default {
} }
}, },
// data: passRateList // data: passRateList
data: [] data: passRateList
} }
] ]
// const colors = ['#5470C6', '#91CC75', '#EE6666'] // const colors = ['#5470C6', '#91CC75', '#EE6666']
@@ -166,19 +167,23 @@ export default {
type: 'cross' type: 'cross'
} }
}, },
grid: { top: 90, right: 60, bottom: 20, left: 20, containLabel: true }, grid: { top: 70, right: 20, bottom: 10, left: 10, containLabel: true },
legend: { // legend: {
itemWidth: 10, // itemWidth: 10,
itemHeight: 10, // itemHeight: 10,
top: '0%', // top: '2%',
right: '20px', // right: '30px',
data: ['产线产量', '产线良品率'], // data: ['产线良品率', '产线产量'],
textStyle: { // textStyle: {
fontSize: 12 * this.beilv, // fontSize: 12 * this.beilv,
color: '#ced1d5' // color: '#ced1d5',
} // fontWight: 'bolder'
}, // }
// },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
@@ -187,8 +192,11 @@ export default {
width: '1' // 坐标线的宽度 width: '1' // 坐标线的宽度
} }
}, },
textStyle: {
fontWight: 'bolder'
},
axisLabel: { axisLabel: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
// textStyle: { // textStyle: {
@@ -217,8 +225,9 @@ export default {
type: 'value', type: 'value',
name: '良品率/%', name: '良品率/%',
nameTextStyle: {// y轴上方单位的颜色 nameTextStyle: {// y轴上方单位的颜色
color: '#fff', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
align: "left", align: "left",
padding: [0, 0, 0, 2]
}, },
position: 'right', position: 'right',
alignTicks: true, alignTicks: true,
@@ -231,7 +240,7 @@ export default {
} }
}, },
axisLabel: { axisLabel: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
formatter: '{value}%' formatter: '{value}%'
@@ -261,8 +270,9 @@ export default {
type: 'value', type: 'value',
name: '产量/片', // y轴上方的单位 name: '产量/片', // y轴上方的单位
nameTextStyle: { nameTextStyle: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
// fontSize: 10, // fontSize: 10,
padding: [0, 4, 0, 0],
align: "right", align: "right",
}, },
// position: 'left', // position: 'left',
@@ -278,7 +288,7 @@ export default {
axisLabel: { axisLabel: {
// textStyle: { // textStyle: {
// color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色 // color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
// show: true, // show: true,
lineStyle: { lineStyle: {
color: "#25528f", color: "#25528f",

View File

@@ -111,8 +111,9 @@ export default {
show: true, //开启显示 show: true, //开启显示
position: 'top', //在上方显示 position: 'top', //在上方显示
textStyle: { //数值样式 textStyle: { //数值样式
color: '#ced1d5', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12 fontSize: 12,
fontWeight: 'normal'
} }
}, },
} }
@@ -132,7 +133,7 @@ export default {
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
} }
}, },
grid: { top: 90, right: 60, bottom: 20, left: 30, containLabel: true }, grid: { top: 70, right: 40, bottom: 10, left: 40, containLabel: true },
// legend: { // legend: {
// itemWidth: 10, // itemWidth: 10,
// itemHeight: 10, // itemHeight: 10,
@@ -144,6 +145,9 @@ export default {
// } // }
// }, // },
xAxis: { xAxis: {
axisTick: {
show: false
},
type: 'category', type: 'category',
axisLine: { axisLine: {
lineStyle: { lineStyle: {
@@ -152,8 +156,11 @@ export default {
width: '1' // 坐标线的宽度 width: '1' // 坐标线的宽度
} }
}, },
textStyle: {
fontWeight: 'bolder'
},
axisLabel: { axisLabel: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12, fontSize: 12,
// formatter: '{value}' // formatter: '{value}'
}, },
@@ -167,13 +174,13 @@ export default {
yAxis: { yAxis: {
name: '单位kwh', name: '单位kwh',
nameTextStyle: { nameTextStyle: {
color: '#fff', color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 10, fontSize: 12,
align: 'right', align: 'right',
}, },
type: 'value', type: 'value',
axisLabel: { axisLabel: {
color: "#fff", color: 'rgba(255,255,255,0.5)', // 坐标值得具体的颜色
fontSize: 12, fontSize: 12,
// formatter: '{value}/kwh' // formatter: '{value}/kwh'
}, },

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

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-03-28 16:10:47 * @LastEditTime: 2024-04-03 17:14:03
* @Description: * @Description:
--> -->
<template> <template>
@@ -10,40 +10,41 @@
<el-row class="container-title" :style="{ <el-row class="container-title" :style="{
height: 88 + 'px', height: 88 + 'px',
lineHeight: 88 + 'px', lineHeight: 88 + 'px',
fontSize: 31 + 'px' fontSize: 31 + 'px',
}"> }">
<img src="../../assets/img/logo.png" style="width:1.1em;position:relative;top:.22em" alt=""> <img src="../../assets/img/logo.png" style="width: 1.1em; position: relative; top: 0.22em" alt="" />
许昌安彩深加工看板 许昌安彩深加工看板
<h3 class="unit">单位河南汇融数字科技有限公司</h3> <h3 class="unit">单位河南汇融数字科技有限公司</h3>
<h3 class="time">{{ times }}</h3> <h3 class="time">{{ times }}</h3>
<el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}" <!-- <el-button type="text" class="title-button" :style="{ right: 18 + 'px', top: 26 + 'px',fontSize:'32px'}"
@click="changeFullScreen"> @click="changeFullScreen">
<svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" /> <svg-icon width="32" height="32" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon width="32" height="32" v-else icon-class="fullScreenView" /> <svg-icon width="32" height="32" v-else icon-class="fullScreenView" />
</el-button> </el-button> -->
</el-row> </el-row>
<el-row class="container-main flex-col" type="flex"> <el-row class="container-main flex-col" type="flex">
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1" style="height: 50%;"> <el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="15" type="flex" class="flex-1" style="height: 50%">
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%"> <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
<base-container :title="'设备报警'" :size="'small'" :height="318" :title-icon="'eqAlarm'"> <base-container :title="'设备报警'" :size="'small'" :height="318" :title-icon="'eqAlarm'">
<dv-scroll-board class="eqTable" :config="eqConfig" style="width:100%;height:350px" ref='eqScrollBoard' /> <dv-scroll-board class="eqTable" :config="eqConfig" style="width: 100%; height: 350px"
ref="eqScrollBoard" />
</base-container> </base-container>
</el-col> </el-col>
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%"> <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
<base-container :title="'各工序缺陷汇总'" :size="'small'" :title-icon="'scrap'"> <base-container :title="'各工序缺陷汇总'" :size="'small'" :title-icon="'scrap'">
<dv-scroll-board :config="processConfig" style="width:100%;height:350px" ref='processScrollBoard' /> <dv-scroll-board :config="processConfig" style="width: 100%; height: 350px" ref="processScrollBoard" />
</base-container> </base-container>
</el-col> </el-col>
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%"> <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8" height="100%">
<base-container :height="318" :size="'small'" :title="'工单监控'" :title-icon="'eqMonitoring'"> <base-container :height="318" :size="'small'" :title="'工单监控'" :title-icon="'eqMonitoring'">
<div class="order" style="width:100%; overflow: hidden scroll;height: 350px;"> <div class="order" style="width: 100%; overflow: hidden scroll; height: 350px">
<el-row v-for="op in orderList" :key="op.id" style="margin-bottom: 1em"> <el-row v-for="op in orderList" :key="op.id" style="margin-bottom: .5em">
<!-- <el-col :span="12"> --> <!-- <el-col :span="12"> -->
<p class="now-secondary-title">{{ op.name }}</p> <p class="now-secondary-title" style="font-size: 14px;opacity: calc(.6);">{{ op.name }}</p>
<el-progress :stroke-width="10" define-back-color="rgba(32, 57, 96, 1)" text-color="white" <el-progress style="width: 620px;" text-color="rgba(255, 255, 255, .6)" :stroke-width="10"
:percentage="op.progressRate" class="custom-progress-bar" /> define-back-color="rgba(32, 57, 96, 1)" :percentage="op.progressRate" class="custom-progress-bar" />
</el-row> </el-row>
</div> </div>
<!-- </div> --> <!-- </div> -->
@@ -66,6 +67,13 @@
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12"> <el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
<base-container :show-time="true" :no-content-padding="true" :height="318 + 338 + 16" :size="'eqStatus'" <base-container :show-time="true" :no-content-padding="true" :height="318 + 338 + 16" :size="'eqStatus'"
:title="'产线产量及良品率'" :title-icon="'productLine'"> :title="'产线产量及良品率'" :title-icon="'productLine'">
<div 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="productLineChart" :id="'doubleYChart'" :height="390" :show-legend="true" /> <double-y-chart ref="productLineChart" :id="'doubleYChart'" :height="390" :show-legend="true" />
</base-container> </base-container>
</el-col> </el-col>
@@ -75,105 +83,175 @@
</template> </template>
<script> <script>
import baseContainer from './components/baseContainer' import baseContainer from './components/baseContainer';
import baseTable1 from './components/baseTable' import baseTable1 from './components/baseTable';
import screenfull from 'screenfull' import screenfull from 'screenfull';
import doubleYChart from './components/doubleYChart ' import doubleYChart from './components/doubleYChart ';
import LinearBarChart from './components/linearBarChart' import LinearBarChart from './components/linearBarChart';
import WebSocketHeartbeat from './ws.js'; import WebSocketHeartbeat from './ws.js';
// 创建WebSocketHeartbeat实例 // 创建WebSocketHeartbeat实例
const qualityYearList = [ const qualityYearList = [
{ {
name: '翻转机', code: 'EQ20240110112358000235', status: '运行', error: '否' name: '翻转机',
code: 'EQ20240110112358000235',
status: '运行',
error: '否',
}, },
{ {
name: '烘干炉', code: 'EQ20240110112537000241', status: '运行', error: '否' name: '烘干炉',
code: 'EQ20240110112537000241',
status: '运行',
error: '否',
}, },
{ {
name: '清洗机', code: ' EQ20240110112310000232', status: '运行', error: '否' name: '清洗机',
}, code: ' EQ20240110112310000232',
{ name: '钢化清洗机', code: 'EQ20240110111700000208', status: '运行', error: '否' }, status: '运行',
{ name: '固化机', code: 'EQ20240110111700000201', status: '运行', error: '否' }, error: '否',
{
name: '磨边清洗机', code: ' EQ20240110111700000208', status: '运行', error: '否'
},
{ name: '预热机', code: 'EQ20240110111700000205', status: '故障', error: '是' },
{ name: '下片机', code: 'EQ20240115151435000279', status: '运行', error: '否' },
{
name: '冷却机', code: 'EQ20240110111700000203', status: '运行', error: '否'
}, },
{ {
name: 'A储片机106', code: 'EQ20240110111700000202', status: '运行', error: '否' name: '钢化清洗机',
code: 'EQ20240110111700000208',
status: '运行',
error: '否',
}, },
{ name: '二次清洗机', code: 'EQ20240110111700000209', status: '运行', error: '否' },
{ {
name: '二次磨边机', code: ' EQ20240110110927000181', status: '故障', error: '是' name: '固化机',
code: 'EQ20240110111700000201',
status: '运行',
error: '否',
}, },
{ name: '测试设备', code: 'EQ20240110111700000201', status: '运行', error: '否' } {
] name: '磨边清洗机',
code: ' EQ20240110111700000208',
status: '运行',
error: '否',
},
{
name: '预热机',
code: 'EQ20240110111700000205',
status: '故障',
error: '是',
},
{
name: '下片机',
code: 'EQ20240115151435000279',
status: '运行',
error: '否',
},
{
name: '冷却机',
code: 'EQ20240110111700000203',
status: '运行',
error: '否',
},
{
name: 'A储片机106',
code: 'EQ20240110111700000202',
status: '运行',
error: '否',
},
{
name: '二次清洗机',
code: 'EQ20240110111700000209',
status: '运行',
error: '否',
},
{
name: '二次磨边机',
code: ' EQ20240110110927000181',
status: '故障',
error: '是',
},
{
name: '测试设备',
code: 'EQ20240110111700000201',
status: '运行',
error: '否',
},
];
const qualityMonthList = [ const qualityMonthList = [
{ {
productionLineName: 'D61', productionLineName: 'D61',
sectionName: '成型', sectionName: '成型',
count: '3片', count: '3片',
inspectionTypeName: '细长泡' inspectionTypeName: '细长泡',
}, },
{ {
productionLineName: 'D62', productionLineName: 'D62',
sectionName: '组合落板', sectionName: '组合落板',
count: '4片', count: '4片',
inspectionTypeName: '细长泡' inspectionTypeName: '细长泡',
}, },
{ {
productionLineName: 'D61', productionLineName: 'D61',
sectionName: '磨边', sectionName: '磨边',
count: '6片', count: '6片',
inspectionTypeName: '开口泡' inspectionTypeName: '开口泡',
}, },
{ {
productionLineName: 'D63', productionLineName: 'D63',
sectionName: '清洗', sectionName: '清洗',
count: '5片', count: '5片',
inspectionTypeName: '结石' inspectionTypeName: '结石',
}, },
{ {
productionLineName: 'D64', productionLineName: 'D64',
sectionName: '打孔', sectionName: '打孔',
count: '2片', count: '2片',
inspectionTypeName: '结石' inspectionTypeName: '结石',
}, },
{ {
productionLineName: 'D63', productionLineName: 'D63',
sectionName: '成型', sectionName: '成型',
count: '7片', count: '7片',
inspectionTypeName: '开口泡' inspectionTypeName: '开口泡',
}, },
{ {
productionLineName: 'D61', productionLineName: 'D61',
sectionName: '上片', sectionName: '上片',
count: '8片', count: '8片',
inspectionTypeName: '结石' inspectionTypeName: '结石',
} },
] ];
const orderProcessList = [ const orderProcessList = [
{ {
id: '1', outRate: '.8', name: '凯盛0322' id: '1',
}, { outRate: '.8',
id: '2', outRate: '.4', name: '光伏玻璃4.0' name: '凯盛0322',
}, {
id: '3', outRate: '.5', name: '光伏玻璃3.0'
}, {
id: '4', outRate: '.3', name: '光伏玻璃2.0'
}, {
id: '5', outRate: '.5', name: '光伏玻璃1.0'
}, {
id: '6', outRate: '.8', name: '光伏玻璃'
}, },
{ {
id: '7', outRate: '.8', name: '统计订单' id: '2',
} outRate: '.4',
] name: '光伏玻璃4.0',
},
{
id: '3',
outRate: '.5',
name: '光伏玻璃3.0',
},
{
id: '4',
outRate: '.3',
name: '光伏玻璃2.0',
},
{
id: '5',
outRate: '.5',
name: '光伏玻璃1.0',
},
{
id: '6',
outRate: '.8',
name: '光伏玻璃',
},
{
id: '7',
outRate: '.8',
name: '统计订单',
},
];
export default { export default {
name: 'ProductionMonitoringCockpit', name: 'ProductionMonitoringCockpit',
components: { components: {
@@ -183,7 +261,7 @@ export default {
// baseTable3, // baseTable3,
// TopRadioGroup, // TopRadioGroup,
doubleYChart, doubleYChart,
LinearBarChart LinearBarChart,
// pieChart1, // pieChart1,
// pieChart2 // pieChart2
// pieChart3 // pieChart3
@@ -204,22 +282,22 @@ export default {
headerBGC: 'rgba(32, 55, 96, 0.8)', headerBGC: 'rgba(32, 55, 96, 0.8)',
oddRowBGC: 'rgba(32, 55, 96, 0.8)', oddRowBGC: 'rgba(32, 55, 96, 0.8)',
evenRowBGC: 'rgba(14, 32, 62, 0.8)', evenRowBGC: 'rgba(14, 32, 62, 0.8)',
columnWidth: [70, 100, 200, 90, 90,], columnWidth: [70, 100, 200, 90, 90],
align: ['center'], align: ['center'],
data: [], data: [],
// index:true, // index:true,
rowNum: 10 rowNum: 10,
}, },
processConfig: { processConfig: {
header: ['序号', '产线名称', '工序', '损耗片数', '缺陷类型'], header: ['序号', '产线名称', '工序', '损耗片数', '缺陷类型'],
headerBGC: 'rgba(32, 55, 96, 0.8)', headerBGC: 'rgba(32, 55, 96, 0.8)',
oddRowBGC: 'rgba(32, 55, 96, 0.8)', oddRowBGC: 'rgba(32, 55, 96, 0.8)',
evenRowBGC: 'rgba(14, 32, 62, 0.8)', evenRowBGC: 'rgba(14, 32, 62, 0.8)',
columnWidth: [70, 130, 100, 120, 110,], columnWidth: [70, 130, 100, 120, 110],
align: ['center'], align: ['center'],
data: [], data: [],
// index:true, // index:true,
rowNum: 10 rowNum: 10,
}, },
// cxDataList, // cxDataList,
SJGws: undefined, SJGws: undefined,
@@ -235,127 +313,205 @@ export default {
// qualityMonthTableProps, // qualityMonthTableProps,
modelMonth: '', modelMonth: '',
dateType: '0', dateType: '0',
} };
}, },
computed: { computed: {
styles() { styles() {
const v = Math.floor(this.value * this.beilv2 * 100) / 10000 const v = Math.floor(this.value * this.beilv2 * 100) / 10000;
return { return {
transform: `scale(${v})`, transform: `scale(${v})`,
transformOrigin: 'top left' transformOrigin: 'top left',
} };
} },
}, },
watch: { watch: {
isFullScreen: function (val) { isFullScreen: function (val) {
if (val) { if (val) {
const _this = this; const _this = this;
_this.beilv2 = document.documentElement.clientWidth / 1920 _this.beilv2 = document.documentElement.clientWidth / 1920;
console.log(_this.beilv2); console.log(_this.beilv2);
} else { } else {
const _this = this; const _this = this;
_this.beilv2 = document.documentElement.clientWidth / 1920 _this.beilv2 = document.documentElement.clientWidth / 1920;
} }
}, },
clientWidth(val) { clientWidth(val) {
if (!this.timer) { if (!this.timer) {
this.clientWidth = val this.clientWidth = val;
this.beilv2 = this.clientWidth / 1920 this.beilv2 = this.clientWidth / 1920;
this.timer = true this.timer = true;
let _this = this let _this = this;
setTimeout(function () { setTimeout(function () {
_this.timer = false _this.timer = false;
}, 500) }, 500);
} }
this.windowWidth(val); this.windowWidth(val);
} },
}, },
created() { created() {
this.init() this.getData();
this.init();
setTimeout(() => { setTimeout(() => {
window.location.reload() window.location.reload();
}, 86400000) }, 86400000);
}, },
destroyed() { destroyed() {
this.websocketClose() this.websocketClose();
this.SJGWebsocketClose() this.SJGWebsocketClose();
}, },
mounted() { mounted() {
// let detData = [ let detData = [
{
id: '1',
name: '测试工单',
progressRate: 0.933333,
},
{
id: '2',
name: '测试工单2',
progressRate: 0.932323,
},
{
id: '3',
name: '测试工单3',
progressRate: 0.23232,
},
{
id: '4',
name: '测试工单4',
progressRate: 0.32323,
},
{
id: '4',
name: '测试工单4',
progressRate: 0.32323,
},
{
id: '4',
name: '测试工单4',
progressRate: 0.32323,
},
{
id: '4',
name: '测试工单4',
progressRate: 0.32323,
},
{
id: '4',
name: '测试工单4',
progressRate: 0.32323,
},
// { // {
// id:'1', // id: '5',
// name: '测试工单', // name: '测试工单',
// progressRate:0.933333 // progressRate: 0.5555
// }, {
// id: '6',
// name: '测试工单',
// progressRate: 0.66564
// }, // },
// { ];
// id: '2', this.orderList = detData.map((ele, index) => {
// name: '测试工单2', if (ele.progressRate && ele.progressRate != 1) {
// progressRate: 0.932323 return {
// }, { id: ele.id,
// id: '3', name: ele.name,
// name: '测试工单3', progressRate: parseFloat((ele.progressRate * 100).toFixed(0)),
// progressRate: 0.23232 };
// }, { }
// id: '4', });
// name: '测试工单4', let EnergyNameList = ['Y61', 'Y62', 'Y63', 'Y64', 'Y65'];
// progressRate: 0.32323 this.EnergyMonitoringNameList = EnergyNameList;
// } let EnergyDataList = [1, 2, 3, 4, 5];
// // { // this.wsData.data.forEach((ele) => {
// // id: '5', // EnergyDataList.push(ele.useQuantity)
// // name: '测试工单', // })
// // progressRate: 0.5555 this.EnergyMonitoringList = EnergyDataList;
// // }, { // console.log(EnergyDataList)
// // id: '6', this.$refs.EnergyMonitoringChart.initChart(
// // name: '测试工单', this.EnergyMonitoringNameList,
// // progressRate: 0.66564 this.EnergyMonitoringList
// // }, );
// ] let eqArr = this.qualityYearList.map((item, index) => [
// this.orderList = detData.map((ele, index) => { `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
// if (ele.progressRate && ele.progressRate != 1) { </span>`,
// return { // formatDate(item.planStartTime) || '',
// id: ele.id, `
// name: ele.name, <span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
// progressRate: parseFloat((ele.progressRate * 100).toFixed(3)) </span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
]);
this.eqConfig.data = eqArr;
let data = [
{
lineName: 'D62',
outputNum: '11111',
passRate: '0.9873'
},
{
lineName: 'D63',
outputNum: '23212',
passRate: '0.9873'
},
{
lineName: 'D61',
outputNum: '423323',
passRate: '0.9873'
},
{
lineName: 'D64',
outputNum: '43434',
passRate: '0.9873'
},
]
let nameList = [];
let passRateList = [];
let outputNumList = [];
// let arr = ['D64', 'D62', 'D61', 'D63', 'D65']
for (let i = 0; i < data.length - 1; i++) {
// 二次循环,注意:再减去外层的循环次数,向后依次两两相互比较转换;
for (let j = 0; j < data.length - i - 1; j++) {
// 当前一个值大于后一个值
if (data[j].lineName.substr(data[j].lineName.length - 1, 1) > data[j + 1].lineName.substr(data[j + 1].lineName.length - 1, 1)) {
// 定义变量,以赋值的形式前后交换,直到换到最小的在前面,左右再无比较,则循环结束形成排序结果
let temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
}
}
}
data.forEach((ele) => {
// if (item.id == ele.productionLineId) {
// if (item.name.substr(0, 1) == "D") {
// console.log(ele)
nameList.push(ele.lineName);
outputNumList.push(ele.outputNum);
passRateList.push(ele.passRate);
// } // }
// } // }
// }); });
// let EnergyNameList = ['Y61', 'Y62', 'Y63', 'Y64', 'Y65',] this.$nextTick(() => {
// this.EnergyMonitoringNameList = EnergyNameList this.$refs.productLineChart.initChart(
// let EnergyDataList = [1, 2, 3, 4, 5] nameList,
// // this.wsData.data.forEach((ele) => { passRateList,
// // EnergyDataList.push(ele.useQuantity) outputNumList
// // }) );
// this.EnergyMonitoringList = EnergyDataList })
// // console.log(EnergyDataList)
// this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList, this.EnergyMonitoringList)
// let eqArr = this.qualityYearList.map((item, index) => [
// `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
// </span>`,
// // formatDate(item.planStartTime) || '',
// `
// <span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
// </span>`,
// `<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
// `<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
// `<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
// ])
// this.eqConfig.data = eqArr
// this.$refs['eqScrollBoard'].updateRows(eqArr)
// this.$refs.productLineChart.initChart(['D61', 'D62', 'D63', 'D64', 'D65',], [98, 97, 98.7, 98.5, 98.3,], [3134, 2323, 3232, 3233, 2321])
// this.getList() // this.getList()
this.initWebSocket() this.initWebSocket();
this.SJGInitWebSocket() this.SJGInitWebSocket();
this.getTimes() this.getTimes();
// this.$refs.EnergyMonitoringChart.initChart(['Y61', 'Y62', 'Y63', 'Y64', 'Y65',], [3134, 2323, 3232, 3233, 2321]) // this.$refs.EnergyMonitoringChart.initChart(['Y61', 'Y62', 'Y63', 'Y64', 'Y65',], [3134, 2323, 3232, 3233, 2321])
const _this = this; const _this = this;
_this.beilv2 = document.documentElement.clientWidth / 1920 _this.beilv2 = document.documentElement.clientWidth / 1920;
window.onresize = () => { window.onresize = () => {
return (() => { return (() => {
_this.clientWidth = `${document.documentElement.clientWidth}` _this.clientWidth = `${document.documentElement.clientWidth}`;
this.beilv2 = _this.clientWidth / 1920 this.beilv2 = _this.clientWidth / 1920;
})() })();
} };
this.getData()
}, },
// beforeDestroy() { // beforeDestroy() {
@@ -371,14 +527,22 @@ export default {
</span>`, </span>`,
// formatDate(item.planStartTime) || '', // formatDate(item.planStartTime) || '',
` `
<span style="color:rgba(255,255,255,0.5)" >${item.productionLineName || ''} <span style="color:rgba(255,255,255,0.5)" >${
item.productionLineName || ''
}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.sectionName || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${
item.sectionName || ''
}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.inspectionTypeName || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${
]) item.inspectionTypeName || ''
this.processConfig.data = processArr }</span>`,
this.$refs['processScrollBoard'].updateRows(processArr) ]);
this.processConfig.data = processArr;
// this.$nextTick(() => {
this.$refs['processScrollBoard'].updateRows(processArr);
// })
}, },
// getList() { // getList() {
// // this.$axios.get( // // this.$axios.get(
@@ -439,41 +603,55 @@ export default {
let seconds = new Date().getSeconds(); //获取当前时间的秒数 let seconds = new Date().getSeconds(); //获取当前时间的秒数
//当小于 10 的是时候,在前面加 0 //当小于 10 的是时候,在前面加 0
if (hours < 10) { if (hours < 10) {
hours = "0" + hours; hours = '0' + hours;
} }
if (minutes < 10) { if (minutes < 10) {
minutes = "0" + minutes; minutes = '0' + minutes;
} }
if (seconds < 10) { if (seconds < 10) {
seconds = "0" + seconds; seconds = '0' + seconds;
} }
//拼接格式化当前时间 //拼接格式化当前时间
this.times = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; this.times =
year +
'.' +
month +
'.' +
day +
' ' +
hours +
':' +
minutes +
':' +
seconds;
}, },
initWebSocket() { initWebSocket() {
let date = new Date().valueOf() let date = new Date().valueOf();
const wsUrl = process.env.VUE_APP_Socket_API + `/websocket/message?userId=EN${date}` const wsUrl =
process.env.VUE_APP_Socket_API + `/websocket/message?userId=EN${date}`;
this.wsHeartbeat = new WebSocketHeartbeat(wsUrl); this.wsHeartbeat = new WebSocketHeartbeat(wsUrl);
// 处理收到的消息 // 处理收到的消息
this.wsHeartbeat.ws.onmessage = (event) => { this.wsHeartbeat.ws.onmessage = (event) => {
console.log('收到消息:', event.data) console.log('收到消息:', event.data);
this.wsData = event?.data ? JSON.parse(event?.data) : {} this.wsData = event?.data ? JSON.parse(event?.data) : {};
// console.log('22222', this.wsData.data) // console.log('22222', this.wsData.data)
if (this.wsData.type === 'EnergyMonitoring') { if (this.wsData.type === 'EnergyMonitoring') {
let EnergyNameList = [] let EnergyNameList = [];
this.wsData.data.forEach((ele) => { this.wsData.data.forEach((ele) => {
EnergyNameList.push(ele.lineName) EnergyNameList.push(ele.lineName);
}) });
this.EnergyMonitoringNameList = EnergyNameList this.EnergyMonitoringNameList = EnergyNameList;
let EnergyDataList = [] let EnergyDataList = [];
this.wsData.data.forEach((ele) => { this.wsData.data.forEach((ele) => {
EnergyDataList.push(ele.useQuantity EnergyDataList.push(ele.useQuantity);
) });
this.EnergyMonitoringList = EnergyDataList;
console.log(EnergyDataList);
this.$nextTick(() => {
this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList,this.EnergyMonitoringList);
}) })
this.EnergyMonitoringList = EnergyDataList
console.log(EnergyDataList)
this.$refs.EnergyMonitoringChart.initChart(this.EnergyMonitoringNameList, this.EnergyMonitoringList)
} }
}; };
// if (typeof (WebSocket) === 'undefined') { // if (typeof (WebSocket) === 'undefined') {
@@ -495,14 +673,15 @@ export default {
// } // }
}, },
SJGInitWebSocket() { SJGInitWebSocket() {
let date = new Date().valueOf() let date = new Date().valueOf();
const SJGWsUrl = process.env.VUE_APP_Socket_API + `/websocket/message?userId=SJG${date}` const SJGWsUrl =
process.env.VUE_APP_Socket_API + `/websocket/message?userId=SJG${date}`;
this.SJGws = new WebSocketHeartbeat(SJGWsUrl); this.SJGws = new WebSocketHeartbeat(SJGWsUrl);
// 处理收到的消息 // 处理收到的消息
this.SJGws.ws.onmessage = (event) => { this.SJGws.ws.onmessage = (event) => {
console.log('收到消息:', event.data) console.log('收到消息:', event.data);
this.SJGWsData = event?.data ? JSON.parse(event?.data) : {} this.SJGWsData = event?.data ? JSON.parse(event?.data) : {};
// console.log(this.wsData.detData); // console.log(this.wsData.detData);
// console.log('22222', this.wsData.data) // console.log('22222', this.wsData.data)
if (this.SJGWsData.type === 'order') { if (this.SJGWsData.type === 'order') {
@@ -511,69 +690,100 @@ export default {
return { return {
id: ele.id, id: ele.id,
name: ele.name, name: ele.name,
progressRate: parseFloat((ele.progressRate * 100).toFixed(3)) progressRate: parseFloat((ele.progressRate * 100).toFixed(0)),
} };
} }
}); });
console.log(this.orderList) console.log(this.orderList);
} else if (this.SJGWsData.type === 'equipment') { } else if (this.SJGWsData.type === 'equipment') {
let eqArr = this.SJGWsData.detData.map((item, index) => [ let eqArr = this.SJGWsData.detData.map((item, index) => [
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''} `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)" >${item.name || ''} `<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
</span>`, </span>`,
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${
`<span style="color:rgba(255,255,255,0.5)"><span style="color:rgba(255,255,255,0.5)"></span> ${item.status || ''}</span>`, item.code || ''
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`, }</span>`,
]) `<span style="color:rgba(255,255,255,0.5)"><span style="color:rgba(255,255,255,0.5)"></span> ${
this.eqConfig.data = eqArr item.status || ''
this.$refs['eqScrollBoard'].updateRows(eqArr) }</span>`,
`<span style="color:rgba(255,255,255,0.5)">${
item.error || ''
}</span>`,
]);
this.eqConfig.data = eqArr;
// this.$nextTick(() => {
this.$refs['eqScrollBoard'].updateRows(eqArr);
// })
// console.log(SJGWsData.orderList) // console.log(SJGWsData.orderList)
} else if (this.SJGWsData.type === 'productline') { } else if (this.SJGWsData.type === 'productline') {
console.log('aaaaaaaaaaaaaaaaaaa', this.SJGWsData); console.log('aaaaaaaaaaaaaaaaaaa', this.SJGWsData);
let nameList = [] let nameList = [];
let passRateList = [] let passRateList = [];
let outputNumList = [] let outputNumList = [];
// let arr = ['D64', 'D62', 'D61', 'D63', 'D65']
for (let i = 0; i < this.SJGWsData.detData.length - 1; i++) {
// 二次循环,注意:再减去外层的循环次数,向后依次两两相互比较转换;
for (let j = 0; j < this.SJGWsData.detData.length - i - 1; j++) {
// 当前一个值大于后一个值
if (this.SJGWsData.detData[j].lineName.substr(this.SJGWsData.detData[j].lineName.length - 1, 1) > this.SJGWsData.detData[j + 1].lineName.substr(this.SJGWsData.detData[j + 1].lineName.length - 1, 1)) {
// 定义变量,以赋值的形式前后交换,直到换到最小的在前面,左右再无比较,则循环结束形成排序结果
let temp = this.SJGWsData.detData[j];
this.SJGWsData.detData[j] = this.SJGWsData.detData[j + 1];
this.SJGWsData.detData[j + 1] = temp;
}
}
}
this.SJGWsData.detData.forEach((ele) => { this.SJGWsData.detData.forEach((ele) => {
// if (item.id == ele.productionLineId) { // if (item.id == ele.productionLineId) {
// if (item.name.substr(0, 1) == "D") { // if (item.name.substr(0, 1) == "D") {
// console.log(ele) // console.log(ele)
nameList.push(ele.lineName) nameList.push(ele.lineName);
outputNumList.push(ele.outputNum) outputNumList.push(ele.outputNum);
passRateList.push(ele.passRate) passRateList.push(ele.passRate);
// } // }
// } // }
});
this.$nextTick(() => {
this.$refs.productLineChart.initChart(
nameList,
passRateList,
outputNumList
);
}) })
this.$refs.productLineChart.initChart(nameList, passRateList, outputNumList)
} else if (this.SJGInitWebSocket === 'inspection') { } else if (this.SJGInitWebSocket === 'inspection') {
} }
}; };
}, },
SJGWebsocketClose(e) { SJGWebsocketClose(e) {
this.SJGws.ws.onclose = (event) => { console.log(event); } this.SJGws.ws.onclose = (event) => {
console.log(event);
};
}, },
websocketClose(e) { websocketClose(e) {
this.wsHeartbeat.ws.onclose = (event) => { console.log(event); } this.wsHeartbeat.ws.onclose = (event) => {
console.log(event);
};
}, },
windowWidth(value) { windowWidth(value) {
this.clientWidth = value this.clientWidth = value;
this.beilv2 = this.clientWidth / 1920 this.beilv2 = this.clientWidth / 1920;
}, },
change() { change() {
console.log(this.isFullScreen); console.log(this.isFullScreen);
debugger; debugger;
this.isFullScreen = screenfull.isFullscreen this.isFullScreen = screenfull.isFullscreen;
}, },
init() { init() {
console.log(screenfull.isEnabled); console.log(screenfull.isEnabled);
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
debugger; debugger;
screenfull.on('change', this.change) screenfull.on('change', this.change);
} }
}, },
destroy() { destroy() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.off('change', this.change) screenfull.off('change', this.change);
} }
}, },
changeFullScreen() { changeFullScreen() {
@@ -581,19 +791,62 @@ export default {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
this.$message({ this.$message({
message: 'you browser can not work', message: 'you browser can not work',
type: 'warning' type: 'warning',
}) });
return false return false;
}
screenfull.toggle()
}
}
} }
screenfull.toggle();
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.myLegend {
position: absolute;
top: -28px;
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;
@@ -612,17 +865,17 @@ export default {
position: absolute; position: absolute;
left: 290px; left: 290px;
top: 25px; top: 25px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.8);
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: 1px;
} }
.time { .time {
position: absolute; position: absolute;
left: 1360px; left: 1360px;
color: rgba(255, 255, 255, 0.80); color: rgba(255, 255, 255, 0.8);
top: 25px; top: 25px;
font-size: 20px; font-size: 20px;
letter-spacing: 0px; letter-spacing: 0.72px;
} }
.title-button { .title-button {
color: #00fff0; color: #00fff0;
@@ -666,6 +919,13 @@ export default {
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: 538px;
// background-color: unset;
// background-image: linear-gradient(to right, #4573fe, #47f8dc);
}
.visual-select { .visual-select {
position: absolute; position: absolute;
right: 1em; right: 1em;
@@ -736,7 +996,7 @@ export default {
} }
} }
.order::-webkit-scrollbar { .order::-webkit-scrollbar {
display: none display: none;
} }
</style> </style>

View File

@@ -9,7 +9,8 @@
: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"
@@ -33,38 +34,49 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -74,7 +86,7 @@ export default {
tableBtn: [].filter((v)=>v), tableBtn: [].filter((v)=>v),
tableData: [], tableData: [],
listQuery: { listQuery: {
pageSize: 10, pageSize: 20,
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-03-20 16:20:39 * @LastEditTime: 2024-04-02 16:46:17
* @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,7 +9,8 @@
: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"
@@ -45,41 +46,56 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -45,6 +46,7 @@ import {
getCoreDepartmentPage, getCoreDepartmentPage,
deleteCoreDepartment deleteCoreDepartment
} from '@/api/base/coreDepartment'; } from '@/api/base/coreDepartment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
@@ -71,7 +73,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

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,7 +12,8 @@
: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"
@@ -78,7 +79,7 @@
queryParams: { queryParams: {
equipmentId: form.id, equipmentId: form.id,
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
}, },
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:core-equipment-attr:update') this.$auth.hasPermi('base:core-equipment-attr:update')
@@ -118,6 +119,7 @@ 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',
@@ -125,7 +127,7 @@ export default {
Editor, Editor,
EquipmentDrawer, EquipmentDrawer,
}, },
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
searchBarKeys: ['name', 'code'], searchBarKeys: ['name', 'code'],
@@ -157,8 +159,8 @@ export default {
width: 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: '设备名称', width: 180, showOverflowtooltip: true },
{ width: 256, prop: 'code', label: '设备编码' }, { width: 250, prop: 'code', label: '设备编码' },
{ prop: 'equipmentTypeName', label: '设备类型' }, { prop: 'equipmentTypeName', label: '设备类型' },
{ prop: 'enName', label: '英文名称' }, { prop: 'enName', label: '英文名称' },
{ prop: 'abbr', label: '缩写' }, { prop: 'abbr', label: '缩写' },
@@ -484,7 +486,7 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
code: '', code: '',
name: '', name: '',
special: false special: false

View File

@@ -12,7 +12,8 @@
: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,13 +52,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], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
basePath: '/base/core-equipment-bind-section', basePath: '/base/core-equipment-bind-section',
@@ -81,12 +82,13 @@ export default {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, fixed: true,
width: 180, width: 150,
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: '产线名称' }, { prop: 'productionLineName', label: '产线名称', width: 120, showOverflowtooltip: true },
{ prop: 'workshopSectionName', label: '工段名称' }, { prop: 'workshopSectionName', label: '工段名称', width: 120, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'equipmentName', label: '设备名称', width: 150, showOverflowtooltip: true },
{ prop: 'sort', label: '工段中排序' }, { prop: 'sort', label: '工段中排序' },
{ {
prop: 'lineDataType', prop: 'lineDataType',
@@ -236,7 +238,7 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
equipmentName: null, equipmentName: null,
productionLineId: null, productionLineId: null,
}, },

View File

@@ -12,7 +12,8 @@
: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"
@@ -50,6 +51,7 @@
<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,
@@ -65,7 +67,7 @@ import {
export default { export default {
name: 'EquipmentType', name: 'EquipmentType',
components: {}, components: {},
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
searchBarKeys: ['name'], searchBarKeys: ['name'],
@@ -171,7 +173,7 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
name: '', name: '',
}, },
// 表单参数 // 表单参数

View File

@@ -9,7 +9,8 @@
: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"
@@ -43,38 +44,51 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -45,6 +46,7 @@ import {
getCoreMajorPage, getCoreMajorPage,
deleteCoreMajor deleteCoreMajor
} from '@/api/base/coreMajor'; } from '@/api/base/coreMajor';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
@@ -71,7 +73,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -2,15 +2,17 @@
* @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-13 13:54:01 * @LastEditTime: 2024-03-27 13:47:24
* @Description: * @Description:
--> -->
<template> <template>
<el-drawer <el-drawer
:visible.sync="visible" :visible.sync="visible"
:show-close="false" :show-close="false"
:wrapper-closable="isdetail" :wrapper-closable="true"
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 ? '新增' : '编辑' }}
@@ -262,6 +264,15 @@ 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,7 +9,8 @@
: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"
@@ -26,7 +27,8 @@
<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>
@@ -39,43 +41,58 @@ 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,
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'name', prop: 'name',
label: '产品名称' label: '产品名称',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'code', prop: 'code',
label: '产品编码' label: '产品编码',
width: 190,
showOverflowtooltip: true
}, },
{ {
prop: 'productType', prop: 'productType',
label: '产品类型', label: '产品类型',
filter: publicFormatter('product_type') filter: publicFormatter('product_type'),
width: 180,
showOverflowtooltip: true
}, },
{ {
prop: 'specifications', prop: 'specifications',
label: '规格' label: '规格',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'unit', prop: 'unit',
label: '单位', label: '单位',
filter: publicFormatter('unit_dict') filter: publicFormatter('unit_dict'),
width: 90,
showOverflowtooltip: true
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注', label: '备注',
width: 120,
showOverflowtooltip: true
}, },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -48,34 +49,47 @@ 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,
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'factoryName', prop: 'factoryName',
label: '工厂' label: '工厂',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'roomNameDict', prop: 'roomNameDict',
label: '车间名称', label: '车间名称',
filter: publicFormatter('workshop') filter: publicFormatter('workshop'),
width: 120,
showOverflowtooltip: true
}, },
{ {
prop: 'name', prop: 'name',
label: '产线名称' label: '产线名称',
width: 120,
showOverflowtooltip: true
}, },
{ {
prop: 'code', prop: 'code',
label: '产线编码' label: '产线编码',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'enabled', prop: 'enabled',
label: '当前状态', label: '当前状态',
filter: codeFilter('lineStatus') filter: codeFilter('lineStatus'),
width: 120,
showOverflowtooltip: true
}, },
// { // {
// prop: 'tvalue', // prop: 'tvalue',
@@ -83,16 +97,20 @@ const tableProps = [
// }, // },
{ {
prop: 'description', prop: 'description',
label: '描述' label: '描述',
width: 120,
showOverflowtooltip: true
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
width: 120,
showOverflowtooltip: true
} }
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

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: 2023-11-22 10:27:43 * @LastEditTime: 2024-04-02 16:46:49
* @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,7 +9,8 @@
: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"
@@ -45,41 +46,56 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

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-03-22 08:53:20 * @LastEditTime: 2024-04-08 10:21:46
* @Description: * @Description:
--> -->
<template> <template>
@@ -214,7 +214,9 @@ 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-03-21 16:52:46 * @LastEditTime: 2024-04-08 14:27:29
* @Description: * @Description:
--> -->
<template> <template>
@@ -182,7 +182,8 @@
: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"
@@ -209,7 +210,8 @@
:table-props="tableProps1" :table-props="tableProps1"
:page="listQuery1.pageNo" :page="listQuery1.pageNo"
:limit="listQuery1.pageSize" :limit="listQuery1.pageSize"
:table-data="materialList" /> :table-data="materialList"
:max-height="tableH" />
<!-- <pagination <!-- <pagination
v-show="listQuery1.total > 0" v-show="listQuery1.total > 0"
:total="listQuery1.total" :total="listQuery1.total"
@@ -235,6 +237,7 @@ 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 = [
{ {
@@ -292,9 +295,11 @@ 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,
@@ -455,7 +460,7 @@ export default {
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}); });
// 获取预使用原料列表 // 获取预使用原料列表
console.log() console.log('111我看看', this.dataForm.materialMethod)
if (this.dataForm.id) { if (this.dataForm.id) {
if (this.dataForm.materialMethod === 1) { if (this.dataForm.materialMethod === 1) {
// 产品 // 产品

View File

@@ -9,7 +9,8 @@
: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"
@@ -62,7 +63,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 = [
{ {
@@ -132,7 +133,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
components: { components: {
AddWorkOrder, AddWorkOrder,
AddOrUpdate, AddOrUpdate,

View File

@@ -9,7 +9,8 @@
: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,20 +47,27 @@ 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',
@@ -70,32 +78,44 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -45,12 +46,14 @@ import {
getCWSectionPage, getCWSectionPage,
deleteCWSection deleteCWSection
} from '@/api/base/coreWorkshopSection'; } from '@/api/base/coreWorkshopSection';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime filter: parseTime,
}, },
{ {
prop: 'code', prop: 'code',
@@ -70,12 +73,13 @@ const tableProps = [
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
showOverflowtooltip: true
}, },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -40,6 +41,7 @@ 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 = [
{ {
@@ -75,7 +77,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

@@ -9,7 +9,8 @@
: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"
@@ -38,6 +39,7 @@ import {
getMaterialPBPage, getMaterialPBPage,
deleteMaterialPB deleteMaterialPB
} from '@/api/base/materialProductBom'; } from '@/api/base/materialProductBom';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
@@ -55,7 +57,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
components: { components: {
AddOrUpdate, AddOrUpdate,
}, },

View File

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

View File

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

View File

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

View File

@@ -106,6 +106,10 @@ 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: {
/** /**
@@ -124,8 +128,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) => ({
@@ -139,7 +143,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) => ({
@@ -153,7 +157,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) => ({
@@ -167,7 +171,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) => ({
@@ -181,9 +185,10 @@ 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',
@@ -195,7 +200,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,13 +18,15 @@
: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>
@@ -47,13 +49,14 @@ 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], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
activeName: 'table', activeName: 'table',
@@ -176,6 +179,11 @@ 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,7 +9,8 @@
: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,6 +42,7 @@
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
@@ -71,7 +73,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {

View File

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

View File

@@ -27,13 +27,16 @@
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
}, },
@@ -56,9 +59,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: {
@@ -115,7 +118,7 @@ export default {
/** 把 list 里的数据转换成 tableProps 对应的格式 */ /** 把 list 里的数据转换成 tableProps 对应的格式 */
convertList(list) { convertList(list) {
// let sectionArr= [] // let sectionArr= []
let temp = Object.values(list.datamap) let temp = list.datamap ? Object.values(list?.datamap) : []
console.log('111', temp) console.log('111', temp)
temp.forEach(item => { temp.forEach(item => {

View File

@@ -32,6 +32,7 @@ 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 = [
{ {
@@ -61,7 +62,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage,tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -70,7 +71,6 @@ export default {
}, },
tableData: [], tableData: [],
tableProps, tableProps,
tableH: this.tableHeight(260),
drawerVisible: false, drawerVisible: false,
formConfig: [ formConfig: [
{ {
@@ -92,13 +92,15 @@ export default {
param: 'searchTime', param: 'searchTime',
}, },
{ {
type: 'button', type: this.$auth.hasPermi('extend:cost-energy-search:query')
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('cost:energyCost:export') type: this.$auth.hasPermi('extend:cost-energy-search:export')
? 'button' ? 'button'
: '', : '',
btnName: '导出', btnName: '导出',
@@ -111,9 +113,6 @@ 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,6 +32,7 @@ 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 = [
{ {
@@ -71,7 +72,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage,tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -80,7 +81,6 @@ export default {
}, },
tableData: [], tableData: [],
tableProps, tableProps,
tableH: this.tableHeight(260),
drawerVisible: false, drawerVisible: false,
formConfig: [ formConfig: [
{ {
@@ -116,13 +116,15 @@ export default {
defaultSelect: [], defaultSelect: [],
}, },
{ {
type: 'button', type: this.$auth.hasPermi('extend:cost-enery-auto-report:query')
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('cost:energyCostHis:export') type: this.$auth.hasPermi('extend:cost-enery-auto-report:export')
? 'button' ? 'button'
: '', : '',
btnName: '导出', btnName: '导出',
@@ -135,9 +137,6 @@ 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

@@ -53,6 +53,7 @@ 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 = [
{ {
@@ -91,7 +92,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage,tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -99,15 +100,14 @@ export default {
deleteURL: deleteCostMaterialSet, deleteURL: deleteCostMaterialSet,
}, },
tableProps, tableProps,
tableH: this.tableHeight(260),
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`cost:rawMaterialConfig:update`) this.$auth.hasPermi(`extend:cost-material-set:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi(`cost:rawMaterialConfig:delete`) this.$auth.hasPermi(`extend:cost-material-set:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
@@ -124,16 +124,22 @@ export default {
filterable: true, filterable: true,
}, },
{ {
type: 'button', type: this.$auth.hasPermi('extend:cost-material-set:query')
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: 'separate', type:
this.$auth.hasPermi('extend:cost-material-set:create') &&
this.$auth.hasPermi('extend:cost-material-set:query')
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('cost:rawMaterialConfig:create') type: this.$auth.hasPermi('extend:cost-material-set:create')
? 'button' ? 'button'
: '', : '',
btnName: '新增', btnName: '新增',
@@ -148,9 +154,6 @@ 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,6 +32,7 @@ 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 = [
{ {
@@ -66,7 +67,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage,tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -75,7 +76,6 @@ export default {
}, },
tableData: [], tableData: [],
tableProps, tableProps,
tableH: this.tableHeight(260),
drawerVisible: false, drawerVisible: false,
formConfig: [ formConfig: [
{ {
@@ -97,13 +97,15 @@ export default {
param: 'searchTime', param: 'searchTime',
}, },
{ {
type: 'button', type: this.$auth.hasPermi('extend:cost-material-search:query')
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('cost:rawMaterialCost:export') type: this.$auth.hasPermi('extend:cost-material-search:export')
? 'button' ? 'button'
: '', : '',
btnName: '导出', btnName: '导出',
@@ -116,9 +118,6 @@ 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,6 +32,7 @@ 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 = [
{ {
@@ -70,7 +71,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage,tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -79,7 +80,6 @@ export default {
}, },
tableData: [], tableData: [],
tableProps, tableProps,
tableH: this.tableHeight(260),
drawerVisible: false, drawerVisible: false,
formConfig: [ formConfig: [
{ {
@@ -115,13 +115,15 @@ export default {
defaultSelect: [], defaultSelect: [],
}, },
{ {
type: 'button', type: this.$auth.hasPermi('extend:cost-material-auto-report:query')
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('cost:rawMaterialCostHis:export') type: this.$auth.hasPermi('extend:cost-material-auto-report:export')
? 'button' ? 'button'
: '', : '',
btnName: '导出', btnName: '导出',
@@ -134,9 +136,6 @@ 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,13 +1,17 @@
<template> <template>
<div style="height: 370px;"> <div style="height: 370px">
<NotMsg v-show="notMsg" /> <NotMsg v-show="notMsg" />
<div id="numRateChart" class="num-rate-chart" style="width:900px;height:420px;" v-show='!notMsg'></div> <div
id="numRateChart"
class="num-rate-chart"
style="width: 900px; height: 420px"
v-show="!notMsg"></div>
</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],
@@ -15,65 +19,88 @@ export default {
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.$emit('emitFun')
}
} }
this.updateChart();
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 = [];
this.productline && this.productline.length > 0 && this.productline.map(item => { for (let i = 0; i < this.productline.length - 1; i++) {
if ((item.lineName).includes('D')) { // 二次循环,注意:再减去外层的循环次数,向后依次两两相互比较转换;
xData.push(item.lineName) for (let j = 0; j < this.productline.length - i - 1; j++) {
outputNum.push(item.outputNum) // 当前一个值大于后一个值
passRate.push(item.passRate?item.passRate*100:null) if (
this.productline[j].lineName.substr(
this.productline[j].lineName.length - 1,
1
) >
this.productline[j + 1].lineName.substr(
this.productline[j + 1].lineName.length - 1,
1
)
) {
// 定义变量,以赋值的形式前后交换,直到换到最小的在前面,左右再无比较,则循环结束形成排序结果
let temp = this.productline[j];
this.productline[j] = this.productline[j + 1];
this.productline[j + 1] = temp;
} }
}) }
}
this.productline &&
this.productline.length > 0 &&
this.productline.map((item) => {
if (item.lineName.includes('D')) {
xData.push(item.lineName);
outputNum.push(item.outputNum);
passRate.push(item.passRate);
}
});
if ( if (
this.chart !== null && this.chart !== null &&
this.chart !== '' && this.chart !== '' &&
this.chart !== undefined this.chart !== undefined
) { ) {
this.chart.dispose() this.chart.dispose();
} }
this.chart = echarts.init(document.getElementById('numRateChart')); this.chart = echarts.init(document.getElementById('numRateChart'));
var option = { var option = {
grid: { top: 82, right: 60, bottom: 20, left: 90 }, grid: { top: 82, right: 60, bottom: 20, left: 90 },
tooltip: { tooltip: {
trigger: "axis", trigger: 'axis',
axisPointer: { axisPointer: {
type: "shadow", type: 'shadow',
}, },
className: "num-rate-chart-tooltip" className: 'num-rate-chart-tooltip',
}, },
legend: { legend: {
itemWidth: 10, itemWidth: 10,
@@ -83,32 +110,32 @@ export default {
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: [
{ {
@@ -120,21 +147,20 @@ export default {
align: 'right', align: 'right',
}, },
axisLabel: { axisLabel: {
color: "#fff", color: '#fff',
fontSize: 12, fontSize: 12,
formatter: '{value}'
}, },
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#213259", color: '#213259',
}, },
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: "#213259a0", color: '#213259a0',
},
}, },
}
}, },
{ {
type: 'value', type: 'value',
@@ -145,24 +171,22 @@ export default {
align: 'LEFT', align: 'LEFT',
}, },
axisLabel: { axisLabel: {
color: "#fff", color: '#fff',
fontSize: 12, fontSize: 12,
formatter: () =>{ formatter: '{value}%',
return value ? '{value} %': '-'
}
}, },
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#213259", color: '#213259',
}, },
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: "#213259a0", color: '#213259a0',
},
},
}, },
}
}
], ],
series: [ series: [
{ {
@@ -171,16 +195,16 @@ export default {
tooltip: { tooltip: {
valueFormatter: function (value) { valueFormatter: function (value) {
return value; return value;
} },
}, },
barWidth: 20, barWidth: 20,
itemStyle: { itemStyle: {
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: '#5CB7FF' },
{ offset: 1, color: '#364BFE' } { offset: 1, color: '#364BFE' },
]) ]),
}, },
data: outputNum data: outputNum,
}, },
{ {
name: '良品率', name: '良品率',
@@ -189,31 +213,31 @@ export default {
tooltip: { tooltip: {
valueFormatter: function (value) { valueFormatter: function (value) {
return value ? value + '%' : '-'; return value ? value + '%' : '-';
} },
}, },
itemStyle: { itemStyle: {
color: '#FFD160' color: '#FFD160',
}, },
areaStyle: { areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#FFCB59' + "40" }, { offset: 0, color: '#FFCB59' + '40' },
{ offset: 0.5, color: '#FFCB59' + "20" }, { offset: 0.5, color: '#FFCB59' + '20' },
{ offset: 1, color: '#FFCB59' + "00" }, { offset: 1, color: '#FFCB59' + '00' },
]), ]),
}, },
lineStyle: { lineStyle: {
width: 1 width: 1,
}, },
symbol: 'circle', symbol: 'circle',
symbolSize: 5, symbolSize: 5,
data: passRate data: passRate,
} },
] ],
};
option && this.chart.setOption(option);
},
},
}; };
option && this.chart.setOption(option)
}
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.num-rate-chart { .num-rate-chart {

View File

@@ -1,9 +1,17 @@
<template> <template>
<div style="flex: 1;"> <div style="flex: 1">
<Container name="各工序缺陷汇总" size="middle" style=""> <Container
<TimePrompt class="timeShow" :timestr="timestr" /> name="各工序缺陷汇总"
<div style="padding: 5px 10px;"> size="middle"
<dv-scroll-board :config="config" style="width:575px;height:380px" ref='defectScrollBoard'/> style="">
<TimePrompt
class="timeShow"
:timestr="timestr" />
<div style="padding: 5px 10px">
<dv-scroll-board
:config="config"
style="width: 575px; height: 380px"
ref="defectScrollBoard" />
</div> </div>
</Container> </Container>
</div> </div>
@@ -11,14 +19,14 @@
<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 {
@@ -30,14 +38,23 @@ export default {
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','气泡']], //假数据
rowNum: 10 [1, 'D61', '成型', '3片', '细长泡'],
} [2, 'D62', '组合落板', '4片', '细长泡'],
} [3, 'D61', '磨边', '6片', '开口泡'],
[4, 'D63', '清洗', '5片', '结石'],
[5, 'D64', '打孔', '2片', '结石'],
[6, 'D63', '成型', '7片', '开口泡'],
[7, 'D61', '上片', '8片', '结石'],
],
// data: [],
rowNum: 10,
},
};
}, },
mounted() { mounted() {
this.timestr = switchShowTime('日') this.timestr = switchShowTime('日');
}, },
watch: { watch: {
defectSum: { defectSum: {
@@ -47,15 +64,15 @@ export default {
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 {

View File

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

View File

@@ -4,31 +4,27 @@
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH">
>
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="160" :width="160"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
<!-- 新增 --> <!-- 新增 -->
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@@ -36,9 +32,10 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="50%" width="50%">
> <add-or-update
<add-or-update ref="addOrUpdate" @successSubmit="successSubmit" /> ref="addOrUpdate"
@successSubmit="successSubmit" />
</base-dialog> </base-dialog>
<!-- 装车 --> <!-- 装车 -->
<base-dialog <base-dialog
@@ -47,73 +44,78 @@
@cancel="handleCancel2" @cancel="handleCancel2"
@confirm="handleConfirm2" @confirm="handleConfirm2"
:before-close="handleCancel2" :before-close="handleCancel2"
width="50%" width="50%">
> <loaded-page
<loaded-page ref="loadedPage" @successSubmit="successSubmit2" /> ref="loadedPage"
@successSubmit="successSubmit2" />
</base-dialog> </base-dialog>
<!-- 发货详情 --> <!-- 发货详情 -->
<delivery-log-detail ref='deliveryLogDetail' v-if='showDetail' /> <delivery-log-detail
ref="deliveryLogDetail"
v-if="showDetail" />
</div> </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: [
@@ -121,34 +123,38 @@ export default {
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' : '', type: this.$auth.hasPermi('extend:delivery-log:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
} },
], ],
// 查询参数 // 查询参数
queryParams: { queryParams: {
@@ -156,158 +162,163 @@ export default {
pageSize: 20, pageSize: 20,
orderName: '', orderName: '',
code: '', code: '',
name: '' name: '',
}, },
tableProps, tableProps,
list: [], list: [],
tableH: this.tableHeight(260),
total: 0, total: 0,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('extend:delivery-log:loaded') this.$auth.hasPermi('extend:delivery-log:loaded')
? { ? {
type: 'loaded', type: 'loaded',
btnName: '装车' btnName: '装车',
} }
: undefined, : undefined,
this.$auth.hasPermi('extend:delivery-log:detail') this.$auth.hasPermi('extend:delivery-log:detail')
? { ? {
type: 'detail', type: 'detail',
btnName: '详情' btnName: '详情',
} }
: undefined, : undefined,
this.$auth.hasPermi('extend:delivery-log:update') this.$auth.hasPermi('extend:delivery-log:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi('extend:delivery-log:delete') this.$auth.hasPermi('extend:delivery-log:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} }
: undefined : undefined,
].filter((v) => v), ].filter((v) => v),
addOrEditTitle: '', addOrEditTitle: '',
centervisible: false, centervisible: false,
centervisible2: false, centervisible2: false,
showDetail: false showDetail: false,
} };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
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) { buttonClick(val) {
if (val.btnName === 'search') { if (val.btnName === 'search') {
this.queryParams.name = val.name this.queryParams.name = val.name;
this.queryParams.orderName = val.orderName this.queryParams.orderName = val.orderName;
this.queryParams.code = val.code this.queryParams.code = val.code;
this.getList() this.getList();
} else { } else {
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init() this.$refs.addOrUpdate.init();
}) });
} }
}, },
handleClick(val) { handleClick(val) {
console.log(val) console.log(val);
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id) this.$refs.addOrUpdate.init(val.data.id);
}) });
break break;
case 'delete': case 'delete':
this.handleDelete(val.data) this.handleDelete(val.data);
break break;
case 'loaded': case 'loaded':
this.centervisible2 = true this.centervisible2 = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.loadedPage.init(val.data.id, val.data.code, val.data.orderId) this.$refs.loadedPage.init(
}) val.data.id,
break val.data.code,
val.data.orderId
);
});
break;
default: default:
this.showDetail = true this.showDetail = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data) this.$refs.deliveryLogDetail.init(val.data);
}) });
} }
}, },
// 新增 // 新增
handleCancel() { handleCancel() {
this.$refs.addOrUpdate.formClear() this.$refs.addOrUpdate.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.addOrUpdate.submitForm() this.$refs.addOrUpdate.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
// 删除 // 删除
handleDelete(val) { handleDelete(val) {
this.$modal.confirm('是否确认删除发货单名为"' + val.name + '"的数据项?').then(function() { this.$modal
return deliveryLogDelete({ id: val.id }) .confirm('是否确认删除发货单名为"' + val.name + '"的数据项?')
}).then(() => { .then(function () {
return deliveryLogDelete({ id: val.id });
})
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
}).catch(() => {}); })
.catch(() => {});
}, },
// 装车 // 装车
handleCancel2() { handleCancel2() {
this.$refs.loadedPage.formClear() this.$refs.loadedPage.formClear();
this.centervisible2 = false this.centervisible2 = false;
}, },
handleConfirm2() { handleConfirm2() {
this.$refs.loadedPage.submitForm() this.$refs.loadedPage.submitForm();
}, },
successSubmit2() { successSubmit2() {
this.handleCancel2() this.handleCancel2();
this.getList() this.getList();
} },
} },
} };
</script> </script>

View File

@@ -4,127 +4,121 @@
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH">
>
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="80" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
<!-- 详情抽屉 --> <!-- 详情抽屉 -->
<delivery-log-det-detail ref='deliveryLogDetail'/> <delivery-log-det-detail ref="deliveryLogDetail" />
</div> </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
].filter((v) => v)
} }
: undefined,
].filter((v) => v),
};
}, },
components: { DeliveryLogDetDetail }, components: { DeliveryLogDetDetail },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
}, },
methods: { methods: {
getList() { getList() {
deliveryProgressPage({...this.queryParams}).then(res => { deliveryProgressPage({ ...this.queryParams }).then((res) => {
this.list = res.data.list || [] this.list = res.data.list || [];
this.total = res.data.total || 0 this.total = res.data.total || 0;
}) });
}, },
buttonClick(val) { buttonClick(val) {
this.queryParams.orderName = val.orderName this.queryParams.orderName = val.orderName;
this.getList() this.getList();
}, },
handleClick(val) { handleClick(val) {
console.log(val) console.log(val);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.deliveryLogDetail.init(val.data) this.$refs.deliveryLogDetail.init(val.data);
}) });
} },
} },
} };
</script> </script>

View File

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

View File

@@ -1,126 +0,0 @@
<template>
<div
id="analysischartLine"
style="width: 100%"
:style="{ height: chartHeight + 'px' }"
></div>
</template>
<script>
import * as echarts from 'echarts'
import resize from '@/utils/chartMixins/resize'
export default {
name: "LineChart",
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
chartHeight: this.tableHeight(214) - 70
}
},
props: {
chartData: {
type: Array,
required: true,
default: () => {
return []
}
},
timeDim: {
type: String,
default: ''
}
},
watch: {
chartData: function () {
this.getChart()
}
},
mounted() {
window.addEventListener('resize', () => {
this.chartHeight = this.tableHeight(214) - 70
})
},
methods: {
getChart() {
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose() // 页面多次刷新会出现警告Dom已经初始化了一个实例这是销毁实例
}
this.chartDom = document.getElementById('analysischartLine')
this.chart = echarts.init(this.chartDom)
let tempArr = []
let xData = []
let yData = []
let legendData = []
if (this.chartData.length === 0) {
return false
} else {
tempArr = this.chartData[0].trendRespVOList
}
for (let k = 0; k < tempArr.length; k++) {
let time = ''
if (this.timeDim === '3') {
let year = tempArr[k].time.slice(0,4)
let weak = tempArr[k].time.slice(4,6)
time = year+' 第 '+weak+' 周'
} else {
time = tempArr[k].time
}
xData.push(time)
}
for (let i = 0; i < this.chartData.length; i++) {
let obj = {
name: this.chartData[i].objName + this.chartData[i].objCode,
type: 'line',
stack: 'Total',
data: []
}
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
let temp = this.chartData[i].trendRespVOList
for (let j = 0; j < temp.length; j++) {
let num = temp[j].useNum ? temp[j].useNum : ''
obj.data.push(num)
}
yData.push(obj)
}
var option = {
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true
},
legend: {
data: legendData,
right: '1%'
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: "45"
}
},
yAxis: {
type: 'value'
},
series: yData
};
option && this.chart.setOption(option);
}
}
}
</script>

View File

@@ -1,28 +1,47 @@
<template> <template>
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }"> <div
<el-form :inline="true" class="demo-form-inline"> class="searchBarBox divHeight"
ref="searchBarRef"
:style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form
:inline="true"
class="demo-form-inline">
<span class="blue-block"></span> <span class="blue-block"></span>
<el-form-item label="能源类型" required> <el-form-item
<el-select v-model="queryParams.energyTypeId" placeholder="请选择" style="width: 100px;" size="small"> label="能源类型"
required>
<el-select
v-model="queryParams.energyTypeId"
placeholder="请选择"
style="width: 150px"
@change="chooseType"
filterable
size="small">
<el-option <el-option
v-for="item in energyTypeList" v-for="item in energyTypeList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.labelName"
:value="item.id"> :value="item.id"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="时间维度" required> <el-form-item
<el-select v-model="queryParams.timeDim" placeholder="请选择" style="width: 80px;" size="small"> label="时间维度"
required>
<el-select
v-model="queryParams.timeDim"
placeholder="请选择"
style="width: 80px"
size="small">
<el-option <el-option
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)" v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="时间范围" required> <el-form-item
label="时间范围"
required>
<div v-show="queryParams.timeDim === '1'"> <div v-show="queryParams.timeDim === '1'">
<el-date-picker <el-date-picker
v-model="timeValue" v-model="timeValue"
@@ -36,10 +55,8 @@
popper-class="noneMinute" popper-class="noneMinute"
@change="timeSelect" @change="timeSelect"
size="small" size="small"
style='width:350px;' style="width: 350px"
:clearable="false" :clearable="false"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '2'"> <div v-show="queryParams.timeDim === '2'">
<el-date-picker <el-date-picker
@@ -52,34 +69,31 @@
:picker-options="pickerOptions" :picker-options="pickerOptions"
:clearable="false" :clearable="false"
size="small" size="small"
style='width:350px;' style="width: 350px"
@change="timeSelect" @change="timeSelect"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '3'"> <div v-show="queryParams.timeDim === '3'">
<el-date-picker <el-date-picker
v-model="weekValue1" v-model="weekValue1"
type="week" type="week"
format="yyyy 第 WW 周" format="yyyy 第 WW 周"
style='width:170px;' style="width: 170px"
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
@change="startWeek" @change="startWeek"
:clearable="false" :clearable="false"
size="small" size="small"
placeholder="选择周"> placeholder="选择周"></el-date-picker>
</el-date-picker>- -
<el-date-picker <el-date-picker
v-model="weekValue2" v-model="weekValue2"
type="week" type="week"
format="yyyy 第 WW 周" format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
style='width:170px;' style="width: 170px"
@change="endWeek" @change="endWeek"
:clearable="false" :clearable="false"
size="small" size="small"
placeholder="选择周"> placeholder="选择周"></el-date-picker>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '4'"> <div v-show="queryParams.timeDim === '4'">
<el-date-picker <el-date-picker
@@ -92,14 +106,12 @@
:clearable="false" :clearable="false"
:picker-options="pickerOptions" :picker-options="pickerOptions"
size="small" size="small"
style='width:350px;' style="width: 350px"
@change="timeSelect" @change="timeSelect"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '5'"> <div v-show="queryParams.timeDim === '5'">
<el-date-picker <el-date-picker
style='width:170px;' style="width: 170px"
v-model="yearValue1" v-model="yearValue1"
type="year" type="year"
:picker-options="pickerOptions" :picker-options="pickerOptions"
@@ -107,11 +119,10 @@
placeholder="选择年" placeholder="选择年"
@change="startYear" @change="startYear"
size="small" size="small"
:clearable="false" :clearable="false"></el-date-picker>
> -
</el-date-picker>-
<el-date-picker <el-date-picker
style='width:170px;' style="width: 170px"
v-model="yearValue2" v-model="yearValue2"
type="year" type="year"
:picker-options="pickerOptions" :picker-options="pickerOptions"
@@ -119,58 +130,99 @@
placeholder="选择年" placeholder="选择年"
@change="endYear" @change="endYear"
size="small" size="small"
:clearable="false" :clearable="false"></el-date-picker>
>
</el-date-picker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="对象维度" required> <el-form-item
<el-select v-model="queryParams.objType" placeholder="请选择" style="width: 80px;" @change="selectObjs" size="small"> v-if="energyType !== 0"
label="对象维度"
required>
<el-select
v-model="queryParams.objType"
placeholder="请选择"
style="width: 80px"
@change="selectObjs"
:disabled="energyType === 2"
size="small">
<el-option <el-option
v-for="item in getDictDatas(this.DICT_TYPE.OBJECT_TYPE)" v-for="item in getDictDatas(this.DICT_TYPE.OBJECT_TYPE)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="对象选择" required> <el-form-item
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple :multiple-limit='5' collapse-tags style="width: 200px;" size="small"> label="对象选择"
required>
<el-select
v-model="queryParams.objIds"
placeholder="请选择"
multiple
:multiple-limit="5"
collapse-tags
filterable
style="width: 200px"
size="small">
<el-option <el-option
v-for="item in objectList" v-for="item in objectList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
<span style="float: left">{{ item.name }}</span> <span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span> <span style="float: right; color: #8492a6; font-size: 13px">
{{ item.code }}
</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button> <el-button
<span class="separateStyle"></span> type="primary"
<el-button size="small" @click="resetBtn">重置</el-button> size="small"
@click="search">
查询
</el-button>
<el-button
size="small"
@click="resetBtn">
重置
</el-button>
<span
class="separateStyle"
v-hasPermi="['analysis:contrast-analysis:export']"></span>
<el-button
v-hasPermi="['analysis:contrast-analysis:export']"
type="primary"
size="small"
plain
@click="exportBtn">
导出
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'> <span
v-if="isFold"
class="foldClass"
@click="switchMode">
{{ isExpand ? '收起' : '展开' }} {{ isExpand ? '收起' : '展开' }}
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" /> <svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
</span> </span>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyTypeListAll } from "@/api/base/energyType" import { getEnergyTypeListAll } from '@/api/base/energyType';
import { getLineAll } from "@/api/base/productionLine" import { getLineAll } from '@/api/base/productionLine';
import { getWorkShopAll } from "@/api/base/workshopSection" import { getWorkShopAll } from '@/api/base/workshopSection';
import { getEquipmentAll } from "@/api/base/equipment" import { getFactoryList } from '@/api/core/base/factory';
import moment from 'moment' import moment from 'moment';
export default { export default {
name: 'searchArea', name: 'searchArea',
props: { props: {
isFold: {// 多行模式(默认否) isFold: {
// 多行模式(默认否)
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
data() { data() {
return { return {
@@ -182,8 +234,9 @@ export default {
objType: '', objType: '',
timeDim: null, timeDim: null,
startTime: null, startTime: null,
endTime: null endTime: null,
}, },
energyType: 0, //1电2非电
timeValue: [], // 最大7天只能整点 timeValue: [], // 最大7天只能整点
dateValue: [], // 最大30天 dateValue: [], // 最大30天
weekValue1: null, //最多24周 weekValue1: null, //最多24周
@@ -195,262 +248,295 @@ export default {
objectList: [], objectList: [],
pickerOptions: { pickerOptions: {
disabledDate(date) { disabledDate(date) {
return date.getTime() > Date.now() return date.getTime() > Date.now();
} },
}, },
pickerOptionsWeek: { pickerOptionsWeek: {
disabledDate(time) { disabledDate(time) {
let day = Date.now() let day = Date.now();
let limitTime = moment(day).day(-1) let limitTime = moment(day).day(-1);
return time.getTime() > new Date(limitTime).getTime() return time.getTime() > new Date(limitTime).getTime();
} },
} },
} };
}, },
mounted() { mounted() {
this.getTypeList() this.getTypeList();
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时 this.queryParams.timeDim = this.getDictDatas(
this.DICT_TYPE.TIME_DIM
)[0].value; // 默认时
}, },
methods: { methods: {
getTypeList() { getTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || [] this.energyTypeList = res.data || [];
}) });
},
// 切换能源类型
chooseType(id) {
let val;
this.energyTypeList.map((item) => {
if (item.id === id) {
val = item.name;
}
});
if (val == 1 || val == 2) {
this.energyType = 1;
this.queryParams.objType = null;
} else {
this.energyType = 2;
this.queryParams.objType = this.getDictDatas(
this.DICT_TYPE.OBJECT_TYPE
)[0].value;
}
this.selectObjs(this.queryParams.objType);
}, },
// 范围选择器 // 范围选择器
timeSelect() { timeSelect() {
switch (this.queryParams.timeDim) { switch (this.queryParams.timeDim) {
case '1': case '1':
if (!this.timeValue) { if (!this.timeValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) { if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为7天请重新选择') this.$modal.msgError('最大时间范围为7天请重新选择');
this.timeValue = [] this.timeValue = [];
} }
break break;
case '2': case '2':
if (!this.dateValue) { if (!this.dateValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) { if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为30天请重新选择') // 自动选择默认是0:00:00要求是23:59:59 this.$modal.msgError('最大时间范围为30天请重新选择'); // 自动选择默认是0:00:00要求是23:59:59
this.dateValue = [] this.dateValue = [];
} }
break break;
case '4': case '4':
if (!this.monthValue) { if (!this.monthValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) { if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24个月请重新选择')// 同理上面 this.$modal.msgError('最大时间范围为24个月请重新选择'); // 同理上面
this.monthValue = [] this.monthValue = [];
} }
break break;
default: default:
} }
}, },
// 年选择器 // 年选择器
startYear() { startYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) { if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择') this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.yearValue1 = null this.yearValue1 = null;
return false return false;
} }
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) { if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择') this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue1 = null this.yearValue1 = null;
return false return false;
} }
} }
}, },
endYear() { endYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) { if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择') this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.yearValue2 = null this.yearValue2 = null;
return false return false;
} }
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) { if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择') this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue2 = null this.yearValue2 = null;
return false return false;
} }
} }
}, },
// 周选择器 // 周选择器
startWeek() { startWeek() {
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime() let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime() let b = new Date(this.weekValue2).getTime();
if (a > b) { if (a > b) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择') this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.weekValue1 = null this.weekValue1 = null;
return false return false;
} }
if (b - a > 167 * 24 * 3600000) { if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择') this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue1 = null this.weekValue1 = null;
return false return false;
} }
} }
}, },
endWeek() { endWeek() {
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime() let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime() let b = new Date(this.weekValue2).getTime();
if (a > b) { if (a > b) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择') this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.weekValue2 = null this.weekValue2 = null;
return false return false;
} }
if (b - a > 167 * 24 * 3600000) { if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择') this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue2 = null this.weekValue2 = null;
return false return false;
} }
} }
}, },
// 对象维度 // 对象维度
selectObjs(val) { selectObjs(val) {
console.log(val) console.log(val);
switch (val) { switch (val) {
case '1': case '1':
getLineAll().then(res => { getFactoryList().then((res) => {
this.objectList = res.data || [] this.objectList = res.data || [];
this.queryParams.objIds = [] this.queryParams.objIds = [];
}) });
break; break;
case '2': case '2':
getWorkShopAll().then(res => { getLineAll().then((res) => {
this.objectList = res.data || [] this.objectList = res.data || [];
this.queryParams.objIds = [] this.queryParams.objIds = [];
}) });
break; break;
default: default:
getEquipmentAll().then(res => { getWorkShopAll().then((res) => {
this.objectList = res.data || [] this.objectList = res.data || [];
this.queryParams.objIds = [] this.queryParams.objIds = [];
}) });
} }
}, },
// 查询 // 查询
search() { search() {
if (!this.queryParams.energyTypeId) { if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型') this.$modal.msgError('请选择能源类型');
return false return false;
} }
if (!this.queryParams.timeDim) { if (!this.queryParams.timeDim) {
this.$modal.msgError('请选择时间维度') this.$modal.msgError('请选择时间维度');
return false return false;
} }
switch (this.queryParams.timeDim) { switch (this.queryParams.timeDim) {
case '1': case '1':
if (this.timeValue && this.timeValue.length > 0) { if (this.timeValue && this.timeValue.length > 0) {
this.queryParams.startTime = this.timeValue[0] this.queryParams.startTime = this.timeValue[0];
this.queryParams.endTime = this.timeValue[1] // 不用转 this.queryParams.endTime = this.timeValue[1]; // 不用转
} else { } else {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
break break;
case '2': case '2':
if (this.dateValue.length > 0) { if (this.dateValue.length > 0) {
this.queryParams.startTime = this.dateValue[0] this.queryParams.startTime = this.dateValue[0];
this.queryParams.endTime = this.dateValue[1] + 86399000 // 转为23:59:59 this.queryParams.endTime = this.dateValue[1] + 86399000; // 转为23:59:59
} else { } else {
this.$modal.msgError('日范围不能为空') this.$modal.msgError('日范围不能为空');
return false return false;
} }
break break;
case '3': case '3':
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00' let a =
let b = moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59' moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00';
this.queryParams.startTime = new Date(a).getTime() let b =
this.queryParams.endTime = new Date(b).getTime() moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59';
this.queryParams.startTime = new Date(a).getTime();
this.queryParams.endTime = new Date(b).getTime();
} else { } else {
this.$modal.msgError('周范围不能为空') this.$modal.msgError('周范围不能为空');
return false return false;
} }
break break;
case '4': // 转为本月最后一天的最后一秒 case '4': // 转为本月最后一天的最后一秒
if (this.monthValue.length > 0) { if (this.monthValue.length > 0) {
this.queryParams.startTime = this.monthValue[0] this.queryParams.startTime = this.monthValue[0];
this.queryParams.endTime = this.transformTime(this.monthValue[1]) this.queryParams.endTime = this.transformTime(this.monthValue[1]);
} else { } else {
this.$modal.msgError('月范围不能为空') this.$modal.msgError('月范围不能为空');
return false return false;
} }
break break;
default: //本年最后一天 default: //本年最后一天
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 < this.yearValue1) { if (this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间') this.$modal.msgError('结束时间不能早于开始时间');
return false return false;
} else { } else {
this.queryParams.startTime = this.yearValue1 this.queryParams.startTime = this.yearValue1;
this.queryParams.endTime = this.transformYear(this.yearValue2) this.queryParams.endTime = this.transformYear(this.yearValue2);
} }
} else { } else {
this.$modal.msgError('年范围不能为空') this.$modal.msgError('年范围不能为空');
return false return false;
} }
} }
if (!this.queryParams.objType) { if (!this.queryParams.objType) {
this.$modal.msgError('请选择对象维度') this.$modal.msgError('请选择对象维度');
return false return false;
} }
if (this.queryParams.objIds.length === 0) { if (this.queryParams.objIds.length === 0) {
this.$modal.msgError('请选择对象') this.$modal.msgError('请选择对象');
return false return false;
} }
this.queryParams.startTime = this.queryParams.startTime + '' this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '' this.queryParams.endTime = this.queryParams.endTime + '';
console.log(this.queryParams) console.log(this.queryParams);
this.$emit('submit', this.queryParams) this.$emit('submit', this.queryParams);
}, },
resetBtn() { resetBtn() {
this.queryParams.energyTypeId = null this.queryParams.energyTypeId = null;
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时 this.queryParams.timeDim = this.getDictDatas(
this.queryParams.objIds = [] this.DICT_TYPE.TIME_DIM
this.queryParams.objType = '' )[0].value; // 默认时
this.timeValue = [] this.queryParams.objIds = [];
this.dateValue = [] this.queryParams.objType = '';
this.weekValue1 = null this.timeValue = [];
this.weekValue2 = null this.dateValue = [];
this.monthValue = [] this.weekValue1 = null;
this.yearValue1 = null this.weekValue2 = null;
this.yearValue2 = null this.monthValue = [];
this.yearValue1 = null;
this.yearValue2 = null;
}, },
transformTime(timeStamp) {// 本月最后一天 // 导出
let year = moment(timeStamp).format('YYYY') exportBtn() {
let month = moment(timeStamp).format('MM') this.$emit('export');
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
let value = new Date(newData).getTime()
return value
}, },
transformYear(timeStamp) {// 本年最后一天 transformTime(timeStamp) {
let year = moment(timeStamp).format('YYYY') // 本月最后一天
let newData = year+'-12-31 23:59:59' let year = moment(timeStamp).format('YYYY');
let value = new Date(newData).getTime() let month = moment(timeStamp).format('MM');
return value let newData =
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
let value = new Date(newData).getTime();
return value;
}, },
switchMode() {// 展开和收起切换 transformYear(timeStamp) {
this.isExpand = !this.isExpand // 本年最后一天
const element = this.$refs.searchBarRef let year = moment(timeStamp).format('YYYY');
let newData = year + '-12-31 23:59:59';
let value = new Date(newData).getTime();
return value;
},
switchMode() {
// 展开和收起切换
this.isExpand = !this.isExpand;
const element = this.$refs.searchBarRef;
if (this.isExpand) { if (this.isExpand) {
element.classList.remove('divHeight') element.classList.remove('divHeight');
} else { } else {
element.classList.add('divHeight') element.classList.add('divHeight');
}
}
}
} }
},
},
};
</script> </script>
<style lang='scss'> <style lang='scss'>
/* 时间整点 */ /* 时间整点 */
@@ -463,11 +549,11 @@ export default {
.demo-form-inline { .demo-form-inline {
.el-date-editor .el-range__icon { .el-date-editor .el-range__icon {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
.el-input__prefix .el-icon-date { .el-input__prefix .el-icon-date {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
} }
</style> </style>
@@ -477,11 +563,15 @@ export default {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 16px; height: 16px;
background-color: #0B58FF; background-color: #0b58ff;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 12px; margin-top: 12px;
} }
.el-form-item {
margin-right: 10px;
margin-bottom: 4px;
}
} }
.searchBarBox .foldClass { .searchBarBox .foldClass {
position: absolute; position: absolute;
@@ -489,7 +579,7 @@ export default {
right: 0; right: 0;
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
color:#0B58FF; color: #0b58ff;
} }
.searchBarBox .foldClass .iconfont { .searchBarBox .foldClass .iconfont {
font-size: 14px; font-size: 14px;
@@ -502,7 +592,7 @@ export default {
display: inline-block; display: inline-block;
width: 1px; width: 1px;
height: 24px; height: 24px;
background: #E8E8E8; background: #e8e8e8;
vertical-align: middle; vertical-align: middle;
margin: 0 10px; margin: 0 10px;
} }

View File

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

View File

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

View File

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

View File

@@ -2,44 +2,43 @@
<div <div
id="analysischartLine" id="analysischartLine"
style="width: 100%" style="width: 100%"
:style="{ height: chartHeight + 'px' }" :style="{ height: chartHeight + 'px' }"></div>
></div>
</template> </template>
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts';
import resize from '@/utils/chartMixins/resize' import resize from '@/utils/chartMixins/resize';
export default { export default {
name: "LineChart", name: 'LineChart',
mixins: [resize], mixins: [resize],
data() { data() {
return { return {
chartDom: '', chartDom: '',
chart: '', chart: '',
chartHeight: this.tableHeight(214) - 70 chartHeight: this.tableHeight(314),
} };
}, },
props: { props: {
chartData: { chartData: {
type: Array, type: Array,
required: true, required: true,
default: () => { default: () => {
return [] return [];
} },
}, },
timeDim: { timeDim: {
type: String, type: String,
default: '' default: '',
} },
}, },
watch: { watch: {
chartData: function () { chartData: function () {
this.getChart() this.getChart();
} },
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.chartHeight = this.tableHeight(214) - 70 this.chartHeight = this.tableHeight(314);
}) });
}, },
methods: { methods: {
getChart() { getChart() {
@@ -48,23 +47,23 @@ export default {
this.chart !== '' && this.chart !== '' &&
this.chart !== undefined this.chart !== undefined
) { ) {
this.chart.dispose() // 页面多次刷新会出现警告Dom已经初始化了一个实例这是销毁实例 this.chart.dispose(); // 页面多次刷新会出现警告Dom已经初始化了一个实例这是销毁实例
} }
this.chartDom = document.getElementById('analysischartLine') this.chartDom = document.getElementById('analysischartLine');
this.chart = echarts.init(this.chartDom) this.chart = echarts.init(this.chartDom);
let xData = [] let xData = [];
let yData = [] let yData = [];
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
let time = "" let time = '';
if (this.timeDim === '3') { if (this.timeDim === '3') {
let year = this.chartData[i].time.slice(0,4) let year = this.chartData[i].time.slice(0, 4);
let weak = this.chartData[i].time.slice(4,6) let weak = this.chartData[i].time.slice(4, 6);
time = year+' 第 '+weak+' 周' time = year + ' 第 ' + weak + ' 周';
} else { } else {
time = this.chartData[i].time time = this.chartData[i].time;
} }
xData.push(time) xData.push(time);
yData.push(this.chartData[i].useNum) yData.push(this.chartData[i].useNum);
} }
var option = { var option = {
@@ -76,28 +75,28 @@ export default {
left: '4%', left: '4%',
right: '1%', right: '1%',
bottom: '1%', bottom: '1%',
containLabel: true containLabel: true,
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: xData, data: xData,
axisLabel: { axisLabel: {
rotate: "45" rotate: '45',
} },
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
}, },
series: [ series: [
{ {
data: yData, data: yData,
type: 'line' type: 'line',
} },
] ],
}; };
option && this.chart.setOption(option); option && this.chart.setOption(option);
} },
} },
} };
</script> </script>

View File

@@ -1,38 +1,79 @@
<template> <template>
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }"> <div
<el-form :inline="true" class="demo-form-inline"> class="searchBarBox divHeight"
ref="searchBarRef"
:style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form
:inline="true"
class="demo-form-inline">
<span class="blue-block"></span> <span class="blue-block"></span>
<el-form-item label="能源类型" required> <el-form-item
<el-select v-model="queryParams.energyTypeId" placeholder="请选择" style="width: 100px;" size="small"> label="能源类型"
required>
<el-select
v-model="queryParams.energyTypeId"
placeholder="请选择"
size="small"
@change="chooseType"
filterable
style="width: 100%">
<el-option <el-option
v-for="item in energyTypeList" v-for="item in energyTypeList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.labelName"
:value="item.id"> :value="item.id"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="对象选择" required> <el-form-item
v-if="energyType === 1"
label="对象选择"
required>
<el-cascader <el-cascader
v-model="objArr" v-model="objArr"
:options="objList" :options="objList"
:show-all-levels="false"
:props="{ checkStrictly: true, value: 'id', label: 'name' }" :props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
size="small" size="small"
@change="changeLine"
clearable></el-cascader> clearable></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="时间维度" required> <el-form-item
<el-select v-model="queryParams.timeDim" placeholder="请选择" style="width: 80px;" size="small"> v-if="energyType === 2"
label="对象选择"
required>
<el-select
v-model="objId"
placeholder="请选择"
style="width: 250px"
filterable
size="small">
<el-option
v-for="item in objList"
:key="item.id"
:label="item.name"
:value="item.id"
:clearable="false"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="时间维度"
required>
<el-select
v-model="queryParams.timeDim"
placeholder="请选择"
style="width: 80px"
size="small">
<el-option <el-option
v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)" v-for="item in getDictDatas(this.DICT_TYPE.TIME_DIM)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
size="small"> size="small"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="时间范围" required> <el-form-item
label="时间范围"
required>
<div v-show="queryParams.timeDim === '1'"> <div v-show="queryParams.timeDim === '1'">
<el-date-picker <el-date-picker
v-model="timeValue" v-model="timeValue"
@@ -46,9 +87,7 @@
popper-class="noneMinute" popper-class="noneMinute"
@change="timeSelect" @change="timeSelect"
size="small" size="small"
style='width:350px;' style="width: 350px"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '2'"> <div v-show="queryParams.timeDim === '2'">
<el-date-picker <el-date-picker
@@ -61,31 +100,28 @@
:picker-options="pickerOptions" :picker-options="pickerOptions"
@change="timeSelect" @change="timeSelect"
size="small" size="small"
style='width:350px;' style="width: 350px"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '3'"> <div v-show="queryParams.timeDim === '3'">
<el-date-picker <el-date-picker
v-model="weekValue1" v-model="weekValue1"
type="week" type="week"
format="yyyy 第 WW 周" format="yyyy 第 WW 周"
style='width:170px;' style="width: 170px"
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
@change="startWeek" @change="startWeek"
size="small" size="small"
placeholder="选择周"> placeholder="选择周"></el-date-picker>
</el-date-picker>- -
<el-date-picker <el-date-picker
v-model="weekValue2" v-model="weekValue2"
type="week" type="week"
format="yyyy 第 WW 周" format="yyyy 第 WW 周"
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
style='width:170px;' style="width: 170px"
@change="endWeek" @change="endWeek"
size="small" size="small"
placeholder="选择周"> placeholder="选择周"></el-date-picker>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '4'"> <div v-show="queryParams.timeDim === '4'">
<el-date-picker <el-date-picker
@@ -97,59 +133,77 @@
value-format="timestamp" value-format="timestamp"
:picker-options="pickerOptions" :picker-options="pickerOptions"
size="small" size="small"
style='width:350px;' style="width: 350px"
@change="timeSelect" @change="timeSelect"></el-date-picker>
>
</el-date-picker>
</div> </div>
<div v-show="queryParams.timeDim === '5'"> <div v-show="queryParams.timeDim === '5'">
<el-date-picker <el-date-picker
style='width:170px;' style="width: 170px"
v-model="yearValue1" v-model="yearValue1"
type="year" type="year"
:picker-options="pickerOptions" :picker-options="pickerOptions"
value-format="timestamp" value-format="timestamp"
placeholder="选择年" placeholder="选择年"
size="small" size="small"
@change="startYear" @change="startYear"></el-date-picker>
> -
</el-date-picker>-
<el-date-picker <el-date-picker
style='width:170px;' style="width: 170px"
v-model="yearValue2" v-model="yearValue2"
type="year" type="year"
:picker-options="pickerOptions" :picker-options="pickerOptions"
value-format="timestamp" value-format="timestamp"
placeholder="选择年" placeholder="选择年"
size="small" size="small"
@change="endYear" @change="endYear"></el-date-picker>
>
</el-date-picker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button> <el-button
<span class="separateStyle"></span> type="primary"
<el-button size="small" @click="resetBtn">重置</el-button> size="small"
@click="handBtn('search')">
查询
</el-button>
<el-button
size="small"
@click="resetBtn">
重置
</el-button>
<span
class="separateStyle"
v-hasPermi="['analysis:trend-analysis:export']"></span>
<el-button
v-hasPermi="['analysis:trend-analysis:export']"
type="primary"
size="small"
plain
@click="handBtn('exportBtn')">
导出
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'> <span
v-if="isFold"
class="foldClass"
@click="switchMode">
{{ isExpand ? '收起' : '展开' }} {{ isExpand ? '收起' : '展开' }}
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" /> <svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
</span> </span>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyTypeListAll } from "@/api/base/energyType" import { getTree } from '@/api/analysis/energyAnalysis';
import { getTree } from '@/api/base/factory' import { getEnergyTypeListAll } from '@/api/base/energyType';
import moment from 'moment' import moment from 'moment';
export default { export default {
name: 'searchArea', name: 'searchArea',
props: { props: {
isFold: {// 多行模式(默认否) isFold: {
// 多行模式(默认否)
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
data() { data() {
return { return {
@@ -160,8 +214,13 @@ export default {
objId: null, objId: null,
timeDim: null, timeDim: null,
startTime: null, startTime: null,
endTime: null endTime: null,
objType: 1, //1工厂2产线3工段
}, },
objId: null,
objType: 1, //1工厂2产线3工段,非电使用
energyTypeList: [],
energyType: 0, //1电2非电
objArr: [], objArr: [],
timeValue: [], // 最大7天只能整点 timeValue: [], // 最大7天只能整点
dateValue: [], // 最大30天 dateValue: [], // 最大30天
@@ -170,248 +229,300 @@ export default {
monthValue: [], //最多24月 monthValue: [], //最多24月
yearValue1: null, //最多10年 yearValue1: null, //最多10年
yearValue2: null, yearValue2: null,
energyTypeList: [],
objList: [], objList: [],
pickerOptions: { pickerOptions: {
disabledDate(date) { disabledDate(date) {
return date.getTime() > Date.now() return date.getTime() > Date.now();
} },
}, },
pickerOptionsWeek: { pickerOptionsWeek: {
disabledDate(time) { disabledDate(time) {
let day = Date.now() let day = Date.now();
let limitTime = moment(day).day(-1) let limitTime = moment(day).day(-1);
return time.getTime() > new Date(limitTime).getTime() return time.getTime() > new Date(limitTime).getTime();
} },
} },
} };
}, },
mounted() { mounted() {
this.getTypeList() this.getEnergyList();
this.getObjTree() this.getObjTree();
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时 this.queryParams.timeDim = this.getDictDatas(
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000] this.DICT_TYPE.TIME_DIM
)[0].value; // 默认时
this.timeValue = [
moment().startOf('day'),
moment().endOf('day') - 59 * 61 * 1000,
];
}, },
methods: { methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || []
})
},
getObjTree() { getObjTree() {
getTree().then(res => { getTree().then((res) => {
this.objList = res.data || [] this.objList = res.data || [];
}) if (this.objList.length > 0) {
this.objId = this.objList[0].id;
}
});
},
// 获取能源类型
getEnergyList() {
getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || [];
});
},
// 切换能源类型
chooseType(id) {
let val;
this.energyTypeList.map((item) => {
if (item.id === id) {
val = item.name;
}
});
if (val == 1 || val == 2) {
this.energyType = 1;
} else {
this.energyType = 2;
}
},
// 选择工厂/产线/单元
changeLine(val) {
this.objType = val.length || 0;
}, },
// 范围选择器 // 范围选择器
timeSelect() { timeSelect() {
switch (this.queryParams.timeDim) { switch (this.queryParams.timeDim) {
case '1': case '1':
if (!this.timeValue) { if (!this.timeValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) { if (this.timeValue[1] - this.timeValue[0] > 7 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为7天请重新选择') this.$modal.msgError('最大时间范围为7天请重新选择');
this.timeValue = [] this.timeValue = [];
} }
break break;
case '2': case '2':
if (!this.dateValue) { if (!this.dateValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) { if (this.dateValue[1] - this.dateValue[0] > 29 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为30天请重新选择') // 自动选择默认是0:00:00要求是23:59:59 this.$modal.msgError('最大时间范围为30天请重新选择'); // 自动选择默认是0:00:00要求是23:59:59
this.dateValue = [] this.dateValue = [];
} }
break break;
case '4': case '4':
if (!this.monthValue) { if (!this.monthValue) {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) { if (this.monthValue[1] - this.monthValue[0] > 729 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24个月请重新选择')// 同理上面 this.$modal.msgError('最大时间范围为24个月请重新选择'); // 同理上面
this.monthValue = [] this.monthValue = [];
} }
break break;
default: default:
} }
}, },
// 年选择器 // 年选择器
startYear() { startYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) { if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择') this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.yearValue1 = null this.yearValue1 = null;
return false return false;
} }
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) { if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择') this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue1 = null this.yearValue1 = null;
return false return false;
} }
} }
}, },
endYear() { endYear() {
if (this.yearValue2 && this.yearValue2 < this.yearValue1) { if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择') this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.yearValue2 = null this.yearValue2 = null;
return false return false;
} }
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) { if (this.yearValue2 - this.yearValue1 > 10 * 365 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为10年请重新选择') this.$modal.msgError('最大时间范围为10年请重新选择');
this.yearValue2 = null this.yearValue2 = null;
return false return false;
} }
} }
}, },
// 周选择器 // 周选择器
startWeek() { startWeek() {
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime() let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime() let b = new Date(this.weekValue2).getTime();
if (a > b) { if (a > b) {
this.$modal.msgError('开始时间不能晚于结束时间,请重新选择') this.$modal.msgError('开始时间不能晚于结束时间,请重新选择');
this.weekValue1 = null this.weekValue1 = null;
return false return false;
} }
if (b - a > 167 * 24 * 3600000) { if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择') this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue1 = null this.weekValue1 = null;
return false return false;
} }
} }
}, },
endWeek() { endWeek() {
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = new Date(this.weekValue1).getTime() let a = new Date(this.weekValue1).getTime();
let b = new Date(this.weekValue2).getTime() let b = new Date(this.weekValue2).getTime();
if (a > b) { if (a > b) {
this.$modal.msgError('结束时间不能早于开始时间,请重新选择') this.$modal.msgError('结束时间不能早于开始时间,请重新选择');
this.weekValue2 = null this.weekValue2 = null;
return false return false;
} }
if (b - a > 167 * 24 * 3600000) { if (b - a > 167 * 24 * 3600000) {
this.$modal.msgError('最大时间范围为24周请重新选择') this.$modal.msgError('最大时间范围为24周请重新选择');
this.weekValue2 = null this.weekValue2 = null;
return false return false;
} }
} }
}, },
// 查询 // 查询
search() { handBtn(val) {
if (!this.queryParams.energyTypeId) { if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型') this.$modal.msgError('请选择能源类型');
return false return false;
} }
if (this.energyType == 1) {
if (this.objArr.length === 0) { if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象') this.$modal.msgError('请选择对象');
return false return false;
} else { } else {
this.queryParams.objId = this.objArr[this.objArr.length-1] this.queryParams.objId = this.objArr[this.objArr.length - 1];
this.queryParams.objType = this.objType;
} }
} else if (this.energyType == 2) {
if (!this.objId) {
this.$modal.msgError('请选择对象');
return false;
} else {
this.queryParams.objId = this.objId;
this.queryParams.objType = 1;
}
}
if (!this.queryParams.timeDim) { if (!this.queryParams.timeDim) {
this.$modal.msgError('请选择时间维度') this.$modal.msgError('请选择时间维度');
return false return false;
} }
switch (this.queryParams.timeDim) { switch (this.queryParams.timeDim) {
case '1': case '1':
if (this.timeValue && this.timeValue.length > 0) { if (this.timeValue && this.timeValue.length > 0) {
this.queryParams.startTime = this.timeValue[0] this.queryParams.startTime = this.timeValue[0];
this.queryParams.endTime = this.timeValue[1] // 不用转 this.queryParams.endTime = this.timeValue[1]; // 不用转
} else { } else {
this.$modal.msgError('时间范围不能为空') this.$modal.msgError('时间范围不能为空');
return false return false;
} }
break break;
case '2': case '2':
if (this.dateValue && this.dateValue.length > 0) { if (this.dateValue && this.dateValue.length > 0) {
this.queryParams.startTime = this.dateValue[0] this.queryParams.startTime = this.dateValue[0];
this.queryParams.endTime = this.dateValue[1] + 86399000 // 转为23:59:59 this.queryParams.endTime = this.dateValue[1] + 86399000; // 转为23:59:59
} else { } else {
this.$modal.msgError('日范围不能为空') this.$modal.msgError('日范围不能为空');
return false return false;
} }
break break;
case '3': case '3':
if (this.weekValue1 && this.weekValue2) { if (this.weekValue1 && this.weekValue2) {
let a = moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00' let a =
let b = moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59' moment(this.weekValue1).day(0).format('YYYY-MM-DD') + ' 00:00:00';
this.queryParams.startTime = new Date(a).getTime() let b =
this.queryParams.endTime = new Date(b).getTime() moment(this.weekValue2).day(6).format('YYYY-MM-DD') + ' 23:59:59';
this.queryParams.startTime = new Date(a).getTime();
this.queryParams.endTime = new Date(b).getTime();
} else { } else {
this.$modal.msgError('周范围不能为空') this.$modal.msgError('周范围不能为空');
return false return false;
} }
break break;
case '4': // 转为本月最后一天的最后一秒 case '4': // 转为本月最后一天的最后一秒
if (this.monthValue && this.monthValue.length > 0) { if (this.monthValue && this.monthValue.length > 0) {
this.queryParams.startTime = this.monthValue[0] this.queryParams.startTime = this.monthValue[0];
this.queryParams.endTime = this.transformTime(this.monthValue[1]) this.queryParams.endTime = this.transformTime(this.monthValue[1]);
} else { } else {
this.$modal.msgError('月范围不能为空') this.$modal.msgError('月范围不能为空');
return false return false;
} }
break break;
default: //本年最后一天 default: //本年最后一天
if (this.yearValue1 && this.yearValue2) { if (this.yearValue1 && this.yearValue2) {
if (this.yearValue2 < this.yearValue1) { if (this.yearValue2 < this.yearValue1) {
this.$modal.msgError('结束时间不能早于开始时间') this.$modal.msgError('结束时间不能早于开始时间');
return false return false;
} else { } else {
this.queryParams.startTime = this.yearValue1 this.queryParams.startTime = this.yearValue1;
this.queryParams.endTime = this.transformYear(this.yearValue2) this.queryParams.endTime = this.transformYear(this.yearValue2);
} }
} else { } else {
this.$modal.msgError('年范围不能为空') this.$modal.msgError('年范围不能为空');
return false return false;
} }
} }
this.queryParams.startTime = this.queryParams.startTime + '' this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '' this.queryParams.endTime = this.queryParams.endTime + '';
this.$emit('submit', this.queryParams) if (val === 'search') {
this.$emit('submit', this.queryParams);
} else {
this.$emit('export', this.queryParams);
}
}, },
// 重置 // 重置
resetBtn() { resetBtn() {
this.queryParams.energyTypeId = null this.queryParams.energyTypeId = null;
this.queryParams.objId = null this.energyType = 0;
this.objArr = [] this.queryParams.objId = null;
this.queryParams.timeDim = this.getDictDatas(this.DICT_TYPE.TIME_DIM)[0].value // 默认时 this.objId = null;
this.timeValue = [moment().startOf('day'), moment().endOf('day')-59*61*1000] this.objType = 1;
this.objArr = [];
this.queryParams.timeDim = this.getDictDatas(
this.DICT_TYPE.TIME_DIM
)[0].value; // 默认时
this.timeValue = [
moment().startOf('day'),
moment().endOf('day') - 59 * 61 * 1000,
];
}, },
transformTime(timeStamp) {// 本月最后一天 transformTime(timeStamp) {
let year = moment(timeStamp).format('YYYY') // 本月最后一天
let month = moment(timeStamp).format('MM') let year = moment(timeStamp).format('YYYY');
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59' let month = moment(timeStamp).format('MM');
let value = new Date(newData).getTime() let newData =
return value moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
let value = new Date(newData).getTime();
return value;
}, },
transformYear(timeStamp) {// 本年最后一天 transformYear(timeStamp) {
let year = moment(timeStamp).format('YYYY') // 本年最后一天
let newData = year+'-12-31 23:59:59' let year = moment(timeStamp).format('YYYY');
let value = new Date(newData).getTime() let newData = year + '-12-31 23:59:59';
return value let value = new Date(newData).getTime();
return value;
}, },
switchMode() {// 展开和收起切换 switchMode() {
this.isExpand = !this.isExpand // 展开和收起切换
const element = this.$refs.searchBarRef this.isExpand = !this.isExpand;
const element = this.$refs.searchBarRef;
if (this.isExpand) { if (this.isExpand) {
element.classList.remove('divHeight') element.classList.remove('divHeight');
} else { } else {
element.classList.add('divHeight') element.classList.add('divHeight');
}
}
}
} }
},
},
};
</script> </script>
<style lang='scss'> <style lang='scss'>
/* 级联选择器 */
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
}
/* 时间整点 */ /* 时间整点 */
.noneMinute .el-time-spinner__wrapper { .noneMinute .el-time-spinner__wrapper {
width: 100%; width: 100%;
@@ -422,11 +533,11 @@ export default {
.demo-form-inline { .demo-form-inline {
.el-date-editor .el-range__icon { .el-date-editor .el-range__icon {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
.el-input__prefix .el-icon-date { .el-input__prefix .el-icon-date {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
} }
</style> </style>
@@ -436,11 +547,15 @@ export default {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 16px; height: 16px;
background-color: #0B58FF; background-color: #0b58ff;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 12px; margin-top: 12px;
} }
.el-form-item {
margin-right: 10px;
margin-bottom: 4px;
}
} }
.searchBarBox .foldClass { .searchBarBox .foldClass {
position: absolute; position: absolute;
@@ -448,7 +563,7 @@ export default {
right: 0; right: 0;
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
color:#0B58FF; color: #0b58ff;
} }
.searchBarBox .foldClass .iconfont { .searchBarBox .foldClass .iconfont {
font-size: 14px; font-size: 14px;
@@ -461,7 +576,7 @@ export default {
display: inline-block; display: inline-block;
width: 1px; width: 1px;
height: 24px; height: 24px;
background: #E8E8E8; background: #e8e8e8;
vertical-align: middle; vertical-align: middle;
margin: 0 10px; margin: 0 10px;
} }

View File

@@ -1,94 +1,113 @@
<template> <template>
<div class="app-container trendAnalysisBox" id="trendAnalysisBox"> <div
class="app-container trendAnalysisBox"
id="trendAnalysisBox">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/> <search-area
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'> :isFold="isFold"
<el-tab-pane label="柱状图" name="bar"> @submit="getList"
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim"/> @export="exportExl" />
</el-tab-pane> <div v-show="chartData.length">
<el-tab-pane label="折线图" name="line"> <base-table
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/> :table-props="tableProps"
</el-tab-pane> :table-data="list"
</el-tabs> class="trend-out-table" />
<line-chart
ref="analysisLineChart"
:chartData="chartData"
:timeDim="timeDim" />
</div>
<!-- 没有数据 --> <!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div> <div
class="no-data-bg"
v-show="!chartData.length"></div>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyTrend } from "@/api/analysis/energyAnalysis" import { getEnergyTrend, exportTrend } from '@/api/analysis/energyAnalysis';
import SearchArea from "./components/searchArea" import SearchArea from './components/searchArea';
import BarChart from "./components/barChart" import LineChart from './components/lineChart';
import LineChart from "./components/lineChart"
// import moment from 'moment' // import moment from 'moment'
export default { export default {
name: 'TrendAnalysis', name: 'TrendAnalysis',
components: { SearchArea, BarChart, LineChart }, components: { SearchArea, LineChart },
data() { data() {
return { return {
isFold: false, isFold: false,
activeName: 'bar',
chartData: [], chartData: [],
timeDim: '' timeDim: '',
} tableProps: [],
list: [],
};
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260);
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263) this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
}) });
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263) this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
}, },
methods: { methods: {
getList(params) { getList(params) {
this.timeDim = params.timeDim this.timeDim = params.timeDim;
getEnergyTrend({ ...params }).then((res) => { getEnergyTrend({ ...params }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.chartData = res.data this.getTableList(res.data || []);
this.chartData = res.data || [];
} else { } else {
this.chartData = [] this.chartData = [];
} }
}) });
}, },
switchChart() { getTableList(arr) {
if (this.activeName === 'bar') { this.tableProps = [];
this.$nextTick((res) => { this.list = [];
this.$refs.analysisBarChart.getChart() let tempX = [];
}) let listObj = { useNum: '消耗量' }; // 数据
} else { for (let i = 0; i < arr.length; i++) {
this.$nextTick((res) => { let obj = {};
this.$refs.analysisLineChart.getChart() obj.prop = arr[i].time;
}) obj.label = arr[i].time;
} obj.minWidth = 100;
} tempX.push(obj);
} listObj[arr[i].time] = arr[i].useNum || null;
} }
this.tableProps = [{ prop: 'useNum', label: '时间' }].concat(tempX);
this.list.push(listObj);
},
// 导出excel
exportExl(params) {
exportTrend({ ...params }).then((res) => {
// let fileName = '';
// const contentDisposition = res.headers['content-disposition'];
// if (contentDisposition) {
// fileName = decodeURIComponent(
// contentDisposition.slice(
// contentDisposition.indexOf('filename=') + 9
// )
// );
// }
const blob = new Blob([res.data]);
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = (e) => {
const a = document.createElement('a');
a.download = '走势分析';
a.href = e.target.result;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
this.$message.success('导出成功');
};
});
},
},
};
</script> </script>
<style lang='scss'> <style lang='scss'>
.trendAnalysisBox { .trendAnalysisBox {
.el-tabs__nav::after { .trend-out-table {
content: ""; margin-bottom: 15px;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
/* z-index: 1; */
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
} }
} }
</style> </style>

View File

@@ -1,37 +1,40 @@
<template> <template>
<div id="analysischartLine" style="width: 100%;height: 100%;"></div> <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(214) - 70 chartHeight: this.tableHeight(250) / 2,
} };
}, },
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(214) - 70 this.chartHeight = this.tableHeight(250) / 2;
}) });
}, },
methods: { methods: {
getChart() { getChart() {
@@ -40,63 +43,77 @@ export default {
this.chart !== '' && this.chart !== '' &&
this.chart !== undefined this.chart !== undefined
) { ) {
this.chart.dispose() // 页面多次刷新会出现警告Dom已经初始化了一个实例这是销毁实例 this.chart.dispose(); // 页面多次刷新会出现警告Dom已经初始化了一个实例这是销毁实例
} }
this.chartDom = document.getElementById('analysischartLine') this.chartDom = document.getElementById('analysischartLine');
this.chart = echarts.init(this.chartDom) this.chart = echarts.init(this.chartDom);
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 (keys[k].indexOf(arr[j] + '_上年同期') > -1 || keys[k].indexOf(arr[j] + '_能源消耗') > -1) { if (
keys[k].indexOf(arr[j] + '_上年同期') > -1 ||
keys[k].indexOf(arr[j] + '_能源消耗') > -1
) {
let obj = { let obj = {
name: '', name: '',
type: 'line', type: 'line',
data: [] data: [],
} };
obj.name = keys[k] obj.name = keys[k];
yData.push(obj) yData.push(obj);
} }
} }
} }
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
xData.push(this.chartData[i].time) xData.push(this.chartData[i].time);
for (let p = 0; p < yData.length; p++) { for (let p = 0; p < yData.length; p++) {
yData[p].data.push(this.chartData[i][yData[p].name]) yData[p].data.push(this.chartData[i][yData[p].name]);
} }
} }
var option = { var option = {
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF', '#FF6860', '#FF9747', '#B0EB42', '#D680FF', '#0043D2'], color: [
'#FFDC94',
'#8EF0AB',
'#63BDFF',
'#288AFF',
'#7164FF',
'#FF6860',
'#FF9747',
'#B0EB42',
'#D680FF',
'#0043D2',
],
legend: { legend: {
data: keys, data: keys,
right: '1%' right: '1%',
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis',
}, },
grid: { grid: {
left: '1%', left: '1%',
right: '1%', right: '1%',
bottom: '3%', bottom: '3%',
containLabel: true containLabel: true,
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: xData data: xData,
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
}, },
series: yData series: yData,
}; };
option && this.chart.setOption(option); option && this.chart.setOption(option);
} },
} },
} };
</script> </script>

View File

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

View File

@@ -1,31 +1,36 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-area @submit="getList" @exportD="exportData"/> <search-area
<div v-show='chartData.length'> @submit="getList"
@exportD="exportData" />
<div v-show="chartData.length">
<div class="chartTitle">同比分析图</div> <div class="chartTitle">同比分析图</div>
<div style='width: 100%;height: 400px;'> <div style="width: 100%">
<line-chart ref="analysisLineChart" :chartData="chartData"/> <line-chart
ref="analysisLineChart"
:chartData="chartData" />
</div> </div>
<!-- 表格 --> <!-- 表格 -->
<base-table <base-table
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH"
class="yoy-out-table" class="yoy-out-table" />
/>
</div> </div>
<!-- 没有数据 --> <!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div> <div
class="no-data-bg"
v-show="!chartData.length"></div>
</div> </div>
</template> </template>
<script> <script>
import { 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 },
@@ -34,98 +39,103 @@ export default {
chartData: [], chartData: [],
tableProps: [], tableProps: [],
list: [], list: [],
tableH: this.tableHeight(640) tableH: this.tableHeight(250) / 2,
} };
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(640) this.tableH = this.tableHeight(250) / 2;
}) });
}, },
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(document.querySelector(".yoy-out-table")) var wb = XLSX.utils.table_to_book(
let fileName = val.name + "同比分析.xlsx" document.querySelector('.yoy-out-table')
);
let fileName = val.name + '同比分析.xlsx';
var wbout = XLSX.write(wb, { var wbout = XLSX.write(wb, {
bookType: "xlsx", bookType: 'xlsx',
bookSST: true, bookSST: true,
type: "array" type: 'array',
}) });
try { try {
FileSaver.saveAs( FileSaver.saveAs(
new Blob([wbout], { type: "application/octet-stream" }), new Blob([wbout], { type: 'application/octet-stream' }),
fileName fileName
) );
} catch (e) { } catch (e) {
if (typeof console !== "undefined") console.log(e, wbout); if (typeof console !== 'undefined') console.log(e, wbout);
} }
return wbout return wbout;
} else { } else {
this.$modal.msgWarning("暂无数据导出") this.$modal.msgWarning('暂无数据导出');
}
}
}
} }
},
},
};
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.yoy-out-table {
margin-top: 20px;
}
.chartTitle { .chartTitle {
font-size: 16px; font-size: 16px;
color: #000; color: #000;
@@ -135,7 +145,7 @@ export default {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 18px; height: 18px;
background-color: #0B58FF; background-color: #0b58ff;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
vertical-align: bottom; vertical-align: bottom;

View File

@@ -1,63 +1,84 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"> :max-height="tableH">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn" <method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" <pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" /> @pagination="getList" />
<!-- 新增 --> <!-- 新增 -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel" <base-dialog
@confirm="handleConfirm" :before-close="handleCancel"> :dialogTitle="addOrEditTitle"
<energy-plc-add ref="energyPlc" @successSubmit="successSubmit" /> :dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-plc-add
ref="energyPlc"
@successSubmit="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc"; import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc';
// import { publicFormatter } from '@/utils/dict' import EnergyPlcAdd from './components/energyPlcAdd.vue';
import EnergyPlcAdd from './components/energyPlcAdd.vue' import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
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: [
@@ -65,65 +86,61 @@ export default {
type: 'input', type: 'input',
label: '标识名', label: '标识名',
placeholder: '标识名', placeholder: '标识名',
param: 'name' param: 'name',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc: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() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
}, },
methods: { methods: {
@@ -131,67 +148,72 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.name = val.name this.queryParams.name = val.name;
this.getList() this.getList();
break break;
default: default:
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyPlc.init() this.$refs.energyPlc.init();
}) });
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getEnergyPlcPage(this.queryParams).then(response => { getEnergyPlcPage(this.queryParams).then((response) => {
let arr = response.data.list || []; let arr = response.data.list || [];
arr && arr.map(item => { arr &&
this.collectionList.map(i => { arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) { if (item.collection === i.value) {
item.collection = i.label item.collection = i.label;
} }
}) });
}) });
this.list = arr this.list = arr;
this.total = response.data.total; this.total = response.data.total;
}); });
}, },
handleClick(val) { handleClick(val) {
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id) this.$refs.energyPlc.init(val.data.id);
}) });
this.centervisible = true this.centervisible = true;
break break;
default: default:
this.handleDelete(val.data) this.handleDelete(val.data);
} }
}, },
handleCancel() { handleCancel() {
this.$refs.energyPlc.formClear() this.$refs.energyPlc.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.energyPlc.submitForm() this.$refs.energyPlc.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function () { this.$modal
.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?')
.then(function () {
return 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,36 +1,50 @@
<template> <template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form"> <el-form
<el-form-item label="关联表名" prop="plcId"> ref="form"
<el-select v-model="form.plcId" placeholder="请选择" style="width: 100%;" filterable> :rules="rules"
label-width="100px"
:model="form">
<el-form-item
label="关联表名"
prop="plcId">
<el-select
v-model="form.plcId"
placeholder="请选择"
style="width: 100%"
filterable>
<el-option <el-option
v-for="item in plcList" v-for="item in plcList"
:key="item.id" :key="item.id"
:label="item.plcTableName" :label="item.plcTableName"
:value="item.id"> :value="item.id"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="对象" prop="bindObjectId"> <el-form-item
label="对象"
prop="bindObjectId">
<el-cascader <el-cascader
style='width: 100%;' style="width: 100%"
v-model="objIds" v-model="objIds"
:options="objList" :options="objList"
:props="{ checkStrictly: true, value: 'id', label: 'name' }" :props="{ checkStrictly: true, value: 'id', label: 'name' }"
popper-class="cascaderParent"
@change="selectObj" @change="selectObj"
clearable></el-cascader> clearable></el-cascader>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script> <script>
import { getEnergyPlcConnect, updateEnergyPlcConnect, createEnergyPlcConnect } from '@/api/base/energyPlcConnect' import {
import { getEnergyPlcAll } from '@/api/base/energyPlc' getEnergyPlcConnect,
updateEnergyPlcConnect,
createEnergyPlcConnect,
} from '@/api/base/energyPlcConnect';
import { getEnergyPlcAll } from '@/api/base/energyPlc';
export default { export default {
name: 'EnergyPlcConnectAdd', name: 'EnergyPlcConnectAdd',
props: { props: {
objList: { objList: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
}, },
data() { data() {
@@ -39,63 +53,70 @@ export default {
id: '', id: '',
plcId: '', plcId: '',
bindObjectId: '', bindObjectId: '',
bindObjectType: '' bindObjectType: '',
}, },
objIds: [], // 回显数组 objIds: [], // 回显数组
plcList: [], plcList: [],
isEdit: false, //是否是编辑 isEdit: false, //是否是编辑
rules: { rules: {
plcId: [{ required: true, message: '关联表名不能为空', trigger: 'change' }], plcId: [
bindObjectId: [{ required: true, message: '对象不能为空', trigger: 'change' }] { required: true, message: '关联表名不能为空', trigger: 'change' },
} ],
} bindObjectId: [
{ required: true, message: '对象不能为空', trigger: 'change' },
],
},
};
}, },
methods: { methods: {
init(id) { init(id) {
getEnergyPlcAll().then((res) => { getEnergyPlcAll().then((res) => {
this.plcList = res.data || [] this.plcList = res.data || [];
}) });
if (id) { if (id) {
this.isEdit = true this.isEdit = true;
this.form.id = id this.form.id = id;
getEnergyPlcConnect(id).then((res) => { getEnergyPlcConnect(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data;
this.objIds = this.changeDetSelect(this.form.bindObjectId, this.objList) this.objIds = this.changeDetSelect(
this.form.bindObjectId,
this.objList
);
} }
}) });
} else { } else {
this.isEdit = false this.isEdit = false;
this.form.id = '' this.form.id = '';
} }
}, },
// 递归处理分类回显问题 // 递归处理分类回显问题
changeDetSelect(key, treeData) { changeDetSelect(key, treeData) {
let arr = [] // 递归时操作的数组 let arr = []; // 递归时操作的数组
let returnArr = [] // 存放结果的数组 let returnArr = []; // 存放结果的数组
let depth = 0 // 定义全局层级 let depth = 0; // 定义全局层级
// 定义递归函数 // 定义递归函数
function childrenEach(childrendData, depthN) { function childrenEach(childrendData, depthN) {
for (var j = 0; j < childrendData.length; j++) { for (var j = 0; j < childrendData.length; j++) {
depth = depthN depth = depthN;
arr[depthN] = childrendData[j].id arr[depthN] = childrendData[j].id;
if (childrendData[j].id == key) { if (childrendData[j].id == key) {
returnArr = arr.slice(0, depthN + 1) returnArr = arr.slice(0, depthN + 1);
break break;
} else { } else {
if (childrendData[j].children) { if (childrendData[j].children) {
depth++ depth++;
childrenEach(childrendData[j].children, depth) childrenEach(childrendData[j].children, depth);
} }
} }
} }
return returnArr return returnArr;
} }
return childrenEach(treeData, depth) return childrenEach(treeData, depth);
}, },
selectObj(val) { selectObj(val) {
this.form.bindObjectId = val[val.length-1] this.form.bindObjectId = val[val.length - 1];
this.form.bindObjectType = val.length-1 this.form.bindObjectType = val.length - 1;
}, },
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
@@ -104,36 +125,31 @@ export default {
// 编辑 // 编辑
updateEnergyPlcConnect({ ...this.form }).then((res) => { updateEnergyPlcConnect({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} else { } else {
createEnergyPlcConnect({ ...this.form }).then((res) => { createEnergyPlcConnect({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} }
} else { } else {
return false return false;
} }
}) });
}, },
formClear() { formClear() {
this.form.id = '' this.form.id = '';
this.form.plcId = '' this.form.plcId = '';
this.form.bindObjectId = '' this.form.bindObjectId = '';
this.form.bindObjectType = '' this.form.bindObjectType = '';
this.objIds = [] this.objIds = [];
this.isEdit = false this.isEdit = false;
} },
} },
} };
</script> </script>
<style>
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
display: none;
}
</style>

View File

@@ -1,16 +1,35 @@
<template> <template>
<div> <div>
<el-drawer :title="drawerTitle" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'> <el-drawer
:title="drawerTitle"
:visible.sync="visible"
size="70%"
@close="closeD"
:show-close="false">
<div class="box"> <div class="box">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item label="关联表名"> <el-form-item label="关联表名">
<el-input v-model="plcTableName" size='small' readonly></el-input> <el-input
v-model="plcTableName"
size="small"
readonly
style="width: 250px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="对象"> <el-form-item label="对象">
<el-input v-model="objName" size='small' readonly></el-input> <el-input
v-model="objName"
size="small"
readonly
style="width: 250px"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="showBtn"> <el-form-item v-if="showBtn">
<el-button type="success" size='small' plain @click="addNew">新增</el-button> <el-button
type="success"
size="small"
plain
@click="addNew">
新增
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table <base-table
@@ -18,23 +37,20 @@
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="tableData" :table-data="tableData"
:max-height="tableH" :max-height="tableH">
>
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="100" :width="100"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
</div> </div>
</el-drawer> </el-drawer>
<!-- 新增 --> <!-- 新增 -->
@@ -43,43 +59,48 @@
:dialogVisible="centervisible" :dialogVisible="centervisible"
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel">
> <energy-plc-param-add
<energy-plc-param-add ref="energyPlcParam" @successSubmit="successSubmit" /> ref="energyPlcParam"
@successSubmit="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyPlcParamPage, deleteEnergyPlcParam } from '@/api/base/energyPlcParam' import {
import EnergyPlcParamAdd from './energyPlcParamAdd' getEnergyPlcParamPage,
import { publicFormatter } from '@/utils/dict' deleteEnergyPlcParam,
} 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: {
@@ -87,9 +108,9 @@ export default {
type: Array, type: Array,
required: true, required: true,
default: () => { default: () => {
return [] return [];
} },
} },
}, },
data() { data() {
return { return {
@@ -103,121 +124,132 @@ export default {
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 = [
{ {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
}, },
{ {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} },
] ];
} }
}, },
getList() { getList() {
getEnergyPlcParamPage({ ...this.queryParams }).then((res) => { getEnergyPlcParamPage({ ...this.queryParams }).then((res) => {
let arr = res.data.list || [] let arr = res.data.list || [];
arr&&arr.map(item => { arr &&
this.collectionList.map(i => { arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) { if (item.collection === i.value) {
item.collection = i.label item.collection = i.label;
} }
}) });
this.energyTypeList.map(j => { this.energyTypeList.map((j) => {
if (item.typeId === j.id) { if (item.typeId === j.id) {
item.typeId = j.name item.typeId = j.name;
} }
}) });
}) });
this.tableData = arr this.tableData = arr;
this.total = res.data.total; this.total = res.data.total;
}) });
}, },
// 新增 // 新增
addNew() { addNew() {
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: ''}) this.$refs.energyPlcParam.init({
}) connectId: this.queryParams.connectId,
id: '',
});
});
}, },
handleCancel() { handleCancel() {
this.$refs.energyPlcParam.formClear() this.$refs.energyPlcParam.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.energyPlcParam.submitForm() this.$refs.energyPlcParam.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
handleClick(val) { handleClick(val) {
console.log(val) console.log(val);
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: val.data.id}) this.$refs.energyPlcParam.init({
}) connectId: this.queryParams.connectId,
break id: val.data.id,
});
});
break;
default: default:
this.handleDelete(val.data) this.handleDelete(val.data);
} }
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?')
.then(function () {
return deleteEnergyPlcParam(row.id); return deleteEnergyPlcParam(row.id);
}).then(() => { })
.then(() => {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
closeD() { closeD() {
this.$emit('closeDrawer') this.$emit('closeDrawer');
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box { .box {

View File

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

View File

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

View File

@@ -0,0 +1,139 @@
<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
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 [];
},
},
},
data() {
return {};
},
computed: {
renderData() {
return this.tableData.map((item, index) => {
return {
...item,
_pageIndex: index + 1,
};
});
},
},
methods: {
emitButtonClick() {
this.$emit('emitButtonClick');
},
changeInput(val1, val2) {
val1.prop = val2;
this.$emit('emitFun', val1);
},
changeSelect(val1, val2) {
val1.prop = val2;
this.$emit('emitFun', val1);
},
},
};
</script>
<style lang='scss' scoped>
.energyQuantityManualAddTable {
.el-table .el-table__cell {
padding: 0;
height: 35px;
}
.addButton {
width: 100%;
height: 35px;
border-top: none;
color: #0b58ff;
border-color: #ebeef5;
border-radius: 0;
}
.addButton:hover {
color: #0b58ff;
border-color: #ebeef5;
background-color: #fff;
}
.addButton:focus {
border-color: #ebeef5;
background-color: #fff;
}
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
}
</style>
<style lang='scss'>
.energyQuantityManualAddTable {
.el-table .el-table__cell {
padding: 0;
height: 35px;
}
}
</style>

View File

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

View File

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

View File

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

View File

@@ -1,119 +1,147 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:max-height="tableH" @selection-change="selectChange"> :page="queryParams.pageNo"
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" :limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
@selection-change="selectChange">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" <pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" /> @pagination="getList" />
<!-- 新增 --> <!-- 新增 -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel" <base-dialog
@confirm="handleConfirm" :before-close="handleCancel"> :dialogTitle="addOrEditTitle"
<energy-quantity-manual-add ref="energyQuantityManualAdd" :energyTypeList="energyTypeList" :dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-quantity-manual-add
ref="energyQuantityManualAdd"
:energyTypeList="energyTypeList"
@successSubmit="successSubmit" /> @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { energyQuantityManualPage, energyQuantityManualDelete, energyQuantityManualExport } from "@/api/base/energyQuantityManual" import {
import { getEnergyTypeListAll } from "@/api/base/energyType" energyQuantityManualPage,
import { publicFormatter } from '@/utils/dict' energyQuantityManualDelete,
import { parseTime, parseTimeTable } from '@/utils/ruoyi' energyQuantityManualExport,
// import FileSaver from "file-saver" } from '@/api/base/energyQuantityManual';
// import * as XLSX from 'xlsx/xlsx.mjs' import { getEnergyTypeListAll } from '@/api/base/energyType';
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd' import { publicFormatter } from '@/utils/dict';
import moment from 'moment' import { parseTimeTable } from '@/utils/ruoyi';
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd';
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'energyType', prop: 'energyTypeLabel',
label: '能源类型', label: '能源类型',
minWidth: 110, minWidth: 110,
showOverflowtooltip: true showOverflowtooltip: true,
}, },
{ {
prop: 'unit', prop: 'unit',
label: '单位', label: '单位',
filter: publicFormatter('energy_unit'), filter: publicFormatter('unit_dict'),
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: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-manual:export') ? 'button' : '', type: this.$auth.hasPermi('base:energy-quantity-manual:export')
? 'button'
: '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'primary',
plain: true plain: true,
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-manual:create') ? 'button' : '', type: this.$auth.hasPermi('base:energy-quantity-manual:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableH: this.tableHeight(260),
// 总条数 // 总条数
total: 0, total: 0,
// 班次基础信息列表 // 班次基础信息列表
@@ -122,150 +150,174 @@ export default {
this.$auth.hasPermi('base:energy-quantity-manual:create') this.$auth.hasPermi('base:energy-quantity-manual:create')
? { ? {
type: 'meterReading', type: 'meterReading',
btnName: '抄表' btnName: '抄表',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:energy-quantity-manual:update') this.$auth.hasPermi('base:energy-quantity-manual:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:energy-quantity-manual:delete') this.$auth.hasPermi('base:energy-quantity-manual:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} }
: undefined : undefined,
].filter((v) => v), ].filter((v) => v),
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
energyTypeId: '', energyTypeId: '',
recordTime: [] recordTime: [],
}, },
energyTypeList: [], energyTypeList: [],
exportList: [], exportList: [],
addOrEditTitle: '', addOrEditTitle: '',
centervisible: false, centervisible: false,
}; };
}, },
components: { EnergyQuantityManualAdd }, components: { EnergyQuantityManualAdd },
mixins: [tableHeightMixin],
created() { created() {
window.addEventListener('resize', () => { let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf();
this.tableH = this.tableHeight(260) let start = moment(
}) moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf() ).valueOf();
let start = moment(moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')).valueOf() this.formConfig[1].defaultSelect = [start, end];
this.formConfig[1].defaultSelect = [start, end] this.queryParams.recordTime[0] = start;
this.queryParams.recordTime[0] = start this.queryParams.recordTime[1] = end;
this.queryParams.recordTime[1] = end
this.getList(); this.getList();
this.getTypeList() this.getTypeList();
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.recordTime[0] = val.timeVal ? moment(moment(val.timeVal[0]).format('YYYY-MM-DD 00:00:00')).valueOf() : null this.queryParams.recordTime[0] = val.timeVal
this.queryParams.recordTime[1] = val.timeVal ? moment(moment(val.timeVal[1]).format('YYYY-MM-DD 23:59:59')).valueOf() : null ? moment(moment(val.timeVal[0]).format('YYYY-MM-DD 00:00:00')).valueOf()
: null;
this.queryParams.recordTime[1] = val.timeVal
? moment(moment(val.timeVal[1]).format('YYYY-MM-DD 23:59:59')).valueOf()
: null;
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.getList() this.getList();
break break;
case 'add': case 'add':
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
let params = {} let params = {};
params.type = 'add' params.type = 'add';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(params) this.$refs.energyQuantityManualAdd.init(params);
}) });
break break;
default: default:
this.$modal.confirm('是否确认导出').then(() => { this.$modal
return energyQuantityManualExport({ energyTypeId: this.queryParams.energyTypeId, recordTime: this.queryParams.recordTime }); .confirm('是否确认导出')
}).then(response => { .then(() => {
return energyQuantityManualExport({
energyTypeId: this.queryParams.energyTypeId,
recordTime: this.queryParams.recordTime,
});
})
.then((response) => {
this.$download.excel(response, '能源报表.xls'); this.$download.excel(response, '能源报表.xls');
}).catch(() => { }) })
.catch(() => {});
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
energyQuantityManualPage(this.queryParams).then(response => { energyQuantityManualPage(this.queryParams).then((response) => {
let arr = response.data.list || [] let arr = response.data.list || [];
arr && arr.map(item => { arr &&
item.amount = item.amount ? (!isNaN(parseFloat(item.amount)) && isFinite(item.amount) ? item.amount.toFixed(2) : '') : '' arr.map((item) => {
}) item.amount = item.amount
this.list = arr ? !isNaN(parseFloat(item.amount)) && isFinite(item.amount)
? item.amount.toFixed(2)
: ''
: '';
this.getDictDatas('energy_type').map((subItem) => {
if (item.energyType === subItem.value) {
item.energyTypeLabel = subItem.label;
}
});
});
this.list = arr;
this.total = response.data.total; this.total = response.data.total;
this.exportList = [] this.exportList = [];
}); });
}, },
getTypeList() { getTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [] this.formConfig[0].selectOptions = res.data || [];
this.energyTypeList = res.data || [] this.energyTypeList = res.data || [];
}) });
}, },
selectChange(val) { selectChange(val) {
console.log(val) console.log(val);
this.exportList = val this.exportList = val;
}, },
handleClick(val) { handleClick(val) {
console.log(val) console.log(val);
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.centervisible = true this.centervisible = true;
let paramA = {} let paramA = {};
paramA.type = 'edit' paramA.type = 'edit';
paramA.id = val.data.id paramA.id = val.data.id;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramA) this.$refs.energyQuantityManualAdd.init(paramA);
}) });
break break;
case 'meterReading': case 'meterReading':
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
let paramB = {} let paramB = {};
paramB.type = 'meterReading' paramB.type = 'meterReading';
paramB.energyTypeId = val.data.energyTypeId paramB.energyTypeId = val.data.energyTypeId;
paramB.tableName = val.data.tableName paramB.tableName = val.data.tableName;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramB) this.$refs.energyQuantityManualAdd.init(paramB);
}) });
break break;
default: default:
this.handleDelete(val.data) this.handleDelete(val.data);
} }
}, },
// 新增 // 新增
handleCancel() { handleCancel() {
this.$refs.energyQuantityManualAdd.formClear() this.$refs.energyQuantityManualAdd.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.energyQuantityManualAdd.submitForm() this.$refs.energyQuantityManualAdd.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
console.log(row.id) console.log(row.id);
this.$modal.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?').then(function () { this.$modal
.confirm('是否确认删除能源类型为"' + row.energyTypeLabel + '"的数据项?')
.then(function () {
return energyQuantityManualDelete({ id: row.id }); return energyQuantityManualDelete({ id: 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,99 +1,114 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:selectWidth="55" :max-height="tableH" @selection-change="selectChange" /> :page="queryParams.pageNo"
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" :limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:selectWidth="55"
:max-height="tableH"
@selection-change="selectChange" />
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" /> @pagination="getList" />
</div> </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: 'energyTypeName', prop: 'energyTypeLabel',
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: '能源类型',
labelField: 'labelName',
selectOptions: [], selectOptions: [],
param: 'energyTypeId', param: 'energyTypeId',
filterable: true filterable: true,
}, },
{ {
type: 'datePicker', type: 'datePicker',
label: '时间', label: '时间',
dateType: 'datetimerange', dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp", valueFormat: 'timestamp',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
param: 'timeVal', param: 'timeVal',
defaultSelect: [], defaultSelect: [],
width: 350 width: 350,
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '', type: this.$auth.hasPermi('base:energy-quantity-realtime:export')
? 'button'
: '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'primary',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableH: this.tableHeight(260),
// 总条数 // 总条数
total: 0, total: 0,
// 班次基础信息列表 // 班次基础信息列表
@@ -104,78 +119,97 @@ export default {
pageSize: 20, pageSize: 20,
energyTypeId: '', energyTypeId: '',
startTime: null, startTime: null,
endTime: null endTime: null,
}, },
energyTypeList: [], energyTypeList: [],
exportList: [] exportList: [],
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
if (location.href.indexOf('?') > 0) { if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&') let arr = location.href.split('?')[1].split('&');
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]] this.formConfig[1].defaultSelect = [
arr[0].split('=')[1],
arr[1].split('=')[1],
];
} else { } else {
this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()] this.formConfig[1].defaultSelect = [
Date.now() - 7 * 24 * 3600000,
Date.now(),
];
} }
this.queryParams.startTime = this.formConfig[1].defaultSelect[0] this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
this.queryParams.endTime = this.formConfig[1].defaultSelect[1] this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
this.getList(); this.getList();
this.getTypeList() this.getTypeList();
}, },
watch: { watch: {
$route: 'initData' $route: 'initData',
}, },
methods: { methods: {
initData(to) { initData(to) {
if (to.name === 'EnergyQuantityRealtime') { if (to.name === 'EnergyQuantityRealtime') {
if (location.href.indexOf('?') > 0) { if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&') let arr = location.href.split('?')[1].split('&');
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]] this.formConfig[1].defaultSelect = [
arr[0].split('=')[1],
arr[1].split('=')[1],
];
} else { } else {
this.formConfig[1].defaultSelect = [Date.now() - 7 * 24 * 3600000, Date.now()] this.formConfig[1].defaultSelect = [
Date.now() - 7 * 24 * 3600000,
Date.now(),
];
} }
this.queryParams.startTime = this.formConfig[1].defaultSelect[0] this.queryParams.startTime = this.formConfig[1].defaultSelect[0];
this.queryParams.endTime = this.formConfig[1].defaultSelect[1] this.queryParams.endTime = this.formConfig[1].defaultSelect[1];
this.getList() this.getList();
} }
}, },
buttonClick(val) { buttonClick(val) {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.getList() this.getList();
break break;
default: default:
this.exportTable() this.exportTable();
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getEnergyQuantityRealtimePage(this.queryParams).then(response => { getEnergyQuantityRealtimePage(this.queryParams).then((response) => {
let arr = response.data.list || [] let arr = response.data.list || [];
arr && arr.map(item => { arr &&
item.amount = item.amount ? (!isNaN(parseFloat(item.amount)) && isFinite(item.amount) ? item.amount.toFixed(2) : '') : '' arr.map((item) => {
}) item.amount = item.amount
this.list = arr ? !isNaN(parseFloat(item.amount)) && isFinite(item.amount)
? item.amount.toFixed(2)
: ''
: '';
this.getDictDatas('energy_type').map((subItem) => {
if (item.energyTypeName === subItem.value) {
item.energyTypeLabel = subItem.label;
}
});
});
this.list = arr;
this.total = response.data.total; this.total = response.data.total;
this.exportList = [] this.exportList = [];
}); });
}, },
getTypeList() { getTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || [] this.formConfig[0].selectOptions = res.data || [];
this.energyTypeList = res.data || [] this.energyTypeList = res.data || [];
}) });
}, },
selectChange(val) { selectChange(val) {
console.log(val) console.log(val);
this.exportList = val this.exportList = val;
}, },
// 勾选导出 // 勾选导出
exportTable() { exportTable() {
@@ -183,38 +217,38 @@ export default {
let body = this.exportList.map((x) => [ let body = this.exportList.map((x) => [
x.objName, x.objName,
x.objCode, x.objCode,
x.energyTypeName, x.energyTypeLabel,
x.startValue, x.startValue,
x.endValue, x.endValue,
x.diffValue, x.diffValue,
x.amount x.amount,
]) ]);
let header = [] let header = [];
this.tableProps.map((y) => { this.tableProps.map((y) => {
header.push(y.label) header.push(y.label);
}) });
body.unshift(header) body.unshift(header);
console.log(body) console.log(body);
const filename = '能源抄表.xlsx' const filename = '能源抄表.xlsx';
const ws_name = 'Sheet1' const ws_name = 'Sheet1';
const wb = XLSX.utils.book_new() const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(body) const ws = XLSX.utils.aoa_to_sheet(body);
XLSX.utils.book_append_sheet(wb, ws, ws_name) XLSX.utils.book_append_sheet(wb, ws, ws_name);
let wbout = XLSX.write(wb, { let wbout = XLSX.write(wb, {
bookType: 'xlsx', bookType: 'xlsx',
bookSST: false, bookSST: false,
type: 'array' type: 'array',
}) });
FileSaver.saveAs( FileSaver.saveAs(
new Blob([wbout], { new Blob([wbout], {
type: 'application/octet-stream' type: 'application/octet-stream',
}), }),
filename filename
) );
} else { } else {
this.$modal.msgWarning('请勾选需要导出的数据') this.$modal.msgWarning('请勾选需要导出的数据');
}
}
} }
},
},
}; };
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,115 +1,139 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
<el-tabs v-model="activeName" @tab-click="toggleTab"> :formConfigs="formConfig"
<el-tab-pane label="自动抄表" name="auto"></el-tab-pane> ref="searchBarForm"
<el-tab-pane label="手动抄表" name="manual"></el-tab-pane> @headBtnClick="buttonClick" />
<el-tabs
v-model="activeName"
@tab-click="toggleTab">
<el-tab-pane
label="自动抄表"
name="auto"></el-tab-pane>
<el-tab-pane
label="手动抄表"
name="manual"></el-tab-pane>
</el-tabs> </el-tabs>
<!-- 列表 --> <!-- 列表 -->
<div v-if="activeName === 'auto'"> <div v-if="activeName === 'auto'">
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" /> :max-height="tableH" />
</div> </div>
<div v-if="activeName === 'manual'"> <div v-if="activeName === 'manual'">
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps2" <base-table
:table-data="list2" :max-height="tableH" /> :page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps2"
:table-data="list2"
:max-height="tableH" />
</div> </div>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" <pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" /> @pagination="getList" />
</div> </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: '能源类型',
labelField: 'labelName',
selectOptions: [], selectOptions: [],
param: 'energyTypeId' param: 'energyTypeId',
}, },
{ {
type: 'select', type: 'select',
@@ -117,102 +141,100 @@ export default {
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE), selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
param: 'indexType' param: 'indexType',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
} },
], ],
activeName: 'auto', activeName: 'auto',
tableProps, tableProps,
tableProps2, tableProps2,
tableH: this.tableHeight(260),
total: 0, total: 0,
list: [], list: [],
list2: [], list2: [],
heightNum: 300,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
energyTypeId: '', energyTypeId: '',
indexType: '', indexType: '',
method: '1' method: '1',
}, },
typeList: [ typeList: [
{ id: 1, name: '合并' }, { id: 1, name: '合并' },
{ id: 2, name: '详细' } { id: 2, name: '详细' },
] ],
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
this.getTypeList() this.getTypeList();
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.indexType = val.indexType this.queryParams.indexType = val.indexType;
this.getList() this.getList();
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getEnergyOverlimitLogPage(this.queryParams).then(response => { getEnergyOverlimitLogPage(this.queryParams).then((response) => {
let arr = response.data.list || []; let arr = response.data.list || [];
arr && 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.getList()
}
} }
this.queryParams.pageNo = 1;
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;

View File

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

View File

@@ -1,57 +1,60 @@
<template> <template>
<div class="app-container" id='energyReportSearchBox'> <div
class="app-container"
id="energyReportSearchBox">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
:isFold="isFold" :isFold="isFold"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH" />
/>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
</div> </div>
</template> </template>
<script> <script>
import { energyReportPage, energyReportPageExport } from "@/api/monitoring/energyReport"; import {
import { getEnergyTypeListAll } from "@/api/base/energyType" energyReportPage,
energyReportPageExport,
} from '@/api/monitoring/energyReport';
import { publicFormatter } from '@/utils/dict';
import { getEnergyTypeListAll } from '@/api/base/energyType';
const tableProps = [ const tableProps = [
{ {
prop: 'statisticName', prop: 'statisticName',
label: '统计方案' label: '统计方案',
}, },
{ {
prop: 'energyType', prop: 'energyType',
label: '能源类型' label: '能源类型',
filter: publicFormatter('energy_type'),
}, },
{ {
prop: 'startValue', prop: 'startValue',
label: '抄表数(起始)' label: '抄表数(起始)',
}, },
{ {
prop: 'endValue', prop: 'endValue',
label: '抄表数(结束)' label: '抄表数(结束)',
}, },
{ {
prop: 'diffValue', prop: 'diffValue',
label: '消耗量' label: '消耗量',
} },
] ];
export default { export default {
name: "EnergyReportSearch", name: 'EnergyReportSearch',
data() { data() {
return { return {
isFold: false, isFold: false,
@@ -59,45 +62,48 @@ export default {
{ {
type: 'input', type: 'input',
label: '统计方案', label: '统计方案',
param: 'statisticName' param: 'statisticName',
}, },
{ {
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: 'datetimerange', dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp", valueFormat: 'timestamp',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
param: 'timeVal', param: 'timeVal',
defaultSelect: [], defaultSelect: [],
width: 350, width: 350,
clearable: false clearable: false,
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-report-search:export') ? 'button' : '', type: this.$auth.hasPermi('monitoring:energy-report-search:export')
? 'button'
: '',
btnName: '导出', btnName: '导出',
name: 'add', name: 'add',
color: 'primary', color: 'primary',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableH: this.tableHeight(260), tableH: this.tableHeight(260),
@@ -111,51 +117,55 @@ export default {
pageSize: 20, pageSize: 20,
statisticName: null, statisticName: null,
startTime: null, startTime: null,
endTime: null endTime: null,
}, },
energyTypeList: [] energyTypeList: [],
}; };
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260);
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180) this.isFold = this.searchBarWidth('energyReportSearchBox', 1180);
}) });
this.getList() this.getList();
this.getTypeList() this.getTypeList();
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180) this.isFold = this.searchBarWidth('energyReportSearchBox', 1180);
}, },
methods: { methods: {
getTypeList() { getTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.formConfig[1].selectOptions = res.data || [] this.formConfig[1].selectOptions = res.data || [];
}) });
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1 this.queryParams.pageNo = 1;
this.queryParams.statisticName = val.statisticName this.queryParams.statisticName = val.statisticName;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId;
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
this.getList() this.getList();
break break;
default: default:
this.$modal.confirm('是否确认导出').then(() => { this.$modal
.confirm('是否确认导出')
.then(() => {
return energyReportPageExport({ ...this.queryParams }); return energyReportPageExport({ ...this.queryParams });
}).then(response => { })
.then((response) => {
this.$download.excel(response, '能源统计查询报表.xls'); this.$download.excel(response, '能源统计查询报表.xls');
}).catch(() => {}) })
.catch(() => {});
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
energyReportPage({...this.queryParams}).then(response => { energyReportPage({ ...this.queryParams }).then((response) => {
this.list = response.data.list || []; this.list = response.data.list || [];
this.total = response.data.total; this.total = response.data.total;
}); });
} },
} },
}; };
</script> </script>

View File

@@ -1,46 +1,67 @@
<template> <template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form"> <el-form
ref="form"
:rules="rules"
label-width="100px"
:model="form">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="方案名称" prop="name"> <el-form-item
label="方案名称"
prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="方案编码" prop="code"> <el-form-item
<el-input v-model="form.code" disabled></el-input> label="方案编码"
prop="code">
<el-input
v-model="form.code"
disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="统计类型" prop="type"> <el-form-item
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;"> label="统计类型"
prop="type">
<el-select
v-model="form.type"
placeholder="请选择"
style="width: 100%">
<el-option <el-option
v-for="item in getDictDatas(DICT_TYPE.STATISTIC_TYPE)" v-for="item in getDictDatas(DICT_TYPE.STATISTIC_TYPE)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="能源类型" prop="energyTypeId"> <el-form-item
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable> label="能源类型"
prop="energyTypeId">
<el-select
v-model="form.energyTypeId"
placeholder="请选择"
style="width: 100%"
filterable>
<el-option <el-option
v-for="item in energyListType" v-for="item in energyListType"
:key="item.id" :key="item.id"
:label="item.name" :label="item.labelName"
:value="item.id"> :value="item.id"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="备注" prop="remark"> <el-form-item
label="备注"
prop="remark">
<el-input v-model="form.remark"></el-input> <el-input v-model="form.remark"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -48,8 +69,13 @@
</el-form> </el-form>
</template> </template>
<script> <script>
import { getCode, createEnergyStatistics, updateEnergyStatistics, getEnergyStatistics } from "@/api/monitoring/energyStatistics"; import {
import { getEnergyTypeListAll } from '@/api/base/energyType' getCode,
createEnergyStatistics,
updateEnergyStatistics,
getEnergyStatistics,
} from '@/api/monitoring/energyStatistics';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { number } from 'echarts'; import { number } from 'echarts';
export default { export default {
name: 'EnergyStatisticsAdd', name: 'EnergyStatisticsAdd',
@@ -60,39 +86,45 @@ export default {
name: '', name: '',
code: '', code: '',
type: '', type: '',
energyTypeId: '' energyTypeId: '',
}, },
plcList: [], plcList: [],
objList: [], objList: [],
isEdit: false, //是否是编辑 isEdit: false, //是否是编辑
rules: { rules: {
name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }], name: [
type: [{ required: true, message: '统计类型不能为空', trigger: 'change' }], { required: true, message: '方案名称不能为空', trigger: 'blur' },
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }] ],
type: [
{ required: true, message: '统计类型不能为空', trigger: 'change' },
],
energyTypeId: [
{ required: true, message: '能源类型不能为空', trigger: 'change' },
],
}, },
energyListType: [], energyListType: [],
} };
}, },
methods: { methods: {
init(id) { init(id) {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.energyListType = res.data || [] this.energyListType = res.data || [];
}) });
if (id) { if (id) {
this.isEdit = true this.isEdit = true;
this.form.id = id this.form.id = id;
getEnergyStatistics(id).then((res) => { getEnergyStatistics(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data;
this.form.type = this.form.type + '' this.form.type = this.form.type + '';
} }
}) });
} else { } else {
getCode().then((res) => { getCode().then((res) => {
this.form.code = res.data this.form.code = res.data;
}) });
this.isEdit = false this.isEdit = false;
this.form.id = '' this.form.id = '';
} }
}, },
submitForm() { submitForm() {
@@ -102,27 +134,27 @@ export default {
// 编辑 // 编辑
updateEnergyStatistics({ ...this.form }).then((res) => { updateEnergyStatistics({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} else { } else {
createEnergyStatistics({ ...this.form }).then((res) => { createEnergyStatistics({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} }
} else { } else {
return false return false;
} }
}) });
}, },
formClear() { formClear() {
this.$refs.form.resetFields() this.$refs.form.resetFields();
this.isEdit = false this.isEdit = false;
} },
} },
} };
</script> </script>

View File

@@ -1,17 +1,42 @@
<template> <template>
<div> <div>
<el-drawer :title="drawerTitle" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'> <el-drawer
:title="drawerTitle"
:visible.sync="visible"
size="70%"
@close="closeD"
:show-close="false">
<div class="box"> <div class="box">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item label="方案名称"> <el-form-item label="方案名称">
<el-input v-model="name" size='small' readonly></el-input> <el-input
v-model="name"
size="small"
readonly></el-input>
</el-form-item> </el-form-item>
<el-form-item label="能源类型"> <el-form-item label="能源类型">
<el-input v-model="energyType" size='small' readonly></el-input> <el-input
v-model="energyTypeLabel"
size="small"
readonly></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="success" size='small' v-if="showBtn" plain @click="addNew">新增</el-button> <el-button
<el-button type="danger" size='small' v-if="showBtn" plain @click="deleteAll">批量删除</el-button> type="success"
size="small"
v-if="showBtn"
plain
@click="addNew">
新增
</el-button>
<el-button
type="danger"
size="small"
v-if="showBtn"
plain
@click="deleteAll">
批量删除
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table <base-table
@@ -21,56 +46,59 @@
:table-data="tableData" :table-data="tableData"
:max-height="tableH" :max-height="tableH"
:selectWidth="55" :selectWidth="55"
@selection-change="selectChange" @selection-change="selectChange">
>
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="80" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
</div> </div>
</el-drawer> </el-drawer>
<!-- 新增 --> <!-- 新增 -->
<energy-statistics-det-add ref="energyStatistics" @closeDet="closeDet" /> <energy-statistics-det-add
ref="energyStatistics"
@closeDet="closeDet" />
</div> </div>
</template> </template>
<script> <script>
import { getEnergyStatisticsDetPage, deleteEnergyStatisticsDet, deleteMany } from '@/api/monitoring/energyStatisticsDet' import {
import EnergyStatisticsDetAdd from './energyStatisticsDetAdd' getEnergyStatisticsDetPage,
import { publicFormatter } from '@/utils/dict' deleteEnergyStatisticsDet,
deleteMany,
} from '@/api/monitoring/energyStatisticsDet';
import EnergyStatisticsDetAdd from './energyStatisticsDetAdd';
import { publicFormatter } from '@/utils/dict';
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',
label: '所属对象' label: '所属对象',
}, },
{ {
prop: 'objCode', prop: 'objCode',
label: '对象编码' label: '对象编码',
}, },
{ {
prop: 'paramName', prop: 'paramName',
label: '参数名称' label: '参数名称',
}, },
{ {
prop: 'unit', prop: 'unit',
label: '单位', label: '单位',
filter: publicFormatter('energy_unit') filter: publicFormatter('unit_dict'),
}, },
{ {
prop: 'desc', prop: 'desc',
label: '描述' label: '描述',
} },
] ];
export default { export default {
name: 'EnergyStatisticsDet', name: 'EnergyStatisticsDet',
props: { props: {
@@ -78,9 +106,9 @@ export default {
type: Array, type: Array,
required: true, required: true,
default: () => { default: () => {
return [] return [];
} },
} },
}, },
data() { data() {
return { return {
@@ -94,134 +122,147 @@ export default {
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 30, pageSize: 30,
statisticsId: null statisticsId: null,
}, },
name: '', name: '',
energyType: '', energyTypeLabel: '',
energyTypeId: '', energyTypeId: '',
// 弹出层标题 // 弹出层标题
addOrEditTitle: "", addOrEditTitle: '',
// 是否显示弹出层 // 是否显示弹出层
centervisible: false, centervisible: false,
collectionList: [ collectionList: [
{ value: 0, label: '否' }, { value: 0, label: '否' },
{value: 1,label: '是'} { value: 1, label: '是' },
], ],
showBtn: true, showBtn: true,
selectedList: [] selectedList: [],
} };
}, },
components: { EnergyStatisticsDetAdd }, components: { EnergyStatisticsDetAdd },
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.statisticsId = data.id this.queryParams.statisticsId = data.id;
this.name = data.name this.name = data.name;
this.energyType = data.energyType this.energyTypeLabel = data.energyTypeLabel;
this.energyTypeId = data.energyTypeId this.energyTypeId = data.energyTypeId;
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 = [
{ {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} },
] ];
} }
}, },
getList() { getList() {
console.log(this.queryParams) console.log(this.queryParams);
getEnergyStatisticsDetPage({ ...this.queryParams }).then((res) => { getEnergyStatisticsDetPage({ ...this.queryParams }).then((res) => {
let arr = res.data.list || [] let arr = res.data.list || [];
arr&&arr.map(item => { arr &&
this.collectionList.map(i => { arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) { if (item.collection === i.value) {
item.collection = i.label item.collection = i.label;
} }
}) });
this.energyTypeList.map(j => { this.energyTypeList.map((j) => {
if (item.typeId === j.id) { if (item.typeId === j.id) {
item.typeId = j.name item.typeId = j.name;
} }
}) });
}) });
this.tableData = arr this.tableData = arr;
this.total = res.data.total; this.total = res.data.total;
}) });
}, },
// 新增 // 新增
addNew() { addNew() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyStatistics.init({'statisticsId': this.queryParams.statisticsId, energyTypeId:this.energyTypeId}) this.$refs.energyStatistics.init({
}) statisticsId: this.queryParams.statisticsId,
energyTypeId: this.energyTypeId,
});
});
}, },
selectChange(val) { selectChange(val) {
console.log(val) console.log(val);
this.selectedList = val this.selectedList = val;
}, },
// 批量删除 // 批量删除
deleteAll() { deleteAll() {
let arr = [] let arr = [];
if (this.selectedList.length === 0) { if (this.selectedList.length === 0) {
this.$modal.msgWarning("请选勾选数据") this.$modal.msgWarning('请选勾选数据');
return false return false;
} else { } else {
this.selectedList.map((item) => { this.selectedList.map((item) => {
arr.push(item.id) arr.push(item.id);
}) });
} }
this.$modal.confirm('是否确认删除所有勾选的数据项?').then(function() { this.$modal
.confirm('是否确认删除所有勾选的数据项?')
.then(function () {
return deleteMany(arr); return deleteMany(arr);
}).then(() => { })
this.queryParams.pageNo = 1 .then(() => {
this.getList() this.queryParams.pageNo = 1;
this.$modal.msgSuccess("删除成功") this.getList();
}).catch(() => {}) this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
}, },
handleCancel() { handleCancel() {
this.$refs.energyStatistics.formClear() this.$refs.energyStatistics.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.energyStatistics.submitForm() this.$refs.energyStatistics.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
handleClick(val) { handleClick(val) {
this.handleDelete(val.data) this.handleDelete(val.data);
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除参数列名为"' + row.paramName + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除参数列名为"' + row.paramName + '"的数据项?')
.then(function () {
return deleteEnergyStatisticsDet(row.id); return deleteEnergyStatisticsDet(row.id);
}).then(() => { })
this.queryParams.pageNo = 1 .then(() => {
this.getList() this.queryParams.pageNo = 1;
this.$modal.msgSuccess("删除成功") this.getList();
}).catch(() => {}) this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
}, },
closeD() { closeD() {
this.$emit('closeDrawer') this.$emit('closeDrawer');
}, },
closeDet() { // 关闭新增框 closeDet() {
this.getList() // 关闭新增框
} this.getList();
} },
} },
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box { .box {

View File

@@ -3,16 +3,15 @@
title="新增" title="新增"
:visible.sync="centervisible" :visible.sync="centervisible"
size="60%" size="60%"
@close='closeA' @close="closeA"
:show-close='false'> :show-close="false">
<div class="box"> <div class="box">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
:removeBlue='true' :removeBlue="true"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
@@ -21,44 +20,44 @@
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH"
:selectWidth="55" :selectWidth="55"
@selection-change="selectChange" @selection-change="selectChange"></base-table>
>
</base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
</div> </div>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import { addParamPage, createEnergyStatisticsDet } from '@/api/monitoring/energyStatisticsDet' import {
import { publicFormatter } from '@/utils/dict' addParamPage,
createEnergyStatisticsDet,
} from '@/api/monitoring/energyStatisticsDet';
import { publicFormatter } from '@/utils/dict';
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',
label: '所属对象' label: '所属对象',
}, },
{ {
prop: 'objCode', prop: 'objCode',
label: '对象编码' label: '对象编码',
}, },
{ {
prop: 'paramName', prop: 'paramName',
label: '参数名称' label: '参数名称',
}, },
{ {
prop: 'unit', prop: 'unit',
label: '单位', label: '单位',
filter: publicFormatter('energy_unit') filter: publicFormatter('unit_dict'),
}, },
{ {
prop: 'desc', prop: 'desc',
label: '描述' label: '描述',
} },
] ];
export default { export default {
name: 'EnergyStatisticsDetAdd', name: 'EnergyStatisticsDetAdd',
data() { data() {
@@ -71,30 +70,30 @@ export default {
selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE), selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
param: 'objType' param: 'objType',
}, },
{ {
type: 'input', type: 'input',
label: '参数名称', label: '参数名称',
placeholder: '参数名称', placeholder: '参数名称',
param: 'paramName' param: 'paramName',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: 'button', type: 'button',
btnName: '关联', btnName: '关联',
name: 'add', name: 'add',
color: 'primary', color: 'primary',
plain: true plain: true,
} },
], ],
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@@ -102,75 +101,75 @@ export default {
energyTypeId: null, energyTypeId: null,
statisticId: null, statisticId: null,
paramName: '', paramName: '',
objType: '' objType: '',
}, },
tableProps, tableProps,
list: [], list: [],
total: 0, total: 0,
tableH: this.tableHeight(260), tableH: this.tableHeight(260),
selectedList: [] selectedList: [],
} };
}, },
methods: { methods: {
init(param) { init(param) {
this.queryParams.statisticId = param.statisticsId this.queryParams.statisticId = param.statisticsId;
this.queryParams.energyTypeId = param.energyTypeId this.queryParams.energyTypeId = param.energyTypeId;
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260);
}) });
this.centervisible = true this.centervisible = true;
this.getList() this.getList();
}, },
getList() { getList() {
addParamPage({ ...this.queryParams }).then((res) => { addParamPage({ ...this.queryParams }).then((res) => {
this.list = res.data.list || [] this.list = res.data.list || [];
this.total = res.data.total this.total = res.data.total;
}) });
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.objType = val.objType this.queryParams.objType = val.objType;
this.queryParams.paramName = val.paramName this.queryParams.paramName = val.paramName;
this.getList() this.getList();
break break;
default: default:
// 关联 // 关联
this.connectParam() this.connectParam();
} }
}, },
// 选中数据 // 选中数据
selectChange(val) { selectChange(val) {
this.selectedList = val this.selectedList = val;
}, },
// 关联 // 关联
connectParam() { connectParam() {
let param = { let param = {
statisticsId: this.queryParams.statisticId, statisticsId: this.queryParams.statisticId,
plcParamIds: [] plcParamIds: [],
} };
if (this.selectedList.length === 0) { if (this.selectedList.length === 0) {
this.$modal.msgWarning("请选勾选数据") this.$modal.msgWarning('请选勾选数据');
return false return false;
} else { } else {
this.selectedList.map((item) => { this.selectedList.map((item) => {
param.plcParamIds.push(item.id) param.plcParamIds.push(item.id);
}) });
} }
createEnergyStatisticsDet({ ...param }).then((res) => { createEnergyStatisticsDet({ ...param }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList() this.getList();
} }
}) });
}, },
closeA() { closeA() {
this.$emit('closeDet') this.$emit('closeDet');
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box { .box {

View File

@@ -1,65 +1,93 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"> :max-height="tableH">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn" <method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="160"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" <pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" /> @pagination="getList" />
<!-- 新增 --> <!-- 新增 -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel" <base-dialog
@confirm="handleConfirm" :before-close="handleCancel"> :dialogTitle="addOrEditTitle"
<energy-statistics-add ref="energyStatistics" @successSubmit="successSubmit" /> :dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-statistics-add
ref="energyStatistics"
@successSubmit="successSubmit" />
</base-dialog> </base-dialog>
<!-- 参数绑定/查看 --> <!-- 参数绑定/查看 -->
<energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer" <energy-statistics-det
ref="plcParam"
@closeDrawer="closeDrawer"
:energyTypeList="energyTypeList"></energy-statistics-det> :energyTypeList="energyTypeList"></energy-statistics-det>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyStatisticsPage, deleteEnergyStatistics } from "@/api/monitoring/energyStatistics"; import {
import { publicFormatter } from '@/utils/dict' getEnergyStatisticsPage,
import { getEnergyTypeListAll } from '@/api/base/energyType' deleteEnergyStatistics,
import EnergyStatisticsAdd from './components/energyStatisticsAdd' } from '@/api/monitoring/energyStatistics';
import EnergyStatisticsDet from './components/energyStatisticsDet' import { publicFormatter } from '@/utils/dict';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import EnergyStatisticsAdd from './components/energyStatisticsAdd';
import EnergyStatisticsDet from './components/energyStatisticsDet';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'name', prop: 'name',
label: '方案名称' label: '方案名称',
}, },
{ {
prop: 'code', prop: 'code',
label: '方案编码', label: '方案编码',
minWidth: 120, minWidth: 120,
showOverflowtooltip: true showOverflowtooltip: true,
}, },
{ {
prop: 'type', prop: 'type',
label: '统计类型', label: '统计类型',
filter: publicFormatter('statistic_type') filter: publicFormatter('statistic_type'),
}, },
{ {
prop: 'energyType', prop: 'energyTypeLabel',
label: '能源类型' label: '能源类型',
showOverflowtooltip: true,
}, },
{ {
prop: 'paramNum', prop: 'paramNum',
label: '统计参数数量' label: '统计参数数量',
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
} },
] ];
export default { export default {
name: "EnergyStatistics", name: 'EnergyStatistics',
components: { EnergyStatisticsAdd, EnergyStatisticsDet }, components: { EnergyStatisticsAdd, EnergyStatisticsDet },
mixins: [tableHeightMixin],
data() { data() {
return { return {
formConfig: [ formConfig: [
@@ -67,156 +95,165 @@ export default {
type: 'input', type: 'input',
label: '方案名称', label: '方案名称',
placeholder: '方案名称', placeholder: '方案名称',
param: 'name' param: 'name',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-statistics:create') ? 'button' : '', type: this.$auth.hasPermi('monitoring:energy-statistics:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('monitoring:energy-statistics:bind') this.$auth.hasPermi('monitoring:energy-statistics:bind')
? { ? {
type: 'connect', type: 'connect',
btnName: '绑定' btnName: '绑定',
} }
: undefined, : undefined,
{ {
type: 'detail', type: 'detail',
btnName: '详情' btnName: '详情',
}, },
this.$auth.hasPermi('monitoring:energy-statistics:update') this.$auth.hasPermi('monitoring:energy-statistics:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi('monitoring:energy-statistics:delete') this.$auth.hasPermi('monitoring:energy-statistics:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} }
: undefined : undefined,
].filter((v) => v), ].filter((v) => v),
tableH: this.tableHeight(260),
// 总条数 // 总条数
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,
}, },
energyTypeList: [] energyTypeList: [],
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
}, },
mounted() { mounted() {
// 获取能源列表 // 获取能源列表
this.getEnergyTypeList() this.getEnergyTypeList();
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.name = val.name this.queryParams.name = val.name;
this.getList() this.getList();
break break;
default: default:
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyStatistics.init() this.$refs.energyStatistics.init();
}) });
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getEnergyStatisticsPage(this.queryParams).then(response => { getEnergyStatisticsPage(this.queryParams).then((response) => {
let arr = response.data.list || []; let arr = response.data.list || [];
this.list = arr arr.map((item) => {
this.getDictDatas('energy_type').map((subItem) => {
if (item.energyType === subItem.value) {
item.energyTypeLabel = subItem.label;
}
});
});
this.list = arr;
this.total = response.data.total; this.total = response.data.total;
}); });
}, },
handleClick(val) { handleClick(val) {
console.log(val) console.log(val);
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyStatistics.init(val.data.id) this.$refs.energyStatistics.init(val.data.id);
}) });
this.centervisible = true this.centervisible = true;
break break;
case 'delete': case 'delete':
this.handleDelete(val.data) this.handleDelete(val.data);
break break;
case 'detail': case 'detail':
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'detail') this.$refs.plcParam.init(val.data, 'detail');
}) });
break break;
default: default:
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'connect') this.$refs.plcParam.init(val.data, 'connect');
}) });
} }
}, },
handleCancel() { handleCancel() {
this.$refs.energyStatistics.formClear() this.$refs.energyStatistics.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.energyStatistics.submitForm() this.$refs.energyStatistics.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function () { this.$modal
.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?')
.then(function () {
return deleteEnergyStatistics(row.id); return deleteEnergyStatistics(row.id);
}).then(() => { })
.then(() => {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => { }); })
.catch(() => {});
}, },
closeDrawer() { closeDrawer() {
this.getList() this.getList();
}, },
getEnergyTypeList() { getEnergyTypeList() {
getEnergyTypeListAll().then((res) => { getEnergyTypeListAll().then((res) => {
this.energyTypeList = res.data || [] this.energyTypeList = res.data || [];
}) });
} },
} },
}; };
</script> </script>

View File

@@ -5,8 +5,7 @@
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
</div> </div>
<div class="box2"> <div class="box2">
<div class="boxTitle"> <div class="boxTitle">
@@ -14,27 +13,29 @@
<span>工单信息</span> <span>工单信息</span>
</div> </div>
<el-row> <el-row>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">工单名称</div> <div class="blodTip">工单名称</div>
<div class="lightTip">{{ orderMsg.name }}</div> <div class="lightTip">{{ orderMsg.name }}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">产品名称</div> <div class="blodTip">产品名称</div>
<div class="lightTip">{{ orderMsg.productName }}</div> <div class="lightTip">{{ orderMsg.productName }}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">计划完成数量</div> <div class="blodTip">计划完成数量</div>
<div class="lightTip">{{ orderMsg.planQuantity }}</div> <div class="lightTip">{{ orderMsg.planQuantity }}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">实际开始时间</div> <div class="blodTip">实际开始时间</div>
<div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div> <div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">实际完成时间</div> <div class="blodTip">实际完成时间</div>
<div class="lightTip">{{ parseTime(orderMsg.finishProduceTime) }}</div> <div class="lightTip">
{{ parseTime(orderMsg.finishProduceTime) }}
</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span="4">
<div class="blodTip">实际加工数量</div> <div class="blodTip">实际加工数量</div>
<div class="lightTip">{{ orderMsg.actualQuantity }}</div> <div class="lightTip">{{ orderMsg.actualQuantity }}</div>
</el-col> </el-col>
@@ -46,8 +47,16 @@
<span>能耗信息</span> <span>能耗信息</span>
</div> </div>
<div class="toggleTabBox"> <div class="toggleTabBox">
<div :class="{ active: activeModule === 'dataList' }" @click="toggleTab('dataList')">数据列表</div> <div
<div :class="{ active: activeModule === 'barChart' }" @click="toggleTab('barChart')">柱状图</div> :class="{ active: activeModule === 'dataList' }"
@click="toggleTab('dataList')">
数据列表
</div>
<div
:class="{ active: activeModule === 'barChart' }"
@click="toggleTab('barChart')">
柱状图
</div>
</div> </div>
<div> <div>
<div v-show="activeModule === 'dataList'"> <div v-show="activeModule === 'dataList'">
@@ -57,12 +66,13 @@
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="tableData" :table-data="tableData"
:max-height="tableH" :max-height="tableH" />
/>
</div> </div>
<!-- 图形 --> <!-- 图形 -->
<div v-show="activeModule === 'barChart'"> <div v-show="activeModule === 'barChart'">
<bar-chart ref="orderEnergyChart" :chartData="chartData"/> <bar-chart
ref="orderEnergyChart"
:chartData="chartData" />
</div> </div>
</div> </div>
</div> </div>
@@ -72,35 +82,40 @@
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',
label: '对象名称' label: '对象名称',
}, },
{ {
prop: 'objCode', prop: 'objCode',
label: '对象编码' label: '对象编码',
}, },
{ {
prop: 'energyType', prop: 'energyType',
label: '能源类型' label: '能源类型',
}, },
{ {
prop: 'startNum', prop: 'startNum',
label: '工单开始值' label: '工单开始值',
}, },
{ {
prop: 'endNum', prop: 'endNum',
label: '工单结束值/当前值' label: '工单结束值/当前值',
}, },
{ {
prop: 'useNum', prop: 'useNum',
label: '使用量' label: '使用量',
} },
] ];
import { getEnergyTypeListAll } from '@/api/base/energyType' import { getEnergyTypeListAll } from '@/api/base/energyType';
import { workOrderList } from '@/api/base/orderManage' import { workOrderList } from '@/api/base/orderManage';
import { getWorkOrderMsg, getOrderEnergyData } from '@/api/monitoring/orderEnergy' import {
import BarChart from "./components/barChart" getWorkOrderMsg,
getOrderEnergyData,
} from '@/api/monitoring/orderEnergy';
import BarChart from './components/barChart';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default { export default {
name: 'OrderEnergy', name: 'OrderEnergy',
mixins: [tableHeightMixin],
data() { data() {
return { return {
formConfig: [ formConfig: [
@@ -109,16 +124,17 @@ export default {
label: '工单', label: '工单',
selectOptions: [], selectOptions: [],
param: 'workOrderId', param: 'workOrderId',
clearable: false clearable: false,
}, },
{ {
type: 'select', type: 'select',
label: '能源类型', label: '能源类型',
selectOptions: [], selectOptions: [],
param: 'energyTypeId', param: 'energyTypeId',
labelField: 'labelName',
filterable: true, filterable: true,
width: 120, width: 120,
clearable: false clearable: false,
}, },
{ {
type: 'select', type: 'select',
@@ -128,89 +144,88 @@ export default {
valueField: 'value', valueField: 'value',
param: 'objType', param: 'objType',
width: 100, width: 100,
clearable: false clearable: false,
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
} },
], ],
tableProps, tableProps,
tableData: [], tableData: [],
tableH: this.tableHeight(400), heightNum: 400,
// 查询参数 // 查询参数
queryParams: { queryParams: {
workOrderId: '', workOrderId: '',
objType: '', objType: '',
energyTypeId: '' energyTypeId: '',
}, },
orderMsg: {}, orderMsg: {},
chartData: [], chartData: [],
activeModule: 'dataList' activeModule: 'dataList',
} };
}, },
components: { BarChart }, components: { BarChart },
mounted() { mounted() {
window.addEventListener('resize', () => { this.getListArr();
this.tableH = this.tableHeight(400)
})
this.getListArr()
}, },
methods: { methods: {
getListArr() { getListArr() {
workOrderList().then(res => { workOrderList().then((res) => {
this.formConfig[0].selectOptions = res.data || [] this.formConfig[0].selectOptions = res.data || [];
}) });
getEnergyTypeListAll().then(res => { getEnergyTypeListAll().then((res) => {
this.formConfig[1].selectOptions = res.data || [] this.formConfig[1].selectOptions = res.data || [];
}) });
}, },
buttonClick(val) { buttonClick(val) {
if (!val.workOrderId) { if (!val.workOrderId) {
this.$modal.msgWarning('工单不能为空') this.$modal.msgWarning('工单不能为空');
return false return false;
} }
if (!val.energyTypeId) { if (!val.energyTypeId) {
this.$modal.msgWarning('能源类型不能为空') this.$modal.msgWarning('能源类型不能为空');
return false return false;
} }
if (!val.objType) { if (!val.objType) {
this.$modal.msgWarning('对象维度不能为空') this.$modal.msgWarning('对象维度不能为空');
return false return false;
} }
this.queryParams.workOrderId = val.workOrderId this.queryParams.workOrderId = val.workOrderId;
this.queryParams.objType = val.objType this.queryParams.objType = val.objType;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId;
getWorkOrderMsg({ ...this.queryParams }).then(res => { getWorkOrderMsg({ ...this.queryParams }).then((res) => {
this.orderMsg = res.data || {} this.orderMsg = res.data || {};
getOrderEnergyData({ getOrderEnergyData({
...this.queryParams, ...this.queryParams,
startProduceTime: res.data.startProduceTime || '', startProduceTime: res.data.startProduceTime || '',
finishProduceTime: res.data.finishProduceTime || '' finishProduceTime: res.data.finishProduceTime || '',
}).then(result => { }).then((result) => {
this.tableData = result.data || [] this.tableData = result.data || [];
this.chartData = result.data || [] this.chartData = result.data || [];
}) });
}) });
}, },
toggleTab(val) { toggleTab(val) {
this.activeModule = val this.activeModule = val;
if (this.activeModule === 'barChart') { if (this.activeModule === 'barChart') {
this.$nextTick((res) => { this.$nextTick((res) => {
this.$refs.orderEnergyChart.getChart() this.$refs.orderEnergyChart.getChart();
}) });
} }
}, },
headBtnClick() {} headBtnClick() {},
} },
} };
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.orderEnergyContainer { .orderEnergyContainer {
background-color: rgb(242, 244, 249); background-color: rgb(242, 244, 249);
.box1, .box2, .box3 { .box1,
.box2,
.box3 {
background-color: #fff; background-color: #fff;
border-radius: 9px; border-radius: 9px;
} }
@@ -230,6 +245,9 @@ export default {
.lightTip { .lightTip {
font-weight: 400; font-weight: 400;
color: rgba(102, 102, 102, 0.75); color: rgba(102, 102, 102, 0.75);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
} }
.box3 { .box3 {
@@ -246,7 +264,7 @@ export default {
} }
.active { .active {
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
border-bottom-color: #0B58FF; border-bottom-color: #0b58ff;
} }
} }
} }
@@ -262,7 +280,7 @@ export default {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 18px; height: 18px;
background-color: #0B58FF; background-color: #0b58ff;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
vertical-align: bottom; vertical-align: bottom;

View File

@@ -9,7 +9,8 @@
: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"
@@ -33,6 +34,7 @@ import {
getEqAnalysis, getEqAnalysis,
exportEqAnalysisExcel, exportEqAnalysisExcel,
} from '@/api/equipment/analysis/statistics'; } from '@/api/equipment/analysis/statistics';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
// { // {
@@ -52,35 +54,49 @@ const tableProps = [
{ {
prop: 'lineName', prop: 'lineName',
label: '产线', label: '产线',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'sectionName', prop: 'sectionName',
label: '工段', label: '工段',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'equipmentName', prop: 'equipmentName',
label: '设备名称', label: '设备名称',
minWidth: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'equipmentType', prop: 'equipmentType',
label: '设备类型', label: '设备类型',
width: 150,
showOverflowtooltip: true
}, },
{ {
prop: 'workTime', prop: 'workTime',
label: '工作时间累积(h)', label: '工作时间累积(h)',
width: 160,
showOverflowtooltip: true
}, },
{ {
prop: 'repairCount', prop: 'repairCount',
label: '维修次数', label: '维修次数',
width: 120,
showOverflowtooltip: true
}, },
{ {
prop: 'maintainCount', prop: 'maintainCount',
label: '保养次数', label: '保养次数',
width: 120,
showOverflowtooltip: true
}, },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
const today = new Date(); const today = new Date();
@@ -110,7 +126,7 @@ export default {
tableBtn: [].filter((v) => v), tableBtn: [].filter((v) => v),
tableData: [], tableData: [],
listQuery: { listQuery: {
pageSize: 10, pageSize: 20,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
recordTime: [ recordTime: [

View File

@@ -75,6 +75,12 @@ export default {
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
formatter: (v) => {
const num = String(v.value)?.split('.').length === 2 ? v.value?.toFixed(2) : v.value
return `<div>
<span>${v.name}: ${num}</span>
</div>`
}
}, },
legend: { legend: {
show: false, show: false,

View File

@@ -19,7 +19,7 @@
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-data="list" :table-data="list"
max-height="600" :max-height="tableH"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<!-- <method-btn <!-- <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
@@ -42,14 +42,16 @@
<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';
export default { export default {
name: 'ExceptionAnalysis', name: 'ExceptionAnalysis',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
components: {}, components: {},
props: {}, props: {},
data() { data() {
return { return {
heightNum: 220,
searchBarKeys: ['name', 'code'], searchBarKeys: ['name', 'code'],
// tableBtn: [ // tableBtn: [
// this.$auth.hasPermi('base:equipment-group:update') // this.$auth.hasPermi('base:equipment-group:update')

View File

@@ -48,9 +48,11 @@
<script> <script>
import moment from 'moment'; import moment from 'moment';
import LineChart from './components/lineChart.vue'; import LineChart from './components/lineChart.vue';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default { export default {
name: 'QualityAnalysis', name: 'QualityAnalysis',
mixins: [tableHeightMixin],
components: { LineChart }, components: { LineChart },
props: {}, props: {},
data() { data() {
@@ -58,7 +60,6 @@ export default {
const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()]; const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()];
return { return {
dialogVisible: false, dialogVisible: false,
tableH: this.tableHeight(260),
urls: { urls: {
page: '/analysis/equipment-analysis/quality', page: '/analysis/equipment-analysis/quality',
}, },
@@ -254,9 +255,9 @@ export default {
this.fillProductOptions(); this.fillProductOptions();
}, },
mounted() { mounted() {
window.addEventListener('resize', () => { // window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) // this.tableH = this.tableHeight(260)
}) // })
this.$refs['search-bar'].headBtnClick('search'); this.$refs['search-bar'].headBtnClick('search');
}, },
methods: { methods: {

View File

@@ -12,7 +12,8 @@
: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"
@@ -61,6 +62,8 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './AddOrUpdate.vue'; import AddOrUpdate from './AddOrUpdate.vue';
import moment from 'moment'; import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = { const btn = {
@@ -89,7 +92,7 @@ const btn = {
export default { export default {
name: 'Record', name: 'Record',
components: { AddOrUpdate }, components: { AddOrUpdate },
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
readOnly: false, readOnly: false,
@@ -116,17 +119,17 @@ export default {
// : undefined, // : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'productionLine', label: '产线' }, { prop: 'productionLine', label: '产线', width: 120, showOverflowtooltip: true },
{ prop: 'workshopSection', label: '工段' }, { prop: 'workshopSection', label: '工段', width: 120, showOverflowtooltip: true },
{ prop: 'equipment', label: '设备名称' }, { prop: 'equipment', label: '设备名称', width: 120, showOverflowtooltip: true },
{ {
prop: 'alarmGrade', prop: 'alarmGrade',
label: '报警级别', label: '报警级别',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL), filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
}, },
{ prop: 'createTime', label: '报警时间', filter: timeFilter }, { prop: 'createTime', label: '报警时间', filter: timeFilter, width: 150, showOverflowtooltip: true },
{ prop: 'alarmCode', label: '设备报警码' }, { prop: 'alarmCode', label: '设备报警码', width: 180, showOverflowtooltip: true },
{ prop: 'alarmContent', label: '报警内容' }, { prop: 'alarmContent', label: '报警内容', width: 150, showOverflowtooltip: true },
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn }, { prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, { prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn },
// { prop: 'remark', label: '备注' }, // { prop: 'remark', label: '备注' },
@@ -203,7 +206,7 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
lineId: null, lineId: null,
equipmentId: null, equipmentId: null,
recordTime: [], recordTime: [],

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