分配添加部门

This commit is contained in:
2025-07-30 13:21:57 +08:00
parent ac43bcd1a8
commit 4ba1ab9c89
4 changed files with 53 additions and 6 deletions

View File

@@ -95,3 +95,7 @@ export const updateUserStatus = (id: number, status: number) => {
export const getSimpleUserList = (): Promise<UserVO[]> => {
return request.get({ url: '/system/user/simple-list' })
}
// 获取用户精简信息列表
export const getSimpleUserListPage = (params: PageParam): Promise<UserVO[]> => {
return request.get({ url: '/system/user/page', params })
}

View File

@@ -486,6 +486,7 @@ export default {
invitationType: 'Invitation Type',
placeInvitationType: 'Please select invitation type',
allocationUser: 'Assigned Employee',
placeAllocationDept: 'Please select assigned department',
placeAllocationUser: 'Please select assigned employee',
yesterdayCoins: 'YesterdayCoins',
search: 'Search',

View File

@@ -486,6 +486,7 @@ export default {
invitationType: '邀请类型',
placeInvitationType: '请选择邀请类型',
allocationUser: '分配员工',
placeAllocationDept: '请选择部门',
placeAllocationUser: '请选择分配的员工',
yesterdayCoins: '昨日金币',
search: '搜索',

View File

@@ -201,10 +201,16 @@
<!-- <div style="padding: 0px 0px 30px 0px ;">
<el-alert title="分配成功数量可能会小于选择数量同id主播无法被重复分配" type="warning" />
</div> -->
<el-select v-model="allocationUser" :placeholder="t('newHosts.placeAllocationUser')" clearable>
<el-option v-for="(user, index) in allocationUserList" :key="index" :label="user.label" :value="user.value" />
</el-select>
<div style="display: flex;">
<el-select v-if="wsCache.get('roleRouters').find(item => item.id === 1).children.find(item => item.id === 103)"
v-model="allocationDept" :placeholder="t('newHosts.placeAllocationDept')" clearable
@change="getAllocationUserList">
<el-option v-for="(dept, index) in allocationdeptList" :key="index" :label="dept.name" :value="dept.id" />
</el-select>
<el-select v-model="allocationUser" :placeholder="t('newHosts.placeAllocationUser')" clearable>
<el-option v-for="(user, index) in allocationUserList" :key="index" :label="user.label" :value="user.value" />
</el-select>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogAllocation = false">{{ t('newHosts.cancel') }}</el-button>
@@ -224,12 +230,14 @@ import { getIntDictOptions, DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { NewHostsApi, NewHostsVO } from '@/api/server/newhosts'
import { getAllocation, getSimpleUserList } from '@/api/system/user'
import { getAllocation, getSimpleUserList, getSimpleUserListPage } from '@/api/system/user'
import NewHostsForm from './NewHostsForm.vue'
import { useCache } from '@/hooks/web/useCache'
import * as DeptApi from '@/api/system/dept'
import { func } from 'vue-types'
const { wsCache } = useCache()
// console.log("===================================", wsCache.get('roleRouters').find(item => item.id === 1).children)
/** 主播数据管理 列表 */
defineOptions({ name: 'NewHosts' })
@@ -265,12 +273,19 @@ const exportLoading = ref(false) // 导出的加载中
let dialogAllocation = ref(false)//分配弹窗
let selectHostList = ref([]) //选中的主播列表
let allocationUser = ref('') //选中的分配用户
let allocationDept = ref('') //选中的分配部门
let allocationUserList = ref([
{
label: '分配用户1',
value: 1
}
]) //选中的分配用户
let allocationdeptList = ref([
{
name: '分配用户1',
id: 1
}
]) //选中的分配部门
/** 查询列表 */
const getList = async () => {
@@ -308,6 +323,28 @@ const getAllocationList = async () => {
loading.value = false
}
}
const getAllocationUserList = async () => {
const data = await getSimpleUserListPage({ pageSize: 1000, pageNo: 1, deptId: allocationDept.value })
allocationUserList.value = []
console.log("----------------------------------------------------", data.list)
data.list.forEach((item) => {
allocationUserList.value.push({
label: item.nickname,
value: item.id
})
})
}
/** 查询部门 */
const getAlldeptList = async () => {
loading.value = true
try {
const data = await DeptApi.getDeptPage(queryParams)
allocationdeptList.value = data
// console.log('=========================================', allocationdeptList)
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
@@ -435,5 +472,9 @@ function handleCopy(text) {
onMounted(() => {
getList()
getAllocationList();
if (wsCache.get('roleRouters').find(item => item.id === 1).children.find(item => item.id === 103)) {
getAlldeptList();
}
})
</script>