Commit 5a177f0e by yangming

shanghu

2 parents b8aa36f0 62ef8a69
......@@ -18,10 +18,10 @@
<el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-input size="small" maxlength="20" style="width: 40%;padding-right:50px" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
<el-input size="small" maxlength="20" style="width: 40%; padding-right: 50px" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色说明" prop="roleDesc">
<el-input size="small" maxlength="50" style="width: 40%;padding-right:50px" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
<el-input size="small" maxlength="50" style="width: 40%; padding-right: 50px" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
</el-form-item>
<!-- <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element">
......@@ -101,7 +101,7 @@ export default {
},
rootList: [],
curRootIndex: 0,
pageName: '新增角色',
pageName: '创建角色',
roleInfo: null,
pageType: 'create',
accountListSelect: [],
......@@ -109,10 +109,18 @@ export default {
merchantList: [],
// tree数据
treeDataList: [],
accountLevel: 1
accountLevel: 1,
isHaveEdit: false
}
},
watch: {
ruleForm: {
handler() {
this.isHaveEdit = true
},
deep: true
}
},
methods: {
// 获取角色信息
getRoleData(id) {
......@@ -124,7 +132,7 @@ export default {
roleDesc: res.roleDescription,
merchantId: res.merchantId
}
this.selectMerchant(res.merchantId,res.responseList)
this.selectMerchant(res.merchantId, res.responseList)
// this.getMerchantTree(id, res.responseList)
this.$refs.productFrom.accountTypeSearchRequest({ id: res.merchantId }, res.responseList)
this.rootList = res.responseList || []
......@@ -170,21 +178,21 @@ export default {
// }
// },
// 选择商户----获取权限
async selectMerchant(id,list) {
async selectMerchant(id, list) {
let res = await this.$refs.productFrom.findMenuFunTreeByMerId({ id })
this.accountListSelect = res.map(item => {
item.select = false
return item
})
if(this.pageType=='edit'){
this.accountListSelect = this.accountListSelect.map(item=>{
list.forEach(key=>{
if( item.accounttypeId==key.accounttypeId){
item.select = true
}
})
return item
})
if (this.pageType == 'edit') {
this.accountListSelect = this.accountListSelect.map(item => {
list.forEach(key => {
if (item.accounttypeId == key.accounttypeId) {
item.select = true
}
})
return item
})
}
// this.rootList = this.accountListSelect
},
......@@ -261,19 +269,19 @@ export default {
this.$message.error('请选择产品')
return
}
let para = {
merchantId: merchantId,
roleName: roleName,
roleDescription: roleDesc,
delFlag,
requestList: accountTypes
}
if (this.pageType == 'edit') {
para.id = this.editId
this.updateRole(para)
} else {
this.insertRole(para)
}
let para = {
merchantId: merchantId,
roleName: roleName,
roleDescription: roleDesc,
delFlag,
requestList: accountTypes
}
if (this.pageType == 'edit') {
para.id = this.editId
this.updateRole(para)
} else {
this.insertRole(para)
}
// }
}
})
......@@ -290,20 +298,42 @@ export default {
}
},
insertRole(para) {
this.$apis.role.createRole(para).then(res => {
if (res) {
this.toBack()
}
this.$confirm('是否保存当前信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$apis.role.createRole(para).then(res => {
if (res) {
this.$router.push('/role/index')
}
})
})
},
updateRole(para) {
this.$apis.role.updateRole(para).then(res => {
if (res) {
this.toBack()
}
this.$confirm('是否保存当前信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$apis.role.updateRole(para).then(res => {
if (res) {
this.$router.push('/role/index')
}
})
})
},
toBack() {
if (this.isHaveEdit&&this.pageType=='create') {
this.$confirm('离开当前页面内容将不会保存,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push('/role/index')
})
return
}
this.$router.push('/role/index')
}
},
......@@ -316,7 +346,7 @@ export default {
}
let id = Number(this.$route.params.id)
if (!id) {
this.pageName = '新增角色'
this.pageName = '创建角色'
this.pageType = 'create'
this.getMerchantName()
} else {
......@@ -375,9 +405,9 @@ export default {
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
.custtom{
.custtom {
background: #ffffff;
color: #5850FF;
color: #5850ff;
}
.wrap_driver {
margin: 0 20px;
......
<template>
<div class="role-home-page">
<div class="top_widget">
<GLButton size="small" fn="创建角色" icon="el-icon-plus" type="primary" display="disabled" @click="toCreatePage">创建角色</GLButton>
<!-- <el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage">创建角色</el-button> -->
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage">创建角色</el-button>
</div>
<div class="table_widget">
<div class="search_widget">
......@@ -31,10 +30,8 @@
</div>
<GLTable v-if="distoryTable" ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="getTableData">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- <el-button type="text" @click="toLookPage(scope.scope)">查看</el-button> -->
<GLButton type="text" @click="toLookPage(scope.scope)" fn="查看">查看</GLButton>
<GLButton v-if="scope.scope.roleName != '超级管理员'" fn="修改" type="text" display="disabled" @click="toEditPage(scope.scope)">修改</GLButton>
<!-- <el-button v-if="scope.scope.roleName!='超级管理员'" type="text" @click="toEditPage(scope.scope)">修改</el-button> -->
<el-button type="text" @click="toLookPage(scope.scope)">查看</el-button>
<el-button v-if="scope.scope.roleName!='超级管理员'" type="text" @click="toEditPage(scope.scope)">修改</el-button>
<el-button v-if="scope.scope.delFlag" type="text" @click="todelete(scope.scope)">删除</el-button>
</template>
</GLTable>
......@@ -121,8 +118,7 @@ export default {
let { delFlag, roleName, merchantId } = this.searchForm
let para = {}
console.log(merchantId)
if (!this.distoryTable) {
//代表重置
if (!this.distoryTable) {//代表重置
para = {
pageNum: 1,
pageSize: 10
......@@ -221,7 +217,6 @@ export default {
}
})
})
.catch(() => {})
}
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!