hookehuyr

fix

<!--
* @Date: 2023-11-01 10:18:53
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-11-22 13:43:23
* @LastEditTime: 2023-11-22 13:49:46
* @FilePath: /vue-flow-editor/doc/selectUserView.vue
* @Description: 成员列表选择控件
-->
......@@ -224,6 +224,7 @@ import { useRoute, useRouter } from "vue-router";
import axios from "./axios";
import $ from "jquery";
import _ from "lodash";
import { ElNotification, ElMessage, ElMessageBox } from 'element-plus'
const props = defineProps({
visible: Boolean
......@@ -238,7 +239,7 @@ const userTags = ref([]); // 现在只维护选中的用户列表,以它为基
const defaultExpandedKeys = ref([]); // 当前展开的节点
const currentNodeKey = ref([]); // 当前选中的节点
const currentCheckedNodeKey = ref([]); // 当前选中的节点
const activeTabId = ref("tab-corp"); // TODO: 需要获取默认第一个ID
const activeTabId = ref("tab-corp"); // 获取默认第一个ID
const activeTabIdx = ref(0); // 默认激活tab的index
const activeTabContent = ref("");
const userTabs = ref([
......@@ -289,16 +290,30 @@ const deptUserList = ref([]); // 部门用户列表
const roleList = ref([]); // 角色列表
onMounted(async () => {
// TAG:接口获取组织结构数据
// API获取后台数据
const dept_list = await getDeptList();
const role_list = await getRoleList();
if (dept_list.data.code) {
deptList.value = dept_list.data.data;
deptUserList.value = _.cloneDeep(dept_list.data.data);
} else {
ElMessage({
type: 'error',
message: dept_list.data.msg,
});
}
if (role_list.data.code) {
roleList.value = role_list.data.data;
} else {
ElMessage({
type: 'error',
message: role_list.data.msg,
});
}
// TODO: 查询到的用户选中列表数据,等待接口数据
userTags.value = [{ id: 35697, name: "西园寺" },{ id: 492081, name: "营员" }];
// Tabs菜单的完整数据结构
userTabs.value.forEach(item => {
if (item.type === 'corp-tree') {
item.data = deptList.value;
......@@ -310,8 +325,6 @@ onMounted(async () => {
item.data = roleList.value;
}
});
// TODO: 查询到的用户选中列表数据,等待接口数据
userTags.value = [{ id: 35697, name: "西园寺" },{ id: 492081, name: "营员" }];
// 第一项目是组织结构树,默认展开第一个节点
if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') {
if (userTabs.value[activeTabIdx.value]['data'].length) {
......@@ -326,7 +339,7 @@ onMounted(async () => {
});
watch(() => {
// TAG:监听弹框状态
// 监听弹框状态
if (props.visible) {
dialogUserFormVisible.value = true;
} else {
......@@ -335,7 +348,7 @@ watch(() => {
});
watch(
// TAG: watch dialogUserFormVisible.value 监听弹框显示,修改tab文字宽度
// watch dialogUserFormVisible.value 监听弹框显示,修改tab文字宽度
() => dialogUserFormVisible.value,
val => {
if (val) {
......@@ -539,7 +552,7 @@ const handleCheckedUserListChange = (user, checked) => {
// watch(
// // TAG: watch userTabs.value 监听数据结构选中值变化
// // watch userTabs.value 监听数据结构选中值变化
// () => userTabs.value,
// val => {
// if (val) {
......