Showing
1 changed file
with
81 additions
and
10 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-29 14:31:20 | 2 | * @Date: 2022-08-29 14:31:20 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-05-31 17:09:02 | 4 | + * @LastEditTime: 2024-05-31 18:05:23 |
| 5 | * @FilePath: /data-table/src/components/TreeField/index.vue | 5 | * @FilePath: /data-table/src/components/TreeField/index.vue |
| 6 | * @Description: 树形组件 | 6 | * @Description: 树形组件 |
| 7 | --> | 7 | --> |
| ... | @@ -12,9 +12,22 @@ | ... | @@ -12,9 +12,22 @@ |
| 12 | {{ item.component_props.label }} | 12 | {{ item.component_props.label }} |
| 13 | </div> | 13 | </div> |
| 14 | 14 | ||
| 15 | + <div class="select-tree-box" @click="openTree"> | ||
| 16 | + <div class="select-tree-item" v-for="(dept) in emitCheckedGroup.dept" :key="dept.id"> | ||
| 17 | + {{ dept.name }} | ||
| 18 | + </div> | ||
| 19 | + <div class="select-tree-item" v-for="(role) in emitCheckedGroup.role" :key="role.id"> | ||
| 20 | + {{ role.name }} | ||
| 21 | + </div> | ||
| 22 | + <div class="select-tree-item" v-for="(user) in emitCheckedGroup.user" :key="user.id"> | ||
| 23 | + {{ user.name }} | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + | ||
| 15 | <van-popup | 27 | <van-popup |
| 16 | v-model:show="showPopover" | 28 | v-model:show="showPopover" |
| 17 | position="bottom" | 29 | position="bottom" |
| 30 | + :close-on-click-overlay="false" | ||
| 18 | :style="{ height: '90vh' }" | 31 | :style="{ height: '90vh' }" |
| 19 | > | 32 | > |
| 20 | <div v-if="!is_search" class="search-box" @click="onSearchFocus"> | 33 | <div v-if="!is_search" class="search-box" @click="onSearchFocus"> |
| ... | @@ -66,7 +79,7 @@ | ... | @@ -66,7 +79,7 @@ |
| 66 | :cascade="false" | 79 | :cascade="false" |
| 67 | :defaultExpandAll="false" | 80 | :defaultExpandAll="false" |
| 68 | @checked-change="deptTreeCheckedChange" | 81 | @checked-change="deptTreeCheckedChange" |
| 69 | - style=" height: 60vh; overflow: scroll;" | 82 | + style=" height: 55vh; overflow: scroll;" |
| 70 | > | 83 | > |
| 71 | <span slot="empty">暂无数据</span> | 84 | <span slot="empty">暂无数据</span> |
| 72 | </Vtree> | 85 | </Vtree> |
| ... | @@ -91,7 +104,7 @@ | ... | @@ -91,7 +104,7 @@ |
| 91 | 104 | ||
| 92 | <div v-if="tabActive === 2" style="padding: 0 0 0 1rem;"> | 105 | <div v-if="tabActive === 2" style="padding: 0 0 0 1rem;"> |
| 93 | <van-row gutter=""> | 106 | <van-row gutter=""> |
| 94 | - <van-col span="10" style="border-right: 1px solid #eee; height: 60vh; overflow: scroll;"> | 107 | + <van-col span="10" style="border-right: 1px solid #eee; height: 55vh; overflow: scroll;"> |
| 95 | <Vtree | 108 | <Vtree |
| 96 | ref="userTreeRef" | 109 | ref="userTreeRef" |
| 97 | v-model="select_user_value" | 110 | v-model="select_user_value" |
| ... | @@ -189,6 +202,16 @@ | ... | @@ -189,6 +202,16 @@ |
| 189 | </van-checkbox-group> | 202 | </van-checkbox-group> |
| 190 | </div> | 203 | </div> |
| 191 | 204 | ||
| 205 | + <div style="position: fixed; bottom: 0; left: 0; width: 100%;"> | ||
| 206 | + <van-row gutter="0"> | ||
| 207 | + <van-col span="12"> | ||
| 208 | + <van-button block type="default" @click="onCancelClick">取消</van-button> | ||
| 209 | + </van-col> | ||
| 210 | + <van-col span="12"> | ||
| 211 | + <van-button block type="primary" @click="onConfirmClick">确定</van-button> | ||
| 212 | + </van-col> | ||
| 213 | + </van-row> | ||
| 214 | + </div> | ||
| 192 | </van-popup> | 215 | </van-popup> |
| 193 | 216 | ||
| 194 | </div> | 217 | </div> |
| ... | @@ -218,8 +241,35 @@ const isGroup = computed(() => { | ... | @@ -218,8 +241,35 @@ const isGroup = computed(() => { |
| 218 | return props.item.component_props.is_field_group | 241 | return props.item.component_props.is_field_group |
| 219 | }); | 242 | }); |
| 220 | 243 | ||
| 244 | +onMounted(() => { | ||
| 245 | + props.item.value = props.item.component_props.default; | ||
| 246 | +}); | ||
| 247 | + | ||
| 248 | +const openTree = () => { | ||
| 249 | + showPopover.value = true; | ||
| 250 | + // TODO:获取数据 | ||
| 251 | + nextTick(() => { | ||
| 252 | + getDeptTreeData(); | ||
| 253 | + }) | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | +const emitCheckedGroup = ref({ | ||
| 257 | + dept: [], // 组织结构 | ||
| 258 | + role: [], // 角色 | ||
| 259 | + user: [] // 成员 | ||
| 260 | +}); | ||
| 261 | + | ||
| 262 | +const onCancelClick = () => { | ||
| 263 | + showPopover.value = false; | ||
| 264 | +} | ||
| 265 | +const onConfirmClick = () => { | ||
| 266 | + showPopover.value = false; | ||
| 267 | + // | ||
| 268 | + emitCheckedGroup.value = _.cloneDeep(checkedGroup.value); | ||
| 269 | +} | ||
| 270 | + | ||
| 221 | /******* 搜索输入项 *******/ | 271 | /******* 搜索输入项 *******/ |
| 222 | -const showPopover = ref(true); // 显示/隐藏弹框 | 272 | +const showPopover = ref(false); // 显示/隐藏弹框 |
| 223 | 273 | ||
| 224 | const searchInputRef = ref(null); | 274 | const searchInputRef = ref(null); |
| 225 | const searchValue = ref(''); | 275 | const searchValue = ref(''); |
| ... | @@ -345,12 +395,6 @@ const userListReset = () => { // 成员重置列表 | ... | @@ -345,12 +395,6 @@ const userListReset = () => { // 成员重置列表 |
| 345 | } | 395 | } |
| 346 | /**************** END *****************/ | 396 | /**************** END *****************/ |
| 347 | 397 | ||
| 348 | -onMounted(() => { | ||
| 349 | - props.item.value = props.item.component_props.default; | ||
| 350 | - // TODO:获取数据 | ||
| 351 | - getDeptTreeData(); | ||
| 352 | -}); | ||
| 353 | - | ||
| 354 | /************* 组织结构模块 ***************/ | 398 | /************* 组织结构模块 ***************/ |
| 355 | const select_dept_value = ref(); // 组织结构树形选中值 | 399 | const select_dept_value = ref(); // 组织结构树形选中值 |
| 356 | 400 | ||
| ... | @@ -542,6 +586,29 @@ const onSearchResultClick = (val, evt) => { // 搜索结果集项点击回调 | ... | @@ -542,6 +586,29 @@ const onSearchResultClick = (val, evt) => { // 搜索结果集项点击回调 |
| 542 | color: red; | 586 | color: red; |
| 543 | } | 587 | } |
| 544 | } | 588 | } |
| 589 | + | ||
| 590 | + .select-tree-box { | ||
| 591 | + height: 4rem; | ||
| 592 | + border: 1px dashed #dfdfdf; | ||
| 593 | + margin: 1rem; | ||
| 594 | + overflow: scroll; | ||
| 595 | + border-radius: 5px; | ||
| 596 | + padding: 0.5rem; | ||
| 597 | + display: flex; | ||
| 598 | + flex-wrap: wrap; | ||
| 599 | + .select-tree-item { | ||
| 600 | + margin-right: 5px; | ||
| 601 | + margin-bottom: 5px; | ||
| 602 | + font-size: 0.85rem; | ||
| 603 | + padding: 5px 8px; | ||
| 604 | + background-color: #C2915F; | ||
| 605 | + color: #fff; | ||
| 606 | + height: 1.2rem; | ||
| 607 | + display: flex; | ||
| 608 | + justify-content: center; | ||
| 609 | + align-items: center; | ||
| 610 | + } | ||
| 611 | + } | ||
| 545 | } | 612 | } |
| 546 | 613 | ||
| 547 | :deep(.van-field__body) { | 614 | :deep(.van-field__body) { |
| ... | @@ -570,6 +637,10 @@ const onSearchResultClick = (val, evt) => { // 搜索结果集项点击回调 | ... | @@ -570,6 +637,10 @@ const onSearchResultClick = (val, evt) => { // 搜索结果集项点击回调 |
| 570 | background-color: #f8e2cb; | 637 | background-color: #f8e2cb; |
| 571 | } | 638 | } |
| 572 | 639 | ||
| 640 | +// :deep(.ctree-tree__scroll-area) { | ||
| 641 | +// margin-bottom: 2rem; | ||
| 642 | +// } | ||
| 643 | + | ||
| 573 | .select-box { | 644 | .select-box { |
| 574 | height: 4rem; | 645 | height: 4rem; |
| 575 | border: 1px dashed #dfdfdf; | 646 | border: 1px dashed #dfdfdf; | ... | ... |
-
Please register or login to post a comment