Git Product home page Git Product logo

Comments (4)

github-actions avatar github-actions commented on May 29, 2024

👋 @lhdhtrc,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

from tdesign-vue.

uyarn avatar uyarn commented on May 29, 2024

回显解决携带父级id,导致半选变全选 是指什么时候额?

from tdesign-vue.

lhdhtrc avatar lhdhtrc commented on May 29, 2024

@uyarn 例如返回数据是[p1, c1, c2], p1下有c1, c2 c3,但是这里只返回了p1下的c1,c2, 那么如果回显到数组件上p1节点会变成全选,这个时候就需要去做处理,看p1下是否存在c1, c2, c3如果存在则不过滤p1, 如果存在则过滤p1

from tdesign-vue.

lhdhtrc avatar lhdhtrc commented on May 29, 2024
<template>
   <t-tree
    ref="menuRef"
    v-model="formData.menuIdList"
    class="narrow-scrollbar"
    max-height="300px"
    checkable
    value-mode="all"
    :expand-all="menuAll"
    :data="menu"
    :keys="{ value: 'id', label: 'name', children: 'children' }"
    @change="treeChange($event, 0)"
  ></t-tree>
</template>

<script>
......
const onWatcher = watch(
  () => props.active,
  async () => {
    if (props.active) {
      switch (props.type) {
        case 0:
          break;
        case 1:
          loading.value = true;
          try {
            const res = await GetRoleInfoAPI(props.row.id);
            res.menuIdList = useTreeFilter(props.menu, res.menuIdList);
            res.deptIdList = useTreeFilter(props.dept, res.deptIdList);
            formData.value = res;

            menuAll.value = res.menuIdList.length === menuRef.value.getItems().length;
            deptAll.value = res.deptIdList.length === deptRef.value.getItems().length;
          } catch (err) {
            console.log(err);
          }
          loading.value = false;
          break;
        default:
      }
    } else {
      formData.value = JSON.parse(JSON.stringify(reset));
    }
  },
);
......
</script>

from tdesign-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.