dev
张同海 2 years ago
parent 9f77a56008
commit 466ca30082

@ -1,26 +1,26 @@
import { axios } from '@/utils/request'
/**
* 获取箱型信息
* 获取付费方式
*
* @author Myshipping
*/
export function CommondbList(parameter) {
return axios({
url: '/commondb/ctn',
url: '/commondb/frt',
method: 'get',
params: parameter
})
}
/**
* 新增箱型
* 新增付费方式
*
* @author Myshipping
*/
export function CommondbAdd(parameter) {
return axios({
url: '/commondb/addctn',
url: '/commondb/addfrt',
method: 'post',
data: parameter
})

@ -7,7 +7,7 @@ import { axios } from '@/utils/request'
* @param parameter
* @returns {*}
*/
export function getMenuList (parameter) {
export function getMenuList(parameter) {
return axios({
url: '/sysMenu/list',
method: 'get',
@ -21,7 +21,7 @@ export function getMenuList (parameter) {
* @author yubaoshan
* @date 2020/4/23 12:22
*/
export function getMenuTree (parameter) {
export function getMenuTree(parameter) {
return axios({
url: '/sysMenu/tree',
method: 'get',
@ -35,7 +35,7 @@ export function getMenuTree (parameter) {
* @author yubaoshan
* @date 2020/4/24 23:23
*/
export function sysMenuAdd (parameter) {
export function sysMenuAdd(parameter) {
return axios({
url: '/sysMenu/add',
method: 'post',
@ -49,7 +49,7 @@ export function sysMenuAdd (parameter) {
* @author yubaoshan
* @date 2020/4/24 23:23
*/
export function sysMenuDelete (parameter) {
export function sysMenuDelete(parameter) {
return axios({
url: '/sysMenu/delete',
method: 'post',
@ -63,7 +63,7 @@ export function sysMenuDelete (parameter) {
* @author yubaoshan
* @date 2020/4/25 01:11
*/
export function sysMenuDetail (parameter) {
export function sysMenuDetail(parameter) {
return axios({
url: '/sysMenu/detail',
method: 'post',
@ -77,7 +77,7 @@ export function sysMenuDetail (parameter) {
* @author yubaoshan
* @date 2020/4/25 01:11
*/
export function sysMenuEdit (parameter) {
export function sysMenuEdit(parameter) {
return axios({
url: '/sysMenu/edit',
method: 'post',
@ -91,7 +91,7 @@ export function sysMenuEdit (parameter) {
* @author yubaoshan
* @date 2020/6/2 17:30
*/
export function SysMenuTreeForGrant (parameter) {
export function SysMenuTreeForGrant(parameter) {
return axios({
url: '/sysMenu/treeForGrant',
method: 'get',
@ -105,7 +105,7 @@ export function SysMenuTreeForGrant (parameter) {
* @author yubaoshan
* @date 2020/6/28 15:25
*/
export function sysMenuChange (parameter) {
export function sysMenuChange(parameter) {
return axios({
url: '/sysMenu/change',
method: 'post',

@ -6,7 +6,7 @@ import { axios } from '@/utils/request'
* @author yubaoshan
* @date 2020/4/26 12:08
*/
export function getOrgTree (parameter) {
export function getOrgTree(parameter) {
return axios({
url: '/sysOrg/tree',
method: 'get',
@ -20,7 +20,7 @@ export function getOrgTree (parameter) {
* @author yubaoshan
* @date 2020/5/11 12:59
*/
export function getOrgList (parameter) {
export function getOrgList(parameter) {
return axios({
url: '/sysOrg/list',
method: 'get',
@ -34,7 +34,7 @@ export function getOrgList (parameter) {
* @author yubaoshan
* @date 2020/5/11 16:17
*/
export function getOrgPage (parameter) {
export function getOrgPage(parameter) {
return axios({
url: '/sysOrg/page',
method: 'get',
@ -48,7 +48,7 @@ export function getOrgPage (parameter) {
* @author yubaoshan
* @date 2020/5/11 13:56
*/
export function sysOrgAdd (parameter) {
export function sysOrgAdd(parameter) {
return axios({
url: '/sysOrg/add',
method: 'post',
@ -62,7 +62,7 @@ export function sysOrgAdd (parameter) {
* @author yubaoshan
* @date 2020/5/11 13:56
*/
export function sysOrgEdit (parameter) {
export function sysOrgEdit(parameter) {
return axios({
url: '/sysOrg/edit',
method: 'post',
@ -76,10 +76,20 @@ export function sysOrgEdit (parameter) {
* @author yubaoshan
* @date 2020/5/11 12:59
*/
export function sysOrgDelete (parameter) {
export function sysOrgDelete(parameter) {
return axios({
url: '/sysOrg/delete',
method: 'post',
data: parameter
})
}
/**
* 获取系统菜单列表树表
*/
export function getMenuList(parameter) {
return axios({
url: '/sysMenu/list',
method: 'get',
params: parameter
})
}

@ -1,6 +1,4 @@
import {
axios
} from '@/utils/request'
import { axios } from '@/utils/request'
/**
* 获取用户列表
@ -240,3 +238,54 @@ export function sysUserImport(parameter) {
data: parameter
})
}
/**
* 获取权限
*/
export function SysDataUserMenuGetGrantData(parameter) {
return axios({
url: '/SysDataUserMenu/GetGrantData',
method: 'get',
params: parameter
})
}
/**
* 获取用户自定义权限
*/
export function SysDataUserMenuGetGrantRightData(parameter) {
return axios({
url: '/SysDataUserMenu/GetGrantRightData',
method: 'get',
params: parameter
})
}
/**
* 获取组织机构树
*/
export function sysOrgTree(parameter) {
return axios({
url: '/sysOrg/tree',
method: 'get',
params: parameter
})
}
/**
* 授权用户数据
*/
export function SysDataUserMenuGrantData(parameter) {
return axios({
url: '/SysDataUserMenu/GrantData',
method: 'post',
data: parameter
})
}
/**
* 授权用户自定义数据
*/
export function SysDataUserMenuGrantRightData(parameter) {
return axios({
url: '/SysDataUserMenu/GrantRightData',
method: 'post',
data: parameter
})
}

@ -63,7 +63,7 @@
</div>
</template>
<script>
import { CommondbList } from '@/api/modular/main/CommondbServiceList'
import { CommondbList } from '@/api/modular/main/CommondbFrt'
import addForm from './addForm.vue'
import editForm from './editForm.vue'
export default {

@ -44,22 +44,22 @@ export default {
return {
labelCol: {
style: {
'padding-right': '20px',
'padding-right': '20px'
},
xs: {
span: 24,
span: 24
},
sm: {
span: 5,
},
span: 5
}
},
wrapperCol: {
xs: {
span: 24,
span: 24
},
sm: {
span: 15,
},
span: 15
}
},
menuTreeData: [],
expandedKeys: [],
@ -73,14 +73,14 @@ export default {
subValues: [],
tenantEntity: [],
replaceFields: {
key: 'id',
key: 'id'
},
form: this.$form.createForm(this),
commitKeys: [],
leastChild: [],
appList: [],
menuList: [],
selectValue: null,
selectValue: null
}
},
@ -91,15 +91,15 @@ export default {
this.tenantEntity = record
this.visible = true
//
SysMenuTreeForGrant().then((res) => {
SysMenuTreeForGrant().then(res => {
if (res.success) {
this.appList = res.data.appList
this.menuList = res.data.menuTree
this.selectValue = this.appList[0].appCode
//
sysRoleOwnMenu({
id: record.id,
}).then((res) => {
id: record.id
}).then(res => {
if (res.success) {
this.commitKeys = res.data
if (this.selectValue) {
@ -114,19 +114,19 @@ export default {
appChange(value) {
this.formLoading = true
this.selectValue = value
let menuList = this.menuList.filter((f) => f.appCode == value)
let menuList = this.menuList.filter(f => f.appCode == value)
this.menuTreeData = menuList
this.getLeastChild(menuList)
//
this.expandedKeys = []
menuList.forEach((item) => {
menuList.forEach(item => {
this.expandedKeys.push(item.id)
})
let menuInfo = this.commitKeys.find((f) => f.appCode == value)
let menuInfo = this.commitKeys.find(f => f.appCode == value)
if (!menuInfo) {
menuInfo = {
appCode: value,
menuIdList: [],
menuIdList: []
}
this.commitKeys.push(menuInfo)
}
@ -134,7 +134,7 @@ export default {
this.formLoading = false
},
getLeastChild(data) {
data.forEach((item) => {
data.forEach(item => {
this.pushLeastChild(item)
})
},
@ -146,7 +146,7 @@ export default {
this.leastChild.push(e.id)
},
pickCheckedKeys(data) {
data.forEach((item) => {
data.forEach(item => {
if (this.leastChild.includes(item)) {
this.checkedKeys.push(item)
}
@ -158,27 +158,27 @@ export default {
},
onCheck(checkedKeys, event) {
this.checkedKeys = checkedKeys
let index = this.commitKeys.findIndex((f) => f.appCode == this.selectValue)
let index = this.commitKeys.findIndex(f => f.appCode == this.selectValue)
this.commitKeys[index].menuIdList = checkedKeys.concat(event.halfCheckedKeys)
},
handleSubmit() {
const {
form: { validateFields },
form: { validateFields }
} = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
let menuIdList = []
this.commitKeys.forEach((item) => {
item.menuIdList.forEach((menuId) => {
this.commitKeys.forEach(item => {
item.menuIdList.forEach(menuId => {
menuIdList.push(menuId)
})
})
sysRoleGrantMenu({
id: this.tenantEntity.id,
grantMenuIdList: menuIdList,
grantMenuIdList: menuIdList
})
.then((res) => {
.then(res => {
if (res.success) {
this.$message.success('授权成功')
this.confirmLoading = false
@ -188,7 +188,7 @@ export default {
this.$message.error('授权失败:' + res.message)
}
})
.finally((res) => {
.finally(res => {
this.confirmLoading = false
})
} else {
@ -202,8 +202,8 @@ export default {
//
this.expandedKeys = []
this.visible = false
},
},
}
}
}
</script>
<style scoped>
@ -212,4 +212,3 @@ export default {
overflow-y: auto;
}
</style>

@ -9,22 +9,23 @@
>
<a-spin :spinning="formLoading">
<a-form :form="form">
<a-form-item
label="授权范围"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-select style="width: 100%" placeholder="请选择授权范围" v-decorator="['dataScopeType', {rules: [{ required: true, message: '' }]}]" >
<a-select-option v-for="(item,index) in dataScopeTypeData" :key="index" :value="item.code" @click="handleChange(item.code)">{{ item.value }}</a-select-option>
<a-form-item label="授权范围" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-select
style="width: 100%"
placeholder="请选择授权范围"
v-decorator="['dataScopeType', { rules: [{ required: true, message: '请选择授权范围!' }] }]"
>
<a-select-option
v-for="(item, index) in dataScopeTypeData"
:key="index"
:value="item.code"
@click="handleChange(item.code)"
>{{ item.value }}</a-select-option
>
</a-select>
</a-form-item>
<div v-show="orgTreeShow">
<a-form-item
label="选择机构"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-form-item label="选择机构" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree
v-model="checkedKeys"
checkable
@ -45,126 +46,134 @@
</template>
<script>
import { getOrgTree } from '@/api/modular/system/orgManage'
import { sysRoleOwnData, sysRoleGrantData } from '@/api/modular/system/roleManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
import { getOrgTree } from '@/api/modular/system/orgManage'
import { sysRoleOwnData, sysRoleGrantData } from '@/api/modular/system/roleManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
export default {
data () {
return {
labelCol: {
style: { 'padding-right': '20px' },
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
orgTreeData: [],
expandedKeys: [],
checkedKeys: [],
visible: false,
confirmLoading: false,
formLoading: true,
autoExpandParent: true,
selectedKeys: [],
subValues: [],
roleEntity: [],
dataScopeTypeData: [],
orgTreeShow: false,
replaceFields: {
key: 'id'
},
form: this.$form.createForm(this)
}
export default {
data() {
return {
labelCol: {
style: { 'padding-right': '20px' },
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
orgTreeData: [],
expandedKeys: [],
checkedKeys: [],
visible: false,
confirmLoading: false,
formLoading: true,
autoExpandParent: true,
selectedKeys: [],
subValues: [],
roleEntity: [],
dataScopeTypeData: [],
orgTreeShow: false,
replaceFields: {
key: 'id'
},
form: this.$form.createForm(this)
}
},
methods: {
//
roleOrg(record) {
console.log(record)
this.roleEntity = record
this.visible = true
this.formLoading = true
this.sysDictTypeDropDown()
this.form.getFieldDecorator('dataScopeType', { initialValue: record.dataScopeType.toString() })
this.handleChange(record.dataScopeType)
},
methods: {
//
roleOrg (record) {
this.roleEntity = record
this.visible = true
this.formLoading = true
this.sysDictTypeDropDown()
this.form.getFieldDecorator('dataScopeType', { initialValue: record.dataScopeType.toString() })
this.handleChange(record.dataScopeType)
},
/**
* 获取字典数据
*/
sysDictTypeDropDown() {
//
sysDictTypeDropDown({ code: 'data_scope_type' }).then(res => {
this.dataScopeTypeData = res.data
this.formLoading = false
})
},
/**
* 获取字典数据
*/
sysDictTypeDropDown () {
//
sysDictTypeDropDown({ code: 'data_scope_type' }).then((res) => {
this.dataScopeTypeData = res.data
this.formLoading = false
})
},
//
handleChange(value) {
// eslint-disable-next-line eqeqeq
if (value == '5') {
this.formLoading = true
this.orgTreeShow = true
//
this.getOrgTree()
//
this.sysRoleOwnData(this.roleEntity)
} else {
this.orgTreeShow = false
//
this.checkedKeys = []
}
},
//
handleChange (value) {
// eslint-disable-next-line eqeqeq
if (value == '5') {
this.formLoading = true
this.orgTreeShow = true
//
this.getOrgTree()
//
this.sysRoleOwnData(this.roleEntity)
} else {
this.orgTreeShow = false
//
this.checkedKeys = []
/**
* 获取机构树
*/
getOrgTree() {
getOrgTree().then(res => {
if (res.success) {
this.orgTreeData = res.data
//
this.orgTreeData.forEach(item => {
this.expandedKeys.push(item.id)
})
}
},
/**
* 获取机构树
*/
getOrgTree () {
getOrgTree().then((res) => {
if (res.success) {
this.orgTreeData = res.data
//
this.orgTreeData.forEach(item => {
this.expandedKeys.push(item.id)
})
}
})
},
})
},
/**
* 此角色已有数据列表
*/
sysRoleOwnData (record) {
sysRoleOwnData({ id: record.id }).then((res) => {
if (res.success) {
this.checkedKeys = res.data
}
this.formLoading = false
})
},
/**
* 此角色已有数据列表
*/
sysRoleOwnData(record) {
sysRoleOwnData({ id: record.id }).then(res => {
if (res.success) {
this.checkedKeys = res.data
}
this.formLoading = false
})
},
onExpand (expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onCheck (checkedKeys) {
console.log(JSON.stringify(checkedKeys))
this.checkedKeys = checkedKeys
},
onSelect (selectedKeys, info) {
this.selectedKeys = selectedKeys
},
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onCheck(checkedKeys) {
console.log(JSON.stringify(checkedKeys))
this.checkedKeys = checkedKeys
},
onSelect(selectedKeys, info) {
this.selectedKeys = selectedKeys
},
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
const checkedKeys = this.checkedKeys.checked === undefined ? this.checkedKeys : this.checkedKeys.checked
sysRoleGrantData({ id: this.roleEntity.id, grantOrgIdList: checkedKeys, dataScopeType: parseInt(values.dataScopeType) }).then((res) => {
handleSubmit() {
const {
form: { validateFields }
} = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
const checkedKeys = this.checkedKeys.checked === undefined ? this.checkedKeys : this.checkedKeys.checked
sysRoleGrantData({
id: this.roleEntity.id,
grantOrgIdList: checkedKeys,
dataScopeType: parseInt(values.dataScopeType)
})
.then(res => {
this.confirmLoading = false
if (res.success) {
this.$message.success('授权成功')
@ -173,24 +182,25 @@
} else {
this.$message.error('授权失败:' + res.message)
}
}).finally((res) => {
})
.finally(res => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
})
},
handleCancel () {
this.form.resetFields()
//
this.checkedKeys = []
//
this.expandedKeys = []
this.visible = false
//
this.orgTreeShow = false
}
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.form.resetFields()
//
this.checkedKeys = []
//
this.expandedKeys = []
this.visible = false
//
this.orgTreeShow = false
}
}
}
</script>

@ -3,8 +3,14 @@
<a-col :md="5" :sm="24" style="padding: 0 0 0 0;">
<a-card :bordered="false" :loading="treeLoading" class="leftTree">
<div v-if="this.orgTree != ''">
<a-tree :treeData="orgTree" v-if="orgTree.length" @select="handleClick" :defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys" :replaceFields="replaceFields" />
<a-tree
:treeData="orgTree"
v-if="orgTree.length"
@select="handleClick"
:defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys"
:replaceFields="replaceFields"
/>
</div>
<div v-else>
<a-empty :image="simpleImage" />
@ -25,37 +31,52 @@
<a-form-item label="状态">
<a-select v-model="queryParam.searchStatus" allow-clear placeholder="请选择状态" default-value="0">
<a-select-option v-for="(item, index) in statusDictTypeDropDown" :key="index" :value="item.code">
{{ item.value }}</a-select-option>
{{ item.value }}</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)"></a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
</x-card>
<a-card :bordered="false">
<s-table ref="table" :columns="columns" :data="loadData" :alert="true" :rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<s-table
ref="table"
:columns="columns"
:data="loadData"
:alert="true"
:rowKey="record => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<template slot="operator">
<a-button type="primary" v-if="hasPerm('sysUser:add')" icon="plus" @click="$refs.addForm.add()">
<a-button type="primary" v-if="hasPerm('sysUser:add')" icon="plus" @click="$refs.addForm.add()"
>新增用户
</a-button>
<a-upload :customRequest="customRequest" :multiple="true" :showUploadList="false" name="file"
v-if="hasPerm('sysUser:import')">
<a-upload
:customRequest="customRequest"
:multiple="true"
:showUploadList="false"
name="file"
v-if="hasPerm('sysUser:import')"
>
<a-button icon="up-circle">导入</a-button>
</a-upload>
<a-button v-if="hasPerm('sysUser:export')" icon="down-circle" @click="sysUserExport()">
</a-button>
<a-button v-if="hasPerm('sysUser:export')" icon="down-circle" @click="sysUserExport()"> </a-button>
</template>
<span slot="sex" slot-scope="text">
{{ sexFilter(text) }}
</span>
<span slot="status" slot-scope="text,record" v-if="hasPerm('sysUser:changeStatus')">
<a-popconfirm placement="top" :title="text === 0 ? '确定停用该用户?' : '确定启用该用户?'"
@confirm="() => editUserStatus(text, record)">
<span slot="status" slot-scope="text, record" v-if="hasPerm('sysUser:changeStatus')">
<a-popconfirm
placement="top"
:title="text === 0 ? '确定停用该用户?' : '确定启用该用户?'"
@confirm="() => editUserStatus(text, record)"
>
<a>{{ statusFilter(text) }}</a>
</a-popconfirm>
</span>
@ -66,7 +87,13 @@
<a v-if="hasPerm('sysUser:edit')" @click="$refs.editForm.edit(record)"></a>
<a-divider type="vertical" v-if="hasPerm('sysUser:edit')" />
<a-dropdown
v-if="hasPerm('sysUser:resetPwd') || hasPerm('sysUser:grantRole') || hasPerm('sysUser:grantData') || hasPerm('sysUser:delete')">
v-if="
hasPerm('sysUser:resetPwd') ||
hasPerm('sysUser:grantRole') ||
hasPerm('sysUser:grantData') ||
hasPerm('sysUser:delete')
"
>
<a class="ant-dropdown-link">
更多
<a-icon type="down" />
@ -101,16 +128,9 @@
</a-row>
</template>
<script>
import {
STable,
XCard
} from '@/components'
import {
Empty
} from 'ant-design-vue'
import {
getOrgTree
} from '@/api/modular/system/orgManage'
import { STable, XCard } from '@/components'
import { Empty } from 'ant-design-vue'
import { getOrgTree } from '@/api/modular/system/orgManage'
import {
getUserPage,
sysUserDelete,
@ -119,9 +139,7 @@ import {
sysUserExport,
sysUserImport
} from '@/api/modular/system/userManage'
import {
sysDictTypeDropDown
} from '@/api/modular/system/dictManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
import addForm from './addForm'
import editForm from './editForm'
import userRoleForm from './userRoleForm'
@ -142,35 +160,37 @@ export default {
//
queryParam: {},
//
columns: [{
title: '账号',
dataIndex: 'account'
},
{
title: '姓名',
dataIndex: 'name'
},
{
title: '性别',
dataIndex: 'sex',
scopedSlots: {
customRender: 'sex'
}
}, {
title: '手机',
dataIndex: 'phone'
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: {
customRender: 'status'
columns: [
{
title: '账号',
dataIndex: 'account'
},
{
title: '姓名',
dataIndex: 'name'
},
{
title: '性别',
dataIndex: 'sex',
scopedSlots: {
customRender: 'sex'
}
},
{
title: '手机',
dataIndex: 'phone'
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: {
customRender: 'status'
}
}
}
],
// Promise
loadData: parameter => {
return getUserPage(Object.assign(parameter, this.queryParam)).then((res) => {
return getUserPage(Object.assign(parameter, this.queryParam)).then(res => {
return res.data
})
},
@ -205,8 +225,13 @@ export default {
}
})
this.sysDictTypeDropDown()
if (this.hasPerm('sysUser:edit') || this.hasPerm('sysUser:resetPwd') || this.hasPerm('sysUser:grantRole') || this
.hasPerm('sysUser:grantData') || this.hasPerm('sysUser:delete')) {
if (
this.hasPerm('sysUser:edit') ||
this.hasPerm('sysUser:resetPwd') ||
this.hasPerm('sysUser:grantRole') ||
this.hasPerm('sysUser:grantData') ||
this.hasPerm('sysUser:delete')
) {
this.columns.push({
title: '操作',
width: '150px',
@ -238,12 +263,12 @@ export default {
sysDictTypeDropDown(text) {
sysDictTypeDropDown({
code: 'sex'
}).then((res) => {
}).then(res => {
this.sexDictTypeDropDown = res.data
})
sysDictTypeDropDown({
code: 'common_status'
}).then((res) => {
}).then(res => {
this.statusDictTypeDropDown = res.data
})
},
@ -292,32 +317,36 @@ export default {
* @param record
*/
sysUserDelete(record) {
sysUserDelete(record).then((res) => {
if (res.success) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.message)
}
}).catch((err) => {
this.$message.error('删除错误:' + err.message)
})
sysUserDelete(record)
.then(res => {
if (res.success) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.message)
}
})
.catch(err => {
this.$message.error('删除错误:' + err.message)
})
},
//
sysUserExport(e) {
this.cardLoading = true
sysUserExport().then((res) => {
this.cardLoading = false
this.downloadfile(res)
}).catch((err) => {
this.cardLoading = false
this.$message.error('下载错误:获取文件流错误')
})
sysUserExport()
.then(res => {
this.cardLoading = false
this.downloadfile(res)
})
.catch(err => {
this.cardLoading = false
this.$message.error('下载错误:获取文件流错误')
})
},
downloadfile(res) {
let fileReader = new FileReader()
let _this = this
fileReader.onload = function () {
fileReader.onload = function() {
try {
// JSON.parse(this.result)this.resultjson
// JSON.parse(this.result)catch
@ -356,7 +385,7 @@ export default {
customRequest(data) {
const formData = new FormData()
formData.append('file', data.file)
sysUserImport(formData).then((res) => {
sysUserImport(formData).then(res => {
if (res.success) {
this.$message.success('上传成功')
this.$refs.table.refresh()

@ -1,14 +1,8 @@
<template>
<a-modal
title="选择用户"
:width="900"
:visible="visible"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-modal title="选择用户" :width="900" :visible="visible" @ok="handleSubmit" @cancel="handleCancel">
<a-row :gutter="24">
<a-col :md="5" :sm="24" style="padding: 0 0 0 0;">
<a-card :bordered="false" :loading="treeLoading" >
<a-card :bordered="false" :loading="treeLoading">
<div v-if="this.orgTree != ''">
<a-tree
:treeData="orgTree"
@ -16,7 +10,8 @@
@select="handleClick"
:defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys"
:replaceFields="replaceFields" />
:replaceFields="replaceFields"
/>
</div>
<div v-else>
<a-empty :image="simpleImage" />
@ -36,14 +31,15 @@
<a-col :md="8" :sm="24">
<a-form-item label="状态">
<a-select v-model="queryParam.searchStatus" allow-clear placeholder="请选择状态" default-value="0">
<a-select-option v-for="(item,index) in statusDictTypeDropDown" :key="index" :value="item.code">
{{ item.value }}</a-select-option>
<a-select-option v-for="(item, index) in statusDictTypeDropDown" :key="index" :value="item.code">
{{ item.value }}</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)"></a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
@ -55,8 +51,9 @@
:columns="columns"
:data="loadData"
:alert="true"
:rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
:rowKey="record => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<span slot="sex" slot-scope="text">
{{ sexFilter(text) }}
</span>
@ -70,164 +67,155 @@
</a-modal>
</template>
<script>
import {
STable,
XCard
} from '@/components'
import {
Empty
} from 'ant-design-vue'
import {
getOrgTree
} from '@/api/modular/system/orgManage'
import {
getUserPage
} from '@/api/modular/system/userManage'
import {
sysDictTypeDropDown
} from '@/api/modular/system/dictManage'
export default {
components: {
XCard,
STable,
},
data() {
return {
// /
advanced: false,
visible:false,
//
queryParam: {},
//
columns: [{
title: '账号',
dataIndex: 'account'
},
{
title: '姓名',
dataIndex: 'name'
},
{
title: '性别',
dataIndex: 'sex',
scopedSlots: {
customRender: 'sex'
}
}, {
title: '手机',
dataIndex: 'phone'
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: {
customRender: 'status'
}
}
],
// Promise
loadData: parameter => {
return getUserPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res.data
})
import { STable, XCard } from '@/components'
import { Empty } from 'ant-design-vue'
import { getOrgTree } from '@/api/modular/system/orgManage'
import { getUserPage } from '@/api/modular/system/userManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
export default {
components: {
XCard,
STable
},
data() {
return {
// /
advanced: false,
visible: false,
//
queryParam: {},
//
columns: [
{
title: '账号',
dataIndex: 'account'
},
orgTree: [],
selectedRowKeys: [],
selectedRows: [],
defaultExpandedKeys: [],
sexDictTypeDropDown: [],
statusDictTypeDropDown: [],
treeLoading: true,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
key: 'id'
}
}
},
methods: {
userList(record) {
this.visible = true
/**
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/
getOrgTree(Object.assign(this.queryParam)).then(res => {
this.treeLoading = false
if (!res.success) {
return
{
title: '姓名',
dataIndex: 'name'
},
{
title: '性别',
dataIndex: 'sex',
scopedSlots: {
customRender: 'sex'
}
this.orgTree = res.data
for (var item of res.data) {
// eslint-disable-next-line eqeqeq
if (item.parentId == 0) {
this.defaultExpandedKeys.push(item.id)
}
},
{
title: '手机',
dataIndex: 'phone'
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: {
customRender: 'status'
}
})
this.sysDictTypeDropDown()
},
sexFilter(sex) {
// eslint-disable-next-line eqeqeq
const values = this.sexDictTypeDropDown.filter(item => item.code == sex)
if (values.length > 0) {
return values[0].value
}
},
statusFilter(status) {
// eslint-disable-next-line eqeqeq
const values = this.statusDictTypeDropDown.filter(item => item.code == status)
if (values.length > 0) {
return values[0].value
}
},
/**
* 获取字典数据
*/
sysDictTypeDropDown(text) {
sysDictTypeDropDown({
code: 'sex'
}).then((res) => {
this.sexDictTypeDropDown = res.data
})
sysDictTypeDropDown({
code: 'common_status'
}).then((res) => {
this.statusDictTypeDropDown = res.data
],
// Promise
loadData: parameter => {
return getUserPage(Object.assign(parameter, this.queryParam)).then(res => {
return res.data
})
},
orgTree: [],
selectedRowKeys: [],
selectedRows: [],
defaultExpandedKeys: [],
sexDictTypeDropDown: [],
statusDictTypeDropDown: [],
treeLoading: true,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
key: 'id'
}
}
},
methods: {
userList(record) {
this.visible = true
/**
* 点击左侧机构树查询列表
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/
handleClick(e) {
this.queryParam = {
'sysEmpParam.orgId': e.toString()
getOrgTree(Object.assign(this.queryParam)).then(res => {
this.treeLoading = false
if (!res.success) {
return
}
this.$refs.table.refresh(true)
},
toggleAdvanced() {
this.advanced = !this.advanced
},
this.orgTree = res.data
for (var item of res.data) {
// eslint-disable-next-line eqeqeq
if (item.parentId == 0) {
this.defaultExpandedKeys.push(item.id)
}
}
})
this.sysDictTypeDropDown()
},
sexFilter(sex) {
// eslint-disable-next-line eqeqeq
const values = this.sexDictTypeDropDown.filter(item => item.code == sex)
if (values.length > 0) {
return values[0].value
}
},
statusFilter(status) {
// eslint-disable-next-line eqeqeq
const values = this.statusDictTypeDropDown.filter(item => item.code == status)
if (values.length > 0) {
return values[0].value
}
},
/**
* 获取字典数据
*/
sysDictTypeDropDown(text) {
sysDictTypeDropDown({
code: 'sex'
}).then(res => {
this.sexDictTypeDropDown = res.data
})
sysDictTypeDropDown({
code: 'common_status'
}).then(res => {
this.statusDictTypeDropDown = res.data
})
},
onSelectChange(selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
},
handleSubmit () {
this.visible = false
this.$emit('ok',this.selectedRows);
},
handleCancel () {
this.visible = false
/**
* 点击左侧机构树查询列表
*/
handleClick(e) {
this.queryParam = {
'sysEmpParam.orgId': e.toString()
}
this.$refs.table.refresh(true)
},
toggleAdvanced() {
this.advanced = !this.advanced
},
onSelectChange(selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
},
handleSubmit() {
this.visible = false
this.$emit('ok', this.selectedRows)
},
handleCancel() {
this.visible = false
}
}
}
</script>
<style lang="less">
.table-operator {
margin-bottom: 18px;
}
.table-operator {
margin-bottom: 18px;
}
button {
margin-right: 8px;
}
button {
margin-right: 8px;
}
</style>

@ -1,7 +1,7 @@
<template>
<a-modal
title="授权数据"
:width="600"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@ -9,147 +9,324 @@
>
<a-spin :spinning="formLoading">
<a-form :form="form">
<a-form-item
label="选择机构"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
class="grantOrgScrollbar"
>
<a-tree
v-model="checkedKeys"
checkable
checkStrictly
:auto-expand-parent="autoExpandParent"
:expanded-keys="expandedKeys"
:tree-data="orgTreeData"
:selected-keys="selectedKeys"
:replaceFields="replaceFields"
@expand="onExpand"
@select="onSelect"
/>
</a-form-item>
<a-row>
<a-col :span="12">
<a-form-item label="选择菜单" :labelCol="labelCol" :wrapperCol="wrapperCol" class="grantOrgScrollbar">
<a-tree
v-model="checkedMenuKeys"
checkable
checkStrictly
:auto-expand-parent="autoExpandParentMenu"
:tree-data="menuTreeData"
:selected-keys="selectedKeys"
:replaceFields="replaceMenuFields"
@select="onSelectMenu"
@check="onCheckMenu"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
v-show="SelectMenu"
label="授权范围"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-select
style="width: 100%"
placeholder="请选择授权范围"
v-decorator="['dataScopeType', { rules: [{ required: true, message: '请选择授权范围!' }] }]"
>
<a-select-option
v-for="(item, index) in dataScopeTypeData"
:key="index"
:value="item.code"
@click="handleChange(item.code)"
>
{{ item.value }}
</a-select-option>
</a-select>
</a-form-item>
<div v-show="SelectMenu && orgTreeShow">
<a-form-item label="选择机构" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree
v-model="checkedKeys"
checkable
checkStrictly
:auto-expand-parent="autoExpandParent"
:expanded-keys="expandedKeys"
:tree-data="orgTreeData"
:selected-keys="selectedKeys"
:replaceFields="replaceFields"
@expand="onExpand"
@check="onCheck"
/>
</a-form-item>
</div>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { getOrgTree } from '@/api/modular/system/orgManage'
import { sysUserOwnData, sysUserGrantData } from '@/api/modular/system/userManage'
import { getMenuList, getOrgTree } from '@/api/modular/system/orgManage'
import {
SysDataUserMenuGrantData,
SysDataUserMenuGrantRightData,
SysDataUserMenuGetGrantRightData,
SysDataUserMenuGetGrantData
} from '@/api/modular/system/userManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
export default {
data() {
return {
labelCol: {
style: { 'padding-right': '20px' },
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
orgTreeData: [],
menuTreeData: [],
expandedKeys: [],
expandedMenuKeys: [],
checkedKeys: [],
checkedMenuKeys: [],
visible: false,
confirmLoading: false,
formLoading: true,
autoExpandParent: true,
autoExpandParentMenu: true,
selectedKeys: [],
userEntity: [],
replaceFields: {
key: 'id',
title: 'title'
},
replaceMenuFields: {
key: 'id',
title: 'name'
},
form: this.$form.createForm(this),
dataScopeTypeData: [],
orgTreeShow: false,
GrantData: [],
SelectMenu: false,
SelectMenuId: '',
MeuncheckedKeys: []
}
},
export default {
data () {
return {
labelCol: {
style: { 'padding-right': '20px' },
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
orgTreeData: [],
expandedKeys: [],
checkedKeys: [],
visible: false,
confirmLoading: false,
formLoading: true,
autoExpandParent: true,
selectedKeys: [],
userEntity: [],
replaceFields: {
key: 'id'
},
form: this.$form.createForm(this)
}
methods: {
//
userOrg(record) {
this.userEntity = record
this.visible = true
//
this.sysDictTypeDropDown()
//
this.getMenuList()
//
this.SysDataUserMenuGetGrantData(record)
// //
// this.SysDataUserMenuGetGrantRightData(record)
},
methods: {
//
userOrg (record) {
this.userEntity = record
this.visible = true
//
SysDataUserMenuGetGrantData(record) {
SysDataUserMenuGetGrantData({ userid: record.id }).then(res => {
this.GrantData = res.data
res.data.forEach(item => {
this.checkedMenuKeys.push(item.sysMenuId)
})
//
SysDataUserMenuGetGrantRightData({ userid: record.id }).then(res => {
this.GrantData.forEach(item => {
item.RightData = []
res.data.forEach(item2 => {
if (item.sysMenuId == item2.sysMenuId) {
item.RightData.push({ menuId: item2.sysMenuId, orgId: item2.sysOrgId })
}
})
})
})
})
},
//
// SysDataUserMenuGetGrantRightData(record) {},
//
handleChange(value) {
let Type = false
this.GrantData.forEach(item => {
if (item.sysMenuId == this.SelectMenuId) {
// if (value == '5') {
// this.checkedKeys = []
// item.RightData.forEach(item => {
// this.checkedKeys.push(item.orgId)
// })
// console.log(this.checkedKeys)
// } else {
// item.RightData = []
// }
item.dataScopeType = value
Type = true
}
})
if (!Type) {
this.GrantData.push({ dataScopeType: value, sysMenuId: this.SelectMenuId, RightData: [] })
}
// eslint-disable-next-line eqeqeq
if (value == '5') {
this.orgTreeShow = true
//
this.getOrgTree()
//
this.sysUserOwnData(this.userEntity)
},
/**
* 获取机构树
*/
getOrgTree () {
this.formLoading = true
getOrgTree().then((res) => {
if (res.success) {
this.orgTreeData = res.data
//
this.orgTreeData.forEach(item => {
this.expandedKeys.push(item.id)
})
}
})
},
} else {
this.orgTreeShow = false
//
this.checkedKeys = []
}
},
/**
* 获取机构树
*/
getOrgTree() {
getOrgTree().then(res => {
if (res.success) {
this.orgTreeData = res.data
console.log(this.orgTreeData, 1111111111111111111111111)
//
this.orgTreeData.forEach(item => {
this.expandedKeys.push(item.id)
})
}
})
},
/**
* 获取字典数据
*/
sysDictTypeDropDown() {
//
sysDictTypeDropDown({ code: 'data_scope_type' }).then(res => {
this.dataScopeTypeData = res.data
this.formLoading = false
})
},
/**
* 获取菜单树
*/
getMenuList() {
this.formLoading = true
getMenuList().then(res => {
if (res.success) {
this.menuTreeData = res.data
}
})
},
/**
* 此用户已有数据列表
*/
sysUserOwnData (record) {
sysUserOwnData({ id: record.id }).then((res) => {
if (res.success) {
this.checkedKeys = res.data
}
this.formLoading = false
})
},
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onCheck(checkedKeys) {
this.checkedKeys = checkedKeys.checked
this.GrantData.forEach(item => {
if (item.sysMenuId == this.SelectMenuId) {
item.RightData = []
checkedKeys.checked.forEach(item2 => {
item.RightData.push({ menuId: this.SelectMenuId, orgId: item2 })
})
}
})
},
onExpand (expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onCheck (checkedKeys) {
this.checkedKeys = checkedKeys
},
onSelect (selectedKeys, info) {
this.selectedKeys = selectedKeys
},
onSelectMenu(selectedKeys) {
this.checkedKeys = []
this.SelectMenu = true
this.SelectMenuId = selectedKeys[0]
let type = ''
this.GrantData.forEach(item => {
if (item.sysMenuId == selectedKeys[0]) {
console.log(item.sysMenuId, item.RightData)
item.RightData.forEach(item2 => {
this.checkedKeys.push(item2.orgId)
})
type = `${item.dataScopeType}`
}
})
this.handleChange(type)
this.form.setFieldsValue({
dataScopeType: type
})
},
onCheckMenu(checkedKeys, e) {
this.MeuncheckedKeys = checkedKeys.checked
},
handleSubmit() {
const {
form: { validateFields }
} = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
let childrens = []
this.MeuncheckedKeys.forEach(item => {
this.GrantData.forEach(item2 => {
if (item == item2.sysMenuId) {
childrens.push({ ...item2, menuId: item2.sysMenuId })
}
})
})
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
const checkedKeys = this.checkedKeys.checked === undefined ? this.checkedKeys : this.checkedKeys.checked
sysUserGrantData({ id: this.userEntity.id, grantOrgIdList: checkedKeys }).then((res) => {
SysDataUserMenuGrantData({ userId: this.userEntity.id, childrens })
.then(res => {
if (res.success) {
this.$message.success('授权成功')
this.confirmLoading = false
this.$emit('ok', values)
this.handleCancel()
let childrens2 = []
childrens.forEach(item => {
childrens2 = [...childrens2, ...item.RightData]
})
SysDataUserMenuGrantRightData({ userId: this.userEntity.id, childrens: childrens2 })
.then(res => {
if (res.success) {
this.$message.success('授权成功')
this.confirmLoading = false
this.$emit('ok', values)
this.handleCancel()
} else {
this.$message.error('授权失败:' + res.message)
}
})
.finally(res => {
this.confirmLoading = false
})
} else {
this.$message.error('授权失败:' + res.message)
}
}).finally((res) => {
})
.finally(res => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
})
},
handleCancel () {
this.form.resetFields()
//
this.checkedKeys = []
//
this.expandedKeys = []
this.visible = false
}
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.form.resetFields()
//
this.checkedKeys = []
this.checkedMenuKeys = []
//
this.expandedKeys = []
this.visible = false
this.SelectMenu = false
}
}
}
</script>
<style scoped>
@ -157,4 +334,4 @@
max-height: 60vh;
overflow-y: auto;
}
</style>
</style>

Loading…
Cancel
Save