Commit b0ee8f5e by 杨北旺

修改角色修改页面

1 parent 4d5cc538
...@@ -52,10 +52,20 @@ const merchantRootById = params => { ...@@ -52,10 +52,20 @@ const merchantRootById = params => {
sign: true 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 { export default {
roleDataList, roleDataList,
merchantDataList, merchantDataList,
roleInfoData, roleInfoData,
roleTreeDataById, roleTreeDataById,
merchantRootById merchantRootById,
createRole
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,18 +5,14 @@ ...@@ -5,18 +5,14 @@
</div> </div>
<div class="main_widget"> <div class="main_widget">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="所属商户" prop="merchantId"> <el-form-item v-if="pageType == 'create'" label="所属商户" prop="merchantId">
<el-select size="small" :disabled="pageType == 'edit' ? true : false" style="width: 40%" <el-select size="small" style="width: 40%" v-model="ruleForm.merchantId" :filter-method="filterList" clearable filterable placeholder="请选择" @change="selectMerchant">
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-option v-for="item in list" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </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-form-item label="角色名称" prop="roleName">
<el-input style="width: 40%" v-model="ruleForm.roleName"></el-input> <el-input style="width: 40%" v-model="ruleForm.roleName"></el-input>
</el-form-item> </el-form-item>
...@@ -27,7 +23,7 @@ ...@@ -27,7 +23,7 @@
<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">
<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> </div>
</template> </template>
</div> </div>
...@@ -44,7 +40,7 @@ ...@@ -44,7 +40,7 @@
<div class="label_title">选择产品</div> <div class="label_title">选择产品</div>
<div class="product_con"> <div class="product_con">
<el-checkbox v-for="(item, index) in productList" :key="index" :false-label="item.productId" :true-label="item" @change="selectProductItem"> <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> </el-checkbox>
</div> </div>
</div> </div>
...@@ -70,7 +66,7 @@ ...@@ -70,7 +66,7 @@
<div class="fixed_bottom"> <div class="fixed_bottom">
<el-button v-if="pageType == 'create'" type="primary">草稿</el-button> <el-button v-if="pageType == 'create'" type="primary">草稿</el-button>
<div class="wrap_driver"> <div class="wrap_driver">
<el-button type="primary">确定</el-button> <el-button type="primary" @click="toCreateRole">确定</el-button>
</div> </div>
<el-button type="primary" @click="toBack">取消</el-button> <el-button type="primary" @click="toBack">取消</el-button>
</div> </div>
...@@ -108,7 +104,7 @@ export default { ...@@ -108,7 +104,7 @@ export default {
//商户 //商户
list: [], list: [],
// tree数据 // tree数据
treeDataList:[] treeDataList: []
} }
}, },
created() { created() {
...@@ -167,9 +163,9 @@ export default { ...@@ -167,9 +163,9 @@ export default {
} }
}, },
// 选择商户----获取权限 // 选择商户----获取权限
selectMerchant(id){ selectMerchant(id) {
this.$apis.role.merchantRootById({ id}).then(res => { this.$apis.role.merchantRootById({ id }).then(res => {
this.accountList = res.map(item=>{ this.accountList = res.map(item => {
item.select = false item.select = false
return item return item
}) })
...@@ -178,30 +174,29 @@ export default { ...@@ -178,30 +174,29 @@ export default {
this.productList = [] this.productList = []
}, },
// 选择商户权限 // 选择商户权限
selectCurAccount(item,index){ selectCurAccount(item, index) {
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) {
this.rootList.push(item) this.rootList.push(item)
}else{ } else {
let arr = this.rootList.filter(el=>{ let arr = this.rootList.filter(el => {
return item.accounttypeId!=el.accounttypeId return item.accounttypeId != el.accounttypeId
}) })
this.rootList = arr this.rootList = arr
} }
this.productList = this.rootList[0].products || [] this.productList = this.rootList[0].products || []
}, },
// 选择产品的值 // 选择产品的值
selectProductItem(val){ selectProductItem(val) {
console.log(val); console.log(val)
this.curMenuIndex = 0 this.curMenuIndex = 0
if(typeof(val)==='number'){ if (typeof val === 'number') {
let arr = this.storeList.filter(el=>{ let arr = this.storeList.filter(el => {
return val!=el.productId return val != el.productId
}) })
this.storeList = arr this.storeList = arr
}else{ } else {
this.storeList.push(val) this.storeList.push(val)
} }
}, },
...@@ -216,6 +211,26 @@ export default { ...@@ -216,6 +211,26 @@ export default {
this.curMenuIndex = index this.curMenuIndex = index
this.treeDataList = this.storeList[index].merchantProTreeResponses 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() { toBack() {
history.go(-1) history.go(-1)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!