修改后台问题

master
夜笙歌 2 months ago
parent d5e8c950e8
commit 7e8b434406

@ -83,3 +83,11 @@ export function getModeFunctionParametersByModeFunctionId(modeFunctionId) {
})
}
export function getDeviceByModel(data) {
return request({
url: '/business/device/getDeviceByModel',
method: 'get',
params:data
})
}

@ -1,6 +1,6 @@
<template>
<div>
<!-- <app-main/>-->
<!-- <app-main/>-->
<router-view> </router-view>
<div style="z-index: 99999;">
<BoardTopNav/>

@ -77,15 +77,18 @@
<div :style='"background-color:" + ((index % 2 === 0)? "#053460":"#032d57") '>
<div
class="scrollTable">
{{ item.value1 }}
{{ item.no }}
</div>
<div
class="scrollTable">
{{ item.value2 }}
{{ item.alarmInfoType === '1' ? '设备报警' : '' }}
{{ item.alarmInfoType === '2' ? '监控单元报警' : '' }}
{{ item.alarmInfoType === '3' ? '离线报警' : '' }}
{{ item.alarmInfoType === '4' ? '电子围栏' : '' }}
</div>
<div
class="scrollTable">
{{ item.value3 }}
{{ item.location }}
</div>
<div class="scrollTable" style="width: 25%">
<el-button v-if="item.status === '0'" size="mini" type="primary" @click="dispose(item)"></el-button>
@ -308,6 +311,7 @@ import green from '@/assets/board/GPS/green.png'
import {handleAlarmInfo} from "@/api/board/index";
import {selectBeaconDevicesHistory} from "../../../api/board/GPS";
import {selectMonitorElectronic} from "../../../api/board";
import gif from "@/assets/board/index/dot.png";
let map = null
let polyEditor = null
@ -401,12 +405,39 @@ export default {
await this.getTable2Data()
},
dispose(e) {
this.warInfo = e
this.textarea = ''
this.isDispose = true
this.disposeNo = e.no
},
disposeThis() {
handleAlarmInfo({
alarmInfoId: this.disposeNo,
alarmInfoField: this.textarea,
ifDisposalAll: 0,
}).then(e => {
this.isDispose = false
this.$message({
type: 'success',
message: '已处理!'
});
this.setAlarmInfos()
})
},
disposeAll() {
handleAlarmInfo({
alarmInfoId: this.disposeNo,
alarmInfoField: this.textarea,
ifDisposalAll: 1,
}).then(e => {
this.$message({
type: 'success',
message: '已处理!'
});
this.isDispose = false
this.setAlarmInfos()
})
},
createMap() {
map = new AMap.Map('map', {
// mapStyle: 'amap://styles/blue',
@ -481,9 +512,10 @@ export default {
const {rows: data} = await getAlarmInfos({"sceneId": this.$store.getters.sceneId})
this.table1Data = data.map((e, i) => {
return {
value1: e.alarmInfoId,
value2: e.alarmTypeName,
value3: e.monitorUnitName,
...e,
no: e.alarmInfoId,
type: e.alarmTypeName,
location: e.monitorUnitName,
status: e.handleStatus
}
})
@ -515,19 +547,55 @@ export default {
async getTable2Data() {
const {data} = await selectDeviceLatitudeAndLongitude(this.$store.getters.sceneId)
this.table2Data = data
console.log(data)
data.forEach(e => {
this.setMarker(e)
if (e.alarmElectronFence) {
this.setMarker1(e)
} else {
this.setMarker(e)
}
})
},
setMarker(e) {
let marker = new AMap.Marker({
position: [e.longitude, e.latitude], // [116.39, 39.9]
title: `信息\n经度${e.longitude}\n纬度${e.latitude}\n名称${e.deviceLocation}\n备注${e.remark}`,
offset: new AMap.Pixel(-20, -40),
content: `<div>
<img src="${gif}" alt="" width=" 40px" style="animation:an1 2s ease-in-out infinite;" >
</div>`
});
marker.on('click', async () => {
if (polygons.length > 0 || circles.length > 0) {
map.remove(polygons)
map.remove(circles)
map.remove(texts)
polygons = []
circles = []
return
}
const {data} = await selectMonitorElectronic(e.deviceId)
data.map(e => e.hwFenceAreaList).flat(1).forEach(e => {
if (e.areaShapeFlag === '1') {
this.setPolygon(e.areaRange.split('_').map(e => e.split(',').map(v => parseFloat(v))))
}
if (e.areaShapeFlag === '2') {
let arr = e.areaRange.split(',')
this.setCircle([arr[0], arr[1]], arr[2])
}
})
})
map.add(marker);
},
setMarker1(e) {
let marker = new AMap.Marker({
position: [e.longitude, e.latitude], // [116.39, 39.9]
title: `信息\n经度${e.longitude}\n纬度${e.latitude}\n名称${e.deviceLocation}\n备注${e.remark}`,
offset: new AMap.Pixel(-15, -30),
content: `<div >
<svg t="1718261114618" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4305" style="width: 30px;height: 30px;">
<path d="M512 64.5c-180.5 0-326.9 146.4-326.9 326.9 0 63.3 18 122.3 49.2 172.4 1.1 2 2.1 4 3.2 5.9 34.9 58.2 113.9 128.8 165.5 194.5 66.3 84.4 93.2 158 93.2 158 1.6 1.4 13.1 35.6 15.1 35.8 2.5 0.2 12.6-34 14.5-35.8 0 0 22-69.2 83.7-146.6 56-70.1 142.8-145.7 177-206 0.9-1.6 1.8-3.3 2.6-5 31.5-50.2 49.7-109.6 49.7-173.3 0.1-180.5-146.3-326.8-326.8-326.8z" fill="${(e.ifAlarm === '1') ? '#3D93FD' : '#ff0000'}" p-id="4306">
<path d="M512 64.5c-180.5 0-326.9 146.4-326.9 326.9 0 63.3 18 122.3 49.2 172.4 1.1 2 2.1 4 3.2 5.9 34.9 58.2 113.9 128.8 165.5 194.5 66.3 84.4 93.2 158 93.2 158 1.6 1.4 13.1 35.6 15.1 35.8 2.5 0.2 12.6-34 14.5-35.8 0 0 22-69.2 83.7-146.6 56-70.1 142.8-145.7 177-206 0.9-1.6 1.8-3.3 2.6-5 31.5-50.2 49.7-109.6 49.7-173.3 0.1-180.5-146.3-326.8-326.8-326.8z" fill="#ff0000" p-id="4306">
</path>
</svg>

@ -61,37 +61,42 @@
</div>
<div class="right">
<div v-for="(i,k) in acquisitionList" class="item">
<div class="iconBg"></div>
<div
class="icon">
<el-image
v-if="i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]"
:preview-src-list="[i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]]"
:src="i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]"
style="width: 100%; height: 100%">
</el-image>
<el-image
v-else-if="i.devicePic"
:src="i.devicePic"
style="width: 100%; height: 100%">
</el-image>
<el-image
v-else
:src="defaultImg1"
style="width: 100%; height: 100%">
</el-image>
</div>
<!-- <div class="iconBg"></div>-->
<!-- <div-->
<!-- class="icon">-->
<!-- <el-image-->
<!-- v-if="i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]"-->
<!-- :preview-src-list="[i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]]"-->
<!-- :src="i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]"-->
<!-- style="width: 100%; height: 100%">-->
<!-- </el-image>-->
<!-- <el-image-->
<!-- v-else-if="i.devicePic"-->
<!-- :src="i.devicePic"-->
<!-- style="width: 100%; height: 100%">-->
<!-- </el-image>-->
<!-- <el-image-->
<!-- v-else-->
<!-- :src="defaultImg1"-->
<!-- style="width: 100%; height: 100%">-->
<!-- </el-image>-->
<!-- </div>-->
<div class="rightBg">
<div class="index">{{ k + 1 }}</div>
<div class="title">{{ i.deviceName }}</div>
<div style="position: absolute;left: 24%;top: 0px;width: 55%;height: 100%;">
<div style="position: absolute;left: 27%;top: 0px;width: 45%;height: 100%;">
<div
v-for="val in Object.keys(i.deviceDataMap).slice(0,6).filter(e=> !(i.deviceDataMap[e].toString().includes('http')))"
:style="'height:'+(Object.keys(i.deviceDataMap).length<4 ? '100%':'50%')" class="infoItem">
:style="'width:'+(Object.keys(i.deviceDataMap).length<=2 ? '100%':'50%')" class="infoItem">
<div class="span">{{ val }}:</div>
<div class="spanBg"></div>
<div class="num">{{ i.deviceDataMap[val] }}</div>
</div>
<div class="infoItem">
<div class="span"> 时间 :</div>
<div class="spanBg"></div>
<div class="num">{{ i.updateTime }}</div>
</div>
</div>
<div class="btn">
@ -143,6 +148,10 @@
:prop="i"
:label="historyTh[i]"
width="180">
<template slot-scope="scope">
<div v-if="historyTh[i] === '时间'">{{ parseTime(scope.row['ts']) }}</div>
<div v-else>{{ scope.row[historyTh[i]] }}</div>
</template>
</el-table-column>
</el-table>
<pagination
@ -410,7 +419,7 @@ export default {
this.$nextTick(() => {
this.historyData = data.tableDataInfo.rows
this.historyTh = data.mapName
if(Object.keys(data.mapName).includes('ts')){
if (Object.keys(data.mapName).includes('ts')) {
this.historyTh.ts = '时间'
}
console.log(this.historyTh)
@ -598,10 +607,14 @@ export default {
height: 44%;
color: #1684c2;
padding: 2vh 0 0 1vw;
display: flex;
flex-direction: column;
justify-content: space-around;
p {
width: 100%;
margin: 0;
line-height: 10vh;
flex: 1;
font-size: 0.9vw;
}
}
@ -717,7 +730,7 @@ export default {
position: relative;
width: 50%;
margin-bottom: 12px;
height: 9vh;
height: 11vh;
padding: 0.5vh 0;
display: inline-block;
@ -749,9 +762,9 @@ export default {
background-size: 100% 100%;
position: absolute;
top: 16%;
left: calc(10% + 8vh);
width: calc(90% - 8vh);
height: 8vh;
left: 1vw;
width: calc(100% - 1vw);
height: 10vh;
.index {
position: absolute;
@ -771,17 +784,19 @@ export default {
.title {
position: absolute;
top: 50%;
left: 12%;
left: 12.5%;
color: #1facf4;
transform: translate(-50%, -50%);
font-size: 0.6vw;
}
.infoItem {
white-space: nowrap;
display: inline-block;
position: relative;
width: 3vw;
height: 50%;
//width: 3vw;
width: 50%;
height: 33%;
.spanBg {
//background-image: url("~@/assets/board/equipment/icon.png");
@ -796,19 +811,23 @@ export default {
}
.span {
position: absolute;
//position: absolute;
bottom: 55%;
left: 12%;
color: #f4f4f4;
font-size: 0.5vw;
font-size: 0.7vw;
display: inline-block;
line-height: calc(11vh / 3);
}
.num {
position: absolute;
//position: absolute;
display: inline-block;
line-height: calc(11vh / 3);
top: 55%;
left: 12%;
color: #f4f4f4;
font-size: 0.5vw;
font-size: 0.7vw;
}
}

@ -103,7 +103,9 @@
title="历史"
:visible.sync="dialogVisible"
width="90%">
<Sensor :dialogData="dialogData"/>
<div class="dialog">
<Sensor :dialogData="dialogData"/>
</div>
</el-dialog>
</div>
</template>
@ -291,8 +293,6 @@ export default {
}
.table {
/deep/ .el-table {
background-color: #0000;
}
@ -322,4 +322,12 @@ export default {
width: 6.5vw;
overflow: hidden;
}
/deep/ .el-dialog:not(.is-fullscreen) {
margin-top: 1vh !important;
}
.dialog{
.container{
height: 86vh;
}
}
</style>

@ -120,7 +120,10 @@
{{ item.no }}
</div>
<div class="scrollTable" style="width: 25%">
{{ item.type }}
{{ item.alarmInfoType === '1' ? '设备报警' : '' }}
{{ item.alarmInfoType === '2' ? '监控单元报警' : '' }}
{{ item.alarmInfoType === '3' ? '离线报警' : '' }}
{{ item.alarmInfoType === '4' ? '电子围栏' : '' }}
</div>
<div class="scrollTable" style="width: 25%">
{{ item.location }}
@ -136,14 +139,15 @@
<div class="exTable">
<el-date-picker
style="width: calc(100% - 140px)"
style="width: calc(100% - 114px)"
size="mini"
v-model="exTableTime"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<el-button type="primary" @click="exTable" style="margin-left: 8px">导出告警信息</el-button>
<el-button size="mini" type="primary" @click="exTable" style="margin-left: 8px">导出告警信息</el-button>
</div>
<div v-if="isMap">
<Chart ref="mapChart" class="mapChart"></Chart>
@ -389,6 +393,9 @@ let polygons = []
let circles = []
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
let time1 = null
let time2 = null
const isJSON = (str) => {
try {
JSON.parse(str);
@ -478,7 +485,8 @@ export default {
y: "center",
width: '100px',
textStyle: {
color: '#fff'
color: '#fff',
fontSize: 0.6 * vw
}
},
tooltip: {
@ -489,7 +497,7 @@ export default {
{
type: "pie",
radius: ["45%", "76%"],
center: ["35%", "50%"],
center: ["25%", "50%"],
encode: {
itemName: "group",
value: "占比",
@ -507,7 +515,7 @@ export default {
{
type: "pie",
radius: ["75%", "90%"],
center: ["35%", "50%"],
center: ["25%", "50%"],
encode: {
itemName: "group",
value: "占比",
@ -575,9 +583,9 @@ export default {
// let data = await axios.get(`http://124.223.15.102:3333/componentLib/getMap?id=${this.code}`)
let {msg} = await getMapData({areaCode: this.code})
let data
if(isJSON(msg)){
if (isJSON(msg)) {
data = JSON.parse(msg)
}else{
} else {
data = ''
}
let mapData = this.code === 100000 ? ChinaMapData : data
@ -952,9 +960,9 @@ export default {
// let data = await axios.get(`http://124.223.15.102:3333/componentLib/getMap?id=${this.code}`)
let {msg} = await getMapData({areaCode: this.code})
let data
if(isJSON(msg)){
if (isJSON(msg)) {
data = JSON.parse(msg)
}else{
} else {
data = ''
}
mapData = this.cityJson[params.dataIndex].properties.adcode === 100000 ? ChinaMapData : data
@ -997,9 +1005,9 @@ export default {
let {msg} = await getMapData({areaCode: this.code})
let data
if(isJSON(msg)){
if (isJSON(msg)) {
data = JSON.parse(msg)
}else{
} else {
data = ''
}
mapData = this.code === 100000 ? ChinaMapData : data
@ -1030,12 +1038,12 @@ export default {
<path fill="${(e.ifAlarm === '1') ? '#3D93FD' : '#ff0000'}" d="M512 64.5c-180.5 0-326.9 146.4-326.9 326.9 0 63.3 18 122.3 49.2 172.4 1.1 2 2.1 4 3.2 5.9 34.9 58.2 113.9 128.8 165.5 194.5 66.3 84.4 93.2 158 93.2 158 1.6 1.4 13.1 35.6 15.1 35.8 2.5 0.2 12.6-34 14.5-35.8 0 0 22-69.2 83.7-146.6 56-70.1 142.8-145.7 177-206 0.9-1.6 1.8-3.3 2.6-5 31.5-50.2 49.7-109.6 49.7-173.3 0.1-180.5-146.3-326.8-326.8-326.8z" p-id="4306">
</path></svg></div>`
});
marker.on('click', async () => {
if (markerIds.includes(e.deviceId)) {
return
} else {
markerIds.push(e.deviceId)
}
marker.on('rightclick', async () => {
// if (markerIds.includes(e.deviceId)) {
// return
// } else {
// markerIds.push(e.deviceId)
// }
const {data} = await selectMonitorElectronic(e.deviceId)
data.map(e => e.hwFenceAreaList).flat(1).forEach(e => {
if (e.areaShapeFlag === '1') {
@ -1065,12 +1073,12 @@ export default {
<img src="${gif}" alt="" width=" 40px" style="animation:an1 2s ease-in-out infinite;" >
</div>`
});
marker.on('click', async () => {
if (markerIds.includes(e.deviceId)) {
return
} else {
markerIds.push(e.deviceId)
}
marker.on('rightclick', async () => {
// if (markerIds.includes(e.deviceId)) {
// return
// } else {
// markerIds.push(e.deviceId)
// }
const {data} = await selectMonitorElectronic(e.deviceId)
data.map(e => e.hwFenceAreaList).flat(1).forEach(e => {
if (e.areaShapeFlag === '1') {
@ -1091,18 +1099,31 @@ export default {
map.add(marker);
markers.push(marker)
},
setMarker2(e) {
setMarker2(e, bl) {
if (!bl) {
if (time1) {
clearInterval(time1)
}
time1 = null
time1 = setInterval(() => {
this.setMarker2(e, true)
}, 5000)
}
map.remove(markers)
map.remove(polygons)
map.remove(circles)
markers = []
e.forEach(v => {
console.log(v)
console.log(this.options)
let arr = this.options.filter(r => r.value.deviceId === v) || []
if (arr.length > 0) {
this.setMarker1(arr[0].value)
}
})
map.setFitView(markers)
if(!bl){
map.setFitView(markers)
}
},
getDeviceInfo() {
this.$router.push({path: '/board/equipment', query: {monitorUnitId: this.monitorUnitId}})
@ -1159,16 +1180,24 @@ export default {
})
map.setFitView(markers)
},
async searchMap1(name) {
async searchMap1(name, e) {
// if(!e){
if (time2) {
clearInterval(time2)
}
time2 = null
time2 = setInterval(async () => {
const {data} = await selectDeviceByName({name: name})
this.markerData = data
}, 5000)
// }
const {data} = await selectDeviceByName({name: name})
this.value = []
map.remove(markers)
map.remove(polygons)
map.remove(circles)
markers = []
this.loading = true;
const {data} = await selectDeviceByName({name: name})
this.markerData = data
console.log(data)
this.loading = false;
let option = []
data.forEach(e => {
@ -1260,7 +1289,16 @@ export default {
padding: 0 12px;
position: absolute;
top: 17%;
left: 15%;
right: 76.3%;
font-size: 0.8vw;
p {
display: block;
max-width: 10vw;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.chart1Table {
@ -1341,7 +1379,7 @@ export default {
.exTable {
position: absolute;
top: 46%;
bottom: 50%;
left: 76.3%;
width: 21%;
/*transform: translateX(-50%);*/

@ -551,15 +551,14 @@ export default {
position: relative;
color: #1fabf3;
font-size: 1.5vh;
height: 100%;
width: 50%;
height: 50%;
white-space: nowrap;
display: inline-block;
height: 100%;
margin-right: 12px;
vertical-align: top;
.info1 {
position: relative;
display: inline-block;
line-height: 8.5vh;
color: #fffc;
font-size: 15px;
@ -568,7 +567,7 @@ export default {
}
.info2 {
position: relative;
display: inline-block;
line-height: 8.5vh;
color: #fff
}
@ -584,5 +583,6 @@ export default {
position: absolute;
left: 60vh;
height: 100%;
width: 33%;
}
</style>

@ -22,7 +22,7 @@
</el-form-item>
<el-form-item label="报警级别" prop="alarmLevelId">
<el-form-item label="报警级别" prop="alarmLevelId" v-if="false">
<el-select v-model="queryParams.alarmLevelId" placeholder="请选择报警级别" clearable>
<el-option
v-for="(alarmLevel, index) in alarmLevels"
@ -184,11 +184,32 @@
/>
<!-- 添加或修改报警规则对话框 -->
<el-dialog :title="title" :visible.sync="open" width="660px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px" >
<el-dialog :title="title" :visible.sync="open" width="660px" append-to-body :before-close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="规则名称" prop="alarmRuleName">
<el-input v-model="form.alarmRuleName" placeholder="请输入规则名称" style="width: 240px"/>
</el-form-item>
<el-form-item label="报警级别" prop="alarmLevelId" v-if="false">
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别" style="width: 240px">
<el-option
v-for="(alarmLevel, index) in editedAlarmLevels"
:key="index"
:label="alarmLevel.alarmLevelName"
:value="alarmLevel.alarmLevelId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="报警类型" prop="alarmTypeId">
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型" style="width: 240px">
<el-option
v-for="(alarmType, index) in editedAlarmTypes"
:key="index"
:label="alarmType.alarmTypeName"
:value="alarmType.alarmTypeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择所属场景" @input="editedSceneChange"
@ -204,75 +225,43 @@
</el-form-item>
<el-form-item label="报警级别" prop="alarmLevelId">
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别" style="width: 240px">
<el-form-item label="设备模型" prop="deviceModeId">
<el-select v-model="form.deviceModeId" placeholder="请选择设备模型" style="width: 240px" @change="modelChange">
<el-option
v-for="(alarmLevel, index) in editedAlarmLevels"
v-for="(i, index) in models"
:key="index"
:label="alarmLevel.alarmLevelName"
:value="alarmLevel.alarmLevelId"
:label="i.deviceModeName "
:value="i.deviceModeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="报警类型" prop="alarmTypeId">
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型" style="width: 240px">
<el-form-item label="设备" prop="ruleDeviceIds">
<el-select v-model="form.ruleDeviceIds" multiple placeholder="请选择设备" :disabled="editedDisabled"
@input="editedDeviceChange" style="width: 240px">
<el-option
v-for="(alarmType, index) in editedAlarmTypes"
v-for="(device, index) in devicesOptions"
:key="index"
:label="alarmType.alarmTypeName"
:value="alarmType.alarmTypeId"
:label="device.deviceName"
:value="device.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="触发时间间隔" prop="triggerTimeFrame">
<el-input v-model="form.triggerTimeFrame" placeholder="请输入时间(分)" style="width: 240px"/>
</el-form-item>
<el-form-item label="告警联系人" prop="phoneNumbers">
<el-select v-model="form.phoneNumbers" placeholder="请选择告警联系人" style="width: 240px">
<el-form-item label="设备属性" prop="ruleModeFunctionIdentifier">
<el-select v-model="form.ruleModeFunctionIdentifier" placeholder="请选择设备属性"
:disabled="editedDisabled" style="width: 240px">
<el-option
v-for="(i, index) in phoneList"
v-for="(deviceModeFunction, index) in editedDeviceModeAttributes"
:key="index"
:label="i.nickName +'('+ i.phonenumber+')'"
:value="i.phonenumber"
:label="deviceModeFunction.functionName"
:value="deviceModeFunction.functionIdentifier"
></el-option>
</el-select>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="设备" prop="ruleDeviceId">
<el-select v-model="form.ruleDeviceId" placeholder="请选择设备" :disabled="editedDisabled"
@input="editedDeviceChange" style="width: 180px">
<el-option
v-for="(device, index) in editedDevices"
:key="index"
:label="device.deviceName"
:value="device.deviceId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备属性" prop="ruleModeFunctionIdentifier">
<el-select v-model="form.ruleModeFunctionIdentifier" placeholder="请选择设备属性"
:disabled="editedDisabled" style="width: 180px">
<el-option
v-for="(deviceModeFunction, index) in editedDeviceModeAttributes"
:key="index"
:label="deviceModeFunction.functionName"
:value="deviceModeFunction.functionIdentifier"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="触发时间间隔" prop="triggerTimeFrame">
<el-input v-model="form.triggerTimeFrame" placeholder="请输入时间(分)" style="width: 240px"/>
</el-form-item>
<el-form-item label="触发条件" prop="triggerCondition">
<el-select v-model="form.triggerCondition" placeholder="请选择触发条件" @input="triggerConditionChange"
:disabled="editedDisabled" style="width: 240px">
@ -285,20 +274,15 @@
</el-select>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="A值" prop="triggerDataA">
<el-input v-model="form.triggerDataA" placeholder="请输入A值" :disabled="editedDisabled" style="width: 180px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="B值" prop="triggerDataB" v-if="triggerDataBVisible">
<el-input v-model="form.triggerDataB" placeholder="请输入B值" :disabled="editedDisabled" style="width: 180px"/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="A值" prop="triggerDataA">
<el-input v-model="form.triggerDataA" placeholder="请输入A值" :disabled="editedDisabled"
style="width: 240px"/>
</el-form-item>
<el-form-item label="B值" prop="triggerDataB" v-if="triggerDataBVisible">
<el-input v-model="form.triggerDataB" placeholder="请输入B值" :disabled="editedDisabled"
style="width: 240px"/>
</el-form-item>
<el-form-item label="状态" prop="alarmRuleStatus">
<el-radio-group v-model="form.alarmRuleStatus">"
<el-radio
@ -377,6 +361,18 @@
</el-form-item>
<el-form-item label="告警联系人" prop="phoneNumbers">
<el-input v-model="form.phoneNumbers" type="text" placeholder="请输入内容" style="width: 240px"/>
<!-- <el-select v-model="form.phoneNumbers" placeholder="请选择告警联系人" style="width: 240px">-->
<!-- <el-option-->
<!-- v-for="(i, index) in phoneList"-->
<!-- :key="index"-->
<!-- :label="i.nickName +'('+ i.phonenumber+')'"-->
<!-- :value="i.phonenumber"-->
<!-- ></el-option>-->
<!-- </el-select>-->
</el-form-item>
<el-form-item label="描述" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
@ -461,8 +457,17 @@
<script>
import {
listAlarmRule, getAlarmRule, delAlarmRule, addAlarmRule, updateAlarmRule,
getScenes, getEditedScenes, getSelectListBySceneId, getDeviceModeByDeviceId, getModeFunctionParametersByModeFunctionId
listAlarmRule,
getAlarmRule,
delAlarmRule,
addAlarmRule,
updateAlarmRule,
getScenes,
getEditedScenes,
getSelectListBySceneId,
getDeviceModeByDeviceId,
getModeFunctionParametersByModeFunctionId,
getDeviceByModel
} from "@/api/business/alarmRule";
import {addDeviceModeFunction} from "@/api/business/deviceModeFunction";
import {listUser} from "../../../api/system/user";
@ -478,6 +483,8 @@ export default {
DATA_MORE_THAN_A_AND_LESS_THAN_B: 3,//AB
DATA_LESS_THAN_A_OR_MORE_THAN_B: 4,//AB
LINK_FLAG_YES: "1",
models: [],
devicesOptions: [],
//
loading: true,
//
@ -532,13 +539,13 @@ export default {
sceneId: [
{required: true, message: "所属场景不能为空", trigger: "change"}
],
alarmLevelId: [
{required: true, message: "报警级别不能为空", trigger: "change"}
],
// alarmLevelId: [
// {required: true, message: "", trigger: "change"}
// ],
alarmTypeId: [
{required: true, message: "报警类型不能为空", trigger: "change"}
],
ruleDeviceId: [
ruleDeviceIds: [
{
required: true,
message: "设备不能为空",
@ -599,11 +606,12 @@ export default {
alarmRuleFlag: "1",
editedScenes: [],
editedDisabled: true,
sceneDisabled: true,
editedDisabled: false,
sceneDisabled: false,
editedAlarmLevels: [],
editedAlarmTypes: [],
editedDevices: [],
editedModels: [],
editedDeviceModeAttributes: [],
editedDeviceModeServices: [],
@ -633,6 +641,11 @@ export default {
this.getPhoneList()
},
methods: {
modelChange(modelId) {
getDeviceByModel({modelId: modelId}).then(e => {
this.devicesOptions = e.data
})
},
getPhoneList() {
listUser({
pageNum: 1,
@ -659,6 +672,7 @@ export default {
//
reset() {
this.editedDeviceModeAttributes = [];
this.models = []
this.editedDevices = [];
this.editedAlarmTypes = [];
this.editedAlarmLevels = [];
@ -672,10 +686,11 @@ export default {
alarmLevelId: null,
alarmTypeId: null,
ruleType: '2',
ruleDeviceId: null,
ruleFunctionTotal: null,
linkFlag: "0",
alarmRuleStatus: "1",
ruleDeviceId: null,
ruleDeviceIds: [],
alarmPushFlag: "0",
alarmPushContent: null,
alarmRecoverContent: null,
@ -691,7 +706,7 @@ export default {
triggerDataB: null,
};
this.hwAlarmRuleDetailList = [];
this.resetForm("form");
// this.resetForm("form");
},
/** 搜索按钮操作 */
@ -722,20 +737,29 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.sceneDisabled = true;
this.sceneDisabled = false;
this.getEditedScenes();
const alarmRuleId = row.alarmRuleId || this.ids
getAlarmRule(alarmRuleId).then(response => {
console.log(response.data.ruleDeviceId)
this.form = response.data;
this.editedDisabled = response.data.alarmInfoFlag === "1";
this.getEditedSelectListBySceneId(this.form.sceneId);
this.getDeviceModeByDeviceId(this.form.ruleDeviceId);
this.getDeviceModeByDeviceId(response.data.ruleDeviceId);
this.triggerDataBVisibleJudge(this.form.triggerCondition);
this.alarmRuleLinkData = response.data.hwAlarmRuleLinkList;
this.alarmRuleLinkVisible = response.data.linkFlag === this.LINK_FLAG_YES;
this.open = true;
this.title = "修改报警规则";
getSelectListBySceneId(response.data.sceneId).then(e => {
this.models = e.data["models"];
})
getDeviceByModel({modelId: response.data.deviceModeId}).then(e => {
console.log(e.data)
this.devicesOptions = e.data
})
});
},
/** 提交按钮 */
@ -851,6 +875,7 @@ export default {
getEditedSelectListBySceneId(sceneId) {
getSelectListBySceneId(sceneId).then(response => {
this.models = response.data["models"];
this.editedDevices = response.data["devices"];
this.editedAlarmTypes = response.data["alarmTypes"];
this.editedAlarmLevels = response.data["alarmLevels"];
@ -858,12 +883,14 @@ export default {
},
editedSceneChange(sceneId) {
this.models = []
this.editedDevices = [];
this.editedAlarmTypes = [];
this.editedAlarmLevels = [];
this.editedDeviceModeAttributes = [];
this.form.alarmTypeId = null;
this.form.alarmLevelId = null;
this.form.ruleDeviceIds = []
this.form.ruleDeviceId = null;
this.form.ruleModeFunctionIdentifier = null;
this.alarmRuleLinkData = [];
@ -881,8 +908,10 @@ export default {
},
editedDeviceChange(deviceId) {
if (Array.isArray(deviceId) ? deviceId?.[0] : deviceId) {
this.getDeviceModeByDeviceId(Array.isArray(deviceId) ? deviceId?.[0] : deviceId);
}
this.form.ruleModeFunctionIdentifier = null;
this.getDeviceModeByDeviceId(deviceId);
},
triggerDataBVisibleJudge(triggerCondition) {
@ -911,7 +940,7 @@ export default {
this.alarmRuleLinkForm.linkDeviceFunctionId = null;
const selectedOption = this.editedDevices.find(option => option.deviceId === deviceId);
this.alarmRuleLinkForm.linkDeviceName = selectedOption.deviceName;
this.getDeviceModeServicesByDeviceId(deviceId);
this.getDeviceModeServicesByDeviceId(deviceId?.[0]);
},
editedLinkDeviceModeServiceChange(modeFunctionId) {

@ -667,11 +667,11 @@ export default {
rules: {
deviceCode: [
{required: true, message: "设备编号不能为空", trigger: "blur"},
{
pattern: /^[a-z0-9_]+$/,
message: "2-20个字符由小写字母、数字或下划线组成",
trigger: "blur"
}
// {
// pattern: /^[a-z0-9_]+$/,
// message: "2-20线",
// trigger: "blur"
// }
],
deviceName: [
{required: true, message: "设备名称不能为空", trigger: "blur"}
@ -860,9 +860,9 @@ export default {
this.reset();
const deviceId = row.deviceId || this.ids
getDevice(deviceId).then(response => {
if (response.data.deviceStatus === this.DEVICE_STATUS_PUBLISHED) {
this.confirmBtnVisible = false;
}
// if (response.data.deviceStatus === this.DEVICE_STATUS_PUBLISHED) {
// this.confirmBtnVisible = false;
// }
if (response.data.devicePic != null) {
let previewFile = {};

@ -91,6 +91,7 @@
:class="{hide: this.fileList.length >= 1}"
>
<i class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<!-- 上传提示 -->

@ -6,7 +6,7 @@
<el-input v-model="form.electronicFenceName" placeholder="请输入电子围栏名称"/>
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择" :disabled="sceneDisable">
<el-select v-model="form.sceneId" placeholder="请选择" @input="editedSceneChange">
<el-option
v-for="(scene, index) in editedScenes"
:key="index"
@ -16,6 +16,29 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备模型" prop="deviceModeId">
<el-select v-model="form.deviceModeId" placeholder="请选择设备模型" @change="modelChange">
<el-option
v-for="(i, index) in models"
:key="index"
:label="i.deviceModeName "
:value="i.deviceModeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备" prop="deviceId">
<el-select v-model="form.deviceId" placeholder="请选择设备">
<el-option
v-for="(device, index) in devicesOptions"
:key="index"
:label="device.deviceName"
:value="device.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="触发状态" prop="triggerStatus">
<el-select v-model="form.triggerStatus" placeholder="请选择触发状态">
<el-option
@ -56,6 +79,7 @@ import {
gcj02towgs84,
wgs84togcj02
} from '@/utils/coordtransform'
import {getDeviceByModel, getSelectListBySceneId} from "@/api/business/alarmRule";
let map = null
let polyEditor = null
@ -69,6 +93,8 @@ export default {
data1: '',
data2: ''
},
models: [],
devicesOptions: [],
//
editedScenes: [],
sceneDisable: true,
@ -202,7 +228,7 @@ export default {
})
let thisPolygon = new AMap.Polygon({path: e, extData: {id: id}});
thisPolygon.on('dblclick', () => {
if(this.alarmInfoFlag === "1"){
if (this.alarmInfoFlag === "1") {
this.$modal.msgWarning("电子围栏已经有报警信息,不能修改电子围栏区域")
return;
}
@ -210,7 +236,7 @@ export default {
polyEditor.open();
})
thisPolygon.on('rightclick', () => {
if(this.alarmInfoFlag === "1"){
if (this.alarmInfoFlag === "1") {
this.$modal.msgWarning("电子围栏已经有报警信息,不能删除电子围栏区域")
return;
}
@ -226,7 +252,7 @@ export default {
e.center = [lng, lat]
let thisCircle = new AMap.Circle({center: e.center, radius: e.radius, extData: {id: id}});
thisCircle.on('dblclick', () => {
if(this.alarmInfoFlag === "1"){
if (this.alarmInfoFlag === "1") {
this.$modal.msgWarning("电子围栏已经有报警信息,不能修改电子围栏区域")
return;
}
@ -234,7 +260,7 @@ export default {
CircleEditor.open();
})
thisCircle.on('rightclick', () => {
if(this.alarmInfoFlag === "1"){
if (this.alarmInfoFlag === "1") {
this.$modal.msgWarning("电子围栏已经有报警信息,不能删除电子围栏区域")
return;
}
@ -299,6 +325,19 @@ export default {
let circleAreaList = JSON.parse(response.data.circleAreaListStr)
let polygonAreaListArr = JSON.parse(response.data.polygonAreaListStr)
if (response.data.sceneId) {
getSelectListBySceneId(response.data.sceneId).then(response => {
this.models = response.data["models"];
})
}
if (response.data.deviceModeId) {
getDeviceByModel({modelId: response.data.deviceModeId}).then(e => {
this.devicesOptions = e.data
})
}
polygonAreaListArr.forEach(e1 => {
let polygonAreaListJson = JSON.parse(e1);
let polyJsonArr = JSON.parse(polygonAreaListJson["polyJsonArr"]);
@ -353,6 +392,25 @@ export default {
this.$tab.closeOpenPage(obj);
},
editedSceneChange(sceneId) {
this.$set(this.form, 'deviceModeId', null)
this.$set(this.form, 'deviceId', null)
this.models = []
this.devicesOptions = []
getSelectListBySceneId(sceneId).then(response => {
this.models = response.data["models"];
})
},
modelChange(modelId) {
this.$set(this.form, 'deviceId', null)
this.devicesOptions = []
console.log(this.form)
getDeviceByModel({modelId: modelId}).then(e => {
this.devicesOptions = e.data
})
},
}
};

@ -9,16 +9,40 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="queryParams.sceneId" placeholder="请选择" clearable>
<el-form-item label="所属场景" prop="sceneId" >
<el-select v-model="queryParams.sceneId" placeholder="请选择" @input="editedSceneChange">
<el-option
v-for="(scene, index) in scenes"
:key="index"
:label="scene.sceneName"
:value="scene.sceneId"
:disabled="scene.selectedDisable && scene.selectedDisable == 1"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备模型" prop="deviceModeId">
<el-select v-model="queryParams.deviceModeId" placeholder="请选择设备模型" @change="modelChange">
<el-option
v-for="(i, index) in models"
:key="index"
:label="i.deviceModeName "
:value="i.deviceModeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备" prop="deviceId">
<el-select v-model="queryParams.deviceId" placeholder="请选择设备">
<el-option
v-for="(device, index) in devicesOptions"
:key="index"
:label="device.deviceName"
:value="device.deviceId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="触发状态" prop="sceneId">
<el-select v-model="queryParams.triggerStatus" placeholder="请选择触发状态" clearable>
<el-option
@ -31,7 +55,6 @@
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -125,12 +148,15 @@
<script>
import { listElectronicFence, getElectronicFence, delElectronicFence, addElectronicFence, updateElectronicFence } from "@/api/business/electronicFence";
import {getScenes} from "@/api/business/device";
import {getDeviceByModel, getSelectListBySceneId} from "@/api/business/alarmRule";
export default {
name: "ElectronicFence",
dicts: ['hw_fence_trigger_status','hw_fence_type'],
data() {
return {
models:[],
devicesOptions:[],
//
loading: true,
//
@ -303,7 +329,25 @@ export default {
this.download('business/electronicFence/export', {
...this.queryParams
}, `electronicFence_${new Date().getTime()}.xlsx`)
}
},
editedSceneChange(sceneId) {
this.$set(this.queryParams,'deviceModeId',null)
this.$set(this.queryParams,'deviceId',null)
this.models = []
this.devicesOptions = []
getSelectListBySceneId(sceneId).then(response => {
this.models = response.data["models"];
})
},
modelChange(modelId) {
this.$set(this.queryParams,'deviceId',null)
this.devicesOptions = []
getDeviceByModel({modelId: modelId}).then(e => {
this.devicesOptions = e.data
})
},
}
};
</script>

@ -112,7 +112,7 @@
<el-input v-model="form.monitorUnitName" placeholder="请输入监控单元名称"/>
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择" :disabled="sceneDisable" @input="editedSceneChange">
<el-select v-model="form.sceneId" placeholder="请选择" @input="editedSceneChange" style="width: 100%">
<el-option
v-for="(scene, index) in editedScenes"
:key="index"
@ -128,7 +128,7 @@
placeholder="请选择父级监控单元"/>
</el-form-item>
<el-form-item label="监控单元类型" prop="monitorUnitTypeId">
<el-select v-model="form.monitorUnitTypeId" placeholder="请选择">
<el-select v-model="form.monitorUnitTypeId" placeholder="请选择" style="width: 100%">
<el-option
v-for="(monitorUnitType, index) in editedMonitorUnitTypes"
:key="index"
@ -167,6 +167,7 @@
:on-preview="handlePictureCardPreview"
:class="{hide: this.fileList.length >= 1}"
>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
<i class="el-icon-plus"></i>
</el-upload>

@ -9,7 +9,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="虚拟标识" prop="vitualFlag">
<el-form-item label="虚拟标识" prop="vitualFlag" v-if="false">
<el-select v-model="queryParams.vitualFlag" placeholder="请选择虚拟标识" clearable>
<el-option
v-for="dict in dict.type.hw_unit_type_vitual_flag"
@ -76,7 +76,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="类型ID" align="center" prop="monitorUnitTypeId" />
<el-table-column label="类型名称" align="center" prop="monitorUnitTypeName" />
<el-table-column label="虚拟标识" align="center" prop="vitualFlag" >
<el-table-column label="虚拟标识" align="center" prop="vitualFlag" v-if="false">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_unit_type_vitual_flag" :value="scope.row.vitualFlag"/>
</template>
@ -118,7 +118,7 @@
<el-input v-model="form.monitorUnitTypeName" placeholder="请输入监控单元类型名称" />
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择" :disabled="sceneDisable">
<el-select v-model="form.sceneId" placeholder="请选择" >
<el-option
v-for="(scene, index) in editedScenes"
:key="index"
@ -129,7 +129,7 @@
</el-select>
</el-form-item>
<el-form-item label="虚拟标识" prop="vitualFlag">
<el-form-item label="虚拟标识" prop="vitualFlag" v-if="false">
<el-radio-group v-model="form.vitualFlag">
<el-radio
v-for="dict in dict.type.hw_unit_type_vitual_flag"
@ -205,9 +205,9 @@ export default {
monitorUnitTypeName: [
{ required: true, message: "监控单元类型名称不能为空", trigger: "blur" }
],
vitualFlag: [
{ required: true, message: "虚拟标识不能为空", trigger: "blur" }
],
// vitualFlag: [
// { required: true, message: "", trigger: "blur" }
// ],
sceneId: [
{ required: true, message: "所属场景不能为空", trigger: "blur" }
],

@ -32,7 +32,7 @@
</el-form-item>
<el-form-item label="默认标识" prop="defaultFlag">
<el-form-item label="默认标识" prop="defaultFlag" v-if="false">
<el-select v-model="queryParams.defaultFlag" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.hw_scene_default_flag"
@ -107,7 +107,7 @@
<el-table-column label="场景名称" align="center" prop="sceneName"/>
<el-table-column label="所属租户" align="center" prop="tenantName"/>
<el-table-column label="场景类型" align="center" prop="sceneModeName"/>
<el-table-column label="默认标识" align="center" prop="defaultFlag">
<el-table-column label="默认标识" align="center" prop="defaultFlag" v-if="false">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_scene_default_flag" :value="scope.row.defaultFlag"/>
</template>
@ -171,7 +171,7 @@
</el-select>
</el-form-item>
<el-form-item label="默认标识" prop="defaultFlag">
<el-form-item label="默认标识" prop="defaultFlag" v-if="false">
<el-radio-group v-model="form.defaultFlag">
<el-radio
v-for="dict in dict.type.hw_scene_default_flag"
@ -194,10 +194,10 @@
</el-select>
</el-form-item>
<el-form-item label="场景账号" prop="modeAccount">
<el-input v-model="form.modeAccount" placeholder="自动生成" disabled/>
<el-input v-model="form.modeAccount" placeholder="自动生成" />
</el-form-item>
<el-form-item label="场景密码" prop="modeKey">
<el-input v-model="form.modeKey" placeholder="自动生成" disabled/>
<el-input v-model="form.modeKey" placeholder="自动生成" />
</el-form-item>
<el-form-item label="保存周期(天)" prop="preserveTime">
@ -227,6 +227,7 @@
:class="{hide: this.fileList.length >= 1}"
>
<i class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<!-- 上传提示 -->
@ -311,7 +312,7 @@ export default {
open: false,
sceneModes: [],
tenants: [],
editedDisable: true,
editedDisable: false,
confirmDisabled: false,
//
queryParams: {
@ -345,9 +346,9 @@ export default {
sceneModeId: [
{required: true, message: "场景类型不能为空", trigger: "change"}
],
defaultFlag: [
{required: true, message: "默认标识不能为空", trigger: "change"}
],
// defaultFlag: [
// {required: true, message: "", trigger: "change"}
// ],
authMode: [
{required: true, message: "认证方式不能为空", trigger: "change"}
],
@ -453,7 +454,7 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.editedDisable = true;
// this.editedDisable = true;
this.confirmDisabled = false;
const sceneId = row.sceneId || this.ids
getScene(sceneId).then(response => {

@ -344,4 +344,4 @@ export default {
}
}
};
</script>
</script>

@ -10,7 +10,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="权限字符" prop="roleKey">
<el-form-item label="所属租户" prop="tenantId">
<el-input
v-model="queryParams.tenantId"
placeholder="请输入所属租户"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="权限字符" prop="roleKey" v-if="false">
<el-input
v-model="queryParams.roleKey"
placeholder="请输入权限字符"
@ -94,7 +103,7 @@
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="角色编号" prop="roleId" width="120"/>
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" v-if="false"/>
<el-table-column label="显示顺序" prop="roleSort" width="100"/>
<el-table-column label="所属租户" prop="tenantName" width="100"/>
<el-table-column label="状态" align="center" width="100">
@ -160,7 +169,17 @@
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="form.roleName" placeholder="请输入角色名称"/>
</el-form-item>
<el-form-item prop="roleKey">
<el-form-item label="所属租户" prop="tenantId">
<el-select v-model="form.tenantId" placeholder="请选择" clearable>
<el-option
v-for="(tenant, index) in tenants"
:key="index"
:label="tenant.tenantName"
:value="tenant.tenantId"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="roleKey" v-if="false">
<span slot="label">
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)" placement="top">
<i class="el-icon-question"></i>
@ -216,7 +235,7 @@
<el-input v-model="form.roleName" :disabled="true"/>
</el-form-item>
<el-form-item label="权限字符">
<el-input v-model="form.roleKey" :disabled="true"/>
<el-input v-model="form.roleKey" :disabled="true" v-if="false"/>
</el-form-item>
<el-form-item label="权限范围">
<el-select v-model="form.dataScope" @change="dataScopeSelectChange">
@ -267,6 +286,7 @@ import {
deptTreeSelect
} from "@/api/system/role";
import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu";
import {getTenants} from "@/api/system/user";
export default {
name: "Role",
@ -287,6 +307,8 @@ export default {
total: 0,
//
roleList: [],
//
tenants: [],
//
title: "",
//
@ -335,7 +357,9 @@ export default {
status: undefined
},
//
form: {},
form: {
roleKey:'iot'
},
defaultProps: {
children: "children",
label: "label"
@ -345,9 +369,12 @@ export default {
roleName: [
{required: true, message: "角色名称不能为空", trigger: "blur"}
],
roleKey: [
{required: true, message: "权限字符不能为空", trigger: "blur"}
tenantId:[
{required: true, message: "所属租户不能为空", trigger: "blur"}
],
// roleKey: [
// {required: true, message: "", trigger: "blur"}
// ],
roleSort: [
{required: true, message: "角色顺序不能为空", trigger: "blur"}
]
@ -356,9 +383,18 @@ export default {
};
},
created() {
this.getTenants();
this.getList();
},
methods: {
/** 获取租户信息列表 */
getTenants() {
getTenants().then(response => {
if (response.data !== undefined) {
this.tenants = response.data;
}
});
},
/** 查询角色列表 */
getList() {
this.loading = true;
@ -440,7 +476,7 @@ export default {
this.form = {
roleId: undefined,
roleName: undefined,
roleKey: undefined,
roleKey: "iot",
roleSort: 0,
status: "0",
menuIds: [],

Loading…
Cancel
Save