Showing
2 changed files
with
42 additions
and
5 deletions
| ... | @@ -109,7 +109,15 @@ | ... | @@ -109,7 +109,15 @@ |
| 109 | <el-icon v-if="tag.type === 'dept'" style="height: 13px; display: inline-block; vertical-align: middle; line-height: 10px;"><House /></el-icon> | 109 | <el-icon v-if="tag.type === 'dept'" style="height: 13px; display: inline-block; vertical-align: middle; line-height: 10px;"><House /></el-icon> |
| 110 | <el-icon v-if="tag.type === 'role'" style="height: 12px; display: inline-block; vertical-align: middle; line-height: 10px;"><Female /></el-icon> | 110 | <el-icon v-if="tag.type === 'role'" style="height: 12px; display: inline-block; vertical-align: middle; line-height: 10px;"><Female /></el-icon> |
| 111 | <el-icon v-if="tag.type === 'user'" style="height: 12px; display: inline-block; vertical-align: middle; line-height: 10px;"><User /></el-icon> | 111 | <el-icon v-if="tag.type === 'user'" style="height: 12px; display: inline-block; vertical-align: middle; line-height: 10px;"><User /></el-icon> |
| 112 | - <span style="margin-left: 2px; height: 10px; display: inline-block; vertical-align: middle; line-height: 10px;">{{ tag.name }}</span> | 112 | + <span style="margin-left: 2px; height: 10px; display: inline-block; vertical-align: middle; line-height: 10px;"> |
| 113 | + <span>{{ tag.name }}</span> | ||
| 114 | + <span v-if="tag?.role_list?.length">/ | ||
| 115 | + <span v-for="(role, index) in tag?.role_list" :key="role.id"> | ||
| 116 | + {{ role.name }} | ||
| 117 | + <span v-if="index !== (tag?.role_list?.length - 1)">,</span> | ||
| 118 | + </span> | ||
| 119 | + </span> | ||
| 120 | + </span> | ||
| 113 | </el-tag> | 121 | </el-tag> |
| 114 | <div v-else class="text-empty">请选择成员</div> | 122 | <div v-else class="text-empty">请选择成员</div> |
| 115 | </div> | 123 | </div> | ... | ... |
| 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: 2024-07-25 13:47:43 | 4 | + * @LastEditTime: 2024-07-30 16:28:12 |
| 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue | 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue |
| 6 | * @Description: 成员列表选择控件 | 6 | * @Description: 成员列表选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -23,7 +23,15 @@ | ... | @@ -23,7 +23,15 @@ |
| 23 | <el-icon v-if="tag.type === 'dept'" style="display: inline-block; vertical-align: middle; height: 13px;"><House /></el-icon> | 23 | <el-icon v-if="tag.type === 'dept'" style="display: inline-block; vertical-align: middle; height: 13px;"><House /></el-icon> |
| 24 | <el-icon v-if="tag.type === 'role'" style="display: inline-block; vertical-align: middle; height: 12px;"><Female /></el-icon> | 24 | <el-icon v-if="tag.type === 'role'" style="display: inline-block; vertical-align: middle; height: 12px;"><Female /></el-icon> |
| 25 | <el-icon v-if="tag.type === 'user'" style="display: inline-block; vertical-align: middle; height: 12px;"><User /></el-icon> | 25 | <el-icon v-if="tag.type === 'user'" style="display: inline-block; vertical-align: middle; height: 12px;"><User /></el-icon> |
| 26 | - <span style="margin-left: 2px;display: inline-block; vertical-align: middle; line-height: 10px; height: 10px;">{{ tag.name }}</span> | 26 | + <span style="margin-left: 2px;display: inline-block; vertical-align: middle; line-height: 10px; height: 10px;"> |
| 27 | + <span>{{ tag.name }}</span> | ||
| 28 | + <span v-if="tag?.role_list?.length">/ | ||
| 29 | + <span v-for="(role, index) in tag?.role_list" :key="role.id"> | ||
| 30 | + {{ role.name }} | ||
| 31 | + <span v-if="index !== (tag?.role_list?.length - 1)">,</span> | ||
| 32 | + </span> | ||
| 33 | + </span> | ||
| 34 | + </span> | ||
| 27 | </el-tag> | 35 | </el-tag> |
| 28 | <div v-else class="text-empty">请选择成员</div> | 36 | <div v-else class="text-empty">请选择成员</div> |
| 29 | </div> | 37 | </div> |
| ... | @@ -255,7 +263,16 @@ | ... | @@ -255,7 +263,16 @@ |
| 255 | :checked="user.checked" | 263 | :checked="user.checked" |
| 256 | @change="handleCheckedUserListChange(user, $event)" | 264 | @change="handleCheckedUserListChange(user, $event)" |
| 257 | > | 265 | > |
| 258 | - {{ user.name }} | 266 | + <!-- <div class="el-ellipsis" :style="{ maxWidth: maxWidth + 'px' }"> --> |
| 267 | + <div> | ||
| 268 | + <span>{{ user.name }}</span> | ||
| 269 | + <span v-if="user.role_list.length">/ | ||
| 270 | + <span v-for="(role, index) in user?.role_list" :key="role.id">{{ role.name }} </span> | ||
| 271 | + </span> | ||
| 272 | + <span v-if="user?.dept_list.length">/ | ||
| 273 | + <span v-for="(dept, index) in user?.dept_list" :key="dept.id">{{ dept.name }} </span> | ||
| 274 | + </span> | ||
| 275 | + </div> | ||
| 259 | </el-checkbox> | 276 | </el-checkbox> |
| 260 | </template> | 277 | </template> |
| 261 | <template v-else> | 278 | <template v-else> |
| ... | @@ -345,6 +362,7 @@ const getRoleList = () => { | ... | @@ -345,6 +362,7 @@ const getRoleList = () => { |
| 345 | const deptList = ref([]); // 部门列表 | 362 | const deptList = ref([]); // 部门列表 |
| 346 | const deptUserList = ref([]); // 部门用户列表 | 363 | const deptUserList = ref([]); // 部门用户列表 |
| 347 | const roleList = ref([]); // 角色列表 | 364 | const roleList = ref([]); // 角色列表 |
| 365 | +const maxWidth = ref(0); | ||
| 348 | 366 | ||
| 349 | onMounted(async () => { | 367 | onMounted(async () => { |
| 350 | // API获取后台数据 | 368 | // API获取后台数据 |
| ... | @@ -424,6 +442,11 @@ watch( | ... | @@ -424,6 +442,11 @@ watch( |
| 424 | }); | 442 | }); |
| 425 | } | 443 | } |
| 426 | } | 444 | } |
| 445 | + | ||
| 446 | + // 获取宽度处理成员角色值可能太长显示问题 | ||
| 447 | + nextTick(() => { | ||
| 448 | + maxWidth.value = ($('.search_box').width() - 50); | ||
| 449 | + }); | ||
| 427 | } | 450 | } |
| 428 | } | 451 | } |
| 429 | ); | 452 | ); |
| ... | @@ -614,7 +637,7 @@ const checkNode = (obj, status) => { | ... | @@ -614,7 +637,7 @@ const checkNode = (obj, status) => { |
| 614 | */ | 637 | */ |
| 615 | const handleCheckedUserListChange = (user, checked) => { | 638 | const handleCheckedUserListChange = (user, checked) => { |
| 616 | if (checked) { // 新增勾选的用户 | 639 | if (checked) { // 新增勾选的用户 |
| 617 | - userTags.value = userTags.value.concat({ id: user.id, name: user.name, type: user.type }); | 640 | + userTags.value = userTags.value.concat({ id: user.id, name: user.name, type: user.type, role_list: user?.role_list?.length ? user?.role_list : [] }); |
| 618 | // 如果ID相同,需要数据去重 | 641 | // 如果ID相同,需要数据去重 |
| 619 | userTags.value = _.uniqBy(userTags.value, 'id'); | 642 | userTags.value = _.uniqBy(userTags.value, 'id'); |
| 620 | } else { | 643 | } else { |
| ... | @@ -975,4 +998,10 @@ const onSearchInput = (val) => { | ... | @@ -975,4 +998,10 @@ const onSearchInput = (val) => { |
| 975 | .el-checkbox__input.is-checked+.el-checkbox__label { | 998 | .el-checkbox__input.is-checked+.el-checkbox__label { |
| 976 | color: #009688!important; | 999 | color: #009688!important; |
| 977 | } | 1000 | } |
| 1001 | + | ||
| 1002 | +.el-ellipsis { | ||
| 1003 | + white-space: nowrap; /* 防止文本换行 */ | ||
| 1004 | + overflow: hidden; /* 超出部分隐藏 */ | ||
| 1005 | + text-overflow: ellipsis; /* 用省略号表示被隐藏的部分 */ | ||
| 1006 | +} | ||
| 978 | </style> | 1007 | </style> | ... | ... |
-
Please register or login to post a comment