合并冲突

This commit is contained in:
zhoumengru
2025-09-12 16:37:27 +08:00
36 changed files with 734 additions and 870 deletions

View File

@@ -213,6 +213,11 @@ export const columnList = [
key: 'status', key: 'status',
scopedSlots: { customRender: 'status' } scopedSlots: { customRender: 'status' }
}, },
{
title: '投运时间',
dataIndex: 'operation_date',
key: 'operation_date'
},
{ {
title: '场站运行模式', title: '场站运行模式',
dataIndex: 'work_mode', dataIndex: 'work_mode',
@@ -225,10 +230,11 @@ export const columnList = [
key: 'policy_id', key: 'policy_id',
scopedSlots: { customRender: 'policy_id' } scopedSlots: { customRender: 'policy_id' }
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
fixed: 'right',
key: 'operate', key: 'operate',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
} }
@@ -668,21 +674,9 @@ export const stationOptions = [
label: '场站运行模式', label: '场站运行模式',
value: undefined, value: undefined,
key: 'work_mode', key: 'work_mode',
type: 'select', type: 'slot',
list: [ slotName: 'work_mode',
{ list: []
label: '最优经济化',
value: '1'
},
{
label: '支撑电网稳定',
value: '2'
},
{
label: '自定义',
value: '3'
}
]
}, },
{ {
// 0未启用1启用 // 0未启用1启用
@@ -690,7 +684,7 @@ export const stationOptions = [
label: '场站运行策略', label: '场站运行策略',
value: undefined, value: undefined,
key: 'policy_id', key: 'policy_id',
type: 'select', type: 'unshow',
list: [ list: [
{ {
label: '削峰套利', label: '削峰套利',

View File

@@ -163,8 +163,6 @@ onMounted(async () => {
data.realTableData = [...props.tableData] data.realTableData = [...props.tableData]
await nextTick() await nextTick()
// console.log(props.tableH, 'props.tableH');
console.log(comtable.value.offsetHeight,'comtable.value.offsetHeight');
scroll.value = { y: comtable.value.offsetHeight - 56 } scroll.value = { y: comtable.value.offsetHeight - 56 }
@@ -386,12 +384,16 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
:deep(.ant-table-body .ant-table-cell-fix-right.ant-table-cell-fix-right-first){ :deep(.ant-table-body .ant-table-cell-fix-right.ant-table-cell-fix-right-first){
background: #082e4a !important; background: #082e4a !important;
}
:deep(.ant-table.ant-table-has-fix-left.ant-table-middle.ant-table-bordered){
border-radius: 20px !important;
} }
:deep(.ant-table-body) { :deep(.ant-table-body) {
color:#fff; color:#fff;
background: $table-bg !important; background: $table-bg !important;
border: 1px solid $table-border; // border: 1px solid $table-border;
border-radius: 0px 0px 20px 20px; border-radius: 20px!important;
.ant-table-cell { .ant-table-cell {
background: var(--theme-bg) !important; background: var(--theme-bg) !important;
} }
@@ -424,6 +426,8 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
} }
:deep(.ant-table-wrapper .ant-table) { :deep(.ant-table-wrapper .ant-table) {
border: 1px solid $table-border!important;
background-color: transparent !important; background-color: transparent !important;
} }

View File

@@ -455,7 +455,6 @@ function confirm() {
resolve(true) resolve(true)
}) })
.catch((error) => { .catch((error) => {
console.log('error', error)
resolve(false) resolve(false)
}) })
} }

View File

@@ -8,6 +8,24 @@
:ref="'detailInfo' + index" :ref="'detailInfo' + index"
:disabled="disabled" :disabled="disabled"
> >
<template #work_mode="item">
<a-select
:dropdown-match-select-width="false"
v-model:value="workModeIdSelect"
:placeholder="'请选择' + item.label"
:disabled="disabled"
allow-clear
>
<a-select-option
:value="selectItem.value"
v-for="selectItem in workModeList"
:key="selectItem.value"
>
{{ selectItem.label }}
</a-select-option>
</a-select>
</template>
<template #role_id="item"> <template #role_id="item">
<a-select <a-select
@@ -110,6 +128,31 @@ export default {
data() { data() {
return { return {
workModeIdSelect: undefined,
workModeList: [
{
label: '峰谷套利',
value: '1'
},
{
label: '增网配容',
value: '2'
},
{
label: '应急供电',
value: '3'
},
{
label: '并网保电',
value: '4'
},
{
label: '自定时段',
value: '5'
}
],
tip: '正在加载...', tip: '正在加载...',
roleIdList: [], roleIdList: [],
transferDialog: false, transferDialog: false,
@@ -132,6 +175,27 @@ export default {
}, },
computed: {}, computed: {},
watch: { watch: {
workModeIdSelect: {
handler(n) {
switch (n) {
case '1':
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='select'
break;
case '5':
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='select'
break;
default:
this.detailInfos[0].list[this.detailInfos[0].list.length-1].type='unshow'
break;
}
},
// immediate: true
},
action: { action: {
handler(n) { handler(n) {
if (n === 'read') { if (n === 'read') {
@@ -155,7 +219,6 @@ export default {
// this.formRules = menuFormRules // this.formRules = menuFormRules
break break
case 'permission': case 'permission':
break break
case 'role': case 'role':
@@ -166,6 +229,7 @@ export default {
case 'station': case 'station':
this.detailInfos = stationOptions this.detailInfos = stationOptions
this.formRules = stationFormRules this.formRules = stationFormRules
this.workModeIdSelect=this.detailInfos[0].ruleForm['work_mode']
break break
case 'device': case 'device':
@@ -312,23 +376,8 @@ export default {
add: '/insertRole', add: '/insertRole',
edit: '/updateRole' edit: '/updateRole'
} }
const { selectedRowKeys ,selectedArr} = this.$refs.treeTable[0] const { selectedRowKeys } = this.$refs.treeTable[0]
console.log(selectedRowKeys,selectedArr, 'selectedRowKeys')
// const arr = selectedArr.map((item) => ({
// ...item,
// // 转换操作权限为布尔值
// ...this.getPerOperBoolean(item),
// // 递归处理children
// children: item.children
// ? item.children.map((child) => ({
// ...child,
// ...this.getPerOperBoolean(child),
// }))
// : []
// }))
// console.log(arr,"arr")
const data = this.filterTreeData(selectedRowKeys, this.$refs.treeTable[0].tableData) const data = this.filterTreeData(selectedRowKeys, this.$refs.treeTable[0].tableData)
const arr = data.map((item) => ({ const arr = data.map((item) => ({
@@ -340,8 +389,7 @@ export default {
children: item.children children: item.children
? item.children.map((child) => ({ ? item.children.map((child) => ({
...child, ...child,
...this.getPerOperBoolean(child), ...this.getPerOperBoolean(child)
})) }))
: [] : []
})) }))
@@ -368,50 +416,46 @@ export default {
}, },
// 定义筛选树形数据的函数 // 定义筛选树形数据的函数
filterTreeData(list1, list2) { filterTreeData(list1, list2) {
const keySet = new Set(list1); const keySet = new Set(list1)
// 递归处理节点的函数 // 递归处理节点的函数
const filterNode = (node) => { const filterNode = (node) => {
// 创建新节点对象(浅拷贝) // 创建新节点对象(浅拷贝)
const newNode = Object.assign({}, node); const newNode = Object.assign({}, node)
// 临时删除children属性以便处理 // 临时删除children属性以便处理
const { children, ...rest } = newNode; const { children, ...rest } = newNode
// 处理子节点 // 处理子节点
let newChildren = []; let newChildren = []
if (children) { if (children) {
newChildren = children newChildren = children.map((child) => filterNode(child)).filter((child) => child !== null)
.map((child) => filterNode(child))
.filter((child) => child !== null);
} }
// 重建新节点 // 重建新节点
const resultNode = Object.assign(rest, {}); const resultNode = Object.assign(rest, {})
if (newChildren.length > 0) { if (newChildren.length > 0) {
resultNode.children = newChildren; resultNode.children = newChildren
} }
// 判断是否保留节点 // 判断是否保留节点
if (keySet.has(node.key)) { if (keySet.has(node.key)) {
return resultNode; return resultNode
} }
// 保留有符合条件子节点的父节点移除自身key // 保留有符合条件子节点的父节点移除自身key
if (newChildren.length > 0) { if (newChildren.length > 0) {
return resultNode; return resultNode
} }
return null; return null
}; }
// 处理根节点 // 处理根节点
const result = list2 const result = list2.map((node) => filterNode(node)).filter((node) => node !== null)
.map((node) => filterNode(node))
.filter((node) => node !== null);
return result; return result
}, },
getPerOperBoolean(data) { getPerOperBoolean(data) {
return { return {

View File

@@ -141,7 +141,7 @@ export default {
} }
}, },
legend: { legend: {
top: 20, top: 10,
textStyle: { textStyle: {
color: '#fff' color: '#fff'
} }
@@ -150,7 +150,8 @@ export default {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '5%', bottom: '5%',
containLabel: true top: '32%',
// containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@@ -192,44 +193,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
.mark {
font-size: 16px;
margin-right: 2px;
}
& > div:nth-child(2),
& > div:nth-child(3) {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
& > div:last-child{
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -154,6 +154,8 @@ export default {
}, },
drawLineChart(activeKey) { drawLineChart(activeKey) {
console.log(this.$refs.charge)
// const labelCount = Math.floor(500 / 30);
this.getChargeData(activeKey) this.getChargeData(activeKey)
if(this.chargeChart){ if(this.chargeChart){
this.chargeChart.dispose() this.chargeChart.dispose()
@@ -170,7 +172,7 @@ export default {
} }
}, },
legend: { legend: {
top: 20, top: 10,
textStyle: { textStyle: {
color: '#fff' color: '#fff'
} }
@@ -178,8 +180,9 @@ export default {
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '5%', bottom: '1%',
containLabel: true top: '32%',
// containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@@ -197,10 +200,11 @@ export default {
lineStyle: { type: 'dashed', color: '#435463' } lineStyle: { type: 'dashed', color: '#435463' }
}, },
axisLabel: { axisLabel: {
interval: 4, // margin: 10,
// interval: 60,
color: '#fff', color: '#fff',
fontSize:12 fontSize:12,
// padding: [5, 0, 0, 0]
} }
}, },
series: this.chargeChartData.ydata series: this.chargeChartData.ydata
@@ -226,37 +230,5 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -105,7 +105,7 @@ export default {
this.energyChartData.ydata[index] = { this.energyChartData.ydata[index] = {
name: item.name, name: item.name,
smooth: true, smooth: true,
type: 'bar', type: 'line',
barWidth: 5, barWidth: 5,
itemStyle: { itemStyle: {
borderRadius: [5, 5, 0, 0], borderRadius: [5, 5, 0, 0],
@@ -147,7 +147,8 @@ export default {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '3%', bottom: '3%',
containLabel: true top: '32%',
// containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@@ -165,7 +166,7 @@ export default {
lineStyle: { type: 'dashed', color: '#435463' } lineStyle: { type: 'dashed', color: '#435463' }
}, },
axisLabel: { axisLabel: {
interval: 4, // interval: 4,
color: '#fff', color: '#fff',
fontSize:12 fontSize:12
@@ -193,37 +194,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -57,7 +57,7 @@ export default {
data() { data() {
return { return {
center: [116.404, 39.915], // 默认中心点(北京 center: [112.870000,34.180000], // 默认中心点(河南
zoom: 12, zoom: 12,
map: null, map: null,
currentMarker: {}, currentMarker: {},
@@ -72,12 +72,19 @@ export default {
} }
}, },
mounted() { mounted() {
this.$nextTick(()=>{
this.initMap() this.initMap()
})
},
beforeUnmount() {
if(this.map){
// this.map.destory()
this.map=null
}
}, },
methods: { methods: {
init(map) { init(map) {
this.map = map this.map = map
this.center= [110.404, 40.915]
this.getMarkList() this.getMarkList()
}, },
async getMarkList() { async getMarkList() {
@@ -114,33 +121,27 @@ export default {
// 备用定位方案
// setFallbackLocation() {
// const fallbackCoords = [116.404, 39.915] // 北京坐标
// this.center = fallbackCoords
// if (this.map) {
// this.map.setCenter(new T.LngLat(...fallbackCoords))
// }
// },
async getSysConfig() { async getSysConfig() {
let sysConfig let sysConfig=this.targetKey
try { // try {
const query = {} // const query = {}
const res = await getReq('/', query) // const res = await getReq('/', query)
if (res.errcode === 0) { // if (res.errcode === 0) {
sysConfig = res.data.value // sysConfig = res.data.value
} else { // } else {
throw res // throw res
} // }
} catch (error) { // } catch (error) {
sysConfig = this.targetKey // sysConfig = this.targetKey
} // }
return sysConfig return sysConfig
}, },
async clickArrayMarker(currentVal) { async clickArrayMarker(currentVal) {
this.changeStationId = currentVal.station_id this.changeStationId = currentVal.station_id
this.testVal.name=currentVal.name
this.showCtrModal = true this.showCtrModal = true
} }
} }

View File

@@ -58,7 +58,7 @@ export default {
propsInfo: { propsInfo: {
cabId: '', cabId: '',
stationId: '', stationId: '',
stationName: '场站111' station_name: '场站111'
}, },
showCtrModal: false, showCtrModal: false,
mapStyle: { mapStyle: {

View File

@@ -165,37 +165,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="onLine"> <div class="env">
<div class="content"> <div class="content">
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`"> <div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
<i <i
@@ -96,18 +96,14 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal !== oldVal) { if (newVal !== oldVal) {
this.list.forEach((item) => { this.list.forEach((item) => {
console.log(this.propsTotal,this.propsTotal[item.key],"this.propsTotal[item.key]")
if (item.key == 'coolingStatus') { if (item.key == 'coolingStatus') {
console.log(this.coolingList.find(
(e) => e.value == this.propsTotal[item.key]
))
item.value = this.coolingList.find( item.value = this.coolingList.find(
(e) => e.value == this.propsTotal[item.key] (e) => e.value == this.propsTotal[item.key]
).label ).label ||'关机'
} else if (item.key == 'aircStatus') { } else if (item.key == 'aircStatus') {
item.value = this.aircList.map( item.value = this.aircList.map(
(e) => e.value == this.propsTotal[item.key] (e) => e.value == this.propsTotal[item.key]
).label )[0].label||'关机'
} else { } else {
item.value = this.propsTotal[item.key] item.value = this.propsTotal[item.key]
} }
@@ -122,7 +118,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.onLine { .env {
height: calc(100% - 45px); height: calc(100% - 45px);
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="onLine"> <div class="operationlInfo">
<div class="content"> <div class="content">
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`"> <div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
<a-image :preview="false" :src="item.iconPath" :width="50" class="left"> </a-image> <a-image :preview="false" :src="item.iconPath" :width="50" class="left"> </a-image>
@@ -101,7 +101,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.onLine { .operationlInfo {
height: calc(100% - 45px); height: calc(100% - 45px);
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -112,7 +112,7 @@ export default {
.content { .content {
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: 90%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
@@ -120,7 +120,7 @@ export default {
.item { .item {
height: 50%; height: 50%;
width: 30%; width: 45%;
// height: 47px; // height: 47px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="onLine"> <div class="prefabCabin">
<div class="content-left"> <div class="content-left">
<div v-for="item in leftList" :key="item.key" :class="`item ${item.class}`"> <div v-for="item in leftList" :key="item.key" :class="`item ${item.class}`">
<div> <div>
@@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div style="text-align: center; font-weight: 500"> <div style="text-align: center; font-weight: 500">
<div class="online-icon"></div> <div class="prefabCabin-icon"></div>
<span>{{ curStatus }}</span> <span>{{ curStatus }}</span>
</div> </div>
@@ -108,7 +108,7 @@ export default {
key: 'power_rated', key: 'power_rated',
value: 100, value: 100,
d: 'Kw', d: 'Kw',
label: 'PCS额定功率', label: '额定功率',
class: 'item-6' class: 'item-6'
} }
] ]
@@ -146,7 +146,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.onLine { .prefabCabin {
height: calc(100% - 45px); height: calc(100% - 45px);
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -198,7 +198,7 @@ export default {
width: 120px; width: 120px;
} }
.online-icon { .prefabCabin-icon {
width: 110px; width: 110px;
height: 130px; height: 130px;
background-image: url('@/assets/home/perIcon.png'); background-image: url('@/assets/home/perIcon.png');

View File

@@ -179,37 +179,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child{
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d{
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -32,7 +32,7 @@ export default {
key: 'runDays', key: 'runDays',
value: 26, value: 26,
d: '天', d: '天',
label: '场站运行天数', label: '运行天数',
class: 'item-1', class: 'item-1',
iconPath: require('@/assets/home/wendu.png') iconPath: require('@/assets/home/wendu.png')
}, },
@@ -56,7 +56,7 @@ export default {
key: 'incomeTotal', key: 'incomeTotal',
value: 26, value: 26,
d: '元', d: '元',
label: '场站累计收益', label: '累计收益',
class: 'item-4', class: 'item-4',
iconPath: require('@/assets/home/dianliu.png') iconPath: require('@/assets/home/dianliu.png')
}, },

View File

@@ -158,37 +158,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -1,19 +1,11 @@
<template> <template>
<div class="Operational"> <div class="operational">
<div class="oper-bg">{{ currentHoverNumber }}%</div> <div id="operational-chart"></div>
<div class="oper-right">
<div v-for="item in curList" :key="item.key" class="oper-item" @mouseover="changeNumber(item)">
<div style="display: flex">
<div :style="`background:${item.lineColor}`" class="item-icon"></div>
<span class="item-name">{{ item.name }}</span>
</div>
<span class="item-value">{{ item.value?item.value:0 }}</span>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: '', name: '',
props: { props: {
@@ -28,89 +20,203 @@ export default {
}, },
data() { data() {
return { return {
currentHoverNumber: 58,
curList: [ curList: [
{ {
name: '收益', name: '收益',
key: 'incomeTotal', key: 'income',
percentKey: 'connector_online_percent', percentKey: 'connector_online_percent',
lineColor: 'linear-gradient(90deg, rgba(13, 87, 144, 1) 0%, rgba(21, 153, 253, 1) 100%);', lineColor: '#00BAAD',
value: 0 value: 0
}, },
{ {
name: '利用率', name: '利用率',
key: 'usage_rate', key: 'usage_rate',
percentKey: 'connector_off_percent', percentKey: 'connector_off_percent',
lineColor: lineColor:'#0E68E4',
'linear-gradient(90deg, rgba(53, 120, 124, 1) 0%, rgba(102, 225, 223, 1) 100%);',
value: 0 value: 0
} }
] ],
operationalChart: null,
operationalChartData: {
ydata: [],
xdata: []
},
} }
}, },
watch: { watch: {
total:{
deviceInfo: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal!==oldVal) { if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
let that=this this.$nextTick(() => {
that.curList.forEach((item)=>{ this.drawLineChart()
item.value=that.total[item.key]
}) })
} }
},
} deep: true // 确保深度比较
} }
}, },
mounted() {}, mounted() {},
beforeUnmount() {
window.removeEventListener('resize', this.handleResize)
if (this.operationalChart) {
this.operationalChart.dispose()
this.operationalChart = null
}
},
methods: { methods: {
changeNumber(item) { processData(data, keys) {
this.currentHoverNumber = item.percentValue? item.percentValue:0 data.sort((a, b) => {
return new Date(a.station_name) - new Date(b.station_name)
})
const dates = data.map((item) => item.station_name)
const values = []
keys.forEach((item, index) => {
values[index] = data.map((dataValue) => dataValue[keys[index]])
})
return {
dates,
values
}
},
handleResize() {
if (this.operationalChart) {
this.operationalChart.resize()
}
},
getChargeData() {
const arr = this.curList
const keyList = this.curList.map((item) => item.key)
const result = this.processData(this.deviceInfo, keyList)
this.operationalChartData.xdata = result.dates
arr.forEach((item, index) => {
this.operationalChartData.ydata[index] = {
name: item.name,
smooth: true,
type: 'bar',
barWidth: 5,
itemStyle: {
borderRadius: [5, 5, 0, 0],
color: item.lineColor
},
emphasis: {
focus: 'series'
},
yAxisIndex: index,
global: false,
showSymbol: false,
data: result.values[index]
}
})
},
drawLineChart(activeKey) {
this.getChargeData(activeKey)
if (this.operationalChart) {
this.operationalChart.dispose()
}
const chartDom = document.getElementById('operational-chart')
if (!chartDom) return
let operationalChart = this.$echarts.init(chartDom)
this.operationalChart = operationalChart
const option = {
tooltip: {
trigger: 'axis', // 触发类型:坐标轴触发
// position: function (pos, params, dom, rect, size) {
// // pos: 鼠标位置 [x, y]
// // size: 提示框大小 {viewSize: [width, height], contentSize: [width, height]}
// const x = pos[0] + 10; // 鼠标右侧10px
// const y = pos[1]; // 保持与鼠标同高
// return [x, y];
// }
},
legend: {
top: 10,
textStyle: {
color: '#fff'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '5%',
containLabel: true
},
xAxis: {
type: 'category',
data: this.operationalChartData.xdata,
axisLine: {
lineStyle: { type: 'dashed', color: '#435463' }
},
axisLabel: {
color:"#fff",
// interval:'auto', // 显示所有标签
fontSize: 12,
formatter: function(value) {
return value.length > 8 ? value.substring(0, 8) + '...' : value;
}
}
},
yAxis: [
{
name: '收益(元)',
type: 'value',
splitLine: {
lineStyle: { type: 'dashed', color: '#435463' }
},
nameTextStyle: {
color: '#fff' // 绿色名称
},
axisLabel: {
interval: 4,
color: '#fff',
fontSize:12
},
},
{
name: '利用率(%)',
type: 'value',
nameTextStyle: {
color: '#fff' // 绿色名称
},
splitLine: {
lineStyle: { type: 'dashed', color: '#435463' }
},
axisLabel: {
interval: 4,
color: '#fff',
fontSize:12
},
},
],
series: this.operationalChartData.ydata
}
option && operationalChart.setOption(option)
this.setupResizeListener()
},
setupResizeListener() {
window.removeEventListener('resize', this.handleResize)
window.addEventListener('resize', this.handleResize)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.Operational { .operational {
display: flex; height: calc(100% - 45px);
justify-content: space-around;
align-items: center; #operational-chart {
height: 100%; height: 100%;
.oper-bg {
font-size: 1vw;
display: flex;
justify-content: center;
align-items: center;
background: url('../../assets/home/operBg.png');
background-size: 100% 100%;
width: 9vw;
height: 9vw;
aspect-ratio: 1/1;
}
.oper-right {
font-size: 13px;
.oper-item {
height: 12%;
align-items: center;
color: #fff;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
padding: 5px 15px;
background: url('../../assets/home/leg-bg.png');
background-size: 100% 100%;
.item-icon {
width: 10px;
height: 10px;
}
.item-name {
margin-left: 5px;
margin-right: 60px;
}
}
} }
} }
</style> </style>

View File

@@ -138,7 +138,7 @@ export default {
} }
}, },
legend: { legend: {
top: 20, top: 10,
textStyle: { textStyle: {
color: '#fff' color: '#fff'
} }
@@ -147,7 +147,8 @@ export default {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '5%', bottom: '5%',
containLabel: true top: '32%',
// containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@@ -165,7 +166,7 @@ export default {
lineStyle: { type: 'dashed', color: '#435463' } lineStyle: { type: 'dashed', color: '#435463' }
}, },
axisLabel: { axisLabel: {
interval: 4, // interval: 4,
color: '#fff', color: '#fff',
fontSize:12 fontSize:12
@@ -193,37 +194,4 @@ export default {
} }
} }
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 14px;
margin: 3px 0px;
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}
</style> </style>

View File

@@ -101,17 +101,15 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal && newVal !== oldVal) { if (newVal && newVal !== oldVal) {
this.curList.forEach((item) => { this.curList.forEach((item) => {
item.value = newVal[item.key] || 0; item.value = newVal[item.key] || 0
}); })
} }
}, },
immediate: true, immediate: true,
deep: true deep: true
} }
}, },
mounted() { mounted() {},
console.log(this.total,'total')
},
methods: {} methods: {}
} }
</script> </script>
@@ -148,8 +146,7 @@ export default {
.content-left, .content-left,
.content-right { .content-right {
width: calc((100% - 110px) / 2); width: 40%;
// width: 40%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -172,7 +169,7 @@ export default {
} }
.online-icon { .online-icon {
width: 110px; width: 20%;
height: 130px; height: 130px;
background-image: url('@/assets/home/onLineIcon.png'); background-image: url('@/assets/home/onLineIcon.png');
background-size: contain; background-size: contain;

View File

@@ -333,7 +333,7 @@ input:-internal-autofill-selected {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.button { .button {
margin-left: 10px; // margin-left: 10px;
} }
} }
} }

View File

@@ -10,7 +10,8 @@
:row-class-name="(record, index) => rowClassName(record, index)" :row-class-name="(record, index) => rowClassName(record, index)"
row-key="key" row-key="key"
size="middle" size="middle"
:row-selection="rowSelection" :row-selection="newTableOpt.select
?rowSelection:null"
:indent-size="30" :indent-size="30"
:check-strictly="false" :check-strictly="false"
@resizeColumn="handleResizeColumn" @resizeColumn="handleResizeColumn"
@@ -100,6 +101,7 @@ export default {
}, },
computed: { computed: {
rowSelection() { rowSelection() {
const { selectedRowKeys } = this const { selectedRowKeys } = this
return { return {
checkStrictly: this.tableOption.checkStrictly, checkStrictly: this.tableOption.checkStrictly,
@@ -152,7 +154,6 @@ export default {
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows[selectedRows.length - 1] this.selectedRows = selectedRows[selectedRows.length - 1]
this.selectedArr=selectedRows this.selectedArr=selectedRows
console.log(selectedRowKeys, this.selectedArr ,"selectedRowKeys")
this.$emit('getSelectedIds', selectedRowKeys) this.$emit('getSelectedIds', selectedRowKeys)
}, },
onSelect(record, selected) { onSelect(record, selected) {
@@ -439,8 +440,13 @@ export default {
} }
:deep(.ant-table-container > .ant-table-content > table) { :deep(.ant-table-container > .ant-table-content > table) {
border-inline-start: 1px solid var(--theme-bg) !important; border-inline-start: 1px solid var(--theme-bg) !important;
} }
:deep(.ant-table.ant-table-has-fix-left.ant-table-middle.ant-table-bordered){
border-radius: 20px !important;
}
:deep(.ant-pagination-item-link) { :deep(.ant-pagination-item-link) {
color: var(--theme-text-default) !important; color: var(--theme-text-default) !important;

View File

@@ -376,7 +376,6 @@ export default {
} }
}, },
async openModal(item, val) { async openModal(item, val) {
console.log(item, '=============')
this.modalComponent = val this.modalComponent = val
this.modalOpen = true this.modalOpen = true
if (val == 1) { if (val == 1) {

View File

@@ -173,6 +173,7 @@ export default {
}, },
// 初始化柱状图 // 初始化柱状图
initBarCharts() { initBarCharts() {
this.chartOptions.forEach((option, index) => { this.chartOptions.forEach((option, index) => {
if (option.type === 'bar') { if (option.type === 'bar') {
const dom = this.$refs[`chartContainer${index}`]?.[0]; const dom = this.$refs[`chartContainer${index}`]?.[0];

View File

@@ -1,7 +1,7 @@
import axios from 'axios' import axios from 'axios'
import openNotification from '../utils/notification' import openNotification from '../utils/notification'
// import { message } from 'ant-design-vue' // import { message } from 'ant-design-vue'
import router from 'vue-router'
const service = axios.create({ const service = axios.create({
baseURL: '/api', baseURL: '/api',
timeout: 120000 timeout: 120000
@@ -17,13 +17,14 @@ service.interceptors.response.use(
const res = response.data const res = response.data
if (res.errCode !== 0) { if (res.errCode !== 0) {
console.log(res, 'res')
if ((res.ERR_TOKEN = 2 || res.errmsg == '校验token过期')) { if ((res.ERR_TOKEN = 2 || res.errmsg == '校验token过期')) {
setTimeout(() => { setTimeout(() => {
// router.push({ path: '/login' }) // router.push({ path: '/login' })
}, 1000) }, 1000)
} else { } else {
console.log(res.errmsg, 'res.errmsg') console.log(res.errmsg, 'res.errmsg')
message.error(res.errmsg) // message.error(res.errmsg)
// openNotification({ // openNotification({
// status: 'error', // status: 'error',
// desc: res.tip // desc: res.tip

View File

@@ -13,41 +13,48 @@ export const routes = [
{ {
path: '/', path: '/',
name: '/', name: '/',
redirect: '/Home', redirect: '/home',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "main" */ '@/views/MainView.vue'), component: () => import(/* webpackChunkName: "main" */ '@/views/MainView.vue'),
children: [ children: [
{ {
path: 'Home', path: 'home',
component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue') component: () => import(/* webpackChunkName: "monitor" */ '@/views/sub/Home.vue'),
meta: { requiresAuth: true }
}, },
{ {
path: 'monitor', path: 'monitor',
name: 'monitor', name: 'monitor',
title: '运行监控', title: '运行监控',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "monitor" */ '@/views/monitor.vue') component: () => import(/* webpackChunkName: "monitor" */ '@/views/monitor.vue')
}, },
{ {
path: 'predict', path: 'predict',
name: 'predict', name: 'predict',
title: '预测管理', title: '预测管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "predict" */ '@/views/predict.vue') component: () => import(/* webpackChunkName: "predict" */ '@/views/predict.vue')
}, },
{ {
path: 'statisticalAnalysis', path: 'statisticalAnalysis',
name: 'statisticalAnalysis', name: 'statisticalAnalysis',
title: '统计分析', title: '统计分析',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "monitor" */ '@/views/statisticalAnalysis.vue') component: () => import(/* webpackChunkName: "monitor" */ '@/views/statisticalAnalysis.vue')
}, },
{ {
path: 'system', path: 'system',
name: 'system', name: 'system',
redirect: '/system/user', redirect: '/system/user',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/index.vue'), component: () => import(/* webpackChunkName: "system" */ '@/views/system/index.vue'),
children: [ children: [
{ {
path: 'user', path: 'user',
name: 'user', name: 'user',
title: '用户管理', title: '用户管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/user.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/user.vue')
}, },
@@ -55,12 +62,14 @@ export const routes = [
name: 'role', name: 'role',
path: 'role', path: 'role',
title: '角色管理', title: '角色管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')
}, },
{ {
name: 'permission', name: 'permission',
path: 'permission', path: 'permission',
title: '权限管理', title: '权限管理',
meta: { requiresAuth: true },
component: () => component: () =>
import(/* webpackChunkName: "system" */ '@/views/system/permission.vue') import(/* webpackChunkName: "system" */ '@/views/system/permission.vue')
}, },
@@ -68,36 +77,42 @@ export const routes = [
name: 'station', name: 'station',
path: 'station', path: 'station',
title: '场站管理', title: '场站管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue')
}, },
{ {
name: 'service', name: 'service',
path: 'service', path: 'service',
title: '服务管理', title: '服务管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue')
}, },
{ {
path: 'policy', path: 'policy',
name: 'policy', name: 'policy',
title: '策略管理', title: '策略管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/policy.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/policy.vue')
}, },
{ {
name: 'device', name: 'device',
path: 'device', path: 'device',
title: '设备管理', title: '设备管理',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/device.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/device.vue')
}, },
{ {
name: 'alarmlog', name: 'alarmlog',
path: 'alarmlog', path: 'alarmlog',
title: '告警日志', title: '告警日志',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/alarmLog.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/alarmLog.vue')
}, },
{ {
name: 'syslog', name: 'syslog',
path: 'syslog', path: 'syslog',
title: '系统日志', title: '系统日志',
meta: { requiresAuth: true },
component: () => import(/* webpackChunkName: "system" */ '@/views/system/log.vue') component: () => import(/* webpackChunkName: "system" */ '@/views/system/log.vue')
} }
] ]
@@ -111,22 +126,26 @@ const router = createRouter({
routes routes
}) })
// 全局前置守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(to) const isLoggedIn = localStorage.getItem('token') // 检查用户是否已登录
const token = localStorage.getItem('token') || ''
if (to.path == '/login') { // 2. 如果访问登录页且已登录,跳转到首页
if (token && token != '') { if (to.path === '/login' && isLoggedIn) {
next('/') next('/')
} else { return
next()
} }
} else {
if (token && token != '') { // 3. 检查路由权限
next() if (to.matched.some((record) => record.meta.requiresAuth)) {
} else { if (!isLoggedIn) {
// 未登录则重定向到登录页,并携带原路径
next('/login') next('/login')
} else {
next()
} }
} else {
next() // 无需认证的路由直接放行
} }
}) })

View File

@@ -19,7 +19,13 @@ $page-border: #cad2dd;
background: #b1c4c4; background: #b1c4c4;
} }
.ant-switch.ant-switch-checked { .ant-switch.ant-switch-checked {
background: #00fffb background: #00fffb;
}
.ant-select .ant-select-arrow {
background: transparent !important;
}
.ant-select .ant-select-clear {
background: transparent !important;
} }
.ant-switch .ant-switch-handle::before { .ant-switch .ant-switch-handle::before {
@@ -60,7 +66,6 @@ $page-border: #cad2dd;
} }
.ant-picker-suffix { .ant-picker-suffix {
color: #ffffff !important; color: #ffffff !important;
} }
} }
.ant-input-affix-wrapper { .ant-input-affix-wrapper {
@@ -163,3 +168,38 @@ $page-border: #cad2dd;
color: #fff !important; color: #fff !important;
} }
} }
// 添加统一布局的样式
.text_Cur {
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
border-image: linear-gradient(to right, transparent, #1d8a7b, transparent) 1;
padding: 0px 15px;
font-size: 12px;
margin: 3px 0px;
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
& > div:last-child {
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
.mark {
font-size: 16px;
margin-right: 2px;
}
background: linear-gradient(
90deg,
rgba(0, 186, 173, 0.15) 0%,
rgba(61, 254, 250, 0.15) 49.2%,
rgba(61, 254, 250, 0) 100%
);
.d {
margin-left: 1px;
font-size: 12px;
}
}

View File

@@ -5,8 +5,6 @@ export function getRunDays(date) {
const timeDiff = today - launchDate // 毫秒差 const timeDiff = today - launchDate // 毫秒差
const daysRun = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)) // 转换为天数 const daysRun = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)) // 转换为天数
console.log(`从 2023-01-01 到今天已经运行了 ${daysRun}`)
return daysRun return daysRun
} }
export function processData(data, keys) { export function processData(data, keys) {

View File

@@ -76,7 +76,6 @@ export default {
const res = await getReq('/login',this.form ) const res = await getReq('/login',this.form )
this.loading = false this.loading = false
console.log(res);
if (res.errcode === 0) { if (res.errcode === 0) {
this.$message.success('登录成功') this.$message.success('登录成功')
@@ -91,7 +90,6 @@ export default {
// this.$message.error(res.message || '登录失败') // this.$message.error(res.message || '登录失败')
// } // }
} catch (error) { } catch (error) {
console.log(error);
this.loading = false this.loading = false
this.$message.error('请求失败,请稍后重试') this.$message.error('请求失败,请稍后重试')

View File

@@ -75,7 +75,6 @@ export default {
$route: { $route: {
immediate: true, immediate: true,
handler(to) { handler(to) {
console.log(this.dynamicMenuList, 'this.dynamicMenuList')
// // 更新当前激活的菜单项 // // 更新当前激活的菜单项
// // this.currentKey = to.matched[0]?.path || '' // // this.currentKey = to.matched[0]?.path || ''
this.menuList = this.dynamicMenuList this.menuList = this.dynamicMenuList
@@ -147,7 +146,6 @@ export default {
} }
}, },
generateMenu(routes) { generateMenu(routes) {
console.log(routes, 'routes')
return routes.map((route) => ({ return routes.map((route) => ({
...route, ...route,
title: route.name, title: route.name,

View File

@@ -20,7 +20,7 @@
> >
<template #stationSelect="item"> <template #stationSelect="item">
<a-select <a-select
style="width: 120px;" style="width: 200px"
:dropdown-match-select-width="false" :dropdown-match-select-width="false"
v-model:value="stationId" v-model:value="stationId"
allow-clear allow-clear
@@ -166,7 +166,7 @@ export default {
} }
], ],
chartData: {}, chartData: {},
chartDatav: {}, chartDatav: {}
}, },
2: { 2: {
chartOptions: [ chartOptions: [
@@ -287,13 +287,14 @@ export default {
key: 1, key: 1,
name: '储能设备' name: '储能设备'
}, },
{
key: 2,
name: '光伏设备'
},
{ {
key: 3, key: 3,
name: '充电设备' name: '充电设备'
},
{
key: 2,
name: '光伏设备'
} }
], ],
tableList: { tableList: {
@@ -505,21 +506,19 @@ export default {
watch: { watch: {
activeKey: { activeKey: {
handler(newVal) { handler(newVal) {
if (!newVal) return; if (!newVal) return
// 清除之前的数据 // 清除之前的数据
this.resetDataForInactiveKey(); this.resetDataForInactiveKey()
// 并行加载新数据 // 并行加载新数据
Promise.all([ Promise.all([this.getStationList(),this.getEchartsListForActiveKey(), this.getTableListForActiveKey()]).then(
this.getEchartsListForActiveKey(), () => {
this.getTableListForActiveKey()
]).then(() => {
this.$nextTick(() => { this.$nextTick(() => {
this.getStatCharts(); this.getStatCharts()
})
}); }
}); )
}, },
immediate: true // 添加立即执行 immediate: true // 添加立即执行
} }
@@ -530,18 +529,17 @@ export default {
this.getStationList(), this.getStationList(),
this.getEchartsListForActiveKey(), this.getEchartsListForActiveKey(),
this.getTableListForActiveKey() this.getTableListForActiveKey()
]); ])
// 初始化实时刷新 // 初始化实时刷新
this.startRealtimeRefresh(); this.startRealtimeRefresh()
}, },
beforeUnmount() { beforeUnmount() {
console.log('beforeUnmount') clearInterval(this.interval) // 组件销毁时清除定时器
clearInterval(this.interval); // 组件销毁时清除定时器
}, },
methods: { methods: {
forceRerender() { forceRerender() {
this.renderKey += 1; this.renderKey += 1
}, },
resetDataForInactiveKey() { resetDataForInactiveKey() {
// 重置非当前激活页面的数据,减少内存占用 // 重置非当前激活页面的数据,减少内存占用
@@ -549,79 +547,74 @@ export default {
if (key != this.activeKey) { if (key != this.activeKey) {
this.echartsInfo[key].chartData = {} this.echartsInfo[key].chartData = {}
this.echartsInfo[key].chartDatav = {} this.echartsInfo[key].chartDatav = {}
} }
}); })
Object.keys(this.tableList).forEach((key) => { Object.keys(this.tableList).forEach((key) => {
if (key != this.activeKey) { if (key != this.activeKey) {
this.echartsInfo[key].tableData = {} this.echartsInfo[key].tableData = {}
} }
}); })
}, },
async getEchartsListForActiveKey() { async getEchartsListForActiveKey() {
if (!this.activeKey) return; if (!this.activeKey) return
this.loading.chart = true; this.loading.chart = true
const currentInfo = this.echartsInfo[this.activeKey]; const currentInfo = this.echartsInfo[this.activeKey]
const query = { const query = {
...this.paramsDate, ...this.paramsDate,
category: this.activeKey category: this.activeKey
}; }
try { try {
const res = await getReq('/queryStatDayList', query); const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartData = res.data this.echartsInfo[this.activeKey].chartData = res.data
this.loading.chart = false; this.loading.chart = false
} else { } else {
throw res; throw res
} }
} catch (error) { } catch (error) {
this.loading.chart = false; this.loading.chart = false
this.echartsInfo[this.activeKey].chartData = {} this.echartsInfo[this.activeKey].chartData = {}
} }
}, },
// 专门获取当前激活页面的表格数据 // 专门获取当前激活页面的表格数据
async getTableListForActiveKey() { async getTableListForActiveKey() {
this.loading.table = true; this.loading.table = true
if (!this.activeKey) return; if (!this.activeKey) return
const currentInfo = this.tableList[this.activeKey]; const currentInfo = this.tableList[this.activeKey]
const query = { const query = {
...this.paramsDate, ...this.paramsDate,
category: this.activeKey, category: this.activeKey,
page_size: currentInfo.pageOption.pageSize, page_size: currentInfo.pageOption.pageSize,
pageNumber: currentInfo.pageOption.page pageNumber: currentInfo.pageOption.page
}; }
try { try {
const res = await getReq('/queryStatDayList', query); const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.tableList[this.activeKey].tableData = res.data.list || res.data this.tableList[this.activeKey].tableData = res.data.list || res.data
this.tableList[this.activeKey].pageOption.count = res.data.count || 0 this.tableList[this.activeKey].pageOption.count = res.data.count || 0
this.loading.table = false; this.loading.table = false
} else { } else {
throw res; throw res
} }
} catch (error) { } catch (error) {
this.tableList[this.activeKey].tableData = [] this.tableList[this.activeKey].tableData = []
this.tableList[this.activeKey].pageOption.count = 0 this.tableList[this.activeKey].pageOption.count = 0
this.loading.table = false; this.loading.table = false
} }
}, },
startRealtimeRefresh() { startRealtimeRefresh() {
this.interval = setInterval(() => { this.interval = setInterval(() => {
if (this.activeKey) { if (this.activeKey) {
this.getStatCharts(); // 定时获取最新实时数据 this.getStatCharts() // 定时获取最新实时数据
} }
}, 10000); // 30秒刷新一次 }, 10000) // 30秒刷新一次
}, },
async getStationList() { async getStationList() {
const params = { const params = {
page_size: 1000, page_size: 1000,
@@ -655,45 +648,19 @@ export default {
this.tableList[this.activeKey].pageOption.pageSize = e.pageSize this.tableList[this.activeKey].pageOption.pageSize = e.pageSize
this.tableList[this.activeKey].pageOption.page = e.page this.tableList[this.activeKey].pageOption.page = e.page
this.getTableListForActiveKey() this.getTableListForActiveKey()
}, },
onSearch(data) { onSearch(data) {
this.paramsDate.start_date = data.time ? data.time[0] : '' this.paramsDate.start_date = data.time ? data.time[0] : ''
this.paramsDate.end_date = data.time ? data.time[1] : '' this.paramsDate.end_date = data.time ? data.time[1] : ''
this.tableList[this.activeKey].pageOption.page = 1 this.tableList[this.activeKey].pageOption.page = 1
this.getStationList(), this.getStationList(), this.getEchartsListForActiveKey(), this.getTableListForActiveKey()
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
}, },
changeStation() { changeStation() {
this.getStatCharts(); this.getStatCharts()
}, },
// async getEchartsList() {
// const key = activeKey || this.activeKey;
// if (!key) return;
// const currentInfo = this.echartsInfo[this.activeKey]
// const query = {
// ...this.paramsDate,
// category: this.activeKey
// }
// try {
// const res = await getReq('/queryStatDayList', query)
// if (res.errcode === 0) {
// this.echartsInfo[this.activeKey].chartData = res.data
// console.log(
// this.echartsInfo[this.activeKey].chartData,
// ' this.echartsInfo[this.activeKey].chartData'
// )
// } else {
// throw res
// }
// } catch (error) {
// this.echartsInfo[this.activeKey].chartData = {}
// }
// },
async getStatCharts() { async getStatCharts() {
const currentInfo = this.echartsInfo[this.activeKey] const currentInfo = this.echartsInfo[this.activeKey]
const query = { const query = {
@@ -704,97 +671,21 @@ export default {
try { try {
const res = await getReq('/queryStatCharts', query) const res = await getReq('/queryStatCharts', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartDatav = { this.echartsInfo[this.activeKey].chartDatav = res.data
"V":[100.0,100.0,100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线
}
// x轴0点到24点 // x轴0点到24点
} else { } else {
throw res throw res
} }
} catch (error) { } catch (error) {
this.echartsInfo[this.activeKey].chartDatav = { this.echartsInfo[this.activeKey].chartDatav = {
"V":[100.0,100.0,100.0], // 电压曲线 V: [100.0, 100.0, 100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线 I: [10.0, 10.0, 10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线 P: [1000.0, 1000.0, 1000.0] // 功率曲线
}
} }
} }
},
// async getTableList() {
// const currentInfo = this.tableList[this.activeKey]
// const query = {
// ...this.paramsDate,
// category: this.activeKey,
// page_size: currentInfo.pageOption.pageSize,
// pageNumber: currentInfo.pageOption.page
// }
// try {
// const res = await getReq('/queryStatDayList', query)
// if (res.errcode === 0) {
// this.tableList[this.activeKey].pageOption.tableData = res.data
// this.tableList[this.activeKey].pageOption.pageOption = {
// page: res.data.page,
// pageSize: res.data.page_size,
// count: res.data.count
// }
// } else {
// throw res
// }
// } catch (error) {
// this.tableList[this.activeKey].pageOption.tableData = [
// {
// key1: '1515151515',
// key2: '设备1111',
// key3: '类型',
// key4: '电量',
// key5: '时长',
// key6: '时长',
// key7: 'dianl',
// key8: '时长',
// key9: '时长11'
// },
// {
// key1: '1515151515',
// key2: '设备1111',
// key3: '类型',
// key4: '电量',
// key5: '时长',
// key6: '时长',
// key7: 'dianl',
// key8: '时长',
// key9: '时长11'
// },
// {
// key1: '1515151515',
// key2: '设备1111',
// key3: '类型',
// key4: '电量',
// key5: '时长',
// key6: '时长',
// key7: 'dianl',
// key8: '时长',
// key9: '时长11'
// },
// {
// key1: '1515151515',
// key2: '设备1111',
// key3: '类型',
// key4: '电量',
// key5: '时长',
// key6: '时长',
// key7: 'dianl',
// key8: '时长',
// key9: '时长11'
// }
// ]
// }
// }
} }
} }
</script> </script>

View File

@@ -48,14 +48,13 @@ import Alarm from '@/components/Home/Alarm.vue'
import Map from '@/components/Home/Map.vue' import Map from '@/components/Home/Map.vue'
import { getReq, postReq } from '@/request/api' import { getReq, postReq } from '@/request/api'
import { getRunDays, getDateDaysAgo } from '@/utils/dealWithData' import { getRunDays, getDateDaysAgo } from '@/utils/dealWithData'
import { markRaw } from 'vue'; import { markRaw } from 'vue'
export default { export default {
name: 'Home', name: 'Home',
components: { Map }, components: { Map },
data() { data() {
return { return {
showFlag: false, showFlag: false,
stationId: null, stationId: null,
deviceInfo: {}, deviceInfo: {},
list: [ list: [
@@ -69,7 +68,7 @@ export default {
title: '运行分析', title: '运行分析',
class: 'stats-cards', class: 'stats-cards',
componentId: markRaw(Operational), componentId: markRaw(Operational),
infoKey: '' infoKey: 'operationTotal'
}, },
{ {
title: '储能设备', title: '储能设备',
@@ -114,16 +113,28 @@ export default {
await Promise.all([ await Promise.all([
this.getOnLineList(), this.getOnLineList(),
this.getStatTotalList(), this.getStatTotalList(),
this.getOperTotalList(),
this.getStatDayList(1), this.getStatDayList(1),
this.getStatDayList(2), this.getStatDayList(2),
this.getStatDayList(3) this.getStatDayList(3)
]) ]).then((r) => {
// this.showFlag=true if (
this.deviceInfo.energy.length &&
this.deviceInfo.charge.length &&
this.deviceInfo.pv.length
) {
const newArr = this.mergedArray(
this.deviceInfo.energy,
this.deviceInfo.charge,
this.deviceInfo.pv
)
this.deviceInfo.alarm = newArr
}
})
}, },
methods: { methods: {
getCurrentStation(e) { getCurrentStation(e) {
console.log(e, 'getCurrentStation')
this.stationId = e this.stationId = e
}, },
// 查询系统统计信息 // 查询系统统计信息
@@ -134,7 +145,6 @@ export default {
if (res.errcode === 0) { if (res.errcode === 0) {
this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data)) this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data))
this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date) this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date)
console.log(JSON.parse(JSON.stringify(res.data)), this.deviceInfo.onLine, '111111111111')
} else { } else {
throw res throw res
} }
@@ -151,7 +161,7 @@ export default {
// station_id:场站ID为0或不传查询所有场站总计 // station_id:场站ID为0或不传查询所有场站总计
// category:类别1:储能设备,2:充电设备,3:光伏设备,为0或不传查询所有类别总计 // category:类别1:储能设备,2:充电设备,3:光伏设备,为0或不传查询所有类别总计
const query = { const query = {
date: new Date(), date: getDateDaysAgo(0),
stationId: this.stationId, stationId: this.stationId,
category: 0 category: 0
} }
@@ -161,28 +171,25 @@ export default {
const { income_charge: incomeCharge, income_elect: incomeElect } = const { income_charge: incomeCharge, income_elect: incomeElect } =
this.deviceInfo.allTotal this.deviceInfo.allTotal
this.deviceInfo.allTotal.incomeTotal = +incomeCharge + +incomeElect this.deviceInfo.allTotal.incomeTotal = +incomeCharge + +incomeElect
console.log(
this.deviceInfo.allTotal.incomeTotal,
incomeCharge,
incomeElect,
' this.deviceInfo.allTotal.incomeTotal'
)
} else { } else {
throw res throw res
} }
} catch (error) { } catch (error) {
this.deviceInfo.allTotal = { this.deviceInfo.allTotal = {}
storageElectIn: 2, this.deviceInfo.allTotal.incomeTotal = 0
storageElectOut: 5,
chargeElect: 4,
chargeNum: 5,
incomeCharge: 7,
incomeElect: 7,
solarElectGen: 7,
solarElectGrid: 7
} }
this.deviceInfo.allTotal.incomeTotal = },
this.deviceInfo.allTotal.incomeCharge + this.deviceInfo.allTotal.incomeElect // 运行分析 联调
async getOperTotalList() {
try {
const res = await getReq('/queryStatStation', {})
if (res.errcode === 0) {
this.deviceInfo.operationTotal = res.data
} else {
throw res
}
} catch (error) {
this.deviceInfo.operationTotal = [ ]
} }
}, },
@@ -205,18 +212,6 @@ export default {
if (res.errcode === 0) { if (res.errcode === 0) {
this.list.forEach((item) => { this.list.forEach((item) => {
this.deviceInfo[arr[category]] = res.data this.deviceInfo[arr[category]] = res.data
if (
this.deviceInfo.energy.length &&
this.deviceInfo.charge.length &&
this.deviceInfo.pv.length
) {
const newArr = this.mergedArray(
this.deviceInfo.energy,
this.deviceInfo.charge,
this.deviceInfo.pv
)
this.deviceInfo.alarm = newArr
}
}) })
} else { } else {
throw res throw res
@@ -257,7 +252,7 @@ export default {
} }
.tianditu { .tianditu {
width: calc(100% - 520px * 2); width: 44%;
height: 100%; height: 100%;
margin: 0px 15px; margin: 0px 15px;
} }
@@ -265,7 +260,7 @@ export default {
.content-left, .content-left,
.content-right { .content-right {
height: 100%; height: 100%;
width: 520px; width: 28%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@@ -1,11 +1,6 @@
<template> <template>
<div class="permission"> <div class="permission">
<searchBox <!-- <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox> -->
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table"> <div class="content-table">
<TreeTable <TreeTable
@@ -18,11 +13,13 @@
> >
<template #is_open="record"> <template #is_open="record">
<!-- 0:禁用; 1:启用 --> <!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span> <a-tag :color="record.is_open == 0 ? 'red' : 'green'">{{
record.is_open == 0 ? '禁用' : '启用'
}}</a-tag>
</template> </template>
<template #permission="record"> <template #permission="record">
<!-- 0:禁用; 1:启用 --> <!-- 0:禁用; 1:启用 -->
<span>{{record.permission.map(item=>item.name).toString() }}</span> <span>{{ record.permission.map((item) => item.name).toString() }}</span>
</template> </template>
<template #action="record"> <template #action="record">
@@ -30,7 +27,13 @@
</template> </template>
</TreeTable> </TreeTable>
</div> </div>
<a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null"> <a-modal
v-model:open="formModal"
width="750px"
style="top: 80px"
:footer="null"
:destroy-on-close="true"
>
<!-- action:edit add --> <!-- action:edit add -->
<EditCom <EditCom
:record="record" :record="record"
@@ -51,9 +54,7 @@ import { createVNode } from 'vue'
export default { export default {
name: '', name: '',
components: { components: {},
},
props: {}, props: {},
data() { data() {
return { return {
@@ -65,7 +66,10 @@ export default {
page: 1 page: 1
}, },
btnOptionList: [], btnOptionList: [],
paramsDate: {} paramsDate: {},
tableOption: {
select: false
}
} }
}, },
computed: {}, computed: {},
@@ -107,10 +111,9 @@ export default {
this.tableData = JSON.parse(localStorage.getItem('permission')).map((item) => { this.tableData = JSON.parse(localStorage.getItem('permission')).map((item) => {
return { return {
...item, ...item,
key:item.permission_id, key: item.permission_id
} }
}) })
console.log( this.tableData," this.tableData")
this.pageOption = { this.pageOption = {
page: res.page, page: res.page,
pageSize: res.page_size, pageSize: res.page_size,
@@ -125,25 +128,9 @@ export default {
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type this.formStatus = type
switch (type) { switch (type) {
// case 'add':
// this.formModal = true
// this.formState = {}
// this.getRuleFormInfo()
// break
// case 'edit':
// case 'read':
// this.formModal = true
// this.formState = record
// this.getRuleFormInfo(record)
// break
case 'del': case 'del':
// this.handleDelete([record.permission_id],this.getList)
break break
case 'back': case 'back':
@@ -198,7 +185,6 @@ export default {
row = record row = record
// this.type='edit' // this.type='edit'
} }
}, },
handlePagesizeChange(pageOption) { handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize this.pageOption.pageSize = pageOption.pageSize
@@ -212,10 +198,9 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.permission { .permission {
height: 100%; height: 100%;
padding: 20px 20px 0 20px;
.content-table { .content-table {
height: calc(100% - 70px); height: calc(100% - 92px);
padding: 10px;
} }
} }
</style> </style>

View File

@@ -1,11 +1,6 @@
<template> <template>
<div class="role"> <div class="role">
<searchBox <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table"> <div class="content-table">
<ComTable <ComTable
@@ -18,7 +13,9 @@
> >
<template #is_open="record"> <template #is_open="record">
<!-- 0:禁用; 1:启用 --> <!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span> <a-tag :color="record.is_open == 0 ? 'red' : 'green'">{{
record.is_open == 0 ? '禁用' : '启用'
}}</a-tag>
</template> </template>
<template #permission="record"> <template #permission="record">
<!-- 0:禁用; 1:启用 --> <!-- 0:禁用; 1:启用 -->
@@ -30,7 +27,13 @@
</template> </template>
</ComTable> </ComTable>
</div> </div>
<a-modal v-model:open="formModal" width="950px" style="top: 80px" :footer="null" :destroy-on-close="true"> <a-modal
v-model:open="formModal"
width="950px"
style="top: 80px"
:footer="null"
:destroy-on-close="true"
>
<!-- action:edit add --> <!-- action:edit add -->
<EditCom <EditCom
:show-flag="formModal" :show-flag="formModal"
@@ -75,7 +78,7 @@ export default {
paramsDate: {}, paramsDate: {},
tableOption: { tableOption: {
select: false select: false
}, }
} }
}, },
computed: {}, computed: {},
@@ -125,6 +128,8 @@ export default {
throw err throw err
} }
} catch (error) { } catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示 //统一处理报错提示
} }
}, },
@@ -244,7 +249,6 @@ export default {
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record, 'rrrrrrrrrr')
this.formStatus = type this.formStatus = type
switch (type) { switch (type) {
case 'add': case 'add':
@@ -293,14 +297,11 @@ export default {
callback() callback()
} }
}, },
onCancel() { onCancel() {},
// console.log("Cancel");
},
class: 'test' class: 'test'
}) })
}, },
async getRuleFormInfo(record) { async getRuleFormInfo(record) {
function getInfo(data, url) { function getInfo(data, url) {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
getReq(data, url).then((res) => { getReq(data, url).then((res) => {
@@ -339,25 +340,25 @@ export default {
}, },
// 定义提取所有ID的函数 // 定义提取所有ID的函数
extractAllIds(treeData) { extractAllIds(treeData) {
const idSet = new Set(); const idSet = new Set()
// 递归遍历函数 // 递归遍历函数
const traverse = (node) => { const traverse = (node) => {
// 添加当前节点ID // 添加当前节点ID
if (node.permission_id) { if (node.permission_id) {
idSet.add(node.permission_id); idSet.add(node.permission_id)
} }
// 递归处理子节点 // 递归处理子节点
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
node.children.forEach((child) => traverse(child)); node.children.forEach((child) => traverse(child))
}
} }
};
// 处理所有根节点 // 处理所有根节点
treeData.forEach((node) => traverse(node)); treeData.forEach((node) => traverse(node))
return Array.from(idSet); return Array.from(idSet)
}, },
handlePagesizeChange(pageOption) { handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize this.pageOption.pageSize = pageOption.pageSize
@@ -372,9 +373,9 @@ export default {
.role { .role {
height: 100%; height: 100%;
padding: 0 20px;
.content-table { .content-table {
height: calc(100% - 70px); height: calc(100% - 92px);
padding: 10px;
} }
} }
</style> </style>

View File

@@ -1,11 +1,6 @@
<template> <template>
<div class="service"> <div class="service">
<searchBox <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table"> <div class="content-table">
<ComTable <ComTable
@@ -17,16 +12,24 @@
:page-option="pageOption" :page-option="pageOption"
> >
<template #is_open="record"> <template #is_open="record">
<span>{{ ['禁用', '启用'][record.is_open] }}</span> <!-- 0:禁用; 1:启用 -->
<a-tag :color="record.is_open == 0 ? 'red' : 'green'">{{
record.is_open == 0 ? '禁用' : '启用'
}}</a-tag>
</template> </template>
<template #action="record"> <template #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" /> <OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template> </template>
</ComTable> </ComTable>
</div> </div>
<a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null"> <a-modal
v-model:open="formModal"
width="750px"
style="top: 80px"
:footer="null"
:destroy-on-close="true"
>
<!-- action:edit add --> <!-- action:edit add -->
<EditCom <EditCom
:record="record" :record="record"
@@ -50,7 +53,7 @@ export default {
name: '', name: '',
components: { components: {
searchBox, searchBox,
EditCom, EditCom
}, },
props: {}, props: {},
data() { data() {
@@ -79,7 +82,7 @@ export default {
{ {
label: '自定义', label: '自定义',
value: 3 value: 3
}, }
], ],
policyList: [ policyList: [
{ {
@@ -93,7 +96,7 @@ export default {
{ {
label: '自发自用', label: '自发自用',
value: 3 value: 3
}, }
] ]
} }
}, },
@@ -145,10 +148,10 @@ export default {
} }
} catch (error) { } catch (error) {
//统一处理报错提示 //统一处理报错提示
this.$refs.comTable.loading = false
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type this.formStatus = type
switch (type) { switch (type) {
case 'add': case 'add':
@@ -199,9 +202,7 @@ export default {
callback() callback()
} }
}, },
onCancel() { onCancel() {},
// console.log("Cancel");
},
class: 'test' class: 'test'
}) })
}, },
@@ -223,7 +224,6 @@ export default {
} }
serviceApiOptions.forEach((e, index) => { serviceApiOptions.forEach((e, index) => {
e.list.forEach((i) => { e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : '' e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id e.ruleForm.id = row.id
}) })

View File

@@ -1,11 +1,6 @@
<template> <template>
<div class="station"> <div class="station">
<searchBox <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table"> <div class="content-table">
<ComTable <ComTable
@@ -17,23 +12,26 @@
:page-option="pageOption" :page-option="pageOption"
> >
<template #status="record"> <template #status="record">
<span>{{ ['未启用', '启用'][record.status] }}</span> <a-tag :color="record.status == 0 ? 'red' : 'green'">{{
record.status == 0 ? '未投运' : '投运'
}}</a-tag>
<span>{{}}</span>
</template> </template>
<template #work_mode="record"> <template #work_mode="record">
<span>{{ workModeList.find((item) => record.value == item.value)?.label || '' }}</span> <span>{{ workModeList.find((item) => record.work_mode == item.value)?.label || '' }}</span>
</template> </template>
<template #policy_id="record"> <template #policy_id="record">
<span>{{ policyList.find((item) => record.value == item.value)?.label || '' }}</span> <span>{{ policyList.find((item) => record.policy_id == item.value)?.label || '' }}</span>
</template> </template>
<template #action="record"> <template #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" /> <OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template> </template>
</ComTable> </ComTable>
</div> </div>
<a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null"> <a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null" :destroy-on-close="true">
<!-- action:edit add --> <!-- action:edit add -->
<EditCom <EditCom
ref="EditCom"
:record="record" :record="record"
@operateForm="operateForm" @operateForm="operateForm"
type="station" type="station"
@@ -78,16 +76,24 @@ export default {
paramsDate: {}, paramsDate: {},
workModeList: [ workModeList: [
{ {
label: '最优经济化', label: '峰谷套利',
value: 1 value: '1'
}, },
{ {
label: '支撑电网稳定', label: '增网配容',
value: 2 value: '2'
}, },
{ {
label: '自定义', label: '应急供电',
value: 3 value: '3'
},
{
label: '并网保电',
value: '4'
},
{
label: '自定时段',
value: '5'
} }
], ],
policyList: [ policyList: [
@@ -154,10 +160,10 @@ export default {
} }
} catch (error) { } catch (error) {
//统一处理报错提示 //统一处理报错提示
this.$refs.comTable.loading = false
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record, record.id, 'rrrrrrrrrr')
this.formStatus = type this.formStatus = type
switch (type) { switch (type) {
case 'add': case 'add':
@@ -208,9 +214,7 @@ export default {
callback() callback()
} }
}, },
onCancel() { onCancel() {},
// console.log("Cancel");
},
class: 'test' class: 'test'
}) })
}, },
@@ -232,8 +236,27 @@ export default {
} }
stationOptions.forEach((e, index) => { stationOptions.forEach((e, index) => {
e.list.forEach((i) => { e.list.forEach((i) => {
if (i.key == 'work_mode') {
console.log(row[i.key], 'rrrrrrrrr')
switch (row[i.key]) {
case '1':
case '5':
e.ruleForm[i.key] =row[i.key]
// this.$refs.EditCom.workModeIdSelect = row[i.key]
e.ruleForm['policy_id'] = row ? row['policy_id'] : ''
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'select'
break
default:
e.ruleForm[i.key] =row[i.key]
console.log('1245')
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'unshow'
break
}
} else {
e.ruleForm[i.key] = row ? row[i.key] : '' e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id }
}) })
}) })
}, },
@@ -250,9 +273,9 @@ export default {
.station { .station {
height: 100%; height: 100%;
padding: 0 20px;
.content-table { .content-table {
height: calc(100% - 70px); height: calc(100% - 92px);
padding: 10px;
} }
} }
</style> </style>

View File

@@ -1,11 +1,6 @@
<template> <template>
<div class="user"> <div class="user">
<searchBox <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table"> <div class="content-table">
<ComTable <ComTable
@@ -26,7 +21,13 @@
</template> </template>
</ComTable> </ComTable>
</div> </div>
<a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null"> <a-modal
v-model:open="formModal"
width="750px"
style="top: 80px"
:footer="null"
:destroy-on-close="true"
>
<!-- action:edit add --> <!-- action:edit add -->
<EditCom <EditCom
:record="record" :record="record"
@@ -48,7 +49,7 @@ import { createVNode } from 'vue'
export default { export default {
name: '', name: '',
components: { components: {
EditCom, EditCom
}, },
props: {}, props: {},
data() { data() {
@@ -114,11 +115,12 @@ export default {
throw err throw err
} }
} catch (error) { } catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示 //统一处理报错提示
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type this.formStatus = type
switch (type) { switch (type) {
case 'add': case 'add':
@@ -169,9 +171,7 @@ export default {
callback() callback()
} }
}, },
onCancel() { onCancel() {},
// console.log("Cancel");
},
class: 'test' class: 'test'
}) })
}, },
@@ -193,7 +193,6 @@ export default {
} }
userOptions.forEach((e, index) => { userOptions.forEach((e, index) => {
e.list.forEach((i) => { e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : '' e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id e.ruleForm.id = row.id
}) })
@@ -211,10 +210,9 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.user { .user {
height: 100%; height: 100%;
padding: 0 20px;
.content-table { .content-table {
height: calc(100% - 70px); height: calc(100% - 92px);
padding: 10px;
} }
} }
</style> </style>