mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
合并代码
This commit is contained in:
@@ -82,6 +82,8 @@ export default {
|
||||
this.$message.success('登录成功')
|
||||
localStorage.setItem('token', res.token)
|
||||
localStorage.setItem('permission',JSON.stringify( res.permission) )
|
||||
localStorage.setItem('account',JSON.stringify( res.account) )
|
||||
|
||||
this.$router.push('/')
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="header"></div>
|
||||
<div class="header">
|
||||
<span class="time">
|
||||
<span class="text" style="margin-right: 15px"> {{ dateVal }} </span>
|
||||
<span class="text" style="width: 80px;">{{ currentTime }}</span>
|
||||
<span class="text">{{ weekVal }}</span>
|
||||
</span>
|
||||
|
||||
<span class="title text"> 能源站监控与运行管理系统 </span>
|
||||
<span class="user">
|
||||
<span style="margin-right: 15px"> {{ user }}</span>
|
||||
<span class="iconfont icon-tuichu" @click="logout"></span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="page">
|
||||
<div class="subMenu" v-if="subMenu.length > 0">
|
||||
@@ -35,7 +47,9 @@
|
||||
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
|
||||
import moment from 'moment'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
export default {
|
||||
name: 'MainView',
|
||||
components: {},
|
||||
@@ -195,6 +209,44 @@ export default {
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
.text {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgb(255, 255, 255) 0%,
|
||||
rgb(227, 254, 255) 33.17%,
|
||||
rgb(35 190 195) 100%
|
||||
);
|
||||
|
||||
-webkit-background-clip: text; /* 兼容 WebKit 浏览器 */
|
||||
background-clip: text;
|
||||
color: transparent; /* 必须设置为透明 */
|
||||
display: inline-block; /* 确保背景裁剪生效 */
|
||||
line-height: 80px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.title{
|
||||
font-size: 40px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
.user{
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
.icon-tuichu{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
.time{
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.subMenu {
|
||||
display: flex;
|
||||
@@ -221,7 +273,7 @@ export default {
|
||||
}
|
||||
.page {
|
||||
width: calc(100% - 20px);
|
||||
height: calc(100% - 70px - 65px - 40px);
|
||||
height: calc(100% - 70px - 60px - 40px);
|
||||
margin: 20px 10px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
@@ -229,12 +281,13 @@ export default {
|
||||
height: 100%;
|
||||
}
|
||||
.subcontent {
|
||||
height: calc(100% - 46px);
|
||||
height: calc(100% - 56px);
|
||||
}
|
||||
.menu {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 15px;
|
||||
bottom: 10px;
|
||||
height: 50px;
|
||||
// height: 150px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -248,6 +301,7 @@ export default {
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
border: 1px solid #ffffff00;
|
||||
cursor: pointer;
|
||||
margin: 0 35px;
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
<div class="search-item">
|
||||
<span>运行模式</span>
|
||||
<a-select v-model:value="workMode" style="width: 220px">
|
||||
<a-select-option :value="item.value" v-for="item in workModes">{{ item.label }}</a-select-option>
|
||||
<a-select-option :value="item.value" v-for="item in workModes">{{
|
||||
item.label
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<a-button type="primary">下发</a-button>
|
||||
<a-button type="primary" @click="handleDispatch">下发</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,13 +35,14 @@
|
||||
:class="systemType == system.systemType ? 'active' : ''"
|
||||
>
|
||||
<span class="name">{{ system.name }}</span>
|
||||
<span class="des">边缘网关:{{ system.power }} W</span>
|
||||
<span class="des">总有功功率(台区):{{ system.num }}</span>
|
||||
<span class="des" v-for="title in system.titles" :key="title.v"
|
||||
>{{ title.v }}:{{ system[title.key] }}{{ title.sufix }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<videos v-if="systemType == 4" :station-id="selectStationId"/>
|
||||
<device v-else :station-id="selectStationId" :system-type="systemType"/>
|
||||
<videos v-if="systemType == 4" :station-id="selectStationId" />
|
||||
<device v-else :station-id="selectStationId" :system-type="systemType" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,10 +65,14 @@ export default {
|
||||
systemType: 1,
|
||||
value: [],
|
||||
stations: [],
|
||||
selectStationId:'',
|
||||
selectStationId: '',
|
||||
systems: [
|
||||
{
|
||||
name: '储能系统',
|
||||
titles: [
|
||||
{ v: '边缘网关', key: 'num' },
|
||||
{ v: '总有功功率(台区)', key: 'power', sufix: 'kW' }
|
||||
],
|
||||
power: 60,
|
||||
num: 62,
|
||||
systemType: 1
|
||||
@@ -74,99 +81,125 @@ export default {
|
||||
name: '充电系统',
|
||||
power: 60,
|
||||
num: 62,
|
||||
systemType: 2
|
||||
systemType: 2,
|
||||
titles: [
|
||||
{ v: '总功率', key: 'power', sufix: 'kW' },
|
||||
{ v: '数量', key: 'num' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '光伏系统',
|
||||
power: 60,
|
||||
num: 62,
|
||||
systemType: 3
|
||||
systemType: 3,
|
||||
titles: [
|
||||
{ v: '总功率', key: 'power', sufix: 'kW' },
|
||||
{ v: '数量', key: 'num' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '安防系统',
|
||||
power: 60,
|
||||
num: 62,
|
||||
systemType: 4
|
||||
systemType: 4,
|
||||
titles: [
|
||||
{ v: '总功率', key: 'power', sufix: 'kW' },
|
||||
{ v: '数量', key: 'num' }
|
||||
]
|
||||
}
|
||||
// {
|
||||
// name: "储能系统4",
|
||||
// }
|
||||
],
|
||||
workMode:'',
|
||||
workModes:[
|
||||
workMode: '',
|
||||
workModes: [
|
||||
// 0:手动,1:峰谷套利,2:增网配容,3:应急供电,4:并网保电,5:自定时段
|
||||
{
|
||||
value:0,
|
||||
label:'手动'
|
||||
value: 0,
|
||||
label: '手动'
|
||||
},
|
||||
{
|
||||
value:1,
|
||||
label:'峰谷套利'
|
||||
value: 1,
|
||||
label: '峰谷套利'
|
||||
},
|
||||
{
|
||||
value:2,
|
||||
label:'增网配容'
|
||||
value: 2,
|
||||
label: '增网配容'
|
||||
},
|
||||
{
|
||||
value:3,
|
||||
label:'应急供电'
|
||||
value: 3,
|
||||
label: '应急供电'
|
||||
},
|
||||
{
|
||||
value:4,
|
||||
label:'并网保电'
|
||||
value: 4,
|
||||
label: '并网保电'
|
||||
},
|
||||
{
|
||||
value:5,
|
||||
label:'自定时段'
|
||||
value: 5,
|
||||
label: '自定时段'
|
||||
}
|
||||
|
||||
],
|
||||
deviceGroup:[]
|
||||
deviceGroup: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getStations()
|
||||
},
|
||||
methods: {
|
||||
//下发
|
||||
async handleDispatch() {
|
||||
console.log(this.workMode)
|
||||
try {
|
||||
const res = await postReq('/updateStation', {
|
||||
station_id: this.selectStationId,
|
||||
work_mode: this.workMode
|
||||
})
|
||||
if (res.errcode == 0) {
|
||||
this.$message.success('下发成功')
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('下发失败')
|
||||
}
|
||||
},
|
||||
//场站切换
|
||||
getStationChange(val){
|
||||
console.log(val);
|
||||
getStationChange(val) {
|
||||
console.log(val)
|
||||
this.getStationAttr()
|
||||
|
||||
},
|
||||
//查询场站列表
|
||||
async getStations() {
|
||||
try {
|
||||
const res = await getReq('/queryStationList', { page: 0, 'page_size': 10000 })
|
||||
const res = await getReq('/queryStationList', { page: 0, page_size: 10000 })
|
||||
|
||||
this.stations = res.data
|
||||
this.selectStationId=this.stations[0]['station_id']
|
||||
this.selectStationId = this.stations[0]['station_id']
|
||||
this.getStationAttr()
|
||||
} catch (error) {
|
||||
this.stations = []
|
||||
this.selectStationId=''
|
||||
this.selectStationId = ''
|
||||
this.$message.error(error.message)
|
||||
}
|
||||
},
|
||||
// 查询场站的参数
|
||||
async getStationAttr(){
|
||||
async getStationAttr() {
|
||||
try {
|
||||
const res = await getReq('/queryStationOverview', { station_id: this.selectStationId })
|
||||
|
||||
res.data.device_group.forEach((Element,index) => {
|
||||
this.systems[index].num=Element.count
|
||||
this.systems[index].power=Element.power
|
||||
});
|
||||
this.workMode=res.data.work_mode
|
||||
res.data.device_group.forEach((Element, index) => {
|
||||
this.systems[index].num = Element.count
|
||||
this.systems[index].power = Element.power
|
||||
})
|
||||
this.workMode = res.data.work_mode
|
||||
} catch (error) {
|
||||
this.deviceGroup = []
|
||||
this.workMode=''
|
||||
this.workMode = ''
|
||||
// this.$message.error(error.errmsg)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
chooseStation(system) {
|
||||
console.log(system, 'system')
|
||||
|
||||
this.systemType = system.systemType
|
||||
}
|
||||
}
|
||||
@@ -176,7 +209,8 @@ export default {
|
||||
<style scoped lang="scss">
|
||||
@import url(@/style/color.scss);
|
||||
.monitor {
|
||||
width: 100%;
|
||||
// width: 100%;
|
||||
// height: calc(100% - 40px);
|
||||
height: 100%;
|
||||
padding: 20px;
|
||||
background: $bg1-color;
|
||||
@@ -207,24 +241,20 @@ export default {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.stations {
|
||||
min-width: 155px;
|
||||
max-width: 235px;
|
||||
width: 13%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
border-radius: 12px;
|
||||
background: $bg2-color;
|
||||
padding: 15px 0;
|
||||
overflow-y: auto;
|
||||
padding-top: 15px;
|
||||
grid-template-rows: repeat(auto-fit, minmax(140px, 4fr));
|
||||
.station-item {
|
||||
width: calc(100% - 30px);
|
||||
flex: 1;
|
||||
margin: 0 15px 15px 15px;
|
||||
border-radius: 12px;
|
||||
min-width: 150px;
|
||||
|
||||
width: 180px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
padding: 10px 10px;
|
||||
cursor: pointer;
|
||||
|
||||
.name {
|
||||
@@ -236,6 +266,11 @@ export default {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 40px;
|
||||
display: inline-block;
|
||||
max-width: 160px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
.active {
|
||||
@@ -243,7 +278,7 @@ export default {
|
||||
}
|
||||
}
|
||||
.container {
|
||||
width: 100%;
|
||||
width: calc(100% - 200px);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="alarmLog">
|
||||
<searchBox
|
||||
:btn-option-list="btnOptionList"
|
||||
@operateForm="operateForm"
|
||||
></searchBox>
|
||||
<!-- <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox> -->
|
||||
|
||||
<div class="content-table">
|
||||
<ComTable
|
||||
@@ -11,16 +8,17 @@
|
||||
:table-data="tableData"
|
||||
@handlePagesizeChange="handlePagesizeChange"
|
||||
ref="comTable"
|
||||
:table-option="tableOption"
|
||||
:page-option="pageOption"
|
||||
>
|
||||
<template #type="record">
|
||||
<span>{{ ['其它','系统日志','操作日志','设备日志'][record.type] }}</span>
|
||||
<span>{{ ['其它', '系统日志', '操作日志', '设备日志'][record.type] }}</span>
|
||||
</template>
|
||||
<template #status="record">
|
||||
<span><a-tag :color="record.status ? 'red' : 'green'">{{
|
||||
record.status ? '异常' : '正常'
|
||||
}}</a-tag></span>
|
||||
<span
|
||||
><a-tag :color="record.status==0 ? 'red' : 'green'">{{
|
||||
record.status==0 ? '异常' : '正常'
|
||||
}}</a-tag></span
|
||||
>
|
||||
</template>
|
||||
|
||||
<template #action="record">
|
||||
@@ -28,7 +26,7 @@
|
||||
</template>
|
||||
</ComTable>
|
||||
</div>
|
||||
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
|
||||
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
|
||||
<!-- action:edit add -->
|
||||
<EditCom
|
||||
:record="formState"
|
||||
@@ -46,11 +44,11 @@ import { getReq, postReq } from '@/request/api.js'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
components: {
|
||||
EditCom,
|
||||
EditCom
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
@@ -63,7 +61,8 @@ export default {
|
||||
page: 1
|
||||
},
|
||||
btnOptionList: [],
|
||||
paramsDate: {}
|
||||
paramsDate: {},
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
@@ -79,7 +78,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.operateList = this.$getBtns(['查看', '删除'])
|
||||
this.operateList = this.$getBtns(['查看'])
|
||||
// this.btnOptionList = this.$getBtns(['新增'])
|
||||
this.getList()
|
||||
},
|
||||
@@ -118,22 +117,21 @@ export default {
|
||||
},
|
||||
async operateForm(type, record = {}) {
|
||||
this.formStatus = type
|
||||
|
||||
if(type=='edit'||type=='read'){
|
||||
|
||||
if (type == 'edit' || type == 'read') {
|
||||
await this.getRuleFormInfo(record)
|
||||
|
||||
this.formModal = true
|
||||
this.formState = record
|
||||
}else if(type=='del'){
|
||||
this.handleDelete([record.device_id],this.getList)
|
||||
}else if(type=='back'){
|
||||
} else if (type == 'del') {
|
||||
this.handleDelete([record.device_id], this.getList)
|
||||
} else if (type == 'back') {
|
||||
this.formModal = false
|
||||
this.getList()
|
||||
}
|
||||
|
||||
},
|
||||
// 删除操作
|
||||
async handleDelete(id,callback) {
|
||||
async handleDelete(id, callback) {
|
||||
const that = this
|
||||
Modal.confirm({
|
||||
title: '你确认删除数据吗?',
|
||||
@@ -141,10 +139,10 @@ export default {
|
||||
|
||||
async onOk() {
|
||||
try {
|
||||
const res = await getReq('/deleteUser',{user_id:id})
|
||||
const res = await getReq('/deleteUser', { user_id: id })
|
||||
if (res.errcode === 0) {
|
||||
this.$message.success(res.errmsg)
|
||||
this.pageOption.page=1
|
||||
this.pageOption.page = 1
|
||||
callback()
|
||||
} else {
|
||||
throw res
|
||||
@@ -160,8 +158,6 @@ export default {
|
||||
})
|
||||
},
|
||||
async getRuleFormInfo(record) {
|
||||
|
||||
|
||||
const row = record || {}
|
||||
|
||||
for (let e of alarmlogOptions) {
|
||||
@@ -182,8 +178,6 @@ export default {
|
||||
// const attrs=JSON.parse(row.attrs||"{}")
|
||||
// e.ruleForm[i.key] = attrs[i.key]
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -199,10 +193,10 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.alarmLog {
|
||||
height: 100%;
|
||||
padding: 20px;
|
||||
|
||||
.content-table {
|
||||
height: calc(100% - 70px);
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<span>{{ getType(record.type) }}</span>
|
||||
</template>
|
||||
<template #isEnable="record">
|
||||
<span><a-tag :color="record.is_open ? 'green' : 'red'">{{
|
||||
record.is_open ? '启用' : '禁用'
|
||||
<span><a-tag :color="record.is_open==1 ? 'green' : 'red'">{{
|
||||
record.is_open==1 ? '启用' : '禁用'
|
||||
}}</a-tag></span>
|
||||
</template>
|
||||
|
||||
@@ -48,7 +48,7 @@ import OperateCom from '@/components/OperateCom'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
import searchBox from '@/components/SearchBox.vue'
|
||||
import {deviceTypeList} from '@/utils/config'
|
||||
export default {
|
||||
@@ -170,7 +170,7 @@ export default {
|
||||
// 删除操作
|
||||
async handleDelete(id,callback) {
|
||||
const that = this
|
||||
Modal.confirm({
|
||||
this.$Modal.confirm({
|
||||
title: '你确认删除数据吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
|
||||
@@ -203,7 +203,7 @@ export default {
|
||||
if (i.key === 'id') {
|
||||
e.ruleForm.id = row.id
|
||||
} else if (i.key === 'is_open') {
|
||||
e.ruleForm.is_open = Boolean(row.is_open)
|
||||
e.ruleForm.is_open = Boolean(Number(row.is_open))
|
||||
} else {
|
||||
e.ruleForm[i.key] = row[i.key] || ''
|
||||
}
|
||||
@@ -232,10 +232,12 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.device {
|
||||
height: 100%;
|
||||
padding: 0 10px;
|
||||
|
||||
.content-table {
|
||||
height: calc(100% - 70px);
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
height: calc(100% - 90px);
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="alarmlog">
|
||||
<searchBox
|
||||
:btn-option-list="btnOptionList"
|
||||
@operateForm="operateForm"
|
||||
></searchBox>
|
||||
<div class="syslog">
|
||||
<!-- <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox> -->
|
||||
|
||||
<div class="content-table">
|
||||
<ComTable
|
||||
@@ -11,12 +8,14 @@
|
||||
:table-data="tableData"
|
||||
@handlePagesizeChange="handlePagesizeChange"
|
||||
ref="comTable"
|
||||
:table-option="tableOption"
|
||||
:page-option="pageOption"
|
||||
>
|
||||
<template #gender="record">
|
||||
<!-- 0:女; 1:男 -->
|
||||
<span>{{ ['女', '男'][record.gender] }}</span>
|
||||
<template #status="record">
|
||||
<span>
|
||||
<a-tag :color="record.status==0 ? 'red' : 'green'">{{
|
||||
record.status==0 ? '异常' : '正常'
|
||||
}}</a-tag>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #action="record">
|
||||
@@ -37,7 +36,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { columnList, userOptions } from '../../../public/config/columnList'
|
||||
import { columnList, syslogOptions } from '../../../public/config/columnList'
|
||||
import { getReq, postReq } from '@/request/api.js'
|
||||
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
@@ -60,13 +59,14 @@ export default {
|
||||
page: 1
|
||||
},
|
||||
btnOptionList: [],
|
||||
paramsDate: {}
|
||||
paramsDate: {},
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
let info = []
|
||||
let col = columnList.find((i) => i.page == 'alarmlog').columns
|
||||
let col = columnList.find((i) => i.page == 'syslog').columns
|
||||
if (col.length) {
|
||||
col.forEach((item) => {
|
||||
info.push(this.$setWidth(item))
|
||||
@@ -76,8 +76,8 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.operateList = this.$getBtns(['查看', '修改', '删除'])
|
||||
this.btnOptionList = this.$getBtns(['新增'])
|
||||
this.operateList = this.$getBtns(['查看'])
|
||||
// this.btnOptionList = this.$getBtns(['新增'])
|
||||
this.getList()
|
||||
},
|
||||
|
||||
@@ -94,7 +94,7 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await getReq('/queryUserList', params)
|
||||
const res = await getReq('/querySystemLogList', params)
|
||||
if (res.errcode === 0) {
|
||||
this.$refs.comTable.loading = false
|
||||
|
||||
@@ -113,41 +113,25 @@ export default {
|
||||
//统一处理报错提示
|
||||
}
|
||||
},
|
||||
operateForm(type, record = {}) {
|
||||
console.log(record, record.id, 'rrrrrrrrrr')
|
||||
async operateForm(type, record = {}) {
|
||||
this.formStatus = type
|
||||
switch (type) {
|
||||
case 'add':
|
||||
this.formModal = true
|
||||
this.formState = {}
|
||||
this.getRuleFormInfo()
|
||||
|
||||
break
|
||||
case 'edit':
|
||||
case 'read':
|
||||
if (type == 'edit' || type == 'read') {
|
||||
await this.getRuleFormInfo(record)
|
||||
|
||||
this.formModal = true
|
||||
this.formState = record
|
||||
this.getRuleFormInfo(record)
|
||||
break
|
||||
|
||||
case 'del':
|
||||
this.handleDelete([record.user_id], this.getList)
|
||||
|
||||
break
|
||||
|
||||
case 'back':
|
||||
} else if (type == 'del') {
|
||||
this.handleDelete([record.device_id], this.getList)
|
||||
} else if (type == 'back') {
|
||||
this.formModal = false
|
||||
this.getList()
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
// 删除操作
|
||||
async handleDelete(id, callback) {
|
||||
const that = this
|
||||
Modal.confirm({
|
||||
this.$Modal.confirm({
|
||||
title: '你确认删除数据吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
|
||||
@@ -172,27 +156,13 @@ export default {
|
||||
})
|
||||
},
|
||||
async getRuleFormInfo(record) {
|
||||
function getInfo(data, url) {
|
||||
return new Promise((reslove, reject) => {
|
||||
getReq(data, url).then((res) => {
|
||||
reslove(res.data)
|
||||
})
|
||||
})
|
||||
}
|
||||
const row = record || {}
|
||||
|
||||
let row = {}
|
||||
if (record && record.user_id) {
|
||||
// row = await getInfo({ id: record.id },'/queryUserList')
|
||||
this.record = record
|
||||
row = record
|
||||
// this.type='edit'
|
||||
for (let e of syslogOptions) {
|
||||
for (let i of e.list) {
|
||||
e.ruleForm[i.key] = row[i.key] || ''
|
||||
}
|
||||
}
|
||||
userOptions.forEach((e, index) => {
|
||||
e.list.forEach((i) => {
|
||||
e.ruleForm[i.key] = row ? row[i.key] : ''
|
||||
e.ruleForm.id = row.id
|
||||
})
|
||||
})
|
||||
},
|
||||
handlePagesizeChange(pageOption) {
|
||||
this.pageOption.pageSize = pageOption.pageSize
|
||||
@@ -204,12 +174,12 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user {
|
||||
.syslog {
|
||||
height: 100%;
|
||||
padding: 20px;
|
||||
|
||||
.content-table {
|
||||
height: calc(100% - 70px);
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -43,12 +43,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { columnList, permissionOptions } from '../../../public/config/columnList'
|
||||
import { columnList } from '../../../public/config/columnList'
|
||||
import { getReq, postReq } from '@/request/api.js'
|
||||
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
components: {
|
||||
@@ -198,13 +198,7 @@ export default {
|
||||
row = record
|
||||
// this.type='edit'
|
||||
}
|
||||
permissionOptions.forEach((e, index) => {
|
||||
e.list.forEach((i) => {
|
||||
|
||||
e.ruleForm[i.key] = row ? row[i.key] : ''
|
||||
e.ruleForm.id = row.id
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
handlePagesizeChange(pageOption) {
|
||||
this.pageOption.pageSize = pageOption.pageSize
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div>{{ getPolicyType(record.type) }}</div>
|
||||
</template>
|
||||
<template #isOpen="record">
|
||||
<a-tag :color="record.is_open == 1 ? '#2db7f5' : '#f50'">{{
|
||||
<a-tag :color="record.is_open == 1 ? 'green' : 'red'">{{
|
||||
record.is_open == 1 ? '启用' : '禁用'
|
||||
}}</a-tag>
|
||||
</template>
|
||||
@@ -27,8 +27,8 @@
|
||||
<div>
|
||||
<a-modal
|
||||
v-model:open="formModal"
|
||||
width="70%"
|
||||
style="top: 20px"
|
||||
width="900px"
|
||||
style="top: 20px;"
|
||||
:footer="null"
|
||||
:get-container="() => $refs.policy"
|
||||
>
|
||||
@@ -47,6 +47,7 @@ export default {
|
||||
name: '',
|
||||
components: { policyForm },
|
||||
props: {},
|
||||
|
||||
data() {
|
||||
return {
|
||||
formModal: false,
|
||||
@@ -57,21 +58,18 @@ export default {
|
||||
title: '策略ID',
|
||||
dataIndex: 'policy_id',
|
||||
key: 'policyId',
|
||||
width: 120,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '策略名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
width: 120,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '策略类型',
|
||||
dataIndex: 'type', //策略类型:1:削峰套利;2:需求响应;3:自发自用
|
||||
key: 'type',
|
||||
width: 120,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'type' }
|
||||
},
|
||||
@@ -79,7 +77,6 @@ export default {
|
||||
title: '策略描述',
|
||||
dataIndex: 'describe',
|
||||
key: 'describe',
|
||||
width: 120,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
@@ -93,7 +90,6 @@ export default {
|
||||
title: '是否启用',
|
||||
dataIndex: 'is_open',
|
||||
key: 'isOpen',
|
||||
width: 120,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'isOpen' }
|
||||
},
|
||||
@@ -102,8 +98,8 @@ export default {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
fixed:'right',
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
@@ -128,16 +124,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getTableList() {
|
||||
this.$refs.comTable.loading = true
|
||||
try {
|
||||
this.$refs.comTable.loading = false
|
||||
const res = await getReq('/queryPolicyList', {
|
||||
page: this.pageOption.page,
|
||||
page_size: this.pageOption.pageSize
|
||||
})
|
||||
console.log(res)
|
||||
this.tableData = res.data
|
||||
this.pageOption.count = res.count
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.$refs.comTable.loading = false
|
||||
}
|
||||
},
|
||||
getPolicyType(type) {
|
||||
@@ -232,12 +230,13 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.policy {
|
||||
width: 100%;
|
||||
// width: 100%;
|
||||
height: 100%;
|
||||
padding: 0 15px;
|
||||
padding: 0 10px;
|
||||
.content-table {
|
||||
width: 100%;
|
||||
height: calc(100% - 90px);
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -51,7 +51,7 @@ import OperateCom from '@/components/OperateCom'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ConsoleSqlOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
import searchBox from '@/components/SearchBox.vue'
|
||||
export default {
|
||||
name: '',
|
||||
|
||||
@@ -44,7 +44,7 @@ import { getReq, postReq } from '@/request/api.js'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
import searchBox from '@/components/SearchBox.vue'
|
||||
export default {
|
||||
name: '',
|
||||
|
||||
@@ -51,7 +51,7 @@ import OperateCom from '@/components/OperateCom'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
|
||||
import searchBox from '@/components/SearchBox.vue'
|
||||
export default {
|
||||
name: '',
|
||||
|
||||
@@ -41,20 +41,14 @@
|
||||
<script>
|
||||
import { columnList, userOptions } from '../../../public/config/columnList'
|
||||
import { getReq, postReq } from '@/request/api.js'
|
||||
import ComTable from '@/components/ComTable'
|
||||
import OperateCom from '@/components/OperateCom'
|
||||
import EditCom from '@/components/EditCom.vue'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { createVNode } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
import searchBox from '@/components/SearchBox.vue'
|
||||
import { createVNode } from 'vue'
|
||||
export default {
|
||||
name: '',
|
||||
components: {
|
||||
searchBox,
|
||||
EditCom,
|
||||
ComTable,
|
||||
OperateCom
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
@@ -157,7 +151,7 @@ export default {
|
||||
// 删除操作
|
||||
async handleDelete(id,callback) {
|
||||
const that = this
|
||||
Modal.confirm({
|
||||
this.$Modal.confirm({
|
||||
title: '你确认删除数据吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user