Commit a1fe995d by 杨北旺

角色管理创建/修改/企微关联绑定添加二次确认框/更换权限按钮

1 parent f2150c38
......@@ -13,7 +13,7 @@
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^1.4.6",
"glsx-components": "^1.2.2",
"glsx-components": "^1.2.5",
"lodash": "^4.17.21",
"vue": "^2.6.10",
"vue-amap": "^0.5.10",
......
......@@ -2,51 +2,51 @@ import Vue from 'vue'
// import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import ElementUI from 'element-ui'
import { GLButton ,GLTable} from 'glsx-components' //权限按钮 (根据权限动态创建)
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import render from './render'
Vue.use(ElementUI)
Vue.use(GLTable)
// import GLTable from '@/components/glsx-table/index'
// Vue.component('GLTable', GLTable)
// import GLTable from '@/components/glsx-table/index'
// Vue.component('GLTable', GLTable)
import 'glsx-components/dist/glsx-components.css'
import '@/assets/css/common.scss'
let routes = []
let router = null
let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState }) {
const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig()
console.log(request)
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
console.log(globalState)
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
subscribe({ messenger })
export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig()
console.log(request)
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
console.log(globalState)
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
}
export async function mount(props) {
console.log('11111', props)
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
export async function mount({ routerBase }) {
const insts = render(routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
\ No newline at end of file
......@@ -270,14 +270,21 @@ export default {
})
let all = [...arrpara1, ...arrpara2, ...arrpara3]
let para = Object.assign({}, ...all)
this.$apis.baseInfo.toGL(para).then(res => {
if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$router.push({ path: '/account/index' })
}
this.$confirm(' 请确认是否关联当前信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$apis.baseInfo.toGL(para).then(res => {
if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$router.push({ path: '/account/index' })
}
})
})
},
deleteLine(row) {
......
......@@ -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">
<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> -->
<GLButton type="primary" size="small" @click="toCreatePage" fn="创建角色" icon="el-icon-plus">创建角色</GLButton>
</div>
<div class="table_widget">
<div class="search_widget">
......@@ -30,8 +31,10 @@
</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>
<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> -->
<GLButton type="text" fn="查看" display="disabled" @click="toLookPage(scope.scope)">查看</GLButton>
<GLButton v-if="scope.scope.roleName!='超级管理员'" display="disabled" type="text" fn="修改" @click="toEditPage(scope.scope)">修改</GLButton>
<el-button v-if="scope.scope.delFlag" type="text" @click="todelete(scope.scope)">删除</el-button>
</template>
</GLTable>
......@@ -217,7 +220,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!