123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702 |
- <template xlang="wxml">
- <view class="tkitree">
- <view class="tkitree-mask show" v-show="showTree" @tap="_cancel"></view>
- <view class="tkitree-cnt show" v-show="showTree">
- <view class="tkitree-bar">
- <view
- class="tkitree-bar-cancel"
- :style="{ color: cancelColor }"
- hover-class="hover-c"
- @tap="_cancel"
- >取消
- </view>
- <view class="tkitree-bar-title" :style="{ color: titleColor }">{{
- title
- }}</view>
- <view
- class="tkitree-bar-confirm"
- :style="{ color: confirmColor }"
- hover-class="hover-c"
- @tap="_confirm"
- v-if="!custom"
- >确定
- </view>
- </view>
- <view class="tkitree-view">
- <view class="searchBox">
- <input
- type="text"
- placeholder="输入姓名搜索"
- v-model="searchname"
- confirm-type="search"
- @confirm="getList()"
- class="searchname"
- />
- <button class="clear" @click="clear()">清空</button>
- </view>
- <scroll-view class="tkitree-view-sc" :scroll-y="true">
- <block v-for="(item, index) in treeList" :key="index">
- <view
- class="tkitree-item"
- :style="[
- {
- paddingLeft: item.rank * 15 + 'px',
- zIndex: item.rank * -1 + 50,
- },
- ]"
- :class="{
- border: border === true,
- show: item.show,
- last: item.lastRank,
- showchild: item.showChild,
- open: item.open,
- }"
- >
- <view class="tkitree-label" @tap.stop="_treeItemTap(item, index)">
- <image
- class="tkitree-icon"
- :src="
- item.lastRank
- ? lastIcon
- : item.showChild
- ? currentIcon
- : defaultIcon
- "
- >
- </image>
- {{ item.name }}
- </view>
- <view v-if="!custom">
- <view
- class="tkitree-check"
- @tap.stop="_treeItemSelect(item, index)"
- v-if="selectParent ? true : item.lastRank"
- >
- <view
- class="tkitree-check-yes"
- v-if="item.checked"
- :class="{ radio: !multiple }"
- :style="{ 'border-color': confirmColor }"
- >
- <view
- class="tkitree-check-yes-b"
- :style="{ 'background-color': confirmColor }"
- >
- </view>
- </view>
- <view
- class="tkitree-check-no"
- v-else
- :class="{ radio: !multiple }"
- :style="{ 'border-color': confirmColor }"
- ></view>
- </view>
- </view>
- <view v-if="custom">
- <u-button
- type="success"
- size="mini"
- @tap.stop="_treeItemSelect2(item, index)"
- >选中
- </u-button>
- </view>
- </view>
- </block>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- import tools from "./tools";
- import { getTreeData6 } from "@/js_sdk/http";
- export default {
- name: "tkitree",
- props: {
- reciveUserInfo: {
- type: String,
- },
- range: {
- type: Array,
- default: [],
- },
- idKey: {
- type: String,
- default: "id",
- },
- default_value: {
- type: Array,
- default: [],
- },
- rangeKey: {
- type: String,
- default: "label",
- },
- title: {
- type: String,
- default: "",
- },
- multiple: {
- // 是否可以多选
- type: Boolean,
- default: false,
- // default: true
- },
- selectParent: {
- //是否可以选父级
- type: Boolean,
- default: false,
- },
- foldAll: {
- //折叠时关闭所有已经打开的子集,再次打开时需要一级一级打开
- type: Boolean,
- default: false,
- },
- confirmColor: {
- // 确定按钮颜色
- type: String,
- default: "", // #07bb07
- },
- cancelColor: {
- // 取消按钮颜色
- type: String,
- default: "", // #757575
- },
- titleColor: {
- // 标题颜色
- type: String,
- default: "", // #757575
- },
- currentIcon: {
- // 展开时候的ic
- type: String,
- default:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MEQ0QTM0MzQ1Q0RBMTFFOUE0MjY4NzI1Njc1RjI1ODIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MEQ0QTM0MzU1Q0RBMTFFOUE0MjY4NzI1Njc1RjI1ODIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowRDRBMzQzMjVDREExMUU5QTQyNjg3MjU2NzVGMjU4MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowRDRBMzQzMzVDREExMUU5QTQyNjg3MjU2NzVGMjU4MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PidwepsAAAK0SURBVHja7JxbTsJAFIYHww7ciStgCeoGvGxAiOsgURegoL5720AXYLiIr0aJviq3Zx3PhIEnKG3ndtr+f3KixrSUj/ZjzjClIqUUiFm2gAAQAREQEUAEREAERAQQAREQAREBREAEREBEEqa67h9RFDWllDv0awWYlqlQHmu1WjMRRMoV1QFttA12y3xRtdNczq8EsE4/f8FumX2q77ROvNXk8UGMEKdUz6tYJHljaZAbuyUH+UR1to5BEohTuqwPCeS4pAA/qY6o/kyHOAMCeRK3owJnj+rH1jjxhqpVsstaebCz6TmnHWyXyY+xHjSBWBY/bvSgadtXBj9u9KCN3rnIfkzkQVsTEEX0Y2IP2oKo/HhMICcFAThUcwVZNGU6FdbX/XURzkbVF4+ybGhjPrFdgP66QdXNurGtSdk6Xdb9nAJ8oDo3OQlsQZzkdPw41ONBo6vI5scDefRjZg+6gpg3Pxp50CXEvPjR2IOuIXL3oxUPuobI3Y9WPOgDIlc/WvOgL4iL/vqFCcD7LH0xB4hj7cfQ/fWH9qCT+FhG0tN+DBk1PzjOM0SVllixcsBT1AvYc/kAPhc0hRg/3uvxoCgKRN9+dOrBUBB9+9GpB0NC9OVH5x4MDdG1H714kANEV3705kEOEBf9dcPi/lQnsuvLg1wgSu3Ha0v7Uh4MMgUXeuG71H407a+VBy9CPQkOdw+MtB+nGbd/D+FBbhBNxo9SjwcngJjNj0E9yBFiFj8G9SBXiGn8GNyDnCEm8SMLD3KHGOdHNh7kDjHOj2w8mAeIi/5arX+c6b/fxHz9oADEdGdjR/fXCw/OOB5oVfCOgnepz8IB14PMw03jCmTE+QBx5z0gAmKSqK9OUF+hcAeIhu/QYr4Qie8rjW83hhMBERARQAREQAREBBABERCLnH8BBgA+TQI7U4t53AAAAABJRU5ErkJggg==",
- },
- defaultIcon: {
- // 折叠时候的ic
- type: String,
- default:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAACE0lEQVR4Xu3c200DMRCF4XEltJAOkEugA+ggpUAHoQMqiFMCdEAJUMEiS4mEELlIO7bPOeN9i6K1rG/952myyea1WiCtXmEuYBPR4RBMxInoIOCwhOtJLKVszWyXc/5y2BvNEq6I+/3+kFK6M7OHnPM7jcLKjbZAvD/uaZtzflm5P4rbWyJWgDcze1LPuzVihfxUz7sH4ilJ2bx7Isrm3RtRMu8RiHJ5j0SUyXs0okTeCIj0eSMh0uaNhkiZNyIiXd7IiDR5oyNS5M2ACJ83EyJs3myIkHkzIsLlzYwIkzc7IkTeCojD81ZCHJa3GuKQvBURu+etjNgtb3XELnlHQGyedyTEZnlHQ2ySd0RE97wjI7rlHR3RJe+JeIrbLOecD6ePpZQ6W1kn2epo4MUrPOKyLN8ppYq1+y1VStncOjIdGnFZlo+U0uOtWOeOY2TE12Ouq//pEA7xXL7XfvcufR8K0Svfv6CREN3yDYfYIt9QiK3yjYTYLF95xB75SiP2ylcZsVu+cogj8pVCHJWvEuKwfOkREfKlRkTJlxkRJl86RMR8qRBR82VChM0XHpEhX2hElnyREWnyhUNkzBcKkTVfJETafIcjKuQ7FFEl35GIMvl2R1TMtyuiar49EWXzbY5oZpv/hibXTF2h3+s60FRKeT6+3TjMS3nrA3ZFRD8xrfY3ER1kJ+JEdBBwWGKeRAfEH1wS5WFZSDB/AAAAAElFTkSuQmCC",
- },
- lastIcon: {
- // 没有子集的ic
- type: String,
- default: "",
- },
- border: {
- // 是否有分割线
- type: Boolean,
- default: false,
- },
- custom: {
- // 是否进入自定义
- type: Boolean,
- default: false,
- },
- spread: {
- // 展开第一层
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {
- fartherKey: "",
- showTree: false,
- treeList: [],
- selectIndex: -1,
- idArr: [],
- searchname: "",
- selectName: [],
- getMsg: "",
- };
- },
- computed: {},
- methods: {
- clear() {
- console.log(this.treeList);
- this.searchname = "";
- },
- // 搜索组织接口
- async getList() {
- let departmentList = await getTreeData6(this.searchname);
- this._initTree(
- tools.transData(departmentList.data, "id", "parentid", "children")
- );
- // this.treeList=departmentList.data;
- let list = this.treeList;
- list.forEach((childItem, i) => {
- if (childItem.name == this.searchname) {
- childItem.show = true;
- }
- this.selectName.forEach((item) => {
- if (childItem.name == item) {
- childItem.checked = true;
- childItem.show = true;
- const obj = this.treeList.filter(
- (x) =>
- childItem.parentId[childItem.parentId.length - 1] ===
- x.parentId[x.parentId.length - 1]
- );
- obj.forEach((x) => {
- x.show = true;
- });
- }
- });
- this.treeList.forEach((k1, i1) => {
- if (k1.checked) {
- k1.parentId.forEach((k2, i2) => {
- this.treeList.forEach((k3, i3) => {
- if (k3.id == k2) {
- this.treeList[i3].checked = true;
- this.treeList[i3].show = true;
- this.treeList[i3].showChild = true;
- }
- });
- });
- }
- });
- });
- },
- _show(e) {
- this.showTree = true;
- this.fartherKey = e;
- },
- _hide() {
- this.showTree = false;
- },
- _cancel() {
- this._hide();
- this.$emit("cancel", "");
- },
- _confirm() {
- // 处理所选数据
- let rt = [];
- let obj = {};
- let str = "";
- this.treeList.forEach((v, i) => {
- if (this.treeList[i].checked && this.treeList[i].lastRank) {
- console.log(this.treeList[i]);
- let parentsName = this.treeList[i].parents
- .map((e) => {
- return e.label;
- })
- .join("/");
- str += parentsName + "/" + this.treeList[i].name + ",";
- console.log(str);
- obj = Object.assign(obj, this.treeList[i].source);
- rt.push(obj, { label: str });
- }
- });
- this._hide();
- this.$emit("confirm", [...rt], this.fartherKey);
- },
- //扁平化树结构
- getSearchObj(item) {
- if (item.children && item.children.length) {
- item.children.forEach((child) => {
- if (child.name === this.searchname) {
- return true;
- }
- });
- } else if (item.name === this.searchname) {
- return true;
- } else {
- return false;
- }
- },
- _renderTreeList(list = [], rank = 0, parentId = [], parents = []) {
- list.forEach((item) => {
- this.treeList.push({
- id: item[this.idKey],
- name: item[this.rangeKey],
- source: item,
- parentId, // 父级id数组
- parents, // 父级id数组
- rank, // 层级
- showChild: false, //子级是否显示
- open: false, //是否打开
- show: rank === 0, // 自身是否显示
- hideArr: [],
- orChecked: item.checked ? item.checked : false,
- checked: item.checked ? item.checked : false,
- });
- if (Array.isArray(item.children) && item.children.length > 0) {
- let parentid = [...parentId],
- parentArr = [...parents],
- childrenid = [...childrenid];
- delete parentArr.children;
- parentid.push(item[this.idKey]);
- parentArr.push({
- [this.idKey]: item[this.idKey],
- [this.rangeKey]: item[this.rangeKey],
- });
- this._renderTreeList(item.children, rank + 1, parentid, parentArr);
- } else {
- this.treeList[this.treeList.length - 1].lastRank = true;
- }
- });
- },
- arrayChunk(array, size) {
- let data = [];
- for (let i = 0; i < array.length; i += size) {
- data.push(array.slice(i, i + size));
- }
- return data;
- },
- // 处理默认选择
- _defaultSelect() {
- let default_value = this.default_value;
- this.treeList.forEach((v, i) => {
- for (let j = 0; j < default_value; j++) {
- if (v.parentId.toString().indexOf(v2.parentId.toString()) >= 0) {
- }
- }
- // if (v.checked) {
- // this.treeList.forEach((v2, i2) => {
- // if (v.parentId.toString().indexOf(v2.parentId.toString()) >= 0) {
- // console.log(v2,v.parentId.toString().indexOf(v2.parentId.toString()));
- // v2.show = true
- // // if(v2.rank>0){
- // // v2.show=false
- // // }
- // if (v.parentId.includes(v2.id)) {
- // v2.showChild = true;
- // v2.open = true;
- // }
- // }
- // })
- // }
- });
- },
- // 点击
- _treeItemTap(item, index) {
- if (item.lastRank === true) {
- //点击最后一级时触发事件
- this.treeList[index].checked = !this.treeList[index].checked;
- this._fixMultiple(index);
- return;
- }
- let list = this.treeList;
- let id = item.id;
- item.showChild = !item.showChild;
- item.open = item.showChild ? true : !item.open;
- list.forEach((childItem, i) => {
- if (item.showChild === false) {
- //隐藏所有子级
- if (!childItem.parentId.includes(id)) {
- return;
- }
- if (!this.foldAll) {
- if (childItem.lastRank !== true && !childItem.open) {
- childItem.showChild = false;
- }
- // 为隐藏的内容添加一个标记
- if (childItem.show) {
- childItem.hideArr[item.rank] = id;
- }
- } else {
- if (childItem.lastRank !== true) {
- childItem.showChild = false;
- }
- }
- childItem.show = false;
- } else {
- // 打开子集
- if (childItem.parentId[childItem.parentId.length - 1] === id) {
- childItem.show = true;
- }
- // 打开被隐藏的子集
- if (childItem.parentId.includes(id) && !this.foldAll) {
- if (childItem.hideArr[item.rank] === id) {
- childItem.show = true;
- if (childItem.open && childItem.showChild) {
- childItem.showChild = true;
- } else {
- childItem.showChild = false;
- }
- childItem.hideArr[item.rank] = null;
- }
- }
- }
- });
- },
- _treeItemSelect(item, index) {
- this.treeList[index].checked = !this.treeList[index].checked;
- this._fixMultiple(index);
- // console.log(item.id, index,this.treeList[index].checked,9);
- // this.$emit('chenge',item,this.treeList[index].checked)
- this._chenge(item, this.treeList[index].checked);
- },
- _treeItemSelect2(item, index) {
- console.log(item, index, "点击事件1");
- this._hide();
- this.$emit("confirm", item);
- },
- _chenge(e, e1) {
- if (e.checked == true) {
- let isClud = this.selectName.indexOf(e.name);
- if (isClud > -1) {
- return;
- } else {
- this.selectName.push(e.name);
- }
- } else {
- let isClud = this.selectName.indexOf(e.name);
- if (isClud > -1) {
- this.selectName.splice(isClud, 1);
- } else {
- return;
- }
- }
- this.searchname = "";
- this.idArr.push(e.id);
- if (e.source.children == undefined) {
- this.treeList.forEach((k, i) => {
- this.idArr.forEach((k1, i1) => {
- if (k.id == k1 && e1 == true) {
- this.treeList[i].checked = true;
- } else if (k.id == k1 && e1 == false) {
- this.treeList[i].checked = false;
- }
- });
- });
- if (e.checked) {
- e.parentId.forEach((k, i) => {
- this.treeList.forEach((k1, i1) => {
- if (k1.id == k) {
- this.treeList[i1].checked = true;
- }
- });
- });
- } else {
- e.parentId.forEach((k, i) => {
- this.treeList.forEach((k1, i1) => {
- if (k1.id == k) {
- this.treeList[i1].checked = false;
- }
- });
- });
- }
- this.treeList.forEach((k1, i1) => {
- if (k1.checked) {
- k1.parentId.forEach((k2, i2) => {
- this.treeList.forEach((k3, i3) => {
- if (k3.id == k2) {
- this.treeList[i3].checked = true;
- }
- });
- });
- }
- });
- this.idArr = [];
- return;
- }
- this.handkeCheck1(e.source.children);
- this.treeList.forEach((k, i) => {
- this.idArr.forEach((k1, i1) => {
- if (k.id == k1 && e1 == true) {
- this.treeList[i].checked = true;
- } else if (k.id == k1 && e1 == false) {
- this.treeList[i].checked = false;
- }
- });
- });
- if (e.checked) {
- e.parentId.forEach((k, i) => {
- this.treeList.forEach((k1, i1) => {
- if (k1.id == k) {
- this.treeList[i1].checked = true;
- }
- });
- });
- } else {
- e.parentId.forEach((k, i) => {
- this.treeList.forEach((k1, i1) => {
- if (k1.id == k) {
- this.treeList[i1].checked = false;
- }
- });
- });
- }
- this.treeList.forEach((k1, i1) => {
- if (k1.checked) {
- k1.parentId.forEach((k2, i2) => {
- this.treeList.forEach((k3, i3) => {
- if (k3.id == k2) {
- this.treeList[i3].checked = true;
- }
- });
- });
- }
- });
- this.idArr = [];
- // this.handkeCheck(this.range, e, e1)
- },
- handkeCheck1(list) {
- list.forEach((k, i) => {
- this.idArr.push(k.id);
- if (k.children == undefined) return;
- this.handkeCheck1(k.children);
- });
- },
- handkeCheck(list, e, e1) {
- // 点击数据权限
- list.forEach((k, i) => {
- if (k.children != undefined) {
- if (k.id == e.id && e.checked == true) {
- k.checked = true;
- // console.log(k.id,'第一');
- this.handkeChecks(k.children, e, e1);
- } else if (k.id == e.id && e.checked == false) {
- k.checked = false;
- this.handkeChecks(k.children, e, e1);
- } else {
- this.handkeCheck(k.children, e, e1);
- }
- } else {
- // console.log(1);
- if (k.id == e.id && e.checked == true) {
- k.checked = true;
- } else if (k.id == e.id && e.checked == false) {
- k.checked = false;
- }
- }
- });
- // console.log(this.treeList);
- // this._reTreeList()
- // this._initTree(list)
- // this._renderTreeList(list)
- // list.splice()
- // this.lists = list
- // this.$forceUpdate()
- // console.log(this.lists,'执行了强制刷新');
- },
- handkeChecks(list, e, e1) {
- // console.log(list, e, e1,'循环执行');
- // console.log(list,'list','循环执行');
- // console.log(e.id,'e','循环执行');
- // console.log(e1,'e1','循环执行');
- list.forEach((k, i) => {
- if (k.children != undefined) {
- if (e.checked) {
- k.checked = true;
- this.handkeChecks(k.children, e, e1);
- } else {
- k.checked = false;
- this.handkeChecks(k.children, e, e1);
- }
- } else {
- // console.log(k, 'else');
- if (e.checked) {
- k.checked = true;
- } else {
- k.checked = false;
- }
- }
- });
- },
- // 处理单选多选
- _fixMultiple(index) {
- // console.log(index,'33333');
- if (this.spread) {
- // 如果是单选
- this.treeList.forEach((v, i) => {
- if (i != index) {
- this.treeList[i].checked = false;
- } else {
- this.treeList[i].checked = true;
- // console.log(index,'4444');
- }
- });
- }
- },
- // 重置数据
- _reTreeList() {
- this.treeList.forEach((v, i) => {
- this.treeList[i].checked = v.orChecked;
- });
- },
- _initTree(range = this.range) {
- // console.log('接收值的事件');
- this.treeList = [];
- this._renderTreeList(range);
- this.$nextTick(() => {
- // this._defaultSelect(range)
- });
- let list = [...this.treeList];
- //展开第一列
- if (this.custom) {
- list.forEach((childItem, i) => {
- console.log("child", childItem);
- if (childItem.rank == "1") {
- childItem.show = true;
- }
- });
- }
- this.treeList = this.arrayChunk(list, 1700)[0];
- setTimeout(() => {
- this.treeList.push(...this.arrayChunk(list, 1700)[1]);
- }, 1000);
- },
- },
- watch: {
- range(list) {
- console.log(list);
- // console.log('监视值的改变1');
- this._initTree(list);
- },
- multiple() {
- // console.log('监视值的改变2');
- if (this.range.length) {
- this._reTreeList();
- }
- },
- selectParent() {
- // console.log('监视值的改变3');
- if (this.range.length) {
- this._reTreeList();
- }
- },
- // searchname() {
- // this.getList();
- // },
- deep: true, // 深度监听
- immediate: true, // 初次监听即执行
- },
- mounted() {
- this._initTree();
- uni.$on("sendMsg", (data) => {
- this.getMsg = data.msg;
- });
- },
- };
- </script>
-
- <style scoped>
- @import "./style.css";
- .searchname {
- margin: 0;
- width: 80%;
- float: left;
- }
- .clear {
- width: 20%;
- float: left;
- }
- </style>
-
|