Commit b0ee8f5e by 杨北旺

修改角色修改页面

1 parent 4d5cc538
......@@ -52,10 +52,20 @@ const merchantRootById = params => {
sign: true
})
}
const createRole = params => {
params.method = 'org.ore.api.role.insert'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
roleDataList,
merchantDataList,
roleInfoData,
roleTreeDataById,
merchantRootById
merchantRootById,
createRole
}
\ No newline at end of file
......@@ -5,18 +5,14 @@
</div>
<div class="main_widget">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="所属商户" prop="merchantId">
<el-select size="small" :disabled="pageType == 'edit' ? true : false" style="width: 40%"
v-model="ruleForm.merchantId"
:filter-method="filterList"
clearable
filterable
placeholder="请选择"
@change="selectMerchant"
>
<el-form-item v-if="pageType == 'create'" label="所属商户" prop="merchantId">
<el-select size="small" style="width: 40%" v-model="ruleForm.merchantId" :filter-method="filterList" clearable filterable placeholder="请选择" @change="selectMerchant">
<el-option v-for="item in list" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'">
<el-input disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-input style="width: 40%" v-model="ruleForm.roleName"></el-input>
</el-form-item>
......@@ -27,7 +23,7 @@
<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>
<AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton>
</div>
</template>
</div>
......@@ -44,7 +40,7 @@
<div class="label_title">选择产品</div>
<div class="product_con">
<el-checkbox v-for="(item, index) in productList" :key="index" :false-label="item.productId" :true-label="item" @change="selectProductItem">
<div class="check_text">{{item.productName}}</div>
<div class="check_text">{{ item.productName }}</div>
</el-checkbox>
</div>
</div>
......@@ -56,13 +52,13 @@
<div v-for="(item, index) in storeList" :key="index" class="menu_line_item" :class="curMenuIndex == index ? 'menu_line_item_active' : ''" @click="selectMenuItem(index)">{{ item.productName }}</div>
</div>
<div class="content_menu_con">
<el-tree v-if="treeDataList.length" :data="treeDataList" :props="defaultProps"></el-tree>
<div v-if="treeDataList.length == 0" class="no_data_icon">
<div class="nodata_wrap">
<img class="icon" src="../../../assets/img/empty.png" />
<span class="text">暂无数据</span>
</div>
<el-tree v-if="treeDataList.length" :data="treeDataList" :props="defaultProps"></el-tree>
<div v-if="treeDataList.length == 0" class="no_data_icon">
<div class="nodata_wrap">
<img class="icon" src="../../../assets/img/empty.png" />
<span class="text">暂无数据</span>
</div>
</div>
</div>
</div>
</div>
......@@ -70,7 +66,7 @@
<div class="fixed_bottom">
<el-button v-if="pageType == 'create'" type="primary">草稿</el-button>
<div class="wrap_driver">
<el-button type="primary">确定</el-button>
<el-button type="primary" @click="toCreateRole">确定</el-button>
</div>
<el-button type="primary" @click="toBack">取消</el-button>
</div>
......@@ -108,7 +104,7 @@ export default {
//商户
list: [],
// tree数据
treeDataList:[]
treeDataList: []
}
},
created() {
......@@ -167,9 +163,9 @@ export default {
}
},
// 选择商户----获取权限
selectMerchant(id){
this.$apis.role.merchantRootById({ id}).then(res => {
this.accountList = res.map(item=>{
selectMerchant(id) {
this.$apis.role.merchantRootById({ id }).then(res => {
this.accountList = res.map(item => {
item.select = false
return item
})
......@@ -178,30 +174,29 @@ export default {
this.productList = []
},
// 选择商户权限
selectCurAccount(item,index){
selectCurAccount(item, index) {
this.accountList[index].select = !item.select
this.curRootIndex = 0
if(this.accountList[index].select){
if (this.accountList[index].select) {
this.rootList.push(item)
}else{
let arr = this.rootList.filter(el=>{
return item.accounttypeId!=el.accounttypeId
})
this.rootList = arr
} else {
let arr = this.rootList.filter(el => {
return item.accounttypeId != el.accounttypeId
})
this.rootList = arr
}
this.productList = this.rootList[0].products || []
this.productList = this.rootList[0].products || []
},
// 选择产品的值
selectProductItem(val){
console.log(val);
selectProductItem(val) {
console.log(val)
this.curMenuIndex = 0
if(typeof(val)==='number'){
let arr = this.storeList.filter(el=>{
return val!=el.productId
})
this.storeList = arr
}else{
if (typeof val === 'number') {
let arr = this.storeList.filter(el => {
return val != el.productId
})
this.storeList = arr
} else {
this.storeList.push(val)
}
},
......@@ -216,6 +211,26 @@ export default {
this.curMenuIndex = index
this.treeDataList = this.storeList[index].merchantProTreeResponses
},
// 创建角色
toCreateRole() {
let { merchantId, roleDesc, roleName } = this.ruleForm
let para = {
merchantId: merchantId,
roleName: roleName,
roleDescription: roleDesc,
accounttypeId: 0,
'check[29]': 44,
delFlag: 0,
requestList: []
}
console.log(this.ruleForm)
console.log(para)
// this.$apis.role.roleInfoData(para).then(res => {
// if (res) {
// history.go(-1)
// }
// })
},
toBack() {
history.go(-1)
}
......@@ -349,27 +364,27 @@ export default {
border-radius: 0px 4px 4px 4px;
}
.no_data_icon {
height: 150px;
display: flex;
align-items: center;
justify-content: center;
.nodata_wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
width: 64px;
height: 41px;
}
.text {
font-size: 14px;
font-weight: 400;
color: #262626;
margin-top: 10px;
}
}
height: 150px;
display: flex;
align-items: center;
justify-content: center;
.nodata_wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
width: 64px;
height: 41px;
}
.text {
font-size: 14px;
font-weight: 400;
color: #262626;
margin-top: 10px;
}
}
}
}
.fixed_bottom {
position: fixed;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!