修改场景跳转

master
夜笙歌 2 weeks ago
parent 55125477fc
commit 350b2b20d9

@ -17,7 +17,7 @@
<div class="topNavScroll"
style="max-height: 300px;overflow: auto;background-color: #053563;padding: 0;border: none;">
<el-dropdown-item v-for="i in selectSecnesList" :key="i.sceneId"
:command="{router:i.router,name:i.sceneName,sceneId:i.sceneId}">
:command="{router:i.router,name:i.sceneName,sceneId:i.sceneId,sceneModeId:i.sceneModeId,sceneField:i.sceneField}">
<span style="color: #f8fefd">
{{
i.sceneName
@ -178,9 +178,14 @@ export default {
},
async dropdownLink(e,) {
this.nowMenu = '2'
await this.$store.dispatch('app/setSceneId', e.sceneId)
this.name = e.name
await this.$router.replace({path: "/board/" + (e.router || 'smartScene'), query: {name: e.name}});
console.log(e)
if(e.sceneModeId === 100){
await this.$router.replace({path: "/board/sceneView" , query: {id: e.sceneField}});
}else{
await this.$store.dispatch('app/setSceneId', e.sceneId)
this.name = e.name
await this.$router.replace({path: "/board/" + (e.router || 'smartScene'), query: {name: e.name}});
}
},
toIndex() {
this.$router.replace({path: "/index"});

@ -32,6 +32,7 @@ import BoardIndex from '@/layout/boardIndex1.vue'
// 公共路由
export const constantRoutes = [
{path: '/sceneView', component: () => import('@/views/sceneView/index.vue')},
{
path: '/map',
component: BoardIndex,

@ -3,7 +3,7 @@
<div class="bindComponents" ref="container">
<div ref="scene" class="scene"
:style="`width:${pageData.width?( pageData.width -1 +'px'):'100%'};height:${pageData.height?( pageData.height - 1+'px'):'100%'};background-image:url(${pageCfg.bg})`">
<component :is="sceneData.center" :viewFlag="true"
<component :is="sceneData.center" :viewFlag="true" :styleData="pageCfg.styleData"
:tree="sceneData.centerChildren"></component>
</div>
</div>
@ -65,7 +65,12 @@ export default {
}
}
}
console.log(this.pageData)
if (pageCfg.sizeType === 3) {
this.pageData = {
width: null,
height: null,
}
}
})
},
methods: {}

@ -14,17 +14,17 @@
<el-card shadow="never" style="border-radius: 6px;margin-top: 12px">
<el-button type="primary" @click="addSceneBtnClick"></el-button>
<el-table
v-loading="load"
:data="sceneList"
style="width: 100%"
v-loading="load"
:data="sceneList"
style="width: 100%"
>
<el-table-column
v-if="false"
prop="achieveId">
v-if="false"
prop="achieveId">
</el-table-column>
<el-table-column
prop="achieveName"
label="名称">
prop="achieveName"
label="名称">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="templateName"-->
@ -40,19 +40,19 @@
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
fixed="right"
label="操作"
width="260">
fixed="right"
label="操作"
width="260">
<template slot-scope="scope">
<el-button @click="viewDetails(scope.row)" type="text" size="small" style="padding: 0 4px">全屏查看
<el-button @click="viewDetails(scope.row)" type="text" size="small" style="padding: 0 4px">预览
</el-button>
<el-button @click="querySceneInfo(scope.row)" type="text" size="small" style="padding: 0 4px">修改模版
</el-button>
<el-button @click="bindComponents(scope.row)" type="text" size="small" style="padding: 0 4px">绑定组件
</el-button>
<el-popconfirm
title="确定删除吗?"
@confirm="delSceneOk(scope.row.achieveId)">
title="确定删除吗?"
@confirm="delSceneOk(scope.row.achieveId)">
<el-button slot="reference" type="text" size="small" style="padding: 0 4px">删除</el-button>
</el-popconfirm>
</template>
@ -60,22 +60,22 @@
</el-table>
<div style="margin-top: 12px">
<el-pagination
style="display: flex;justify-content: flex-end;"
@size-change="getList"
@current-change="getList"
:current-page.sync="queryForm.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="queryForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
style="display: flex;justify-content: flex-end;"
@size-change="getList"
@current-change="getList"
:current-page.sync="queryForm.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="queryForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</el-card>
<el-dialog
:title="sceneDialogTitle"
:visible.sync="addSceneDialogVisible"
width="30%">
:title="sceneDialogTitle"
:visible.sync="addSceneDialogVisible"
width="30%">
<el-form ref="form" :model="sceneForm" label-width="80px">
<el-form-item label="场景名称">
<el-input v-model="sceneForm.achieveName"></el-input>
@ -85,7 +85,8 @@
<div class="useModel" v-if="!sceneForm.achieveContent.center">
<i class="el-icon-plus"></i>
</div>
<div class="layout" ref="layout" v-if="sceneForm.achieveContent.center">
<div class="layout" ref="layout" v-if="sceneForm.achieveContent.center"
:style="`background-image:url(${(sceneForm.achieveContent.pageCfg||{}).bg})`">
<component style="pointer-events: none" :is="sceneForm.achieveContent.center"
:tree="sceneForm.achieveContent.centerChildren"></component>
</div>
@ -100,12 +101,13 @@
</el-dialog>
<el-dialog
title="选择模版"
:visible.sync="selectModelDialogVisible"
width="700px">
title="选择模版"
:visible.sync="selectModelDialogVisible"
width="700px">
<div class="modelListItem" v-for="i in modelList" @click="useModel(i)">
<div class="modelListItemContent">
<div class="modelListItemContent"
:style="`background-image:url(${(JSON.parse(i.templateContent).pageCfg||{}).bg})`">
<component style="pointer-events: none;" :is="JSON.parse(i.templateContent).center"
:tree="JSON.parse(i.templateContent).centerChildren"></component>
</div>
@ -122,15 +124,15 @@
</div>
<el-pagination
hide-on-single-page
style="display: flex;justify-content: center;"
@size-change="getModelList"
@current-change="getModelList"
:current-page.sync="modelPagination.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="modelPagination.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
hide-on-single-page
style="display: flex;justify-content: center;"
@size-change="getModelList"
@current-change="getModelList"
:current-page.sync="modelPagination.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="modelPagination.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="selectModelDialogVisible = false"> </el-button>
@ -139,10 +141,10 @@
</el-dialog>
<el-dialog
title="绑定组件"
:visible.sync="bindComponentsDialogVisible"
fullscreen
width="600px">
title="绑定组件"
:visible.sync="bindComponentsDialogVisible"
fullscreen
width="600px">
<div slot="title">
<span>
绑定组件
@ -169,6 +171,7 @@
<el-radio-group v-model="pageCfg.sizeType">
<el-radio :label="1">固定宽高</el-radio>
<el-radio :label="2">固定比例</el-radio>
<el-radio :label="3">撑满容器</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="页面大小" label-width="120px" v-if="pageCfg.sizeType">
@ -183,13 +186,13 @@
</el-form-item>
<el-form-item label="画布背景" label-width="120px">
<el-upload
class="avatar-uploader"
action="dev-api/basic/hwTemplateAchieve/saveImage"
:headers="{
class="avatar-uploader"
action="dev-api/basic/hwTemplateAchieve/saveImage"
:headers="{
authorization:'Bearer ' + getToken()
}"
:show-file-list="false"
:on-success="getImg">
:show-file-list="false"
:on-success="getImg">
<img v-if="pageCfg.bg" :src="pageCfg.bg" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
@ -207,39 +210,41 @@
</el-form-item>
<el-form-item label="基准颜色">
<el-tag
:key="tag"
v-for="(tag,k) in (pageCfg.styleData||{}).colors"
closable
:disable-transitions="false"
@close="colorsClose(tag)">
<el-color-picker show-alpha v-model="colors[k]" size="mini" @change="colorsChange($event,k)"></el-color-picker>
:key="tag"
v-for="(tag,k) in (pageCfg.styleData||{}).colors"
closable
:disable-transitions="false"
@close="colorsClose(tag)">
<el-color-picker show-alpha v-model="colors[k]" size="mini"
@change="colorsChange($event,k)"></el-color-picker>
</el-tag>
<el-color-picker show-alpha
class="input-new-tag"
v-if="inputVisible"
v-model="inputValue"
ref="saveTagInput"
size="small"
@change="colorsInputConfirm"></el-color-picker>
class="input-new-tag"
v-if="inputVisible"
v-model="inputValue"
ref="saveTagInput"
size="small"
@change="colorsInputConfirm"></el-color-picker>
<el-button v-else class="button-new-tag" size="small" @click="showInput"></el-button>
</el-form-item>
<el-form-item label="颜色库">
<el-tag
:key="tag"
v-for="(tag,k) in (pageCfg.styleData||{}).colors1"
closable
:disable-transitions="false"
@close="colorsClose1(tag)">
<el-color-picker show-alpha v-model="colors1[k]" size="mini" @change="colorsChange1($event,k)"></el-color-picker>
:key="tag"
v-for="(tag,k) in (pageCfg.styleData||{}).colors1"
closable
:disable-transitions="false"
@close="colorsClose1(tag)">
<el-color-picker show-alpha v-model="colors1[k]" size="mini"
@change="colorsChange1($event,k)"></el-color-picker>
</el-tag>
<el-color-picker show-alpha
class="input-new-tag"
v-if="inputVisible1"
v-model="inputValue1"
ref="saveTagInput1"
size="small"
@change="colorsInputConfirm1"></el-color-picker>
class="input-new-tag"
v-if="inputVisible1"
v-model="inputValue1"
ref="saveTagInput1"
size="small"
@change="colorsInputConfirm1"></el-color-picker>
<el-button v-else class="button-new-tag" size="small" @click="showInput1"></el-button>
</el-form-item>
</el-form>
@ -296,9 +301,9 @@ export default {
pageCfgDialogVisible: false,
pageCfg: {
styleData: {
colors:[],
colors1:[],
region:''
colors: [],
colors1: [],
region: ''
}
},
colors: [],
@ -332,7 +337,7 @@ export default {
colorsInputConfirm() {
let inputValue = this.inputValue;
if (inputValue) {
this.$detectingNullValues(this.pageCfg, ['styleData', 'colors',0])
this.$detectingNullValues(this.pageCfg, ['styleData', 'colors', 0])
this.pageCfg.styleData.colors.push(inputValue);
this.colors.push(inputValue);
}
@ -342,7 +347,7 @@ export default {
colorsInputConfirm1() {
let inputValue = this.inputValue1;
if (inputValue) {
this.$detectingNullValues(this.pageCfg, ['styleData', 'colors1',0])
this.$detectingNullValues(this.pageCfg, ['styleData', 'colors1', 0])
this.pageCfg.styleData.colors1.push(inputValue);
this.colors1.push(inputValue);
}
@ -453,17 +458,18 @@ export default {
...e,
sceneData: JSON.parse(e.achieveContent)
}
this.pageCfg = this.bindComponentsData.sceneData.pageCfg || {}
if (!this.pageCfg.styleData?.colors) {
this.$set(this.pageCfg.styleData, 'colors', [])
}
if (!this.pageCfg.styleData?.colors1) {
this.$set(this.pageCfg.styleData, 'colors1', [])
}
if (!this.pageCfg.styleData?.region) {
this.$set(this.pageCfg.styleData, 'region', '')
}
console.log('csssss', JSON.parse(e.achieveContent))
this.$nextTick(() => {
this.pageCfg = this.bindComponentsData.sceneData.pageCfg || {}
if (!this.pageCfg.styleData?.colors) {
this.$set(this.pageCfg.styleData, 'colors', [])
}
if (!this.pageCfg.styleData?.colors1) {
this.$set(this.pageCfg.styleData, 'colors1', [])
}
if (!this.pageCfg.styleData?.region) {
this.$set(this.pageCfg.styleData, 'region', '')
}
this.colors = JSON.parse(JSON.stringify(this.pageCfg.styleData.colors || '[]'))
this.colors1 = JSON.parse(JSON.stringify(this.pageCfg.styleData.colors1 || '[]'))
@ -490,6 +496,12 @@ export default {
}
}
}
if (this.pageCfg.sizeType === 3) {
this.pageData = {
width: null,
height: null,
}
}
})
},
bindComponentsOk() {
@ -533,6 +545,12 @@ export default {
}
}
}
if (this.pageCfg.sizeType === 3) {
this.pageData = {
width: null,
height: null,
}
}
this.bindComponentsData.sceneData.pageCfg = this.pageCfg
this.pageCfgDialogVisible = false
},
@ -540,7 +558,7 @@ export default {
this.$set(this.pageCfg, 'bg', file.data.url.replaceAll('127.0.0.1', '10.11.40.122'))
},
viewDetails(e) {
this.$router.push({path: '/board/sceneView', query: {achieveId: e.achieveId}})
this.$router.push({path: '/sceneView', query: {achieveId: e.achieveId}})
}
}
}
@ -580,6 +598,8 @@ export default {
.layout {
height: 500px;
border: 1px solid #0003;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.miniLayout {
@ -617,6 +637,8 @@ export default {
height: 200px;
border: 1px solid #0003;
vertical-align: top;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.modelListItemName {
@ -638,12 +660,15 @@ export default {
width: 100%;
height: calc(100vh - 70px - 70px - 60px - 6px);
position: relative;
overflow: auto;
.scene {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
left: 0%;
top: 0%;
//left: 50%;
//top: 50%;
//transform: translate(-50%, -50%);
border: 1px solid #0003;
background-repeat: no-repeat;
background-size: 100% 100%;

@ -14,20 +14,20 @@
<el-card shadow="never" style="border-radius: 6px;margin-top: 12px">
<el-button type="primary" @click="addModels"></el-button>
<el-table
v-loading="load"
:data="tableData"
style="width: 100%"
v-loading="load"
:data="tableData"
style="width: 100%"
>
<el-table-column
v-if="false"
prop="templateId">
v-if="false"
prop="templateId">
</el-table-column>
<el-table-column
prop="templateName"
label="名称">
prop="templateName"
label="名称">
</el-table-column>
<el-table-column
label="缩略图">
label="缩略图">
<template slot-scope="scope">
<div class="miniLayout">
<component :is="JSON.parse(scope.row.templateContent).center"
@ -36,14 +36,14 @@
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="120">
fixed="right"
label="操作"
width="120">
<template slot-scope="scope">
<el-button @click="queryModelInfo(scope.row)" type="text" size="small" style="padding: 0 4px">修改</el-button>
<el-popconfirm
title="确定删除吗?"
@confirm="delModelOk(scope.row.templateId)">
title="确定删除吗?"
@confirm="delModelOk(scope.row.templateId)">
<el-button slot="reference" type="text" size="small" style="padding: 0 4px">删除</el-button>
</el-popconfirm>
</template>
@ -51,33 +51,46 @@
</el-table>
<div style="margin-top: 12px">
<el-pagination
style="display: flex;justify-content: flex-end;"
@size-change="getList"
@current-change="getList"
:current-page.sync="queryForm.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="queryForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
style="display: flex;justify-content: flex-end;"
@size-change="getList"
@current-change="getList"
:current-page.sync="queryForm.pageNum"
:page-sizes="[10,20,50,100]"
:page-size="queryForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</el-card>
<el-dialog
:title="dialogTitle1"
:visible.sync="addModelDialog"
:append-to-body="true"
width="30%">
:title="dialogTitle1"
:visible.sync="addModelDialog"
:append-to-body="true"
width="30%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="模型名称">
<el-input v-model="form.templateName"></el-input>
</el-form-item>
<el-form-item label="模型内容">
<div class="layout" ref="layout">
<div class="layout" ref="layout" :style="`background-image:url(${form.templateContent.pageCfg.bg})`">
<component :is="form.templateContent.center" :tree="form.templateContent.centerChildren"></component>
</div>
</el-form-item>
<el-form-item label="背景" label-width="80px">
<el-upload
class="avatar-uploader"
action="dev-api/basic/hwTemplateAchieve/saveImage"
:headers="{
authorization:'Bearer ' + getToken()
}"
:show-file-list="false"
:on-success="getImg">
<img v-if="form.templateContent.pageCfg.bg" :src="form.templateContent.pageCfg.bg" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="addModelOk" v-if="dialogTitle1 === '新增模型'"> </el-button>
@ -87,10 +100,10 @@
</el-dialog>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
:append-to-body="true"
width="30%">
title="提示"
:visible.sync="dialogVisible"
:append-to-body="true"
width="30%">
<el-button type="primary" @click="leftRight"></el-button>
<el-button type="primary" @click="upDown"></el-button>
<span slot="footer" class="dialog-footer">
@ -104,6 +117,7 @@
import LeftRight from '../../components/setLayout/leftRightStr'
import UpDown from '../../components/setLayout/upDownStr'
import {addModel, delModel, queryModel, updateModel} from "@/api/configuration/layoutModel";
import {getToken} from "@/utils/auth";
export default {
name: 'Layout',
@ -122,12 +136,16 @@ export default {
pageNum: 1,
pageSize: 10,
},
pageCfg: {},
total: 0,
form: {
templateName: '',
templateContent: {
center: null,
centerChildren: {}
centerChildren: {},
pageCfg: {
bg: ''
}
}
},
tableData: []
@ -137,6 +155,12 @@ export default {
this.queryModels()
},
methods: {
getToken() {
return getToken()
},
async getImg(file) {
this.$set(this.form.templateContent.pageCfg, 'bg', file.data.url)
},
getList() {
console.log(this.queryForm)
this.load = true
@ -160,7 +184,10 @@ export default {
templateName: '',
templateContent: {
center: null,
centerChildren: {}
centerChildren: {},
pageCfg: {
bg: ''
}
}
}
this.addModelDialog = true
@ -248,6 +275,8 @@ export default {
.layout {
height: 500px;
border: 1px solid #0003;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.miniLayout {
@ -256,4 +285,33 @@ export default {
border: 1px solid #0003;
pointer-events: none
}
/deep/ .avatar-uploader {
.el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.el-upload:hover {
border-color: #409EFF;
}
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>

Loading…
Cancel
Save