fast(配置): 配置列表动态调整logo、系统名称、大屏地址,解决项目线路报错

This commit is contained in:
fhysy 2024-09-24 14:56:40 +08:00
parent 7f1696d5df
commit 4b3e70e195
5 changed files with 157 additions and 83 deletions

View File

@ -2,11 +2,11 @@
<div :class="{'collapse':collapse}" class="sidebar-logo-container" @click="toggleSideBar"> <div :class="{'collapse':collapse}" class="sidebar-logo-container" @click="toggleSideBar">
<transition name="sidebarLogoFade"> <transition name="sidebarLogoFade">
<div v-if="collapse" key="collapse" class="sidebar-logo-link"> <div v-if="collapse" key="collapse" class="sidebar-logo-link">
<img v-if="logo" :src="logo" class="sidebar-logo"> <img v-if="attributeLogo" :src="attributeLogo" class="sidebar-logo">
<h1 class="sidebar-title">{{ attribute }} </h1> <h1 class="sidebar-title">{{ attribute }} </h1>
</div> </div>
<div v-else key="expand" class="sidebar-logo-link"> <div v-else key="expand" class="sidebar-logo-link">
<img v-if="logo" :src="logo" class="sidebar-logo"> <img v-if="attributeLogo" :src="attributeLogo" class="sidebar-logo">
<h1 class="sidebar-title">{{ attribute }} </h1> <h1 class="sidebar-title">{{ attribute }} </h1>
</div> </div>
</transition> </transition>
@ -34,8 +34,26 @@ export default {
return this.$store.state.settings.sideTheme return this.$store.state.settings.sideTheme
}, },
attribute() { attribute() {
// return this.$store.getters.attributeInfo['logoTitle'] || this.title; let title = this.$store.getters.attributeInfo['logoTitle'];
return process.env.VUE_APP_SYSTEM_NAME || this.title; if(title){
document.title = title;
return title || this.title;
}else{
return process.env.VUE_APP_SYSTEM_NAME || this.title;
}
},
attributeLogo() {
let logo = this.$store.getters.attributeInfo['logoUrl'];
if(logo){
// favicon
var link = document.querySelector('link[rel~="icon"]');
// favicon
link.href = logo;
return logo || this.logo;
}else{
return '/images/' + process.env.VUE_APP_ICO_URL || this.logo;
}
} }
}, },
data() { data() {
@ -45,7 +63,7 @@ export default {
} }
}, },
created() { created() {
this.logo = '/images/' + process.env.VUE_APP_ICO_URL; // this.logo = '/images/' + process.env.VUE_APP_ICO_URL;
}, },
methods: { methods: {
toggleSideBar() { toggleSideBar() {

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-loading="loading" class="big-screen-iframe" style="height: calc(100vh - 0px);"> <div v-loading="loading" class="big-screen-iframe" style="height: calc(100vh - 0px);">
<iframe ref="iframeRef" :src="src" allow="*" allowfullscreen="true" class="big-iframe" frameborder="0" style="width: 100%; height: 100%;" @error="onIframeError" @load="onIframeLoad"/> <iframe ref="iframeRef" :src="iframeUrl" allow="*" allowfullscreen="true" class="big-iframe" frameborder="0" style="width: 100%; height: 100%;" @error="onIframeError" @load="onIframeLoad"/>
</div> </div>
</template> </template>
@ -15,10 +15,20 @@ export default {
iframeRef: null iframeRef: null
}; };
}, },
computed: {
iframeUrl() {
let token = this.getCookie("Admin-Token");
let src = this.$store.getters.attributeInfo['bigScreenUrl'];
if(src){
return src + "?token=" + token || this.src;
}else{
return process.env.VUE_APP_BIGSCREEN_PLATFORM_URL + "?token=" + token;
}
},
},
created() { created() {
this.token = this.getCookie("Admin-Token"); // this.token = this.getCookie("Admin-Token");
this.src = process.env.VUE_APP_BIGSCREEN_PLATFORM_URL + "?token=" + this.token; // this.src = process.env.VUE_APP_BIGSCREEN_PLATFORM_URL + "?token=" + this.token;
}, },
mounted() { mounted() {
this.iframeRef = this.$refs.iframeRef; this.iframeRef = this.$refs.iframeRef;

View File

@ -394,7 +394,7 @@ export default {
handleDeviceInfo(param) { handleDeviceInfo(param) {
if (this.tableList && this.tableList.length > 0) { if (this.tableList && this.tableList.length > 0) {
this.tableList = this.tableList.map((v) => { this.tableList = this.tableList.map((v) => {
if (v["deviceKey"] === param["deviceId"]) { if (v["deviceKey"] === param["deviceId"] || v["deviceKey"] === param["deviceKey"]) {
return Object.assign(v, param); return Object.assign(v, param);
} else { } else {
return v; return v;

View File

@ -43,8 +43,8 @@
<div class="content"> <div class="content">
<span class="name">{{ infoData.deviceId }}</span> <span class="name">{{ infoData.deviceId }}</span>
<el-button <el-button
type="text"
size="small" size="small"
type="text"
@click.stop="copyTexts(infoData.deviceId)" @click.stop="copyTexts(infoData.deviceId)"
>复制</el-button >复制</el-button
> >
@ -60,35 +60,35 @@
<div class="title">设备密码</div> <div class="title">设备密码</div>
<div class="content"> <div class="content">
<!-- <span v-show="!showDevicePassword" class="centent">********</span> --> <!-- <span v-show="!showDevicePassword" class="centent">********</span> -->
<span class="centent secret" :title="infoData.devicePassword">{{ <span :title="infoData.devicePassword" class="centent secret">{{
infoData.devicePassword infoData.devicePassword
}}</span> }}</span>
<el-button <el-button
type="text"
size="small"
v-if="isTenant === false" v-if="isTenant === false"
size="small"
type="text"
@click.stop="upldatePassword" @click.stop="upldatePassword"
>修改密码</el-button >修改密码</el-button
> >
<div v-else> <div v-else>
<el-button <el-button
v-show="!showDevicePassword" v-show="!showDevicePassword"
type="text"
size="small" size="small"
type="text"
@click.stop="showDevicePassword = true" @click.stop="showDevicePassword = true"
>显示</el-button >显示</el-button
> >
<el-button <el-button
v-show="showDevicePassword" v-show="showDevicePassword"
type="text"
size="small" size="small"
type="text"
@click.stop="copyTexts(infoData.devicePassword)" @click.stop="copyTexts(infoData.devicePassword)"
>复制</el-button >复制</el-button
> >
<el-button <el-button
v-show="showDevicePassword" v-show="showDevicePassword"
type="text"
size="small" size="small"
type="text"
@click.stop="showDevicePassword = false" @click.stop="showDevicePassword = false"
>隐藏</el-button >隐藏</el-button
> >
@ -102,8 +102,8 @@
<div class="content"> <div class="content">
<span class="name">{{ infoData.prodKey }}</span> <span class="name">{{ infoData.prodKey }}</span>
<el-button <el-button
type="text"
size="small" size="small"
type="text"
@click.stop="copyTexts(infoData.prodKey)" @click.stop="copyTexts(infoData.prodKey)"
>复制</el-button >复制</el-button
> >
@ -120,28 +120,28 @@
<span v-show="!showProdSecret" class="centent">********</span> <span v-show="!showProdSecret" class="centent">********</span>
<span <span
v-show="showProdSecret" v-show="showProdSecret"
class="centent secret"
:title="infoData.deviceSecret" :title="infoData.deviceSecret"
class="centent secret"
>{{ infoData.deviceSecret }}</span >{{ infoData.deviceSecret }}</span
> >
<el-button <el-button
v-show="!showProdSecret" v-show="!showProdSecret"
type="text"
size="small" size="small"
type="text"
@click.stop="showProdSecret = true" @click.stop="showProdSecret = true"
>显示</el-button >显示</el-button
> >
<el-button <el-button
v-show="showProdSecret" v-show="showProdSecret"
type="text"
size="small" size="small"
type="text"
@click.stop="copyTexts(infoData.deviceSecret)" @click.stop="copyTexts(infoData.deviceSecret)"
>复制</el-button >复制</el-button
> >
<el-button <el-button
v-show="showProdSecret" v-show="showProdSecret"
type="text"
size="small" size="small"
type="text"
@click.stop="showProdSecret = false" @click.stop="showProdSecret = false"
>隐藏</el-button >隐藏</el-button
> >
@ -156,16 +156,16 @@
</div> </div>
<div class="table-row-col"> <div class="table-row-col">
<div class="title">当前状态</div> <div class="title">当前状态</div>
<div class="content" v-if="infoData.deviceState === 'ONLINE'"> <div v-if="infoData.deviceState === 'ONLINE'" class="content">
在线 在线
</div> </div>
<div class="content" v-else-if="infoData.deviceState === 'OFFLINE'"> <div v-else-if="infoData.deviceState === 'OFFLINE'" class="content">
离线 离线
</div> </div>
<div class="content" v-else-if="infoData.deviceState === 'OUTLINE'"> <div v-else-if="infoData.deviceState === 'OUTLINE'" class="content">
脱线 脱线
</div> </div>
<div class="content" v-else-if="infoData.deviceState === 'UNACTIVE'"> <div v-else-if="infoData.deviceState === 'UNACTIVE'" class="content">
未激活 未激活
</div> </div>
</div> </div>
@ -205,9 +205,9 @@
</div> </div>
<div <div
v-if="infoData.deviceType === 'MINIATURE_BREAKER'"
class="group-list-info" class="group-list-info"
style="margin-top: 15px" style="margin-top: 15px"
v-if="infoData.deviceType === 'MINIATURE_BREAKER'"
> >
<div class="top"> <div class="top">
<div class="top-label"> <div class="top-label">
@ -220,9 +220,9 @@
</div> </div>
<div <div
v-if="infoData.deviceType === 'MINIATURE_BREAKER'"
class="group-list-table" class="group-list-table"
style="border: 0" style="border: 0"
v-if="infoData.deviceType === 'MINIATURE_BREAKER'"
> >
<device-alarm-config <device-alarm-config
v-if="infoData.deviceType === 'MINIATURE_BREAKER'" v-if="infoData.deviceType === 'MINIATURE_BREAKER'"
@ -231,48 +231,48 @@
/> />
</div> </div>
<div <!-- <div-->
class="group-list-info" <!-- class="group-list-info"-->
style="margin-top: 15px" <!-- style="margin-top: 15px"-->
v-if="infoData.deviceType === 'MINIATURE_BREAKER'" <!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
> <!-- >-->
<div class="top"> <!-- <div class="top">-->
<div class="top-label"> <!-- <div class="top-label">-->
<svg-icon <!-- <svg-icon-->
icon-class="A_product1" <!-- icon-class="A_product1"-->
style="margin-right: 2px; height: 20px; width: 20px" <!-- style="margin-right: 2px; height: 20px; width: 20px"-->
/> <!-- />-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div <!-- <div-->
class="group-list-table" <!-- class="group-list-table"-->
style="border: 0" <!-- style="border: 0"-->
v-if="infoData.deviceType === 'MINIATURE_BREAKER'" <!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
> <!-- >-->
<device-timing-config <!-- <device-timing-config-->
v-if="infoData.deviceType === 'MINIATURE_BREAKER'" <!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
:deviceId="infoData.deviceId" <!-- :deviceId="infoData.deviceId"-->
:deviceKey="infoData.deviceKey" <!-- :deviceKey="infoData.deviceKey"-->
/> <!-- />-->
</div> <!-- </div>-->
<!-- 添加或修改设备对话框 --> <!-- 添加或修改设备对话框 -->
<el-dialog <el-dialog
class="eldialog-wrap"
:close-on-click-modal="false" :close-on-click-modal="false"
:title="title" :title="title"
:visible.sync="open" :visible.sync="open"
class="eldialog-wrap"
width="500px" width="500px"
> >
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="设备密码:" prop="devicePassword"> <el-form-item label="设备密码:" prop="devicePassword">
<el-input <el-input
v-model="form.devicePassword" v-model="form.devicePassword"
@input="inputI"
placeholder="选填--设备密码"
clearable clearable
placeholder="选填--设备密码"
@input="inputI"
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@ -1,56 +1,65 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form <el-form
:model="queryParams" v-show="showSearch"
ref="queryForm" ref="queryForm"
:inline="true" :inline="true"
v-show="showSearch" :model="queryParams"
label-width="68px" label-width="68px"
> >
<el-form-item label="属性值" prop="attributeValue"> <el-form-item label="属性值" prop="attributeValue">
<el-input <el-input
v-model="queryParams.attributeValue" v-model="queryParams.attributeValue"
placeholder="请输入属性值"
clearable clearable
placeholder="请输入属性值"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button
type="primary"
icon="el-icon-search" icon="el-icon-search"
size="mini" size="mini"
type="primary"
@click="handleQuery" @click="handleQuery"
>搜索</el-button >搜索</el-button
> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button >重置</el-button
> >
<el-popover
content="大屏地址KEYbigScreenUrl、系统logoKEYlogoUrl、系统名称KEYlogoTitle"
placement="bottom"
title="预设属性KEY"
trigger="click"
width="200">
<el-button slot="reference" size="mini" style="margin-left: 10px" type="info">预设配置</el-button>
</el-popover>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:attribute:add']" v-hasPermi="['system:attribute:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增</el-button >新增</el-button
> >
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:attribute:remove']" v-hasPermi="['system:attribute:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除</el-button >删除</el-button
> >
</el-col> </el-col>
@ -65,34 +74,34 @@
:data="attributeList" :data="attributeList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="50" align="center" /> <el-table-column align="center" type="selection" width="50" />
<el-table-column <el-table-column
label="属性KEY"
align="center" align="center"
label="属性KEY"
prop="enterpriseAttribute" prop="enterpriseAttribute"
/> />
<el-table-column label="属性值" align="center" prop="attributeValue" /> <el-table-column align="center" label="属性值" prop="attributeValue" />
<el-table-column <el-table-column
label="操作"
align="center" align="center"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
label="操作"
width="200" width="200"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-hasPermi="['system:attribute:edit']"
icon="el-icon-edit"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:attribute:edit']"
>修改</el-button >修改</el-button
> >
<el-button <el-button
v-hasPermi="['system:attribute:remove']"
icon="el-icon-delete"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:attribute:remove']"
>删除</el-button >删除</el-button
> >
</template> </template>
@ -101,20 +110,32 @@
<pagination <pagination
v-show="total > 0" v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改企业属性对话框 --> <!-- 添加或修改企业属性对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" class="eldialog-wrap" append-to-body :close-on-click-modal="false"> <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body class="eldialog-wrap" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="属性KEY" prop="enterpriseAttribute"> <el-form-item label="属性KEY" prop="enterpriseAttribute">
<el-input v-model="form.enterpriseAttribute" :disabled="form.recordId != null" placeholder="请输入属性KEY" /> <el-input v-model="form.enterpriseAttribute" :disabled="form.recordId != null" placeholder="请输入属性KEY" />
</el-form-item> </el-form-item>
<el-form-item label="属性值" prop="attributeValue"> <el-form-item label="属性值" prop="attributeValue">
<el-input v-model="form.attributeValue" placeholder="请输入属性值" /> <el-input v-model="form.attributeValue" clearable placeholder="请输入属性值" />
</el-form-item>
<el-form-item label="选择图片" >
<el-upload
:before-upload="beforeRemove"
:http-request="upload"
:show-file-list="false"
action=""
class="upload-demo"
multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传图片文件且不超过2M</div>
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -134,6 +155,7 @@ import {
updateAttribute, updateAttribute,
exportAttribute, exportAttribute,
} from "@/api/system/attribute"; } from "@/api/system/attribute";
import { uploadFile } from "@/api/file";
export default { export default {
name: "Attribute", name: "Attribute",
@ -192,6 +214,30 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
beforeRemove(file) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (file.type.indexOf("image/") == -1) {
this.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。");
return false;
}else if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
return false;
}else{
return true;
}
},
upload(file) {
console.log("upload",file)
let formData = new FormData();
formData.append("file", file.file);
uploadFile(formData).then(response => {
if (response.code === 200) {
this.form.attributeValue = response.url;
}
}).catch(e => {
console.log(e)
})
},
// //
cancel() { cancel() {
this.open = false; this.open = false;