|
@@ -4,23 +4,23 @@
|
|
|
<save slot="btn" @click.native="save()"></save>
|
|
|
</handle-top>
|
|
|
<role-info-handle ref="info"></role-info-handle>
|
|
|
- <el-row class="power">
|
|
|
+ <el-row class="power1">
|
|
|
<el-col :span="24" class="title-box">
|
|
|
<p class="title">角色授权</p>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
|
- <role-power-left :roleData="power" @currentItemChange="currentItemChange" @checkList="checkList">
|
|
|
+ <role-power-left :roleData="power" @currentItemChange="currentItemChange">
|
|
|
<search @searchActive="searchActive()" @clearData="clearData()" slot="search"></search>
|
|
|
- <pagination :total="6"
|
|
|
+ <!-- <pagination :total="6"
|
|
|
slot="page"
|
|
|
:pageSize="3"
|
|
|
:currentPage="1"
|
|
|
@pageChange="pageChange">
|
|
|
- </pagination>
|
|
|
+ </pagination> -->
|
|
|
</role-power-left>
|
|
|
</el-col>
|
|
|
<el-col :span="14">
|
|
|
- <role-power-right :roleData="currentItem"></role-power-right>
|
|
|
+ <role-power-right :roleData="currentItem" @powerChange="powerChange"></role-power-right>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -35,6 +35,7 @@ import search from '@/components/search/index'
|
|
|
import Pagination from '@/components/pagination/Pagination'
|
|
|
|
|
|
import save from '@/SManagement/archives_upload/components/save'
|
|
|
+import { log } from '@antv/g2plot/lib/utils'
|
|
|
export default {
|
|
|
name: 'roleEdit',
|
|
|
data () {
|
|
@@ -57,24 +58,28 @@ export default {
|
|
|
"classname": "sale.role.role",
|
|
|
"method": "insertormodify_role",
|
|
|
"content": {
|
|
|
- "roleid":3,
|
|
|
- "rolename":"店长",
|
|
|
- "remarks":"店长角色"
|
|
|
+ "roleid":0,
|
|
|
+ "rolename":"",
|
|
|
+ "remarks":""
|
|
|
}
|
|
|
},
|
|
|
pullPower: {
|
|
|
"classname": "sale.role.role",
|
|
|
"method": "query_appselect",
|
|
|
"content": {
|
|
|
- "roleid": 0,
|
|
|
+ "roleid": this.roleid,
|
|
|
}
|
|
|
},
|
|
|
+ roleid: this.$route.params.data ? this.$route.params.data.roleid : this.$route.query.id,
|
|
|
//拉取的权限列表
|
|
|
power: [],
|
|
|
//编辑逻辑时数据储存
|
|
|
editData:'',
|
|
|
//选中的模块数据
|
|
|
currentItem:0,
|
|
|
+ currentApp:[],
|
|
|
+ //授权数据
|
|
|
+ systemapps:[]
|
|
|
};
|
|
|
},
|
|
|
components: { HandleTop, save, roleInfoHandle, search, RolePowerLeft, RolePowerRight ,Pagination},
|
|
@@ -105,6 +110,7 @@ export default {
|
|
|
if(this.editData) this.pullPower.content.roleid = this.editData.roleid
|
|
|
this.$api.requested(this.pullPower).then(res => {
|
|
|
this.power = res.data
|
|
|
+ this.currentItem = res.data[0]
|
|
|
console.log(res);
|
|
|
})
|
|
|
},
|
|
@@ -112,30 +118,79 @@ export default {
|
|
|
this.currentItem = data
|
|
|
console.log(data);
|
|
|
},
|
|
|
- //勾选复选框事件
|
|
|
- checkList(data) {
|
|
|
- let checkArr = []
|
|
|
- // this.power.filter(item => )
|
|
|
- },
|
|
|
save () {
|
|
|
this.$refs.info.$refs.ruleForm.validate((val) => {
|
|
|
if(val) {
|
|
|
- this.add.content.rolename = this.$refs.info.ruleForm.name
|
|
|
- this.add.content.remarks = this.$refs.info.ruleForm.descript
|
|
|
- this.$api.requested(this.add).then( res => {
|
|
|
- console.log(res);
|
|
|
- })
|
|
|
+ if(this.$route.params.data) {
|
|
|
+ this.auth.content.roleid = this.roleid
|
|
|
+ this.auth.content.systemapps = this.systemapps
|
|
|
+ this.$api.requested(this.auth).then( res => {
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
+ if(res.code == 1) {
|
|
|
+ this.$notify({
|
|
|
+ title:'提示',
|
|
|
+ message:'修改成功',
|
|
|
+ type:'success'
|
|
|
+ })
|
|
|
+ this.$router.back()
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title:'提示',
|
|
|
+ message:'修改失败',
|
|
|
+ type:'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.add.content.rolename = this.$refs.info.ruleForm.name
|
|
|
+ this.add.content.remarks = this.$refs.info.ruleForm.descript
|
|
|
+ this.$api.requested(this.add).then( res => {
|
|
|
+ if(res.code == 1) {
|
|
|
+ this.auth.content.roleid = res.data.roleid
|
|
|
+ this.auth.content.systemapps = this.systemapps
|
|
|
+ console.log(this.auth);
|
|
|
+
|
|
|
+ this.$api.requested(this.auth).then( res => {
|
|
|
+ if(res.code == 1) {
|
|
|
+ this.$notify({
|
|
|
+ title:'提示',
|
|
|
+ message:'新建成功',
|
|
|
+ type:'success'
|
|
|
+ })
|
|
|
+ this.$router.back()
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title:'提示',
|
|
|
+ message:'新建失败',
|
|
|
+ type:'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取所有需要授权数据
|
|
|
+ getAllPower() {
|
|
|
+ let is
|
|
|
+ this.currentApp.apps.forEach(item => {
|
|
|
+ is = this.systemapps.find(item2 => item2.systemappid == item.systemappid)
|
|
|
+ if(is == undefined) {
|
|
|
+ let obj = {}
|
|
|
+ obj.systemappid = item.systemappid
|
|
|
+ obj.optionids = item.optionids
|
|
|
+ this.systemapps.push(obj)
|
|
|
} else {
|
|
|
- this.$notify({
|
|
|
- title:'提示',
|
|
|
- message:'请填写名称或描述',
|
|
|
- type:'warning'
|
|
|
- })
|
|
|
+ is.systemappid = item.systemappid
|
|
|
+ is.optionids = item.optionids
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- searchActive () {
|
|
|
+ searchActive (data) {
|
|
|
|
|
|
},
|
|
|
clearData () {
|
|
@@ -143,14 +198,27 @@ export default {
|
|
|
},
|
|
|
pageChange() {
|
|
|
|
|
|
+ },
|
|
|
+ powerChange(data) {
|
|
|
+ this.currentItem.clients[0].modules.forEach(item => {
|
|
|
+ if(item.systemmoduleid == data.systemmoduleid) {
|
|
|
+ item = data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.currentApp = data
|
|
|
+ this.getAllPower()
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.power {
|
|
|
+.role-edit {
|
|
|
+ min-height: 100%;
|
|
|
+}
|
|
|
+.power1 {
|
|
|
background: #ffffff;
|
|
|
+ min-height: calc(100vh - 320px);
|
|
|
}
|
|
|
.title-box {
|
|
|
height: 48px;
|