Showing
1 changed file
with
21 additions
and
8 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-11-01 10:18:53 | 2 | * @Date: 2023-11-01 10:18:53 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-11-22 13:43:23 | 4 | + * @LastEditTime: 2023-11-22 13:49:46 |
| 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue | 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue |
| 6 | * @Description: 成员列表选择控件 | 6 | * @Description: 成员列表选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -224,6 +224,7 @@ import { useRoute, useRouter } from "vue-router"; | ... | @@ -224,6 +224,7 @@ import { useRoute, useRouter } from "vue-router"; |
| 224 | import axios from "./axios"; | 224 | import axios from "./axios"; |
| 225 | import $ from "jquery"; | 225 | import $ from "jquery"; |
| 226 | import _ from "lodash"; | 226 | import _ from "lodash"; |
| 227 | +import { ElNotification, ElMessage, ElMessageBox } from 'element-plus' | ||
| 227 | 228 | ||
| 228 | const props = defineProps({ | 229 | const props = defineProps({ |
| 229 | visible: Boolean | 230 | visible: Boolean |
| ... | @@ -238,7 +239,7 @@ const userTags = ref([]); // 现在只维护选中的用户列表,以它为基 | ... | @@ -238,7 +239,7 @@ const userTags = ref([]); // 现在只维护选中的用户列表,以它为基 |
| 238 | const defaultExpandedKeys = ref([]); // 当前展开的节点 | 239 | const defaultExpandedKeys = ref([]); // 当前展开的节点 |
| 239 | const currentNodeKey = ref([]); // 当前选中的节点 | 240 | const currentNodeKey = ref([]); // 当前选中的节点 |
| 240 | const currentCheckedNodeKey = ref([]); // 当前选中的节点 | 241 | const currentCheckedNodeKey = ref([]); // 当前选中的节点 |
| 241 | -const activeTabId = ref("tab-corp"); // TODO: 需要获取默认第一个ID | 242 | +const activeTabId = ref("tab-corp"); // 获取默认第一个ID |
| 242 | const activeTabIdx = ref(0); // 默认激活tab的index | 243 | const activeTabIdx = ref(0); // 默认激活tab的index |
| 243 | const activeTabContent = ref(""); | 244 | const activeTabContent = ref(""); |
| 244 | const userTabs = ref([ | 245 | const userTabs = ref([ |
| ... | @@ -289,16 +290,30 @@ const deptUserList = ref([]); // 部门用户列表 | ... | @@ -289,16 +290,30 @@ const deptUserList = ref([]); // 部门用户列表 |
| 289 | const roleList = ref([]); // 角色列表 | 290 | const roleList = ref([]); // 角色列表 |
| 290 | 291 | ||
| 291 | onMounted(async () => { | 292 | onMounted(async () => { |
| 292 | - // TAG:接口获取组织结构数据 | 293 | + |
| 294 | + // API获取后台数据 | ||
| 293 | const dept_list = await getDeptList(); | 295 | const dept_list = await getDeptList(); |
| 294 | const role_list = await getRoleList(); | 296 | const role_list = await getRoleList(); |
| 295 | if (dept_list.data.code) { | 297 | if (dept_list.data.code) { |
| 296 | deptList.value = dept_list.data.data; | 298 | deptList.value = dept_list.data.data; |
| 297 | deptUserList.value = _.cloneDeep(dept_list.data.data); | 299 | deptUserList.value = _.cloneDeep(dept_list.data.data); |
| 300 | + } else { | ||
| 301 | + ElMessage({ | ||
| 302 | + type: 'error', | ||
| 303 | + message: dept_list.data.msg, | ||
| 304 | + }); | ||
| 298 | } | 305 | } |
| 299 | if (role_list.data.code) { | 306 | if (role_list.data.code) { |
| 300 | roleList.value = role_list.data.data; | 307 | roleList.value = role_list.data.data; |
| 308 | + } else { | ||
| 309 | + ElMessage({ | ||
| 310 | + type: 'error', | ||
| 311 | + message: role_list.data.msg, | ||
| 312 | + }); | ||
| 301 | } | 313 | } |
| 314 | + // TODO: 查询到的用户选中列表数据,等待接口数据 | ||
| 315 | + userTags.value = [{ id: 35697, name: "西园寺" },{ id: 492081, name: "营员" }]; | ||
| 316 | + // Tabs菜单的完整数据结构 | ||
| 302 | userTabs.value.forEach(item => { | 317 | userTabs.value.forEach(item => { |
| 303 | if (item.type === 'corp-tree') { | 318 | if (item.type === 'corp-tree') { |
| 304 | item.data = deptList.value; | 319 | item.data = deptList.value; |
| ... | @@ -310,8 +325,6 @@ onMounted(async () => { | ... | @@ -310,8 +325,6 @@ onMounted(async () => { |
| 310 | item.data = roleList.value; | 325 | item.data = roleList.value; |
| 311 | } | 326 | } |
| 312 | }); | 327 | }); |
| 313 | - // TODO: 查询到的用户选中列表数据,等待接口数据 | ||
| 314 | - userTags.value = [{ id: 35697, name: "西园寺" },{ id: 492081, name: "营员" }]; | ||
| 315 | // 第一项目是组织结构树,默认展开第一个节点 | 328 | // 第一项目是组织结构树,默认展开第一个节点 |
| 316 | if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') { | 329 | if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') { |
| 317 | if (userTabs.value[activeTabIdx.value]['data'].length) { | 330 | if (userTabs.value[activeTabIdx.value]['data'].length) { |
| ... | @@ -326,7 +339,7 @@ onMounted(async () => { | ... | @@ -326,7 +339,7 @@ onMounted(async () => { |
| 326 | }); | 339 | }); |
| 327 | 340 | ||
| 328 | watch(() => { | 341 | watch(() => { |
| 329 | - // TAG:监听弹框状态 | 342 | + // 监听弹框状态 |
| 330 | if (props.visible) { | 343 | if (props.visible) { |
| 331 | dialogUserFormVisible.value = true; | 344 | dialogUserFormVisible.value = true; |
| 332 | } else { | 345 | } else { |
| ... | @@ -335,7 +348,7 @@ watch(() => { | ... | @@ -335,7 +348,7 @@ watch(() => { |
| 335 | }); | 348 | }); |
| 336 | 349 | ||
| 337 | watch( | 350 | watch( |
| 338 | - // TAG: watch dialogUserFormVisible.value 监听弹框显示,修改tab文字宽度 | 351 | + // watch dialogUserFormVisible.value 监听弹框显示,修改tab文字宽度 |
| 339 | () => dialogUserFormVisible.value, | 352 | () => dialogUserFormVisible.value, |
| 340 | val => { | 353 | val => { |
| 341 | if (val) { | 354 | if (val) { |
| ... | @@ -539,7 +552,7 @@ const handleCheckedUserListChange = (user, checked) => { | ... | @@ -539,7 +552,7 @@ const handleCheckedUserListChange = (user, checked) => { |
| 539 | 552 | ||
| 540 | 553 | ||
| 541 | // watch( | 554 | // watch( |
| 542 | -// // TAG: watch userTabs.value 监听数据结构选中值变化 | 555 | +// // watch userTabs.value 监听数据结构选中值变化 |
| 543 | // () => userTabs.value, | 556 | // () => userTabs.value, |
| 544 | // val => { | 557 | // val => { |
| 545 | // if (val) { | 558 | // if (val) { | ... | ... |
-
Please register or login to post a comment