系统参数配置页面调试
This commit is contained in:
parent
f0cd49362b
commit
1fa7b697f3
18
ui/dasadmin/src/api/backend/SystemParam/request.ts
Normal file
18
ui/dasadmin/src/api/backend/SystemParam/request.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import createAxios from '/@/utils/axios'
|
||||
|
||||
export function getParamList(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/home/set/getList',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
export function Paramupdate(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/page/home/set/update',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
@ -9,13 +9,13 @@
|
||||
<el-col :span="24">
|
||||
<div class="tablePart">
|
||||
<el-table :data="paramData" style="width: 100%">
|
||||
<el-table-column prop="paramNmae" label="参数名称" />
|
||||
<el-table-column prop="namedes" label="中文" />
|
||||
<el-table-column prop="paramName" label="参数名称" />
|
||||
<el-table-column prop="paramDesc" label="中文" />
|
||||
<!-- <el-table-column prop="paramValue" label="参数值" />-->
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<span style="color: #0064aa; cursor: pointer"
|
||||
v-if="scope.row.paramNmae=='ParamColor'"
|
||||
v-if="scope.row.paramName=='paramColor'"
|
||||
@click="Editcolor(scope)"
|
||||
>编辑</span>
|
||||
<span style="color: #0064aa; cursor: pointer"
|
||||
@ -33,10 +33,26 @@
|
||||
<el-dialog v-model="visibleColor" title="状态颜色" width="1000" :before-close="handleClose" class="ColorPart">
|
||||
<div class="tablePart">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="porder" label="状态" />
|
||||
<el-table-column prop="attributeCode" label="颜色">
|
||||
<el-table-column prop="state" label="状态">
|
||||
<template #default="scope">
|
||||
<div class="color-box" :style="{ backgroundColor: scope.row.attributeCode }"></div>
|
||||
<div v-if="scope.row.state == 20">并网</div>
|
||||
<div v-if="scope.row.state == 10">维护</div>
|
||||
<div v-if="scope.row.state == 8">限功率运行</div>
|
||||
<div v-if="scope.row.state == 0">离线</div>
|
||||
<div v-if="scope.row.state == 16">启动</div>
|
||||
<div v-if="scope.row.state == 6">正常停机</div>
|
||||
<div v-if="scope.row.state == 1">外部因素导致停机</div>
|
||||
<div v-if="scope.row.state == 2">停机</div>
|
||||
<div v-if="scope.row.state == 11">待机</div>
|
||||
<div v-if="scope.row.state == 1110">解缆状态</div>
|
||||
<div v-if="scope.row.state == 1111">电网故障停机</div>
|
||||
<div v-if="scope.row.state == 1112">安全链停机</div>
|
||||
<div v-if="scope.row.state == 33">通讯中断</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="color" label="颜色">
|
||||
<template #default="scope">
|
||||
<div class="color-box" :style="{ backgroundColor: scope.row.color }"></div>
|
||||
<!-- <el-color-picker v-model="scope.row.attributeCode" show-alpha></el-color-picker>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -49,7 +65,7 @@
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmitType">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||
<el-button @click="visibleColor = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -58,55 +74,100 @@
|
||||
<div class="layoutmain">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(2, 119, 179);">
|
||||
<div class="demo-color-box"
|
||||
style="background: #9C27B0 ;"
|
||||
@click="onSubmitColor('#9C27B0')">
|
||||
<div class="value" text="xs">#9C27B0</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #673AB7 ;"
|
||||
@click="onSubmitColor('#673AB7')">
|
||||
<div class="value" text="xs">#673AB7</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #3F51B5;"
|
||||
@click="onSubmitColor('#3F51B5')">
|
||||
<div class="value" text="xs">#3F51B5</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #3059EC;"
|
||||
@click="onSubmitColor('#3059EC')">
|
||||
<div class="value" text="xs">#3059EC</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #0277B3;"
|
||||
@click="onSubmitColor('#0277B3')">
|
||||
<div class="value" text="xs">#0277B3</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(255, 126, 0)">
|
||||
<div class="value" text="xs">#FF7E00</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(6, 180, 41)">
|
||||
<div class="value" text="xs">#FE3731</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(0, 160, 150);">
|
||||
<div class="demo-color-box"
|
||||
style="background: #00A096;"
|
||||
@click="onSubmitColor('#00A096')">
|
||||
<div class="value" text="xs">#00A096</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(153, 153, 153);">
|
||||
<div class="demo-color-box"
|
||||
style="background: #06B429;"
|
||||
@click="onSubmitColor('#06B429')">
|
||||
<div class="value" text="xs">#06B429</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #64DD17;"
|
||||
@click="onSubmitColor('#64DD17')">
|
||||
<div class="value" text="xs">#64DD17</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #EEFF41;"
|
||||
@click="onSubmitColor('#EEFF41')">
|
||||
<div class="value" text="xs">#EEFF41</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #FFB600;"
|
||||
@click="onSubmitColor('#FFB600')">
|
||||
<div class="value" text="xs">#FFB600</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: #FF7E00;"
|
||||
@click="onSubmitColor('#FF7E00')">
|
||||
<div class="value" text="xs">#FF7E00</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: #FE3731;"
|
||||
@click="onSubmitColor('#FE3731')">
|
||||
<div class="value" text="xs">#FE3731</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box"
|
||||
style="background: rgb(153, 153, 153);"
|
||||
@click="onSubmitColor('#999999')">
|
||||
<div class="value" text="xs">#999999</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
|
||||
<div class="value" text="xs">#67C23A</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(254, 55, 49);">
|
||||
<div class="value" text="xs">#67C23A</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
|
||||
<div class="value" text="xs">#67C23A</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="demo-color-box" style="background: rgb(48, 89, 236);">
|
||||
<div class="value" text="xs">#67C23A</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmitType">确定</el-button>
|
||||
<!-- <el-button type="primary" @click="onSubmitColor">确定</el-button>-->
|
||||
<el-button @click="visibleselectColor = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -115,19 +176,19 @@
|
||||
<div class="layoutmain">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<div class="demo-color-box">
|
||||
<div class="style01 selected"><img src="~assets/SystemParam/style01.png" alt="" /></div>
|
||||
<div class="demo-color-box" @click="onSubmitLayout('风格1', $event.currentTarget)">
|
||||
<div class="style01"><img src="~assets/SystemParam/style01.png" alt="" /></div>
|
||||
<div>风格1</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="demo-color-box">
|
||||
<div class="demo-color-box" @click="onSubmitLayout('风格2', $event.currentTarget)">
|
||||
<div class="style01"><img src="~assets/SystemParam/style02.png" alt="" /></div>
|
||||
<div>风格2</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="demo-color-box">
|
||||
<div class="demo-color-box" @click="onSubmitLayout('风格3', $event.currentTarget)">
|
||||
<div class="style01"><img src="~assets/SystemParam/style03.png" alt="" /></div>
|
||||
<div>风格3</div>
|
||||
</div>
|
||||
@ -136,7 +197,7 @@
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmitType">保存</el-button>
|
||||
<!-- <el-button type="primary" @click="SaveLayout">保存</el-button>-->
|
||||
<el-button @click="visibleLayout = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -145,53 +206,126 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref} from 'vue'
|
||||
const paramData=ref([
|
||||
{paramNmae:'ParamColor',namedes:'颜色',paramValue:'0.5'},
|
||||
{paramNmae:'ParamLayout',namedes:'布局',paramValue:'0.5'}
|
||||
])
|
||||
const tableData = ref([
|
||||
{ porder: '并网', attributeCode: 'rgb(2, 119, 179)' },
|
||||
{ porder: '待机', attributeCode: 'rgb(255, 126, 0)' },
|
||||
{ porder: '启动', attributeCode: 'rgb(6, 180, 41)' },
|
||||
{ porder: '维护', attributeCode: 'rgb(0, 160, 150)' },
|
||||
{ porder: '离线', attributeCode: 'rgb(153, 153, 153)' },
|
||||
{ porder: '限功率运行', attributeCode: 'rgb(48, 89, 236)' },
|
||||
{ porder: '正常停机', attributeCode: 'rgb(254, 55, 49)' },
|
||||
{ porder: '通讯中断', attributeCode: 'rgb(153, 153, 153)' },
|
||||
{ porder: '停机', attributeCode: 'rgb(153, 153, 153)' },
|
||||
{ porder: '解缆状态', attributeCode: 'rgb(48, 89, 236)' },
|
||||
{ porder: '电网故障停机', attributeCode: 'rgb(254, 55, 49)' },
|
||||
{ porder: '安全链停机', attributeCode: 'rgb(254, 55, 49)' },
|
||||
])
|
||||
import {onMounted, ref,nextTick} from 'vue'
|
||||
import { getParamList,Paramupdate } from '/@/api/backend/SystemParam/request'
|
||||
import { ElMessage} from 'element-plus'
|
||||
const paramData=ref([])
|
||||
const tableData = ref([])
|
||||
const PARAM_COLOR = 'paramColor';
|
||||
const PARAM_LAYOUT = 'paramLayout';
|
||||
const getList=()=>{
|
||||
getParamList().then((res:any)=>{
|
||||
paramData.value=res.data
|
||||
paramData.value.forEach((item, index) => {
|
||||
if (item.paramName === PARAM_COLOR && res.data && res.data[index]) {
|
||||
tableData.value = res.data[index].paramValueJson;
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
const setDefaultLayout = (defaultLayout: string) => {
|
||||
const layoutElements = document.querySelectorAll('.LayoutPart .demo-color-box');
|
||||
if (selectedLayout.value) {
|
||||
selectedLayout.value.classList.remove('selected');
|
||||
}
|
||||
layoutElements.forEach((element: HTMLElement) => {
|
||||
if (element.textContent?.trim() === defaultLayout) {
|
||||
element.classList.add('selected');
|
||||
selectedLayout.value = element;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const selectLayout=ref([
|
||||
{value:'0',label:'风格1'},
|
||||
{value:'1',label:'风格2'},
|
||||
{value:'2',label:'风格3'},
|
||||
])
|
||||
const visibleColor=ref(false)
|
||||
const Editcolor = (data: any) => {
|
||||
debugger
|
||||
visibleColor.value=true
|
||||
paramColorData.value.id=data.row.id
|
||||
paramColorData.value.paramName=data.row.paramName
|
||||
paramColorData.value.paramDesc=data.row.paramDesc
|
||||
}
|
||||
const handleClose = () => {
|
||||
debugger
|
||||
visibleColor.value=false
|
||||
}
|
||||
const visibleLayout=ref(false)
|
||||
const EditLayout = (data: any) => {
|
||||
debugger
|
||||
paramColorData.value.id=data.row.id
|
||||
paramColorData.value.paramName=data.row.paramName
|
||||
paramColorData.value.paramDesc=data.row.paramDesc
|
||||
visibleLayout.value=true
|
||||
const defaultLayout = data.row.paramValueJson[0];
|
||||
nextTick(() => {
|
||||
setDefaultLayout(defaultLayout);
|
||||
});
|
||||
}
|
||||
const handleCloselayout = () => {
|
||||
debugger
|
||||
visibleLayout.value=false
|
||||
}
|
||||
const currentparemColor=ref({
|
||||
state:'',
|
||||
color:''
|
||||
})
|
||||
const visibleselectColor=ref(false)
|
||||
const selectColor = () => {
|
||||
const selectColor = (data:any) => {
|
||||
visibleselectColor.value=true
|
||||
currentparemColor.value.state=data.row.state
|
||||
currentparemColor.value.color=data.row.color
|
||||
}
|
||||
//选择颜色
|
||||
const onSubmitColor=(data:any)=>{
|
||||
currentparemColor.value.color=data
|
||||
tableData.value.forEach((item:any)=>{
|
||||
if(item.state==currentparemColor.value.state){
|
||||
item.color=currentparemColor.value.color
|
||||
}
|
||||
})
|
||||
visibleselectColor.value=false
|
||||
}
|
||||
//布局修改保存
|
||||
const selectedLayout = ref(null);
|
||||
const onSubmitLayout=(data:any,layoutElement: HTMLElement)=>{
|
||||
if (selectedLayout.value) {
|
||||
selectedLayout.value.classList.remove('selected');
|
||||
}
|
||||
layoutElement.classList.add('selected');
|
||||
selectedLayout.value = layoutElement
|
||||
paramColorData.value.paramValue=JSON.stringify([data])
|
||||
Paramupdate(paramColorData.value).then((res:any)=>{
|
||||
if(res.code==200){
|
||||
ElMessage.success(res.msg ?? '保存成功')
|
||||
visibleLayout.value=false
|
||||
getList()
|
||||
}else {
|
||||
ElMessage.error(res.msg ?? '保存失败')
|
||||
}
|
||||
}).catch((err) => {
|
||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||
})
|
||||
}
|
||||
const paramColorData=ref({
|
||||
id:'',
|
||||
paramName:'',
|
||||
paramDesc:'',
|
||||
paramValue:[]
|
||||
})
|
||||
//状态颜色保存
|
||||
const onSubmit=()=>{
|
||||
paramColorData.value.paramValue=JSON.stringify(tableData.value)
|
||||
Paramupdate(paramColorData.value).then((res:any)=>{
|
||||
if(res.code==200){
|
||||
ElMessage.success(res.msg ?? '保存成功')
|
||||
visibleColor.value=false
|
||||
getList()
|
||||
}else {
|
||||
ElMessage.error(res.msg ?? '保存失败')
|
||||
}
|
||||
}).catch((err) => {
|
||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||
})
|
||||
}
|
||||
onMounted(() =>{
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -248,10 +382,11 @@ $headerHeight: 60px;
|
||||
.LayoutPart{
|
||||
.demo-color-box{
|
||||
text-align: center;
|
||||
.style01.selected:before {
|
||||
}
|
||||
.demo-color-box.selected:before {
|
||||
opacity: 1;
|
||||
}
|
||||
.style01.selected img {
|
||||
.demo-color-box.selected img {
|
||||
box-shadow: 0 0 0 4px #00c09e;
|
||||
animation: selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
||||
-o-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
||||
@ -259,34 +394,6 @@ $headerHeight: 60px;
|
||||
-moz-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
||||
-webkit-animation:selected 0.3s cubic-bezier(0.250, 0.100, 0.250, 1.000);
|
||||
}
|
||||
.style01.selected:before {
|
||||
content: "2714";
|
||||
display: block;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top: 0; left: 0; bottom: 0; right: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
background: #00c09e;
|
||||
border-radius: 50px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
z-index: 10;
|
||||
opacity: 0;
|
||||
transition: 0.3s linear;
|
||||
-o-transition: 0.3s linear;
|
||||
-ms-transition: 0.3s linear;
|
||||
-moz-transition: 0.3s linear;
|
||||
-webkit-transition: 0.3s linear;
|
||||
-o-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user