用户管理列表页增加同步组织人员按钮

用户管理列表页搜索用户可设置为全局搜索
This commit is contained in:
yaoyn
2024-03-27 17:29:18 +08:00
parent f4adcd3dff
commit d55f879846
2 changed files with 36 additions and 4 deletions

View File

@ -25,6 +25,7 @@ enum Api {
User = '/organization/user', User = '/organization/user',
MultiInfo = '/organization/user/info/multi', MultiInfo = '/organization/user/info/multi',
Password = '/organization/user/reset-password', Password = '/organization/user/reset-password',
syncOrgAndUser='/organization/syncOrgAndUser/fromDataCenter',
enabled = '/organization/user/enabled', enabled = '/organization/user/enabled',
Online = '/organization/user/online-users/page', Online = '/organization/user/online-users/page',
OffOnline = '/organization/user/offline-users', OffOnline = '/organization/user/offline-users',
@ -107,6 +108,20 @@ export async function resetUserPassword(id: String, mode: ErrorMessageMode = 'mo
}, },
); );
} }
/**
* @description: 同步部门人员
*/
export async function syncOrgAndUser(source: String, mode: ErrorMessageMode = 'modal') {
return defHttp.put(
{
url: Api.syncOrgAndUser,
data: { source },
},
{
errorMessageMode: mode,
},
);
}
/** /**
* @description: 更新用户 * @description: 更新用户

View File

@ -6,10 +6,13 @@
<a-button type="primary" v-auth="'user:add'" @click="handleCreate">{{ <a-button type="primary" v-auth="'user:add'" @click="handleCreate">{{
t('新增用户') t('新增用户')
}}</a-button> }}</a-button>
<a-button type="primary" v-auth="'user:resetPassword'" @click="handleReset">{{ <a-button type="default" v-auth="'user:resetPassword'" @click="handleReset">{{
t('重置密码') t('重置密码')
}}</a-button> }}</a-button>
<a-button type="primary" v-auth="'user:unlock'" @click="handleLock"> <a-button type="default" v-auth="'user:syncOrgAndUser'" @click="handleSync">{{
t('同步组织人员')
}}</a-button>
<a-button type="default" v-auth="'user:unlock'" @click="handleLock">
{{ lockText }} {{ lockText }}
</a-button> </a-button>
</template> </template>
@ -43,7 +46,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, h, ref, computed } from 'vue'; import { defineComponent, h, ref, computed } from 'vue';
import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table'; import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table';
import { getUserPageList, deleteUser, resetUserPassword, userEnabled } from '/@/api/system/user'; import { getUserPageList, deleteUser, resetUserPassword, userEnabled, syncOrgAndUser } from '/@/api/system/user';
import { PageWrapper } from '/@/components/Page'; import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
@ -54,6 +57,12 @@
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
const { t } = useI18n(); const { t } = useI18n();
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
field: 'isSearchAll',
label: t('全局搜索'),
component: 'Checkbox',
colProps: { style:'width:100px;' },
},
{ {
field: 'userName', field: 'userName',
label: t('用户名'), label: t('用户名'),
@ -172,7 +181,7 @@
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
//发送请求默认新增 左边树结构所选机构id //发送请求默认新增 左边树结构所选机构id
return { ...params, departmentId: selectDeptId.value }; return params.isSearchAll?{...params}:{ ...params, departmentId: selectDeptId.value };
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
@ -238,6 +247,13 @@
function handleCancel() { function handleCancel() {
isVisible.value = false; isVisible.value = false;
} }
function handleSync(){
syncOrgAndUser("fromDataCenter");
notification.success({
message: t('开始同步组织和人员,请稍后刷新页面查看结果'),
description: t('成功'),
});
}
function handleReset() { function handleReset() {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
notification.warning({ notification.warning({
@ -301,6 +317,7 @@
handleSuccess, handleSuccess,
handleSelect, handleSelect,
handleReset, handleReset,
handleSync,
handleLock, handleLock,
lockText, lockText,
handleCancel, handleCancel,