|
|
@@ -107,14 +107,22 @@
|
|
|
<div class="form-group">
|
|
|
<label>{{ $t("lang.OrganizationEditPanel.departmentManager") }}</label>
|
|
|
<div>
|
|
|
- <v-select
|
|
|
- id="departmentManagerSelect"
|
|
|
- v-model="organization.managerUsers"
|
|
|
- multiple
|
|
|
- label="name"
|
|
|
+ <a-select
|
|
|
+ v-model:value="organization.userIds"
|
|
|
+ style="width: 100%"
|
|
|
+ mode="multiple"
|
|
|
+ :filter-option="false"
|
|
|
+ :field-names="{ label: 'text', value: 'id' }"
|
|
|
+ :not-found-content="fetching ? undefined : null"
|
|
|
:options="userList"
|
|
|
- @search="fetchUserList"
|
|
|
- />
|
|
|
+ show-search
|
|
|
+ @search="fetchUser"
|
|
|
+ @change="getOrgUsers"
|
|
|
+ >
|
|
|
+ <template v-if="fetching" #notFoundContent>
|
|
|
+ <a-spin size="small" />
|
|
|
+ </template>
|
|
|
+ </a-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
@@ -163,14 +171,22 @@
|
|
|
<div class="form-group">
|
|
|
<label>{{ $t("lang.OrganizationEditPanel.departmentManager") }}</label>
|
|
|
<div>
|
|
|
- <v-select
|
|
|
- id="departmentManagerSelect"
|
|
|
- v-model="client.managerUsers"
|
|
|
- multiple
|
|
|
- label="name"
|
|
|
+ <a-select
|
|
|
+ v-model:value="client.userIds"
|
|
|
+ style="width: 100%"
|
|
|
+ mode="multiple"
|
|
|
+ :filter-option="false"
|
|
|
+ :field-names="{ label: 'text', value: 'id' }"
|
|
|
+ :not-found-content="fetching ? undefined : null"
|
|
|
:options="userList"
|
|
|
- @search="fetchUserList"
|
|
|
- />
|
|
|
+ show-search
|
|
|
+ @search="fetchUser"
|
|
|
+ @change="getClientUsers"
|
|
|
+ >
|
|
|
+ <template v-if="fetching" #notFoundContent>
|
|
|
+ <a-spin size="small" />
|
|
|
+ </template>
|
|
|
+ </a-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
@@ -182,8 +198,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import vSelect from 'vue-select';
|
|
|
-import 'vue-select/dist/vue-select.css';
|
|
|
import Common from '../common/Common.js';
|
|
|
import { Notify } from 'pc-component-v3';
|
|
|
import { ref, onMounted, getCurrentInstance } from 'vue';
|
|
|
@@ -223,9 +237,24 @@ const superiorDepartment = ref('');
|
|
|
const organizations = ref([]);
|
|
|
const oldParentId = ref('');
|
|
|
const oldParentName = ref('');
|
|
|
+const fetching = ref(false);
|
|
|
onMounted(() => {
|
|
|
getComponyInfo();
|
|
|
});
|
|
|
+
|
|
|
+const fetchUser = Common.debounce(value => {
|
|
|
+ userList.value = [];
|
|
|
+ fetching.value = true;
|
|
|
+ fetchUserList(value);
|
|
|
+}, 500);
|
|
|
+
|
|
|
+const getOrgUsers = (_, list) => {
|
|
|
+ organization.value.managerUsers = list;
|
|
|
+};
|
|
|
+const getClientUsers = (_, list) => {
|
|
|
+ client.value.managerUsers = list;
|
|
|
+};
|
|
|
+
|
|
|
// 获取公司名称id
|
|
|
const getComponyInfo = () => {
|
|
|
companies.value = [];
|
|
|
@@ -262,6 +291,10 @@ const editClient = () => {
|
|
|
if (success.errorCode == 0) {
|
|
|
fetchUserList();
|
|
|
client.value = success.data;
|
|
|
+ client.value.userIds = [];
|
|
|
+ success.data.managerUsers.forEach(user => {
|
|
|
+ client.value.userIds.push(user.id);
|
|
|
+ });
|
|
|
} else {
|
|
|
message.error(success.errorMessage);
|
|
|
}
|
|
|
@@ -408,8 +441,12 @@ const editOrganization = (flag, id) => {
|
|
|
drawerTitle.value = '编辑部门';
|
|
|
loadOrganization(id).then(
|
|
|
success => {
|
|
|
+ organization.value = success.data;
|
|
|
+ organization.value.userIds = [];
|
|
|
if (success.errorCode == 0) {
|
|
|
- organization.value = success.data;
|
|
|
+ success.data.managerUsers.forEach(user => {
|
|
|
+ organization.value.userIds.push(user.id);
|
|
|
+ });
|
|
|
oldParentName.value = success.data.parentName;
|
|
|
oldParentId.value = success.data.parentId;
|
|
|
fetchUserList();
|
|
|
@@ -496,32 +533,66 @@ const deleteOrganization = id => {
|
|
|
};
|
|
|
|
|
|
// 部门管理员输入的过滤条件发生改变
|
|
|
-const fetchUserList = (search, loading) => {
|
|
|
- if (loading != null) {
|
|
|
- loading(true);
|
|
|
- }
|
|
|
- let searchQueryParam = {
|
|
|
- conditional: search,
|
|
|
+const fetchUserList = value => {
|
|
|
+ const params = {
|
|
|
range: {
|
|
|
start: 0,
|
|
|
- length: 100,
|
|
|
+ length: 1000,
|
|
|
},
|
|
|
+ conditional: value,
|
|
|
};
|
|
|
- getUsersByName(searchQueryParam).then(
|
|
|
+ getUsersByName(params).then(
|
|
|
successData => {
|
|
|
- if (loading != null) {
|
|
|
- loading(false);
|
|
|
+ if (successData && successData.resultList) {
|
|
|
+ successData.resultList.forEach(function (user) {
|
|
|
+ if (user.no) {
|
|
|
+ user.text = user.name + '(' + user.no + ')';
|
|
|
+ if (user.organizations && user.organizations.length > 0) {
|
|
|
+ user.organizations.forEach(item => {
|
|
|
+ user.text = user.text + '(' + item.organizationName + ')';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ user.text = user.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ userList.value = successData.resultList;
|
|
|
+ } else {
|
|
|
+ userList.value = [];
|
|
|
}
|
|
|
- userList.value = successData.resultList;
|
|
|
+ fetching.value = false;
|
|
|
},
|
|
|
errorData => {
|
|
|
- if (loading != null) {
|
|
|
- loading(false);
|
|
|
- }
|
|
|
-
|
|
|
+ fetching.value = false;
|
|
|
Common.processException(errorData);
|
|
|
},
|
|
|
);
|
|
|
+
|
|
|
+ // if (loading != null) {
|
|
|
+ // loading(true);
|
|
|
+ // }
|
|
|
+ // let searchQueryParam = {
|
|
|
+ // conditional: search,
|
|
|
+ // range: {
|
|
|
+ // start: 0,
|
|
|
+ // length: 100,
|
|
|
+ // },
|
|
|
+ // };
|
|
|
+ // getUsersByName(searchQueryParam).then(
|
|
|
+ // (successData) => {
|
|
|
+ // if (loading != null) {
|
|
|
+ // loading(false);
|
|
|
+ // }
|
|
|
+ // userList.value = successData.resultList;
|
|
|
+ // },
|
|
|
+ // (errorData) => {
|
|
|
+ // if (loading != null) {
|
|
|
+ // loading(false);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // Common.processException(errorData);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
};
|
|
|
|
|
|
// 上级部门change事件
|