Showing
1 changed file
with
76 additions
and
3 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-15 17:27:42 | 4 | + * @LastEditTime: 2023-11-16 17:46:07 |
| 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue | 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue |
| 6 | * @Description: 成员列表选择控件 | 6 | * @Description: 成员列表选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -81,6 +81,25 @@ | ... | @@ -81,6 +81,25 @@ |
| 81 | <!-- 未激活搜索框 --> | 81 | <!-- 未激活搜索框 --> |
| 82 | <div v-if="!is_active_search"> | 82 | <div v-if="!is_active_search"> |
| 83 | <div v-for="(item, index) in userTabs" :key="index"> | 83 | <div v-for="(item, index) in userTabs" :key="index"> |
| 84 | + <div v-if="item.id === activeTabId && item.type === 'select'"> | ||
| 85 | + <el-row> | ||
| 86 | + <el-col :span="24"> | ||
| 87 | + <el-checkbox-group | ||
| 88 | + class="flow-checkbox-group" | ||
| 89 | + v-model="checkedUserList" | ||
| 90 | + > | ||
| 91 | + <el-checkbox | ||
| 92 | + v-for="(user, idx) in userList" | ||
| 93 | + :key="idx" | ||
| 94 | + :label="user.id" | ||
| 95 | + :disabled="user.disabled" | ||
| 96 | + @change="handleCheckedUserListChange(user, $event)" | ||
| 97 | + >{{ user.label }}</el-checkbox | ||
| 98 | + > | ||
| 99 | + </el-checkbox-group> | ||
| 100 | + </el-col> | ||
| 101 | + </el-row> | ||
| 102 | + </div> | ||
| 84 | <div v-if="item.id === activeTabId && item.type === 'tree'"> | 103 | <div v-if="item.id === activeTabId && item.type === 'tree'"> |
| 85 | <el-row> | 104 | <el-row> |
| 86 | <el-col :span="8"> | 105 | <el-col :span="8"> |
| ... | @@ -186,7 +205,7 @@ const emit = defineEmits(["close", "confirm"]); | ... | @@ -186,7 +205,7 @@ const emit = defineEmits(["close", "confirm"]); |
| 186 | const dialogUserFormVisible = ref(false); | 205 | const dialogUserFormVisible = ref(false); |
| 187 | const userTags = ref([]); | 206 | const userTags = ref([]); |
| 188 | const currentNodeKey = ref([]); // 当前展开的节点 | 207 | const currentNodeKey = ref([]); // 当前展开的节点 |
| 189 | -const activeTabId = ref("tab-1"); // TODO: 需要获取默认第一个ID | 208 | +const activeTabId = ref("tab-0"); // TODO: 需要获取默认第一个ID |
| 190 | const activeTabContent = ref(""); | 209 | const activeTabContent = ref(""); |
| 191 | const userTabs = ref([]); | 210 | const userTabs = ref([]); |
| 192 | const tabSelectData = ref([]); | 211 | const tabSelectData = ref([]); |
| ... | @@ -216,8 +235,28 @@ onMounted(() => { | ... | @@ -216,8 +235,28 @@ onMounted(() => { |
| 216 | // TODO: 查询到的用户列表数据 | 235 | // TODO: 查询到的用户列表数据 |
| 217 | userTabs.value = [ | 236 | userTabs.value = [ |
| 218 | { | 237 | { |
| 238 | + id: "tab-0", | ||
| 239 | + label: "组织结构", | ||
| 240 | + type: "select", | ||
| 241 | + data: [ | ||
| 242 | + { | ||
| 243 | + id: "corp-1", | ||
| 244 | + label: "", | ||
| 245 | + children: [], | ||
| 246 | + list: [ | ||
| 247 | + { | ||
| 248 | + id: "corp-1-1", | ||
| 249 | + label: "组织结构1-1", | ||
| 250 | + checked: false, | ||
| 251 | + disabled: false | ||
| 252 | + } | ||
| 253 | + ] | ||
| 254 | + }, | ||
| 255 | + ] | ||
| 256 | + }, | ||
| 257 | + { | ||
| 219 | id: "tab-1", | 258 | id: "tab-1", |
| 220 | - label: "组织架构", | 259 | + label: "成员", |
| 221 | type: "tree", | 260 | type: "tree", |
| 222 | data: [ | 261 | data: [ |
| 223 | { | 262 | { |
| ... | @@ -345,6 +384,23 @@ watch(() => { | ... | @@ -345,6 +384,23 @@ watch(() => { |
| 345 | // 监听弹框状态 | 384 | // 监听弹框状态 |
| 346 | if (props.visible) { | 385 | if (props.visible) { |
| 347 | dialogUserFormVisible.value = true; | 386 | dialogUserFormVisible.value = true; |
| 387 | + // 第一个类型为多选,获取类型为多选的数据结构 | ||
| 388 | + if (userTabs.value[0]['type'] === 'select') { | ||
| 389 | + userTabs.value.forEach(ele => { | ||
| 390 | + if (ele.type === "select") { | ||
| 391 | + ele.data.forEach(ele => { | ||
| 392 | + userList.value = ele.list; | ||
| 393 | + checkedUserList.value = ele.list | ||
| 394 | + .filter(ele => { | ||
| 395 | + return ele.checked; | ||
| 396 | + }) | ||
| 397 | + .map(ele => { | ||
| 398 | + return ele.id; | ||
| 399 | + }); | ||
| 400 | + }); | ||
| 401 | + } | ||
| 402 | + }); | ||
| 403 | + } | ||
| 348 | } else { | 404 | } else { |
| 349 | dialogUserFormVisible.value = false; | 405 | dialogUserFormVisible.value = false; |
| 350 | } | 406 | } |
| ... | @@ -374,6 +430,23 @@ const handleTabClick = (tab, event, idx) => { | ... | @@ -374,6 +430,23 @@ const handleTabClick = (tab, event, idx) => { |
| 374 | } | 430 | } |
| 375 | // 文字宽度 | 431 | // 文字宽度 |
| 376 | tabTextWidth.value = $("#" + tab.id).width() + "px"; | 432 | tabTextWidth.value = $("#" + tab.id).width() + "px"; |
| 433 | + // 获取类型为多选的数据结构 | ||
| 434 | + if (tab.type === 'select') { | ||
| 435 | + userTabs.value.forEach(ele => { | ||
| 436 | + if (ele.type === "select") { | ||
| 437 | + ele.data.forEach(ele => { | ||
| 438 | + userList.value = ele.list; | ||
| 439 | + checkedUserList.value = ele.list | ||
| 440 | + .filter(ele => { | ||
| 441 | + return ele.checked; | ||
| 442 | + }) | ||
| 443 | + .map(ele => { | ||
| 444 | + return ele.id; | ||
| 445 | + }); | ||
| 446 | + }); | ||
| 447 | + } | ||
| 448 | + }); | ||
| 449 | + } | ||
| 377 | // 检查列表第一项是否有值 | 450 | // 检查列表第一项是否有值 |
| 378 | // if (tab?.data[0]?.list) { | 451 | // if (tab?.data[0]?.list) { |
| 379 | // let list = tab.data[0].list; | 452 | // let list = tab.data[0].list; | ... | ... |
-
Please register or login to post a comment