Commit 72c66bbb by 李长胜

角色修改

1 parent 63d9111f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-form-item label="角色说明" prop="roleDesc"> <el-form-item label="角色说明" prop="roleDesc">
<el-input size="small" style="width: 40%" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input> <el-input size="small" style="width: 40%" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色权限" prop="roleRoot"> <!-- <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element"> <div class="custom_element">
<template v-for="(item, index) in accountList"> <template v-for="(item, index) in accountList">
<div :key="index" class="wrap"> <div :key="index" class="wrap">
...@@ -28,7 +28,29 @@ ...@@ -28,7 +28,29 @@
</div> </div>
</template> </template>
</div> </div>
</el-form-item> </el-form-item> -->
<el-row>
<el-col :span="16">
<div data-v-995a4ff0="" class="el-form-item is-required">
<label for="roleName" class="el-form-item__label" style="width: 100px">角色权限</label>
<div class="el-form-item__content" style="margin-left: 100px">
<!-- <div data-v-995a4ff0="" class="el-input el-input--small">
<auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button>
</div> -->
<div class="custom_element">
<template v-for="(item, index) in accountList">
<div :key="index" class="wrap">
<AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton>
</div>
</template>
</div>
<div class="el-form-item__error" v-if="roleRootRules">
请选择角色权限
</div>
</div>
</div>
</el-col>
</el-row>
</el-form> </el-form>
</div> </div>
</div> </div>
...@@ -65,6 +87,8 @@ export default { ...@@ -65,6 +87,8 @@ export default {
data() { data() {
return { return {
roleRootRules: false,
accounttypeIds: [],
ruleForm: { ruleForm: {
merchantId: '', merchantId: '',
roleName: '', roleName: '',
...@@ -100,7 +124,7 @@ export default { ...@@ -100,7 +124,7 @@ export default {
merchantId: res.merchantId merchantId: res.merchantId
} }
this.getMerchantTree(id, res.responseList) this.getMerchantTree(id, res.responseList)
this.$refs.productFrom.accountTypeSearchRequest({ id: res.merchantId },this.roleInfo.responseList) this.$refs.productFrom.accountTypeSearchRequest({ id: res.merchantId }, this.roleInfo.responseList)
}) })
}, },
// 获取商户树 // 获取商户树
...@@ -144,6 +168,7 @@ export default { ...@@ -144,6 +168,7 @@ export default {
}, },
// 选择商户权限 // 选择商户权限
selectCurAccount(item, index) { selectCurAccount(item, index) {
this.roleRootRules = false
this.accountList[index].select = !item.select this.accountList[index].select = !item.select
this.curRootIndex = 0 this.curRootIndex = 0
if (this.accountList[index].select) { if (this.accountList[index].select) {
...@@ -154,10 +179,13 @@ export default { ...@@ -154,10 +179,13 @@ export default {
}) })
this.rootList = arr this.rootList = arr
} }
let accounttypeId = []; let accounttypeId = []
this.rootList.forEach(item=>{
this.rootList.forEach(item => {
accounttypeId.push(item.accounttypeId) accounttypeId.push(item.accounttypeId)
}) })
this.accounttypeIds = accounttypeId
this.$refs.productFrom.findMenuFunTree(accounttypeId) this.$refs.productFrom.findMenuFunTree(accounttypeId)
}, },
...@@ -169,10 +197,16 @@ export default { ...@@ -169,10 +197,16 @@ export default {
this.$refs.ruleForm.validateField('merchantId') this.$refs.ruleForm.validateField('merchantId')
return return
} }
if (!roleName || this.$refs.productFrom.getSelectInfo().length == 0) { if (!roleName || this.$refs.productFrom.getSelectInfo().length == 0) {
this.$message.error('角色和权限至少选择一项') this.$message.error('角色和权限至少选择一项')
return return
} }
this.roleRootRules = false
if (this.accounttypeIds.length == 0) {
this.roleRootRules = true
return
}
let accountTypes = JSON.stringify(this.$refs.productFrom.getSelectInfo()) let accountTypes = JSON.stringify(this.$refs.productFrom.getSelectInfo())
let para = { let para = {
merchantId: merchantId, merchantId: merchantId,
...@@ -191,6 +225,12 @@ export default { ...@@ -191,6 +225,12 @@ export default {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
let accountTypes = JSON.stringify(this.$refs.productFrom.getSelectInfo()) let accountTypes = JSON.stringify(this.$refs.productFrom.getSelectInfo())
this.roleRootRules = false
if (this.$refs.productFrom.getSelectInfo().length == 0) {
this.roleRootRules = true
return
}
let para = { let para = {
merchantId: merchantId, merchantId: merchantId,
roleName: roleName, roleName: roleName,
...@@ -247,7 +287,7 @@ export default { ...@@ -247,7 +287,7 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -160,15 +160,15 @@ export default { ...@@ -160,15 +160,15 @@ export default {
}, },
// 去创建角色页面 // 去创建角色页面
toCreatePage() { toCreatePage() {
this.$router.push("/role/create/"+0); this.$router.push('/role/create/' + 0)
}, },
// 去查看角色页面 // 去查看角色页面
toLookPage(row) { toLookPage(row) {
this.$router.push("/role/look/"+row.id); this.$router.push('/role/look/' + row.id)
}, },
// 去修改角色页面 // 去修改角色页面
toEditPage(row) { toEditPage(row) {
this.$router.push("/role/create/"+row.id); this.$router.push('/role/create/' + row.id)
}, },
// 去删除草稿 // 去删除草稿
todelete(row) { todelete(row) {
...@@ -188,8 +188,7 @@ export default { ...@@ -188,8 +188,7 @@ export default {
} }
}) })
}) })
.catch(() => { .catch(() => {})
})
} }
}, },
...@@ -206,7 +205,7 @@ export default { ...@@ -206,7 +205,7 @@ export default {
mounted() { mounted() {
this.getTableData() this.getTableData()
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div v-for="(item, index) in productList" :key="index" class="line_element_two" :class="curProductIndex == index ? 'line_element_two_active' : ''" @click="selectProductItem(index)">{{ item.productName }}</div> <div v-for="(item, index) in productList" :key="index" class="line_element_two" :class="curProductIndex == index ? 'line_element_two_active' : ''" @click="selectProductItem(index)">{{ item.productName }}</div>
</div> </div>
<div class="tree_widget"> <div class="tree_widget">
<el-tree v-if="productList.length" :data="productList[curProductIndex].merchantProTreeResponses" :props="defaultProps"></el-tree> <el-tree v-if="productList.length" default-expand-all :data="productList[curProductIndex].merchantProTreeResponses" :props="defaultProps"></el-tree>
<div v-if="productList.length == 0" class="no_data_icon"> <div v-if="productList.length == 0" class="no_data_icon">
<div class="nodata_wrap"> <div class="nodata_wrap">
<img class="icon" src="../../assets/img/empty.png" /> <img class="icon" src="../../assets/img/empty.png" />
...@@ -43,7 +43,16 @@ ...@@ -43,7 +43,16 @@
</div> </div>
</div> </div>
<div style="height: 84px"></div> <div style="height: 84px"></div>
<div class="fixed_bottom"> <!-- <div class="fixed_bottom">
<el-button type="primary" @click="toBack">关闭</el-button>
</div> -->
<div
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="toBack">关闭</el-button> <el-button type="primary" @click="toBack">关闭</el-button>
</div> </div>
</div> </div>
...@@ -68,10 +77,14 @@ export default { ...@@ -68,10 +77,14 @@ export default {
} }
}, },
created() { created() {
let id = this.$route.params.id; let id = this.$route.params.id
this.getRoleData(id) this.getRoleData(id)
this.getMerchantTree(id) this.getMerchantTree(id)
}, },
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
},
methods: { methods: {
// 获取角色信息 // 获取角色信息
getRoleData(id) { getRoleData(id) {
...@@ -166,6 +179,7 @@ export default { ...@@ -166,6 +179,7 @@ export default {
.wrapper { .wrapper {
box-sizing: border-box; box-sizing: border-box;
padding: 0 20px; padding: 0 20px;
padding-bottom: 20px;
.menu_line_one { .menu_line_one {
width: 100%; width: 100%;
height: 36px; height: 36px;
...@@ -223,6 +237,8 @@ export default { ...@@ -223,6 +237,8 @@ export default {
// height: calc(100% - 40px); // height: calc(100% - 40px);
background: #ffffff; background: #ffffff;
border-radius: 0px 4px 4px 4px; border-radius: 0px 4px 4px 4px;
// height: 200px;
// overflow: auto;
} }
.tree_widget /deep/ .el-tree-node__expand-icon { .tree_widget /deep/ .el-tree-node__expand-icon {
// content: "\e6d9"; // content: "\e6d9";
...@@ -272,4 +288,16 @@ export default { ...@@ -272,4 +288,16 @@ export default {
margin: 0 40px; margin: 0 40px;
} }
} }
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!