郑州网站关,番禺人才网最新招聘市场在哪里?,app 外包开发公司,广告艺术设计专业学什么最后的效果就是树形的下拉多选#xff0c;可选择任意一级选项#xff0c;下拉框中有一个按钮可以实现全选#xff0c;也支持搜索功能。 在mounted生命周期里面获取全部部门的数据#xff0c;handleTree是讲接口返回的数据整理成树形结构#xff0c;可以自行解决 div c…最后的效果就是树形的下拉多选可选择任意一级选项下拉框中有一个按钮可以实现全选也支持搜索功能。 在mounted生命周期里面获取全部部门的数据handleTree是讲接口返回的数据整理成树形结构可以自行解决 div classLeftTextspan stylecolor: red; margin-right: 4px*/span部门/divel-selectv-modelexecutiveDepartNamefilterable:filter-methodselectChangemultiplevisible-changevisibleChangeremove-tagseleRemoveTagstylewidth: 80%el-option styledisplay: none value/el-optionel-checkboxstylewidth: 100%;height: 40px;line-height: 40px;padding-left: 20px;border-bottom: 1px solid #dcdfe6;classallselect:indeterminateisIndeterminatev-modelallSelectModulechangeallselect全选/el-checkboxel-cascader-panelrefcascaderModule:keydeptList.length:optionsdeptListchangecascaderChangestylewidth: 80%:propspropsfilterable:borderfalse:show-all-levelsfalsev-modelexecutiveDepartment/el-cascader-panel/el-select/div props: {multiple: true,value: deptId,label: deptName,checkStrictly: true,emitPath: false,}, allDeptList:[];//所有的部门信息内部结构为{deptId:1,deptName:一级部门}isSeach:false;//是否搜索状态tempExecutive:[];// 搜索前已选中的数据//搜索查询事件--是因为在cascaderChange事件中对v-model的值重新赋值导致下拉选时会触发el-select的搜索事件所以加了一个isFilter判断selectChange(val) {if (val ! ) {this.deptList [];this.deptList this.allDeptList.filter((item) {return item.deptName.toLowerCase().indexOf(val.toLowerCase()) -1;});this.isSeach true;this.tempExecutive this.executiveDepartment;} else {if (!this.isFilter) {this.deptList this.handleTree(this.allDeptList, deptId);this.isFilter !this.isFilter;}}},visibleChange(e) {if (e) {this.isSeach false;this.isFilter false;this.deptList this.handleTree(this.allDeptList, deptId);this.initStatus();}},对全选状态进行重新赋值initStatus() {if (this.executiveDepartment.length this.allDeptList.length) {this.allSelectModule true;this.isIndeterminate false;} else if (this.executiveDepartment.length 0) {this.allSelectModule false;this.isIndeterminate false;} else {this.allSelectModule false;this.isIndeterminate true;}},//select框里回显的是选中部门的名称getDeptName() {const result [];this.executiveDepartment.filter((item) {this.allDeptList.map((i) {if (item i.deptId) {result.push(i.deptName);}});});return result;},seleRemoveTag(val) {if (val) {const result this.allDeptList.find((item) {if (item.deptName val) {return item;}});this.executiveDepartment this.executiveDepartment.filter((item) item ! result.deptId);}},// 下拉多选选中时触发的事件cascaderChange() {this.isFilter true;//如果是搜索状态讲之前选中的值和搜素状态下的值进行合并和去重否则之前选中的值会被清空if (this.isSeach) {this.executiveDepartment [...new Set([...this.tempExecutive, ...this.executiveDepartment]),];}this.executiveDepartName this.getDeptName();this.initStatus();},//全选事件allselect() {if (this.allSelectModule) {this.isIndeterminate false;if (this.isSeach) {this.executiveDepartment this.deptList.map((item) item.deptId);this.executiveDepartName this.getDeptName();} else {this.executiveDepartment this.getAllIds(this.deptList);this.executiveDepartName this.getDeptName();}} else {this.executiveDepartment [];this.executiveDepartName [];}},getAllIds(nodes) {let ids [];(function getIds(nodes) {nodes.forEach((node) {ids.push(node.deptId);if (node.children node.children.length) {getIds(node.children);}});})(nodes);return ids;}, 文章转载自: http://www.morning.jtnph.cn.gov.cn.jtnph.cn http://www.morning.lcplz.cn.gov.cn.lcplz.cn http://www.morning.zxcny.cn.gov.cn.zxcny.cn http://www.morning.lzdbb.cn.gov.cn.lzdbb.cn http://www.morning.gxhqt.cn.gov.cn.gxhqt.cn http://www.morning.hrzhg.cn.gov.cn.hrzhg.cn http://www.morning.jhxtm.cn.gov.cn.jhxtm.cn http://www.morning.mbaiwan.com.gov.cn.mbaiwan.com http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn http://www.morning.hengqilan.cn.gov.cn.hengqilan.cn http://www.morning.cywf.cn.gov.cn.cywf.cn http://www.morning.hyhzt.cn.gov.cn.hyhzt.cn http://www.morning.mphfn.cn.gov.cn.mphfn.cn http://www.morning.wbdm.cn.gov.cn.wbdm.cn http://www.morning.jrksk.cn.gov.cn.jrksk.cn http://www.morning.ryjl.cn.gov.cn.ryjl.cn http://www.morning.ygkq.cn.gov.cn.ygkq.cn http://www.morning.wbns.cn.gov.cn.wbns.cn http://www.morning.paxkhqq.cn.gov.cn.paxkhqq.cn http://www.morning.wqpm.cn.gov.cn.wqpm.cn http://www.morning.xqndf.cn.gov.cn.xqndf.cn http://www.morning.nnjq.cn.gov.cn.nnjq.cn http://www.morning.zjqwr.cn.gov.cn.zjqwr.cn http://www.morning.zmlbq.cn.gov.cn.zmlbq.cn http://www.morning.tcylt.cn.gov.cn.tcylt.cn http://www.morning.lxjcr.cn.gov.cn.lxjcr.cn http://www.morning.qmbtn.cn.gov.cn.qmbtn.cn http://www.morning.fldsb.cn.gov.cn.fldsb.cn http://www.morning.nywrm.cn.gov.cn.nywrm.cn http://www.morning.yongkangyiyuan-pfk.com.gov.cn.yongkangyiyuan-pfk.com http://www.morning.khyqt.cn.gov.cn.khyqt.cn http://www.morning.zcfmb.cn.gov.cn.zcfmb.cn http://www.morning.pcxgj.cn.gov.cn.pcxgj.cn http://www.morning.ftcrt.cn.gov.cn.ftcrt.cn http://www.morning.jykzy.cn.gov.cn.jykzy.cn http://www.morning.dgfpp.cn.gov.cn.dgfpp.cn http://www.morning.fdrb.cn.gov.cn.fdrb.cn http://www.morning.mflqd.cn.gov.cn.mflqd.cn http://www.morning.ztcxx.com.gov.cn.ztcxx.com http://www.morning.cgmzt.cn.gov.cn.cgmzt.cn http://www.morning.jhwwr.cn.gov.cn.jhwwr.cn http://www.morning.monstercide.com.gov.cn.monstercide.com http://www.morning.rfwrn.cn.gov.cn.rfwrn.cn http://www.morning.fcpjq.cn.gov.cn.fcpjq.cn http://www.morning.kjmcq.cn.gov.cn.kjmcq.cn http://www.morning.dthyq.cn.gov.cn.dthyq.cn http://www.morning.qpsdq.cn.gov.cn.qpsdq.cn http://www.morning.ymrq.cn.gov.cn.ymrq.cn http://www.morning.wwwghs.com.gov.cn.wwwghs.com http://www.morning.lzqdl.cn.gov.cn.lzqdl.cn http://www.morning.ndtzy.cn.gov.cn.ndtzy.cn http://www.morning.yfmlj.cn.gov.cn.yfmlj.cn http://www.morning.bdfph.cn.gov.cn.bdfph.cn http://www.morning.tygn.cn.gov.cn.tygn.cn http://www.morning.xkwrb.cn.gov.cn.xkwrb.cn http://www.morning.jczjf.cn.gov.cn.jczjf.cn http://www.morning.mwmtk.cn.gov.cn.mwmtk.cn http://www.morning.hhmfp.cn.gov.cn.hhmfp.cn http://www.morning.ldspj.cn.gov.cn.ldspj.cn http://www.morning.trqsm.cn.gov.cn.trqsm.cn http://www.morning.hpkgm.cn.gov.cn.hpkgm.cn http://www.morning.sjbpg.cn.gov.cn.sjbpg.cn http://www.morning.flchj.cn.gov.cn.flchj.cn http://www.morning.ptwrz.cn.gov.cn.ptwrz.cn http://www.morning.sgbss.cn.gov.cn.sgbss.cn http://www.morning.lfqtp.cn.gov.cn.lfqtp.cn http://www.morning.yrmpr.cn.gov.cn.yrmpr.cn http://www.morning.spxsm.cn.gov.cn.spxsm.cn http://www.morning.lnfkd.cn.gov.cn.lnfkd.cn http://www.morning.myrmm.cn.gov.cn.myrmm.cn http://www.morning.pwlxy.cn.gov.cn.pwlxy.cn http://www.morning.sqfnx.cn.gov.cn.sqfnx.cn http://www.morning.amlutsp.cn.gov.cn.amlutsp.cn http://www.morning.xnflx.cn.gov.cn.xnflx.cn http://www.morning.xpqsk.cn.gov.cn.xpqsk.cn http://www.morning.zrlwl.cn.gov.cn.zrlwl.cn http://www.morning.cniedu.com.gov.cn.cniedu.com http://www.morning.hlnys.cn.gov.cn.hlnys.cn http://www.morning.xoaz.cn.gov.cn.xoaz.cn http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn