Commit a1fe995d by 杨北旺

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

1 parent f2150c38
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"glsx-components": "^1.2.2", "glsx-components": "^1.2.5",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-amap": "^0.5.10", "vue-amap": "^0.5.10",
......
...@@ -2,51 +2,51 @@ import Vue from 'vue' ...@@ -2,51 +2,51 @@ import Vue from 'vue'
// import { message } from '@/plugins/element.js' // import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import { GLButton ,GLTable} from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
import render from './render' import render from './render'
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(GLTable) Vue.use(GLTable)
// import GLTable from '@/components/glsx-table/index' // import GLTable from '@/components/glsx-table/index'
// Vue.component('GLTable', GLTable) // Vue.component('GLTable', GLTable)
import 'glsx-components/dist/glsx-components.css' import 'glsx-components/dist/glsx-components.css'
import '@/assets/css/common.scss' import '@/assets/css/common.scss'
let routes = [] let routes = []
let router = null let router = null
let instance = null let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState }) { export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig() const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig()
console.log(request) console.log(request)
Vue.prototype.$history = history Vue.prototype.$history = history
Vue.prototype.$messenger = messenger Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState Vue.prototype.$globalState = globalState
console.log(globalState) console.log(globalState)
Vue.prototype.$common = common 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 = 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_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.$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.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)
const routesData = common.utils.deepClone(globalState.routers) routes = getRoutes(routesData)
routes = getRoutes(routesData) subscribe({ messenger })
subscribe({ messenger }) Vue.use(GLButton, { routes, routerBase })
} }
export async function mount(props) { export async function mount({ routerBase }) {
console.log('11111', props) const insts = render(routerBase, routes)
const insts = render(props.routerBase, routes) router = insts.router
router = insts.router instance = insts.vm
instance = insts.vm
} }
export async function unmount() { export async function unmount() {
instance.$destroy() instance.$destroy()
instance.$el.innerHTML = '' instance.$el.innerHTML = ''
instance = null instance = null
router = null router = null
} }
function subscribe({ messenger }) { function subscribe({ messenger }) {
messenger.subscribe(v => { messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v) console.log(`监听到子应用${v.from}发来消息:`, v)
}) })
} }
\ No newline at end of file \ No newline at end of file
...@@ -270,14 +270,21 @@ export default { ...@@ -270,14 +270,21 @@ export default {
}) })
let all = [...arrpara1, ...arrpara2, ...arrpara3] let all = [...arrpara1, ...arrpara2, ...arrpara3]
let para = Object.assign({}, ...all) let para = Object.assign({}, ...all)
this.$apis.baseInfo.toGL(para).then(res => {
if (res) { this.$confirm(' 请确认是否关联当前信息?', '提示', {
this.$message({ confirmButtonText: '确定',
message: '操作成功', cancelButtonText: '取消',
type: 'success' type: 'warning'
}) }).then(() => {
this.$router.push({ path: '/account/index' }) this.$apis.baseInfo.toGL(para).then(res => {
} if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$router.push({ path: '/account/index' })
}
})
}) })
}, },
deleteLine(row) { deleteLine(row) {
......
...@@ -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,21 +178,21 @@ export default { ...@@ -170,21 +178,21 @@ 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
} }
}) })
return item return item
}) })
} }
// this.rootList = this.accountListSelect // this.rootList = this.accountListSelect
}, },
...@@ -261,19 +269,19 @@ export default { ...@@ -261,19 +269,19 @@ export default {
this.$message.error('请选择产品') this.$message.error('请选择产品')
return return
} }
let para = { let para = {
merchantId: merchantId, merchantId: merchantId,
roleName: roleName, roleName: roleName,
roleDescription: roleDesc, roleDescription: roleDesc,
delFlag, delFlag,
requestList: accountTypes requestList: accountTypes
} }
if (this.pageType == 'edit') { if (this.pageType == 'edit') {
para.id = this.editId para.id = this.editId
this.updateRole(para) this.updateRole(para)
} else { } else {
this.insertRole(para) this.insertRole(para)
} }
// } // }
} }
}) })
...@@ -290,20 +298,42 @@ export default { ...@@ -290,20 +298,42 @@ export default {
} }
}, },
insertRole(para) { insertRole(para) {
this.$apis.role.createRole(para).then(res => { this.$confirm('是否确定当前信息?', '提示', {
if (res) { confirmButtonText: '确定',
this.toBack() cancelButtonText: '取消',
} type: 'warning'
}).then(() => {
this.$apis.role.createRole(para).then(res => {
if (res) {
this.$router.push('/role/index')
}
})
}) })
}, },
updateRole(para) { updateRole(para) {
this.$apis.role.updateRole(para).then(res => { this.$confirm('是否更改当前信息?', '提示', {
if (res) { confirmButtonText: '确定',
this.toBack() cancelButtonText: '取消',
} type: 'warning'
}).then(() => {
this.$apis.role.updateRole(para).then(res => {
if (res) {
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">
<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>
<div class="table_widget"> <div class="table_widget">
<div class="search_widget"> <div class="search_widget">
...@@ -30,8 +31,10 @@ ...@@ -30,8 +31,10 @@
</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> -->
<el-button v-if="scope.scope.roleName!='超级管理员'" type="text" @click="toEditPage(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> <el-button v-if="scope.scope.delFlag" type="text" @click="todelete(scope.scope)">删除</el-button>
</template> </template>
</GLTable> </GLTable>
...@@ -217,7 +220,6 @@ export default { ...@@ -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!