mirror of https://gitee.com/xiaonuobase/snowy
【优化】优化前端系统模块下组织、用户、职位、用户组四个页面在小屏幕下的表现
parent
b0b2d67fce
commit
9b733d6746
|
@ -73,6 +73,7 @@ export default {
|
|||
frontLogin: 'Front Login',
|
||||
},
|
||||
user: {
|
||||
userOrg: 'User Org',
|
||||
userStatus: 'User Status',
|
||||
resetPassword: 'Reset Password',
|
||||
role: 'Role',
|
||||
|
@ -83,6 +84,7 @@ export default {
|
|||
exportUserInfo: 'Export UserInfo',
|
||||
placeholderNameAndSearchKey: 'Please enter your name or keyword',
|
||||
placeholderUserStatus: 'Please select status',
|
||||
placeholderUserOrg: 'Please select org',
|
||||
popConfirmDeleteUser: 'Are you sure you want to delete it?',
|
||||
popConfirmResatUserPwd: 'Are you sure you want to reset?'
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ export default {
|
|||
frontLogin: '前台登录',
|
||||
},
|
||||
user: {
|
||||
userOrg: '所属组织',
|
||||
userStatus: '用户状态',
|
||||
resetPassword: '重置密码',
|
||||
role: '角色',
|
||||
|
@ -83,6 +84,7 @@ export default {
|
|||
grantResource: '授权资源',
|
||||
grantPermission: '授权权限',
|
||||
exportUserInfo: '导出信息',
|
||||
placeholderUserOrg: '请选择组织',
|
||||
placeholderNameAndSearchKey: '请输入姓名或关键词',
|
||||
placeholderUserStatus: '请选择状态',
|
||||
popConfirmDeleteUser: '确定要删除吗?',
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
<template>
|
||||
<a-card :bordered="false">
|
||||
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="6">
|
||||
<a-form-item label="名称" name="name">
|
||||
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
|
||||
<a-card :bordered="false" class="xn-mb10">
|
||||
<a-form ref="searchFormRef" :model="searchFormState">
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item label="关键词" name="name">
|
||||
<a-input v-model:value="searchFormState.name" placeholder="请输入名称关键词"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" @click="tableRef.refresh()">查询</a-button>
|
||||
<a-button style="margin: 0 8px" @click="reset">重置</a-button>
|
||||
<a-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="tableRef.refresh()">查询</a-button>
|
||||
<a-button style="margin: 0 8px" @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-card>
|
||||
<a-card :bordered="false">
|
||||
<s-table
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
|
@ -22,11 +28,14 @@
|
|||
:row-key="(record) => record.id"
|
||||
:tool-config="toolConfig"
|
||||
:row-selection="options.rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="formRef.onOpen()">
|
||||
<template #icon><plus-outlined /></template>
|
||||
<template #icon>
|
||||
<plus-outlined/>
|
||||
</template>
|
||||
新增
|
||||
</a-button>
|
||||
<xn-batch-button
|
||||
|
@ -42,9 +51,9 @@
|
|||
<template v-if="column.dataIndex === 'action'">
|
||||
<a-space>
|
||||
<a @click="formRef.onOpen(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="openGroupUserSelector(record)">授权用户</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm title="确定要删除吗?" @confirm="deleteSysGroup(record)">
|
||||
<a-button type="link" danger size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
|
@ -53,7 +62,7 @@
|
|||
</template>
|
||||
</s-table>
|
||||
</a-card>
|
||||
<Form ref="formRef" @successful="tableRef.refresh()" />
|
||||
<Form ref="formRef" @successful="tableRef.refresh()"/>
|
||||
<xn-user-selector
|
||||
ref="userSelectorRef"
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
|
@ -65,115 +74,118 @@
|
|||
</template>
|
||||
|
||||
<script setup name="sysGroupIndex">
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import Form from './form.vue'
|
||||
import sysGroupApi from '@/api/sys/groupApi'
|
||||
const searchFormState = ref({})
|
||||
const searchFormRef = ref()
|
||||
const tableRef = ref()
|
||||
const formRef = ref()
|
||||
const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
|
||||
const recordCacheData = ref()
|
||||
const userSelectorRef = ref()
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark'
|
||||
},
|
||||
{
|
||||
title: '排序码',
|
||||
dataIndex: 'sortCode'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
width: 220
|
||||
import {cloneDeep} from 'lodash-es'
|
||||
import Form from './form.vue'
|
||||
import sysGroupApi from '@/api/sys/groupApi'
|
||||
|
||||
const searchFormState = ref({})
|
||||
const searchFormRef = ref()
|
||||
const tableRef = ref()
|
||||
const formRef = ref()
|
||||
const toolConfig = {refresh: true, height: true, columnSetting: true, striped: false}
|
||||
const recordCacheData = ref()
|
||||
const userSelectorRef = ref()
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark'
|
||||
},
|
||||
{
|
||||
title: '排序码',
|
||||
dataIndex: 'sortCode'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 220
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
// columns数字类型字段加入 needTotal: true 可以勾选自动算账
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
// columns数字类型字段加入 needTotal: true 可以勾选自动算账
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
const loadData = (parameter) => {
|
||||
const searchFormParam = cloneDeep(searchFormState.value)
|
||||
return sysGroupApi.groupPage(Object.assign(parameter, searchFormParam)).then((data) => {
|
||||
return data
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const deleteSysGroup = (record) => {
|
||||
let params = [
|
||||
{
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
sysGroupApi.groupDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchSysGroup = (params) => {
|
||||
sysGroupApi.groupDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
// 打开用户选择器
|
||||
const openGroupUserSelector = (record) => {
|
||||
// 打开人员选择器的时候,缓存一个记录数据
|
||||
recordCacheData.value = record
|
||||
// 查询接口,查到这个角色是多少个用户都有它
|
||||
const param = {
|
||||
}
|
||||
const loadData = (parameter) => {
|
||||
const searchFormParam = cloneDeep(searchFormState.value)
|
||||
return sysGroupApi.groupPage(Object.assign(parameter, searchFormParam)).then((data) => {
|
||||
return data
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const deleteSysGroup = (record) => {
|
||||
let params = [
|
||||
{
|
||||
id: record.id
|
||||
}
|
||||
sysGroupApi.groupOwnUser(param).then((data) => {
|
||||
userSelectorRef.value.showUserPlusModal(data)
|
||||
]
|
||||
sysGroupApi.groupDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchSysGroup = (params) => {
|
||||
sysGroupApi.groupDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
// 打开用户选择器
|
||||
const openGroupUserSelector = (record) => {
|
||||
// 打开人员选择器的时候,缓存一个记录数据
|
||||
recordCacheData.value = record
|
||||
// 查询接口,查到这个角色是多少个用户都有它
|
||||
const param = {
|
||||
id: record.id
|
||||
}
|
||||
sysGroupApi.groupOwnUser(param).then((data) => {
|
||||
userSelectorRef.value.showUserPlusModal(data)
|
||||
})
|
||||
}
|
||||
// 人员选择器回调
|
||||
const userCallBack = (value) => {
|
||||
const param = {
|
||||
id: recordCacheData.value.id,
|
||||
grantInfoList: value
|
||||
}
|
||||
sysGroupApi.groupGrantUser(param).then(() => {
|
||||
})
|
||||
}
|
||||
// 传递设计器需要的API
|
||||
const selectorApiFunction = {
|
||||
orgTreeApi: (param) => {
|
||||
return sysGroupApi.groupOrgTreeSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
userPageApi: (param) => {
|
||||
return sysGroupApi.groupUserSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
}
|
||||
// 人员选择器回调
|
||||
const userCallBack = (value) => {
|
||||
const param = {
|
||||
id: recordCacheData.value.id,
|
||||
grantInfoList: value
|
||||
}
|
||||
sysGroupApi.groupGrantUser(param).then(() => {})
|
||||
}
|
||||
// 传递设计器需要的API
|
||||
const selectorApiFunction = {
|
||||
orgTreeApi: (param) => {
|
||||
return sysGroupApi.groupOrgTreeSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
userPageApi: (param) => {
|
||||
return sysGroupApi.groupUserSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="5" :xl="5">
|
||||
<a-col :xs="0" :sm="0" :md="0" :lg="4" :xl="4">
|
||||
<a-card :bordered="false" :loading="cardLoading" class="left-tree-container">
|
||||
<a-tree
|
||||
v-if="treeData.length > 0"
|
||||
|
@ -9,27 +9,54 @@
|
|||
:field-names="treeFieldNames"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE"/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="19" :xl="19">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="20" :xl="20">
|
||||
<a-card :bordered="false" class="xn-mb10">
|
||||
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="8">
|
||||
<a-form-item name="searchKey" label="名称关键词">
|
||||
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入组织名称关键词" />
|
||||
<a-form ref="searchFormRef" :model="searchFormState">
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="0" :xl="0">
|
||||
<a-form-item label="上级组织:" name="parentId">
|
||||
<a-tree-select
|
||||
v-model:value="searchFormState.parentId"
|
||||
class="xn-wd"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择上级组织"
|
||||
allow-clear
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon><redo-outlined /></template>
|
||||
重置
|
||||
</a-button>
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item name="searchKey" label="名称">
|
||||
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入名称关键词"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon>
|
||||
<SearchOutlined/>
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon>
|
||||
<redo-outlined/>
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
@ -44,11 +71,14 @@
|
|||
bordered
|
||||
:row-key="(record) => record.id"
|
||||
:row-selection="options.rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="formRef.onOpen(undefined, searchFormState.parentId)">
|
||||
<template #icon><plus-outlined /></template>
|
||||
<template #icon>
|
||||
<plus-outlined/>
|
||||
</template>
|
||||
新增
|
||||
</a-button>
|
||||
<xn-batch-button
|
||||
|
@ -66,7 +96,7 @@
|
|||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a @click="formRef.onOpen(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm title="删除此组织与下级组织吗?" @confirm="removeOrg(record)">
|
||||
<a-button type="link" danger size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
|
@ -76,132 +106,128 @@
|
|||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<Form ref="formRef" @successful="tableRef.refresh()" />
|
||||
<Form ref="formRef" @successful="tableRef.refresh()"/>
|
||||
</template>
|
||||
|
||||
<script setup name="sysOrg">
|
||||
import { Empty } from 'ant-design-vue'
|
||||
import { isEmpty } from 'lodash-es'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
import {Empty} from 'ant-design-vue'
|
||||
import {isEmpty} from 'lodash-es'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
|
||||
const columns = [
|
||||
const columns = [
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'category'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: '150px'
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 定义tableDOM
|
||||
const tableRef = ref(null)
|
||||
const formRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const searchFormState = ref({})
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
const treeData = ref([])
|
||||
// 替换treeNode 中 title,key,children
|
||||
const treeFieldNames = {children: 'children', title: 'name', key: 'id'}
|
||||
const cardLoading = ref(true)
|
||||
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
loadTreeData()
|
||||
return orgApi.orgPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
const loadTreeData = () => {
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.parentId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.parentId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const removeOrg = (record) => {
|
||||
let params = [
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'category'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
width: '150px'
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 定义tableDOM
|
||||
const tableRef = ref(null)
|
||||
const formRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const searchFormState = ref({})
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
const treeData = ref([])
|
||||
// 替换treeNode 中 title,key,children
|
||||
const treeFieldNames = { children: 'children', title: 'name', key: 'id' }
|
||||
const cardLoading = ref(true)
|
||||
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
loadTreeData()
|
||||
return orgApi.orgPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
orgApi.orgDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
const loadTreeData = () => {
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.parentId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.parentId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const removeOrg = (record) => {
|
||||
let params = [
|
||||
{
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
orgApi.orgDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchOrg = (params) => {
|
||||
orgApi.orgDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchOrg = (params) => {
|
||||
orgApi.orgDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ant-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.snowy-button-left {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="5" :xl="5">
|
||||
<a-col :xs="0" :sm="0" :md="0" :lg="4" :xl="4">
|
||||
<a-card :bordered="false" :loading="cardLoading" class="left-tree-container">
|
||||
<a-tree
|
||||
v-if="treeData.length > 0"
|
||||
|
@ -9,27 +9,54 @@
|
|||
:field-names="treeFieldNames"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE"/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="19" :xl="19">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="20" :xl="20">
|
||||
<a-card :bordered="false" class="xn-mb10">
|
||||
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="8">
|
||||
<a-form-item name="searchKey" label="名称关键词">
|
||||
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入职位名称关键词" />
|
||||
<a-form ref="searchFormRef" :model="searchFormState">
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="0" :xl="0">
|
||||
<a-form-item label="组织:" name="orgId">
|
||||
<a-tree-select
|
||||
v-model:value="searchFormState.orgId"
|
||||
class="xn-wd"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择组织"
|
||||
allow-clear
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon><redo-outlined /></template>
|
||||
重置
|
||||
</a-button>
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item name="searchKey" label="关键词">
|
||||
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入职位名称关键词"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon>
|
||||
<SearchOutlined/>
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon>
|
||||
<redo-outlined/>
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
@ -44,11 +71,14 @@
|
|||
bordered
|
||||
:row-key="(record) => record.id"
|
||||
:row-selection="options.rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="formRef.onOpen(undefined, searchFormState.orgId)">
|
||||
<template #icon><plus-outlined /></template>
|
||||
<template #icon>
|
||||
<plus-outlined/>
|
||||
</template>
|
||||
新增
|
||||
</a-button>
|
||||
<xn-batch-button
|
||||
|
@ -66,7 +96,7 @@
|
|||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a @click="formRef.onOpen(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm title="确定删除此职位?" @confirm="removeOrg(record)">
|
||||
<a-button type="link" danger size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
|
@ -76,130 +106,126 @@
|
|||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<Form ref="formRef" @successful="tableRef.refresh(true)" />
|
||||
<Form ref="formRef" @successful="tableRef.refresh(true)"/>
|
||||
</template>
|
||||
|
||||
<script setup name="sysPosition">
|
||||
import { Empty } from 'ant-design-vue'
|
||||
import { isEmpty } from 'lodash-es'
|
||||
import positionApi from '@/api/sys/positionApi'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
import {Empty} from 'ant-design-vue'
|
||||
import {isEmpty} from 'lodash-es'
|
||||
import positionApi from '@/api/sys/positionApi'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
|
||||
const columns = [
|
||||
const columns = [
|
||||
{
|
||||
title: '职位名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'category'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: '150px'
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 定义tableDOM
|
||||
const tableRef = ref(null)
|
||||
const formRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const searchFormState = ref({})
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
const treeData = ref([])
|
||||
// 替换treeNode 中 title,key,children
|
||||
const treeFieldNames = {children: 'children', title: 'name', key: 'id'}
|
||||
const cardLoading = ref(true)
|
||||
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
return positionApi.positionPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.orgId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.orgId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const removeOrg = (record) => {
|
||||
let params = [
|
||||
{
|
||||
title: '职位名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'category'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
width: '150px'
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
const selectedRowKeys = ref([])
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 定义tableDOM
|
||||
const tableRef = ref(null)
|
||||
const formRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const searchFormState = ref({})
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
const treeData = ref([])
|
||||
// 替换treeNode 中 title,key,children
|
||||
const treeFieldNames = { children: 'children', title: 'name', key: 'id' }
|
||||
const cardLoading = ref(true)
|
||||
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
return positionApi.positionPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
positionApi.positionDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.orgId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.orgId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 删除
|
||||
const removeOrg = (record) => {
|
||||
let params = [
|
||||
{
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
positionApi.positionDelete(params).then(() => {
|
||||
tableRef.value.refresh(true)
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchPosition = (params) => {
|
||||
positionApi.positionDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchPosition = (params) => {
|
||||
positionApi.positionDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ant-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.snowy-button-left {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
:row-key="(record) => record.id"
|
||||
:tool-config="toolConfig"
|
||||
:row-selection="options.rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="5" :xl="5">
|
||||
<a-col :xs="0" :sm="0" :md="0" :lg="4" :xl="4">
|
||||
<a-card :bordered="false" :loading="cardLoading" class="left-tree-container mb-3">
|
||||
<a-tree
|
||||
v-if="treeData.length > 0"
|
||||
|
@ -8,16 +8,34 @@
|
|||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
@select="treeSelect"
|
||||
>
|
||||
</a-tree>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE"/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="19" :xl="19">
|
||||
<a-col :xs="24" :sm="20" :md="20" :lg="20" :xl="20">
|
||||
<a-card :bordered="false" class="xn-mb10">
|
||||
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="8">
|
||||
<a-form ref="searchFormRef" :model="searchFormState">
|
||||
<a-row :gutter="10">
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="0" :xl="0">
|
||||
<a-form-item :label="$t('user.userOrg')" name="orgId">
|
||||
<a-tree-select
|
||||
v-model:value="searchFormState.orgId"
|
||||
class="xn-wd"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
:placeholder="$t('user.placeholderUserOrg')"
|
||||
allow-clear
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item name="searchKey" :label="$t('common.searchKey')">
|
||||
<a-input
|
||||
v-model:value="searchFormState.searchKey"
|
||||
|
@ -25,28 +43,36 @@
|
|||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item name="userStatus" :label="$t('user.userStatus')">
|
||||
<a-select
|
||||
v-model:value="searchFormState.userStatus"
|
||||
:placeholder="$t('user.placeholderUserStatus')"
|
||||
:getPopupContainer="(trigger) => trigger.parentNode"
|
||||
>
|
||||
<a-select-option v-for="item in statusData" :key="item.value" :value="item.value">{{
|
||||
item.label
|
||||
}}</a-select-option>
|
||||
<a-select-option v-for="item in statusData" :key="item.value" :value="item.value">
|
||||
{{ item.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
{{ $t('common.searchButton') }}
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon><redo-outlined /></template>
|
||||
{{ $t('common.resetButton') }}
|
||||
</a-button>
|
||||
<a-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="tableRef.refresh(true)">
|
||||
<template #icon>
|
||||
<SearchOutlined/>
|
||||
</template>
|
||||
{{ $t('common.searchButton') }}
|
||||
</a-button>
|
||||
<a-button class="snowy-button-left" @click="reset">
|
||||
<template #icon>
|
||||
<redo-outlined/>
|
||||
</template>
|
||||
{{ $t('common.resetButton') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
@ -61,19 +87,26 @@
|
|||
:alert="options.alert.show"
|
||||
:row-key="(record) => record.id"
|
||||
:row-selection="options.rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #operator class="table-operator">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="formRef.onOpen(undefined, searchFormState.orgId)">
|
||||
<template #icon><plus-outlined /></template>
|
||||
<template #icon>
|
||||
<plus-outlined/>
|
||||
</template>
|
||||
<span>{{ $t('common.addButton') }}{{ $t('model.user') }}</span>
|
||||
</a-button>
|
||||
<a-button @click="ImpExpRef.onOpen()">
|
||||
<template #icon><import-outlined /></template>
|
||||
<template #icon>
|
||||
<import-outlined/>
|
||||
</template>
|
||||
<span>{{ $t('common.imports') }}</span>
|
||||
</a-button>
|
||||
<a-button @click="exportBatchUserVerify">
|
||||
<template #icon><export-outlined /></template>
|
||||
<template #icon>
|
||||
<export-outlined/>
|
||||
</template>
|
||||
{{ $t('user.batchExportButton') }}
|
||||
</a-button>
|
||||
<xn-batch-button
|
||||
|
@ -87,27 +120,29 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'avatar'">
|
||||
<a-avatar :src="record.avatar" style="margin-bottom: -5px; margin-top: -5px" />
|
||||
<a-avatar :src="record.avatar" style="margin-bottom: -5px; margin-top: -5px"/>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'gender'">
|
||||
{{ $TOOL.dictTypeData('GENDER', record.gender) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'userStatus'">
|
||||
<a-switch :loading="loading" :checked="record.userStatus === 'ENABLE'" @change="editStatus(record)" />
|
||||
<a-switch :loading="loading" :checked="record.userStatus === 'ENABLE'"
|
||||
@change="editStatus(record)"/>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a @click="formRef.onOpen(record)">{{ $t('common.editButton') }}</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm :title="$t('user.popConfirmDeleteUser')" placement="topRight" @confirm="removeUser(record)">
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm :title="$t('user.popConfirmDeleteUser')" placement="topRight"
|
||||
@confirm="removeUser(record)">
|
||||
<a-button type="link" danger size="small">
|
||||
{{ $t('common.removeButton') }}
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a-divider type="vertical"/>
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">
|
||||
{{ $t('common.more') }}
|
||||
<DownOutlined />
|
||||
<DownOutlined/>
|
||||
</a>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
|
@ -124,10 +159,14 @@
|
|||
<a @click="selectRole(record)">{{ $t('user.grantRole') }}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="grantResourceFormRef.onOpen(record)">{{ $t('user.grantResource') }}</a>
|
||||
<a @click="grantResourceFormRef.onOpen(record)">{{
|
||||
$t('user.grantResource')
|
||||
}}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="grantPermissionFormRef.onOpen(record)">{{ $t('user.grantPermission') }}</a>
|
||||
<a @click="grantPermissionFormRef.onOpen(record)">{{
|
||||
$t('user.grantPermission')
|
||||
}}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="exportUserInfo(record)">{{ $t('user.exportUserInfo') }}</a>
|
||||
|
@ -141,7 +180,7 @@
|
|||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<Form ref="formRef" @successful="tableRef.refresh()" />
|
||||
<Form ref="formRef" @successful="tableRef.refresh()"/>
|
||||
<xn-role-selector
|
||||
ref="RoleSelectorPlusRef"
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
|
@ -151,275 +190,269 @@
|
|||
:role-global="true"
|
||||
@onBack="roleBack"
|
||||
/>
|
||||
<ImpExp ref="ImpExpRef" />
|
||||
<grantResourceForm ref="grantResourceFormRef" @successful="tableRef.refresh()" />
|
||||
<grantPermissionForm ref="grantPermissionFormRef" @successful="tableRef.refresh()" />
|
||||
<ImpExp ref="ImpExpRef"/>
|
||||
<grantResourceForm ref="grantResourceFormRef" @successful="tableRef.refresh()"/>
|
||||
<grantPermissionForm ref="grantPermissionFormRef" @successful="tableRef.refresh()"/>
|
||||
</template>
|
||||
|
||||
<script setup name="sysUser">
|
||||
import { message, Empty } from 'ant-design-vue'
|
||||
import { isEmpty } from 'lodash-es'
|
||||
import tool from '@/utils/tool'
|
||||
import downloadUtil from '@/utils/downloadUtil'
|
||||
import userApi from '@/api/sys/userApi'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
import ImpExp from './impExp.vue'
|
||||
import GrantResourceForm from './grantResourceForm.vue'
|
||||
import GrantPermissionForm from './grantPermissionForm.vue'
|
||||
import {message, Empty} from 'ant-design-vue'
|
||||
import {isEmpty} from 'lodash-es'
|
||||
import tool from '@/utils/tool'
|
||||
import downloadUtil from '@/utils/downloadUtil'
|
||||
import userApi from '@/api/sys/userApi'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import Form from './form.vue'
|
||||
import ImpExp from './impExp.vue'
|
||||
import GrantResourceForm from './grantResourceForm.vue'
|
||||
import GrantPermissionForm from './grantPermissionForm.vue'
|
||||
|
||||
const columns = [
|
||||
const columns = [
|
||||
{
|
||||
title: '头像',
|
||||
dataIndex: 'avatar',
|
||||
align: 'center',
|
||||
width: '80px'
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'account',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'genderName',
|
||||
width: '50px'
|
||||
},
|
||||
{
|
||||
title: '手机',
|
||||
dataIndex: 'phone',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '机构',
|
||||
dataIndex: 'orgName',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '职位',
|
||||
dataIndex: 'positionName',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'userStatus',
|
||||
width: '80px'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: '220px'
|
||||
}
|
||||
]
|
||||
const statusData = tool.dictList('COMMON_STATUS')
|
||||
const searchFormRef = ref()
|
||||
const defaultExpandedKeys = ref([])
|
||||
const searchFormState = ref({})
|
||||
const tableRef = ref(null)
|
||||
const treeData = ref([])
|
||||
const selectedRowKeys = ref([])
|
||||
const treeFieldNames = {children: 'children', title: 'name', key: 'id'}
|
||||
const formRef = ref(null)
|
||||
const RoleSelectorPlusRef = ref()
|
||||
const selectedRecord = ref({})
|
||||
const loading = ref(false)
|
||||
const cardLoading = ref(true)
|
||||
const ImpExpRef = ref()
|
||||
const grantResourceFormRef = ref()
|
||||
const grantPermissionFormRef = ref()
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
return userApi.userPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 左侧树查询
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.orgId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.orgId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 修改状态
|
||||
const editStatus = (record) => {
|
||||
loading.value = true
|
||||
if (record.userStatus === 'ENABLE') {
|
||||
userApi
|
||||
.userDisableUser(record)
|
||||
.then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
userApi
|
||||
.userEnableUser(record)
|
||||
.then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
// 删除用户
|
||||
const removeUser = (record) => {
|
||||
let params = [
|
||||
{
|
||||
title: '头像',
|
||||
dataIndex: 'avatar',
|
||||
align: 'center',
|
||||
width: '80px'
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'account',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'genderName',
|
||||
width: '50px'
|
||||
},
|
||||
{
|
||||
title: '手机',
|
||||
dataIndex: 'phone',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '机构',
|
||||
dataIndex: 'orgName',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '职位',
|
||||
dataIndex: 'positionName',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'userStatus',
|
||||
width: '80px'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
width: '220px'
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
const statusData = tool.dictList('COMMON_STATUS')
|
||||
const searchFormRef = ref()
|
||||
const defaultExpandedKeys = ref([])
|
||||
const searchFormState = ref({})
|
||||
const tableRef = ref(null)
|
||||
const treeData = ref([])
|
||||
const selectedRowKeys = ref([])
|
||||
const treeFieldNames = { children: 'children', title: 'name', key: 'id' }
|
||||
const formRef = ref(null)
|
||||
const RoleSelectorPlusRef = ref()
|
||||
const selectedRecord = ref({})
|
||||
const loading = ref(false)
|
||||
const cardLoading = ref(true)
|
||||
const ImpExpRef = ref()
|
||||
const grantResourceFormRef = ref()
|
||||
const grantPermissionFormRef = ref()
|
||||
// 表格查询 返回 Promise 对象
|
||||
const loadData = (parameter) => {
|
||||
return userApi.userPage(Object.assign(parameter, searchFormState.value)).then((res) => {
|
||||
return res
|
||||
})
|
||||
}
|
||||
// 左侧树查询
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
userApi.userDelete(params).then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
show: false,
|
||||
clear: () => {
|
||||
selectedRowKeys.value = ref([])
|
||||
}
|
||||
},
|
||||
rowSelection: {
|
||||
onChange: (selectedRowKey, selectedRows) => {
|
||||
selectedRowKeys.value = selectedRowKey
|
||||
}
|
||||
}
|
||||
}
|
||||
// 批量导出校验并加参数
|
||||
const exportBatchUserVerify = () => {
|
||||
if ((selectedRowKeys.value.length < 1) & !searchFormState.value.searchKey & !searchFormState.value.userStatus) {
|
||||
message.warning('请输入查询条件或勾选要导出的信息')
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.orgId = selectedKeys.toString()
|
||||
} else {
|
||||
delete searchFormState.value.orgId
|
||||
}
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 修改状态
|
||||
const editStatus = (record) => {
|
||||
loading.value = true
|
||||
if (record.userStatus === 'ENABLE') {
|
||||
userApi
|
||||
.userDisableUser(record)
|
||||
.then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
userApi
|
||||
.userEnableUser(record)
|
||||
.then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
// 删除用户
|
||||
const removeUser = (record) => {
|
||||
let params = [
|
||||
{
|
||||
id: record.id
|
||||
}
|
||||
]
|
||||
userApi.userDelete(params).then(() => {
|
||||
tableRef.value.refresh()
|
||||
})
|
||||
}
|
||||
// 批量导出校验并加参数
|
||||
const exportBatchUserVerify = () => {
|
||||
if ((selectedRowKeys.value.length < 1) & !searchFormState.value.searchKey & !searchFormState.value.userStatus) {
|
||||
message.warning('请输入查询条件或勾选要导出的信息')
|
||||
}
|
||||
if (selectedRowKeys.value.length > 0) {
|
||||
const params = {
|
||||
userIds: selectedRowKeys.value
|
||||
.map((m) => {
|
||||
return m
|
||||
})
|
||||
.join()
|
||||
}
|
||||
exportBatchUser(params)
|
||||
return
|
||||
}
|
||||
if (searchFormState.value.searchKey || searchFormState.value.userStatus) {
|
||||
const params = {
|
||||
searchKey: searchFormState.value.searchKey,
|
||||
userStatus: searchFormState.value.userStatus
|
||||
}
|
||||
exportBatchUser(params)
|
||||
}
|
||||
}
|
||||
// 批量导出
|
||||
const exportBatchUser = (params) => {
|
||||
userApi.userExport(params).then((res) => {
|
||||
downloadUtil.resultDownload(res)
|
||||
tableRef.value.clearSelected()
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchUser = (params) => {
|
||||
userApi.userDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
// 打开角色选择器
|
||||
const selectRole = (record) => {
|
||||
selectedRecord.value = record
|
||||
// 查询到已有角色,并转为ids的格式,给角色选择器
|
||||
const param = {
|
||||
id: record.id
|
||||
}
|
||||
userApi.userOwnRole(param).then((data) => {
|
||||
RoleSelectorPlusRef.value.showModel(data)
|
||||
})
|
||||
}
|
||||
// 角色选择回调
|
||||
const roleBack = (value) => {
|
||||
let params = {
|
||||
id: selectedRecord.value.id,
|
||||
roleIdList: []
|
||||
}
|
||||
if (value.length > 0) {
|
||||
value.forEach((item) => {
|
||||
params.roleIdList.push(item)
|
||||
})
|
||||
}
|
||||
userApi.grantRole(params).then(() => {})
|
||||
}
|
||||
// 重置用户密码
|
||||
const resetPassword = (record) => {
|
||||
userApi.userResetPassword(record).then(() => {})
|
||||
}
|
||||
// 导出用户信息
|
||||
const exportUserInfo = (record) => {
|
||||
if (selectedRowKeys.value.length > 0) {
|
||||
const params = {
|
||||
id: record.id
|
||||
userIds: selectedRowKeys.value
|
||||
.map((m) => {
|
||||
return m
|
||||
})
|
||||
.join()
|
||||
}
|
||||
userApi.userExportUserInfo(params).then((res) => {
|
||||
downloadUtil.resultDownload(res)
|
||||
exportBatchUser(params)
|
||||
return
|
||||
}
|
||||
if (searchFormState.value.searchKey || searchFormState.value.userStatus) {
|
||||
const params = {
|
||||
searchKey: searchFormState.value.searchKey,
|
||||
userStatus: searchFormState.value.userStatus
|
||||
}
|
||||
exportBatchUser(params)
|
||||
}
|
||||
}
|
||||
// 批量导出
|
||||
const exportBatchUser = (params) => {
|
||||
userApi.userExport(params).then((res) => {
|
||||
downloadUtil.resultDownload(res)
|
||||
tableRef.value.clearSelected()
|
||||
})
|
||||
}
|
||||
// 批量删除
|
||||
const deleteBatchUser = (params) => {
|
||||
userApi.userDelete(params).then(() => {
|
||||
tableRef.value.clearRefreshSelected()
|
||||
})
|
||||
}
|
||||
// 打开角色选择器
|
||||
const selectRole = (record) => {
|
||||
selectedRecord.value = record
|
||||
// 查询到已有角色,并转为ids的格式,给角色选择器
|
||||
const param = {
|
||||
id: record.id
|
||||
}
|
||||
userApi.userOwnRole(param).then((data) => {
|
||||
RoleSelectorPlusRef.value.showModel(data)
|
||||
})
|
||||
}
|
||||
// 角色选择回调
|
||||
const roleBack = (value) => {
|
||||
let params = {
|
||||
id: selectedRecord.value.id,
|
||||
roleIdList: []
|
||||
}
|
||||
if (value.length > 0) {
|
||||
value.forEach((item) => {
|
||||
params.roleIdList.push(item)
|
||||
})
|
||||
}
|
||||
// 传递设计器需要的API
|
||||
const selectorApiFunction = {
|
||||
orgTreeApi: (param) => {
|
||||
return userApi.userOrgTreeSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
rolePageApi: (param) => {
|
||||
return userApi.userRoleSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
}
|
||||
userApi.grantRole(params).then(() => {
|
||||
})
|
||||
}
|
||||
// 重置用户密码
|
||||
const resetPassword = (record) => {
|
||||
userApi.userResetPassword(record).then(() => {
|
||||
})
|
||||
}
|
||||
// 导出用户信息
|
||||
const exportUserInfo = (record) => {
|
||||
const params = {
|
||||
id: record.id
|
||||
}
|
||||
userApi.userExportUserInfo(params).then((res) => {
|
||||
downloadUtil.resultDownload(res)
|
||||
})
|
||||
}
|
||||
// 传递设计器需要的API
|
||||
const selectorApiFunction = {
|
||||
orgTreeApi: (param) => {
|
||||
return userApi.userOrgTreeSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
rolePageApi: (param) => {
|
||||
return userApi.userRoleSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ant-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.snowy-table-avatar {
|
||||
margin-top: -10px;
|
||||
margin-bottom: -10px;
|
||||
}
|
||||
.snowy-button-left {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue