Commit 169a1987 by 周海峰

no message

parent 416d6b89
...@@ -71,7 +71,38 @@ ...@@ -71,7 +71,38 @@
<q-field :count="200"> <q-field :count="200">
<q-input v-model="tempRole.description" :float-label="$t('Role description')" /> <q-input v-model="tempRole.description" :float-label="$t('Role description')" />
</q-field> </q-field>
<q-option-group color="secondary" type="checkbox" v-model="group" :options="itemList" /> <div class="q-mt-md">
<div class="row q-gutter-md">
<div class="col-6">
<q-card flat bordered class="full-height">
<div class="text-h6">PC端可见应用</div>
<div class="q-pa-md">
<q-option-group
color="primary"
type="checkbox"
v-model="group"
:options="itemList"
class="q-gutter-sm"
/>
</div>
</q-card>
</div>
<div class="col-6">
<q-card flat bordered class="full-height">
<div class="text-h6">App端可见应用</div>
<div class="q-pa-md">
<q-option-group
color="secondary"
type="checkbox"
v-model="groupApp"
:options="itemListApp"
class="q-gutter-sm"
/>
</div>
</q-card>
</div>
</div>
</div>
</div> </div>
</q-modal-layout> </q-modal-layout>
</q-modal> </q-modal>
...@@ -85,7 +116,9 @@ import { ...@@ -85,7 +116,9 @@ import {
delRoles, delRoles,
saveRole, saveRole,
platformapplicationslistall, platformapplicationslistall,
listbyrole listbyrole,
platformapplicationslistallApp,
listbyroleApp
} from "@/service/permission/role"; } from "@/service/permission/role";
export default { export default {
name: "role", name: "role",
...@@ -134,6 +167,8 @@ export default { ...@@ -134,6 +167,8 @@ export default {
}, },
itemList:[], itemList:[],
group:[], group:[],
itemListApp:[],
groupApp:[],
}; };
}, },
methods: { methods: {
...@@ -212,23 +247,35 @@ export default { ...@@ -212,23 +247,35 @@ export default {
}, },
async editRole(id) { async editRole(id) {
this.group=[]; this.group=[];
this.groupApp=[];
let editRole = this.serverData.filter(s => { let editRole = this.serverData.filter(s => {
return s.id === id; return s.id === id;
}); });
if (editRole && editRole.length > 0) { if (editRole && editRole.length > 0) {
this.tempRole = JSON.parse(JSON.stringify(editRole[0])); this.tempRole = JSON.parse(JSON.stringify(editRole[0]));
} else { } else {
return true; return true;
} }
// 加载PC端应用权限
let dataRes = await listbyrole(this.tempRole.id); let dataRes = await listbyrole(this.tempRole.id);
for(let i=0;i<dataRes.data.data.length;i++){ for(let i=0;i<dataRes.data.data.length;i++){
this.group.push(dataRes.data.data[i].roleUseStatue+'') let app = dataRes.data.data[i];
if(app.roleUseStatue !== 0){
this.group.push(app.roleUseStatue+'')
}
}
// 加载App端应用权限
let dataResApp = await listbyroleApp(this.tempRole.id);
for(let i=0;i<dataResApp.data.data.length;i++){
let app = dataResApp.data.data[i];
if(app.roleUseStatue !== 0){
this.groupApp.push(app.roleUseStatue+'')
}
} }
this.editModal = true; this.editModal = true;
}, },
async saveRole() { async saveRole() {
debugger
if(this.tempRole.name == "" || this.tempRole.name == null|| this.tempRole.namezh == "" || this.tempRole.namezh == null) { if(this.tempRole.name == "" || this.tempRole.name == null|| this.tempRole.namezh == "" || this.tempRole.namezh == null) {
this.$q.notify({ this.$q.notify({
message: "角色名称和角色编码不能为空", message: "角色名称和角色编码不能为空",
...@@ -241,6 +288,8 @@ export default { ...@@ -241,6 +288,8 @@ export default {
} }
let groupstr = (JSON.stringify(this.group).substr(1,JSON.stringify(this.group).length - 2)).split('"').join(''); let groupstr = (JSON.stringify(this.group).substr(1,JSON.stringify(this.group).length - 2)).split('"').join('');
this.tempRole.group = groupstr; this.tempRole.group = groupstr;
let groupAppStr = (JSON.stringify(this.groupApp).substr(1,JSON.stringify(this.groupApp).length - 2)).split('"').join('');
this.tempRole.groupApp = groupAppStr;
await saveRole(this.tempRole); await saveRole(this.tempRole);
this.$q.notify({ this.$q.notify({
type: "positive", type: "positive",
...@@ -258,18 +307,24 @@ export default { ...@@ -258,18 +307,24 @@ export default {
addRole() { addRole() {
this.tempRole = {}; this.tempRole = {};
this.group=[]; this.group=[];
this.groupApp=[];
this.editModal = true; this.editModal = true;
}, },
async platformapplicationslistall(){ async platformapplicationslistall(){
let dataRes = await platformapplicationslistall(); let dataRes = await platformapplicationslistall();
this.itemList = dataRes.data.data; this.itemList = dataRes.data.data;
}, },
async platformapplicationslistallApp(){
let dataRes = await platformapplicationslistallApp();
this.itemListApp = dataRes.data.data;
},
}, },
mounted() { mounted() {
this.request({ this.request({
pagination: this.serverPagination pagination: this.serverPagination
}); });
this.platformapplicationslistall(); this.platformapplicationslistall();
this.platformapplicationslistallApp();
} }
}; };
</script> </script>
...@@ -68,3 +68,21 @@ export function listbyrole(id){ ...@@ -68,3 +68,21 @@ export function listbyrole(id){
loading:"hourglass" loading:"hourglass"
}) })
} }
export function platformapplicationslistallApp(){
return request({
url: '/PlatformRoleApplicationAppController/platformapplications/listallApp',
method: 'get',
data: '',
loading:"hourglass"
})
}
export function listbyroleApp(id){
return request({
url: '/PlatformRoleApplicationAppController/platformapplications/listbyroleApp/'+id,
method: 'get',
data: '',
loading:"hourglass"
})
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论