Commit 5a177f0e by yangming

shanghu

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