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">
<transition name="sidebarLogoFade">
<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>
</div>
<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>
</div>
</transition>
@ -34,8 +34,26 @@ export default {
return this.$store.state.settings.sideTheme
},
attribute() {
// return this.$store.getters.attributeInfo['logoTitle'] || this.title;
return process.env.VUE_APP_SYSTEM_NAME || this.title;
let title = this.$store.getters.attributeInfo['logoTitle'];
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() {
@ -45,7 +63,7 @@ export default {
}
},
created() {
this.logo = '/images/' + process.env.VUE_APP_ICO_URL;
// this.logo = '/images/' + process.env.VUE_APP_ICO_URL;
},
methods: {
toggleSideBar() {

View File

@ -1,6 +1,6 @@
<template>
<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>
</template>
@ -15,10 +15,20 @@ export default {
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() {
this.token = this.getCookie("Admin-Token");
this.src = process.env.VUE_APP_BIGSCREEN_PLATFORM_URL + "?token=" + this.token;
// this.token = this.getCookie("Admin-Token");
// this.src = process.env.VUE_APP_BIGSCREEN_PLATFORM_URL + "?token=" + this.token;
},
mounted() {
this.iframeRef = this.$refs.iframeRef;

View File

@ -394,7 +394,7 @@ export default {
handleDeviceInfo(param) {
if (this.tableList && this.tableList.length > 0) {
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);
} else {
return v;

View File

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

View File

@ -1,56 +1,65 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
v-show="showSearch"
ref="queryForm"
:inline="true"
v-show="showSearch"
:model="queryParams"
label-width="68px"
>
<el-form-item label="属性值" prop="attributeValue">
<el-input
v-model="queryParams.attributeValue"
placeholder="请输入属性值"
clearable
placeholder="请输入属性值"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
type="primary"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:attribute:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:attribute:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除</el-button
>
</el-col>
@ -65,34 +74,34 @@
:data="attributeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center" />
<el-table-column align="center" type="selection" width="50" />
<el-table-column
label="属性KEY"
align="center"
label="属性KEY"
prop="enterpriseAttribute"
/>
<el-table-column label="属性值" align="center" prop="attributeValue" />
<el-table-column align="center" label="属性值" prop="attributeValue" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
label="操作"
width="200"
>
<template slot-scope="scope">
<el-button
v-hasPermi="['system:attribute:edit']"
icon="el-icon-edit"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:attribute:edit']"
>修改</el-button
>
<el-button
v-hasPermi="['system:attribute:remove']"
icon="el-icon-delete"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:attribute:remove']"
>删除</el-button
>
</template>
@ -101,20 +110,32 @@
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@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-item label="属性KEY" prop="enterpriseAttribute">
<el-input v-model="form.enterpriseAttribute" :disabled="form.recordId != null" placeholder="请输入属性KEY" />
</el-form-item>
<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>
<div slot="footer" class="dialog-footer">
@ -134,6 +155,7 @@ import {
updateAttribute,
exportAttribute,
} from "@/api/system/attribute";
import { uploadFile } from "@/api/file";
export default {
name: "Attribute",
@ -192,6 +214,30 @@ export default {
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() {
this.open = false;