Compare commits

..

2 Commits

Author SHA1 Message Date
xiaomeng dc8309352d Merge pull request '1' (#205) from pc-master into portal
Reviewed-on: #205
2024-12-19 08:01:24 +00:00
sunmeng b92ab99ae1 1 2024-12-19 15:51:11 +08:00
3 changed files with 92 additions and 1 deletions

View File

@ -494,6 +494,11 @@ selControlPermissions(data){
putpermission(data){ putpermission(data){
return sendPutRequest(`/getcontrol/putpermission`, data) return sendPutRequest(`/getcontrol/putpermission`, data)
}, },
//根据权限id修改权限显示或者隐藏
updatePermissionState(data){
return sendPutRequest(`/getcontrol/updatePermissionState`, data)
},
//根据设备ID获取设备控制值 //根据设备ID获取设备控制值
selpermission(data){ selpermission(data){
return sendGetRequest(`/getcontrol/selpermission`, data) return sendGetRequest(`/getcontrol/selpermission`, data)
@ -700,6 +705,10 @@ getIccid(data){
readControl_setMemo(data){ readControl_setMemo(data){
return sendPostRequest(`/readControl/setMemo`, data) return sendPostRequest(`/readControl/setMemo`, data)
}, },
//根据设备id查询控制器权限
getcontrol_cpermission(data){
return sendPostRequest(`/getcontrol/cpermission?deviceId=${data}`, '')
},

View File

@ -103,6 +103,9 @@ export default {
this.routerList = []; this.routerList = [];
this.purview = res.data.data; this.purview = res.data.data;
this.purview.forEach((el, index) => { this.purview.forEach((el, index) => {
if(el.state==1){
return
}
if (el.id == 1) { if (el.id == 1) {
var list = [ var list = [
{ name: "目标温度", list: [], router: "targetTemperature", isRouter: true, index: 1 }, { name: "目标温度", list: [], router: "targetTemperature", isRouter: true, index: 1 },

View File

@ -63,6 +63,9 @@
<div class="table-operate blue" @click="openModel1(scope.row, scope.$index)"> <div class="table-operate blue" @click="openModel1(scope.row, scope.$index)">
<img src="../../assets/manageImg/table-edit.png" alt="">编辑 <img src="../../assets/manageImg/table-edit.png" alt="">编辑
</div> </div>
<div class="table-operate blue" @click="openRoleModel(scope.row.deviceId)">
<img src="../../assets/manageImg/table-edit.png" alt="">权限编辑
</div>
</div> </div>
</template> </template>
@ -372,6 +375,21 @@
<div class="vrcode-btn cancle-btn w-100" @click="changeName = false">取消</div> <div class="vrcode-btn cancle-btn w-100" @click="changeName = false">取消</div>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" title="控制器权限管理" :append-to-body="true" :visible.sync="roleModel" width="70%">
<div class="model-title">控制器权限管理</div>
<div class="model-sel scroll">
<div v-for="item, index in allDevicestatus" :key="index">
<div @click="selClick(item)" :class="item.state==0 ? 'sel' : 'no-sel'"></div>
{{ item.nickName }}
</div>
</div>
<span slot="footer" class="dialog-footer">
<!-- <div class="vrcode-btn blue-btn">添加标准控制器</div> -->
<div class="vrcode-btn cancle-btn w-100" @click="roleModel = false">确定</div>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -390,6 +408,10 @@ export default {
nameList:null,// nameList:null,//
name20List:null,// name20List:null,//
changeName1:false,// changeName1:false,//
allDevicestatus:[],
roleModel:false,
nowDeviceId:'',
} }
}, },
// watch:{ // watch:{
@ -401,6 +423,7 @@ export default {
// }, // },
mounted() { this.dataInit() }, mounted() { this.dataInit() },
methods: { methods: {
dataInit() { dataInit() {
var user = JSON.parse(localStorage.getItem('userInfo')) var user = JSON.parse(localStorage.getItem('userInfo'))
this.api.selUserbyid(user.userid).then(res => { this.api.selUserbyid(user.userid).then(res => {
@ -420,7 +443,63 @@ export default {
} }
}) })
}, },
selClick(item){
var data
if(item.state==0){
data= {
"deviceId": this.nowDeviceId,
"permission": item.id,
"state":1
}
}else{
data= {
"deviceId": this.nowDeviceId,
"permission": item.id,
"state":0
}
}
item.state = data.state
this.$forceUpdate();
var apiData=JSON.parse(JSON.stringify(data))
this.api.updatePermissionState(apiData).then((res => {
if (res.data.code == 200) {
this.$message({
message: '修改成功',
type: "success",
});
// this.getcontrol_cpermission()
} else {
this.$message({
message: res.data.msg,
type: "warning",
});
}
}))
},
openRoleModel(deviceId) {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.selDevicestatus = []
this.nowDeviceId=deviceId
// 线
this.api.getcontrol_cpermission(deviceId).then(res => {
if (res.data.code == 200) {
this.allDevicestatus = res.data.data
this.roleModel=true
this.loading.close()
// deviceId name
// this.getcontrol_cpermission()
} else {
this.loading.close()
this.$message.error(res.data.msg);
}
})
},
changeAddModel() { changeAddModel() {
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,