|
@@ -16,6 +16,7 @@
|
|
|
<el-table ref="departmentTable" v-loading="loading" :data="deptList" row-key="id" height="100%" :indent="20" default-expand-all highlight-current-row @current-change="handleGetUser">
|
|
|
<el-table-column label="行号" type="index" width="50" align="center" />
|
|
|
<el-table-column label="部门名称" prop="label" header-align="center" />
|
|
|
+ <el-table-column label="部门编码" prop="deptCode" align="center" />
|
|
|
<el-table-column label="是否企业" prop="deptType" width="70" align="center">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="dept_type" :value="scope.row.deptType" />
|
|
@@ -54,10 +55,10 @@
|
|
|
<el-table v-loading="loading" :data="userList" row-key="id" height="100%" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
|
<el-table-column type="index" label="行号" width="50" align="center" />
|
|
|
- <el-table-column label="员工编码" width="100" prop="userName" align="center" />
|
|
|
- <el-table-column label="员工姓名" width="100" prop="nickName" align="center" />
|
|
|
- <el-table-column label="性别" width="50" prop="sex" align="center" />
|
|
|
- <el-table-column label="手机号码" width="120" prop="phoneNumber" align="center" />
|
|
|
+ <el-table-column label="员工编码" width="100" prop="user.userName" align="center" />
|
|
|
+ <el-table-column label="员工姓名" width="100" prop="user.nickName" align="center" />
|
|
|
+ <el-table-column label="性别" width="50" prop="user.sex" align="center" />
|
|
|
+ <el-table-column label="手机号码" width="120" prop="user.phoneNumber" align="center" />
|
|
|
<el-table-column label="部门负责人" width="90" align="center">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="yesOrNo" :value="scope.row.isLeader" />
|
|
@@ -99,7 +100,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Process">
|
|
|
-import { getUsersByDeptId, saveDeptUser, deptTreeSelect, delDeptUser } from '@/api/system/user'
|
|
|
+import { getUsersByDeptId, saveDeptUser, deptTreeSelect, delDeptUser,getDeptUser,getUsersItemByDeptId} from '@/api/system/user'
|
|
|
import { delDept, getDept } from '@/api/system/dept'
|
|
|
import deptForm from './form'
|
|
|
import userForm from './formUser'
|
|
@@ -111,6 +112,7 @@ const { work_section_status } = proxy.useDict('work_section_status')
|
|
|
|
|
|
const deptList = ref([])
|
|
|
const userList = ref([])
|
|
|
+const userInfoList = ref([])
|
|
|
const loading = ref(true)
|
|
|
const ids = ref([])
|
|
|
const deptName = ref('')
|
|
@@ -162,27 +164,23 @@ const openUser = () => {
|
|
|
function handleAddBatchUsers() {
|
|
|
multiple.value = true
|
|
|
const userInfo = {}
|
|
|
- const userListIds = []
|
|
|
- for (let i = 0; i < userList.value.length; i++) {
|
|
|
- userListIds.push(userList.value[i].userName)
|
|
|
- }
|
|
|
userInfo.identifying = true
|
|
|
- userInfo.userListIds = userListIds
|
|
|
userInfo.deptId = currentDept.value.id
|
|
|
proxy.$refs.personRef.open(userInfo)
|
|
|
}
|
|
|
|
|
|
function handleMultipleSelected(selection) {
|
|
|
- const newList = []
|
|
|
+ var newList = []
|
|
|
for (var i = 0; i < selection.length; ++i) {
|
|
|
- const newPerson = {}
|
|
|
+ var newPerson = {}
|
|
|
|
|
|
newPerson.userId = selection[i].userId
|
|
|
newPerson.deptId = currentDept.value.id
|
|
|
|
|
|
- userList.value.push(newPerson)
|
|
|
+ newList.push(newPerson)
|
|
|
+
|
|
|
}
|
|
|
- saveDeptUser(userList.value).then((response) => {
|
|
|
+ saveDeptUser(newList).then((response) => {
|
|
|
if (response.code == 200) {
|
|
|
proxy.$modal.msgSuccess('操作成功')
|
|
|
handleGetUser(currentDept.value)
|
|
@@ -192,14 +190,9 @@ function handleMultipleSelected(selection) {
|
|
|
|
|
|
// 多选框选中数据
|
|
|
function handleSelectionChange(selection) {
|
|
|
- for (var i = 0; i < selection.length; ++i) {
|
|
|
- var newDeptUser = {}
|
|
|
- newDeptUser.userId = selection[i].userId
|
|
|
- newDeptUser.deptId = currentDept.value.id
|
|
|
- deptUser.value.push(newDeptUser)
|
|
|
- }
|
|
|
-
|
|
|
- ids.value = selection.map((item) => item.id)
|
|
|
+ ids.value = selection.map((item) => {
|
|
|
+ return { userId: item.userId, deptId: currentDept.value.id };
|
|
|
+});
|
|
|
single.value = selection.length != 1
|
|
|
multiple.value = !selection.length
|
|
|
}
|
|
@@ -219,14 +212,15 @@ function handleUpdate(row) {
|
|
|
function handleGetUser(row) {
|
|
|
if (row) {
|
|
|
currentDept.value = row
|
|
|
+ console.log(row)
|
|
|
}
|
|
|
- getUsers()
|
|
|
+ getUserList()
|
|
|
}
|
|
|
|
|
|
/** 获取员工列表 */
|
|
|
function getUsers() {
|
|
|
queryParams.value.deptId = currentDept.value.id
|
|
|
- getUsersByDeptId(queryParams.value).then((response) => {
|
|
|
+ getDeptUser(queryParams.value).then((response) => {
|
|
|
if (response.code == 200) {
|
|
|
userList.value = response.rows
|
|
|
total.value = response.total
|
|
@@ -235,12 +229,15 @@ function getUsers() {
|
|
|
}
|
|
|
|
|
|
function getUserList() {
|
|
|
- getUsersByDeptId(queryParams.value).then((response) => {
|
|
|
+ queryParams.value.deptId = currentDept.value.id
|
|
|
+
|
|
|
+ getDeptUser(queryParams.value).then((response) => {
|
|
|
if (response.code == 200) {
|
|
|
userList.value = response.rows
|
|
|
total.value = response.total
|
|
|
}
|
|
|
})
|
|
|
+ console.log(currentDept.value)
|
|
|
}
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
@@ -268,13 +265,14 @@ function handleDelete(row) {
|
|
|
}
|
|
|
/** 人员删除按钮操作 */
|
|
|
function handleUserDelete(row) {
|
|
|
+ console.log(ids.value)
|
|
|
proxy.$modal
|
|
|
.confirm('是否确认删除选中的数据项?')
|
|
|
.then(function () {
|
|
|
- return delDeptUser(deptUser.value)
|
|
|
+ return delDeptUser(ids.value)
|
|
|
})
|
|
|
.then(() => {
|
|
|
- getList()
|
|
|
+ handleGetUser(currentDept.value)
|
|
|
proxy.$modal.msgSuccess('删除成功!')
|
|
|
})
|
|
|
.catch(() => {})
|