合并冲突

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

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

View File

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

View File

@@ -20,7 +20,7 @@
>
<template #stationSelect="item">
<a-select
style="width: 120px;"
style="width: 200px"
:dropdown-match-select-width="false"
v-model:value="stationId"
allow-clear
@@ -39,17 +39,17 @@
</div>
<div class="main_content">
<a-spin :spinning="loading.chart || loading.table">
<energyEchart
:key="`${activeKey}_${renderKey}`"
:chart-options="echartsInfo[activeKey].chartOptions"
:chart-data="echartsInfo[activeKey].chartData"
:chart-datav="echartsInfo[activeKey].chartDatav"
:columns="tableList[activeKey].columns"
:page-option="tableList[activeKey].pageOption"
:table-info="tableList[activeKey].tableInfo"
:table-data="tableList[activeKey].tableData"
@pagesizeChange="pagesizeChange()"
></energyEchart>
<energyEchart
:key="`${activeKey}_${renderKey}`"
:chart-options="echartsInfo[activeKey].chartOptions"
:chart-data="echartsInfo[activeKey].chartData"
:chart-datav="echartsInfo[activeKey].chartDatav"
:columns="tableList[activeKey].columns"
:page-option="tableList[activeKey].pageOption"
:table-info="tableList[activeKey].tableInfo"
:table-data="tableList[activeKey].tableData"
@pagesizeChange="pagesizeChange()"
></energyEchart>
</a-spin>
</div>
</div>
@@ -166,7 +166,7 @@ export default {
}
],
chartData: {},
chartDatav: {},
chartDatav: {}
},
2: {
chartOptions: [
@@ -281,19 +281,20 @@ export default {
}
},
activeKey: 1,
interval:null,
interval: null,
tabList: [
{
key: 1,
name: '储能设备'
},
{
key: 2,
name: '光伏设备'
},
{
key: 3,
name: '充电设备'
},
{
key: 2,
name: '光伏设备'
}
],
tableList: {
@@ -505,123 +506,115 @@ export default {
watch: {
activeKey: {
handler(newVal) {
if (!newVal) return;
if (!newVal) return
// 清除之前的数据
this.resetDataForInactiveKey();
this.resetDataForInactiveKey()
// 并行加载新数据
Promise.all([
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
]).then(() => {
this.$nextTick(() => {
this.getStatCharts();
});
});
Promise.all([this.getStationList(),this.getEchartsListForActiveKey(), this.getTableListForActiveKey()]).then(
() => {
this.$nextTick(() => {
this.getStatCharts()
})
}
)
},
immediate: true // 添加立即执行
}
},
async mounted() {
// 优先加载第一个页面(activeKey=1)所需的数据
// 优先加载第一个页面(activeKey=1)所需的数据
await Promise.all([
this.getStationList(),
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
]);
])
// 初始化实时刷新
this.startRealtimeRefresh();
this.startRealtimeRefresh()
},
beforeUnmount() {
console.log('beforeUnmount')
clearInterval(this.interval); // 组件销毁时清除定时器
clearInterval(this.interval) // 组件销毁时清除定时器
},
methods: {
forceRerender() {
this.renderKey += 1;
this.renderKey += 1
},
resetDataForInactiveKey() {
// 重置非当前激活页面的数据,减少内存占用
// 重置非当前激活页面的数据,减少内存占用
Object.keys(this.echartsInfo).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].chartData={}
this.echartsInfo[key].chartDatav={}
this.echartsInfo[key].chartData = {}
this.echartsInfo[key].chartDatav = {}
}
});
})
Object.keys(this.tableList).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].tableData={}
this.echartsInfo[key].tableData = {}
}
});
})
},
async getEchartsListForActiveKey() {
if (!this.activeKey) return;
this.loading.chart = true;
const currentInfo = this.echartsInfo[this.activeKey];
if (!this.activeKey) return
this.loading.chart = true
const currentInfo = this.echartsInfo[this.activeKey]
const query = {
...this.paramsDate,
category: this.activeKey
};
}
try {
const res = await getReq('/queryStatDayList', query);
const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartData=res.data
this.loading.chart = false;
this.echartsInfo[this.activeKey].chartData = res.data
this.loading.chart = false
} else {
throw res;
throw res
}
} catch (error) {
this.loading.chart = false;
this.echartsInfo[this.activeKey].chartData={}
this.loading.chart = false
this.echartsInfo[this.activeKey].chartData = {}
}
},
// 专门获取当前激活页面的表格数据
async getTableListForActiveKey() {
this.loading.table = true;
if (!this.activeKey) return;
const currentInfo = this.tableList[this.activeKey];
this.loading.table = true
if (!this.activeKey) return
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);
const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) {
this.tableList[this.activeKey].tableData=res.data.list || res.data
this.tableList[this.activeKey].pageOption.count=res.data.count || 0
this.loading.table = false;
this.tableList[this.activeKey].tableData = res.data.list || res.data
this.tableList[this.activeKey].pageOption.count = res.data.count || 0
this.loading.table = false
} else {
throw res;
throw res
}
} catch (error) {
this.tableList[this.activeKey].tableData=[]
this.tableList[this.activeKey].pageOption.count= 0
this.loading.table = false;
this.tableList[this.activeKey].tableData = []
this.tableList[this.activeKey].pageOption.count = 0
this.loading.table = false
}
},
startRealtimeRefresh() {
this.interval = setInterval(() => {
if (this.activeKey) {
this.getStatCharts(); // 定时获取最新实时数据
this.getStatCharts() // 定时获取最新实时数据
}
}, 10000); // 30秒刷新一次
}, 10000) // 30秒刷新一次
},
async getStationList() {
const params = {
page_size: 1000,
@@ -655,45 +648,19 @@ export default {
this.tableList[this.activeKey].pageOption.pageSize = e.pageSize
this.tableList[this.activeKey].pageOption.page = e.page
this.getTableListForActiveKey()
},
onSearch(data) {
this.paramsDate.start_date = data.time ? data.time[0] : ''
this.paramsDate.end_date = data.time ? data.time[1] : ''
this.tableList[this.activeKey].pageOption.page = 1
this.getStationList(),
this.getEchartsListForActiveKey(),
this.getTableListForActiveKey()
this.getStationList(), this.getEchartsListForActiveKey(), this.getTableListForActiveKey()
},
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() {
const currentInfo = this.echartsInfo[this.activeKey]
const query = {
@@ -704,97 +671,21 @@ export default {
try {
const res = await getReq('/queryStatCharts', query)
if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartDatav = {
"V":[100.0,100.0,100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线
}
this.echartsInfo[this.activeKey].chartDatav = res.data
// x轴0点到24点
} else {
throw res
}
} catch (error) {
this.echartsInfo[this.activeKey].chartDatav = {
"V":[100.0,100.0,100.0], // 电压曲线
"I":[10.0,10.0,10.0], // 电流曲线
"P":[1000.0,1000.0,1000.0], // 功率曲线
V: [100.0, 100.0, 100.0], // 电压曲线
I: [10.0, 10.0, 10.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>

View File

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

View File

@@ -1,11 +1,6 @@
<template>
<div class="permission">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<!-- <searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox> -->
<div class="content-table">
<TreeTable
@@ -18,11 +13,13 @@
>
<template #is_open="record">
<!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span>
<a-tag :color="record.is_open == 0 ? 'red' : 'green'">{{
record.is_open == 0 ? '禁用' : '启用'
}}</a-tag>
</template>
<template #permission="record">
<!-- 0:禁用; 1:启用 -->
<span>{{record.permission.map(item=>item.name).toString() }}</span>
<span>{{ record.permission.map((item) => item.name).toString() }}</span>
</template>
<template #action="record">
@@ -30,7 +27,13 @@
</template>
</TreeTable>
</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 -->
<EditCom
:record="record"
@@ -51,9 +54,7 @@ import { createVNode } from 'vue'
export default {
name: '',
components: {
},
components: {},
props: {},
data() {
return {
@@ -65,7 +66,10 @@ export default {
page: 1
},
btnOptionList: [],
paramsDate: {}
paramsDate: {},
tableOption: {
select: false
}
}
},
computed: {},
@@ -104,13 +108,12 @@ export default {
this.$refs.comTable.loading = false
// this.tableData = res.data
this.tableData =JSON.parse( localStorage.getItem('permission')).map((item)=>{
this.tableData = JSON.parse(localStorage.getItem('permission')).map((item) => {
return {
...item,
key:item.permission_id,
key: item.permission_id
}
})
console.log( this.tableData," this.tableData")
this.pageOption = {
page: res.page,
pageSize: res.page_size,
@@ -125,25 +128,9 @@ export default {
}
},
operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = 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':
// this.handleDelete([record.permission_id],this.getList)
break
case 'back':
@@ -156,7 +143,7 @@ export default {
}
},
// 删除操作
async handleDelete(id,callback) {
async handleDelete(id, callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
@@ -164,10 +151,10 @@ export default {
async onOk() {
try {
const res = await getReq('/deletepermission',{permission_id:id})
const res = await getReq('/deletepermission', { permission_id: id })
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
this.pageOption.page = 1
callback()
} else {
throw res
@@ -198,7 +185,6 @@ export default {
row = record
// this.type='edit'
}
},
handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize
@@ -212,10 +198,9 @@ export default {
<style lang="scss" scoped>
.permission {
height: 100%;
padding: 20px 20px 0 20px;
.content-table {
height: calc(100% - 70px);
padding: 10px;
height: calc(100% - 92px);
}
}
</style>

View File

@@ -1,11 +1,6 @@
<template>
<div class="role">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
<div class="content-table">
<ComTable
@@ -18,7 +13,9 @@
>
<template #is_open="record">
<!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span>
<a-tag :color="record.is_open == 0 ? 'red' : 'green'">{{
record.is_open == 0 ? '禁用' : '启用'
}}</a-tag>
</template>
<template #permission="record">
<!-- 0:禁用; 1:启用 -->
@@ -30,7 +27,13 @@
</template>
</ComTable>
</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 -->
<EditCom
:show-flag="formModal"
@@ -74,8 +77,8 @@ export default {
btnOptionList: [],
paramsDate: {},
tableOption: {
select:false
},
select: false
}
}
},
computed: {},
@@ -125,6 +128,8 @@ export default {
throw err
}
} catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示
}
},
@@ -140,9 +145,9 @@ export default {
...item,
key: item.permission_id,
is_add: Boolean(+item.is_add) || false,
is_del: Boolean(+item.is_del )|| false,
is_edit: Boolean(+item.is_edit )|| false,
is_view: Boolean(+item.is_view )|| false,
is_del: Boolean(+item.is_del) || false,
is_edit: Boolean(+item.is_edit) || false,
is_view: Boolean(+item.is_view) || false,
// 确保子权限容器存在
children: item.children ? [...item.children] : []
}
@@ -191,10 +196,10 @@ export default {
},
calculateParentPermissions(node) {
if (node.children?.length) {
node.is_view = node.children.some((child) => child.is_view === '1') ? true:false
node.is_add = node.children.some((child) => child.is_add === '1') ? true:false
node.is_edit = node.children.some((child) => child.is_edit === '1') ? true:false
node.is_del = node.children.some((child) => child.is_del === '1') ? true:false
node.is_view = node.children.some((child) => child.is_view === '1') ? true : false
node.is_add = node.children.some((child) => child.is_add === '1') ? true : false
node.is_edit = node.children.some((child) => child.is_edit === '1') ? true : false
node.is_del = node.children.some((child) => child.is_del === '1') ? true : false
}
},
async getPermissionList() {
@@ -240,11 +245,10 @@ export default {
is_add: data ? Boolean(+data.is_add) : false,
is_del: data ? Boolean(+data.is_del) : false,
is_edit: data ? Boolean(+data.is_edit) : false,
is_view: data ? Boolean(+data.is_view ): false
is_view: data ? Boolean(+data.is_view) : false
}
},
operateForm(type, record = {}) {
console.log(record, 'rrrrrrrrrr')
this.formStatus = type
switch (type) {
case 'add':
@@ -293,14 +297,11 @@ export default {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
onCancel() {},
class: 'test'
})
},
async getRuleFormInfo(record) {
function getInfo(data, url) {
return new Promise((reslove, reject) => {
getReq(data, url).then((res) => {
@@ -319,16 +320,16 @@ export default {
perList,
record && record.permission.length ? record.permission : []
)
const newData=JSON.parse(JSON.stringify( this.processedData))
const newData = JSON.parse(JSON.stringify(this.processedData))
roleOptions.forEach((e, index) => {
e.list.forEach((i) => {
if (i.key == 'permission') {
i.tableData = newData
if(record&&record.role_id){
i.selectTableData=this.extractAllIds( record.permission)
}else {
i.selectTableData=[]
if (record && record.role_id) {
i.selectTableData = this.extractAllIds(record.permission)
} else {
i.selectTableData = []
}
} else {
e.ruleForm[i.key] = row ? row[i.key] : ''
@@ -339,25 +340,25 @@ export default {
},
// 定义提取所有ID的函数
extractAllIds(treeData) {
const idSet = new Set();
const idSet = new Set()
// 递归遍历函数
const traverse = (node) => {
// 添加当前节点ID
if (node.permission_id) {
idSet.add(node.permission_id);
idSet.add(node.permission_id)
}
// 递归处理子节点
if (node.children && node.children.length > 0) {
node.children.forEach((child) => traverse(child));
node.children.forEach((child) => traverse(child))
}
};
}
// 处理所有根节点
treeData.forEach((node) => traverse(node));
return Array.from(idSet);
treeData.forEach((node) => traverse(node))
return Array.from(idSet)
},
handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize
@@ -372,9 +373,9 @@ export default {
.role {
height: 100%;
padding: 0 20px;
.content-table {
height: calc(100% - 70px);
padding: 10px;
height: calc(100% - 92px);
}
}
</style>

View File

@@ -1,11 +1,6 @@
<template>
<div class="service">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
<div class="content-table">
<ComTable
@@ -17,16 +12,24 @@
:page-option="pageOption"
>
<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 #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template>
</ComTable>
</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 -->
<EditCom
:record="record"
@@ -50,13 +53,13 @@ export default {
name: '',
components: {
searchBox,
EditCom,
EditCom
},
props: {},
data() {
return {
tableOption: {
select:false
select: false
},
formModal: false,
formState: {},
@@ -67,33 +70,33 @@ export default {
},
btnOptionList: [],
paramsDate: {},
workModeList:[
workModeList: [
{
label:'最优经济化',
value:1
label: '最优经济化',
value: 1
},
{
label:'支撑电网稳定',
value:2
label: '支撑电网稳定',
value: 2
},
{
label:'自定义',
value:3
},
label: '自定义',
value: 3
}
],
policyList:[
policyList: [
{
label:'削峰套利',
value:1
label: '削峰套利',
value: 1
},
{
label:'需求响应',
value:2
label: '需求响应',
value: 2
},
{
label:'自发自用',
value:3
},
label: '自发自用',
value: 3
}
]
}
},
@@ -145,10 +148,10 @@ export default {
}
} catch (error) {
//统一处理报错提示
this.$refs.comTable.loading = false
}
},
operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type
switch (type) {
case 'add':
@@ -163,9 +166,9 @@ export default {
this.formState = record
this.getRuleFormInfo(record)
break
case 'del':
this.handleDelete([record.api_id],this.getList)
this.handleDelete([record.api_id], this.getList)
break
@@ -179,7 +182,7 @@ export default {
}
},
// 删除操作
async handleDelete(id,callback) {
async handleDelete(id, callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
@@ -187,10 +190,10 @@ export default {
async onOk() {
try {
const res = await getReq('/deleteServiceApi',{api_id:id})
const res = await getReq('/deleteServiceApi', { api_id: id })
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
this.pageOption.page = 1
callback()
} else {
throw res
@@ -199,9 +202,7 @@ export default {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
onCancel() {},
class: 'test'
})
},
@@ -223,7 +224,6 @@ export default {
}
serviceApiOptions.forEach((e, index) => {
e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
})

View File

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

View File

@@ -1,11 +1,6 @@
<template>
<div class="user">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<searchBox :btn-option-list="btnOptionList" @operateForm="operateForm"></searchBox>
<div class="content-table">
<ComTable
@@ -26,7 +21,13 @@
</template>
</ComTable>
</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 -->
<EditCom
:record="record"
@@ -48,13 +49,13 @@ import { createVNode } from 'vue'
export default {
name: '',
components: {
EditCom,
EditCom
},
props: {},
data() {
return {
tableOption: {
select:false
select: false
},
formModal: false,
formState: {},
@@ -114,11 +115,12 @@ export default {
throw err
}
} catch (error) {
this.$refs.comTable.loading = false
//统一处理报错提示
}
},
operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type
switch (type) {
case 'add':
@@ -133,9 +135,9 @@ export default {
this.formState = record
this.getRuleFormInfo(record)
break
case 'del':
this.handleDelete([record.user_id],this.getList)
this.handleDelete([record.user_id], this.getList)
break
@@ -149,7 +151,7 @@ export default {
}
},
// 删除操作
async handleDelete(id,callback) {
async handleDelete(id, callback) {
const that = this
this.$Modal.confirm({
title: '你确认删除数据吗?',
@@ -157,10 +159,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
@@ -169,9 +171,7 @@ export default {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
onCancel() {},
class: 'test'
})
},
@@ -193,7 +193,6 @@ export default {
}
userOptions.forEach((e, index) => {
e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
})
@@ -211,10 +210,9 @@ export default {
<style lang="scss" scoped>
.user {
height: 100%;
padding: 0 20px;
.content-table {
height: calc(100% - 70px);
padding: 10px;
height: calc(100% - 92px);
}
}
</style>