1 |
- import{a as w}from"./contants-84ba384e-1734950731618.js";import{d as I,e as P,r as _,A as y,U as T,q as S,f as n,W as k,F as g,k as f,aR as B}from"./index-efb66432-1734950731618.js";import{N as E}from"./Scrollbar-10f58cff-1734950731618.js";const x="_nBaseCascaser_jdjr3_1",R="_nBaseCascaserActive_jdjr3_16",K="_arrow_jdjr3_64",j="_arrowSmall_jdjr3_72",U="_inner_jdjr3_93",G="_cascaderPopover_jdjr3_113",Q="_baseScrollBar_jdjr3_120",F="_baseContentTitle_jdjr3_123",J="_baseContentWrap_jdjr3_129",M="_tag_jdjr3_136",O="_tagActive_jdjr3_146",Y="_btnGroup_jdjr3_150",X="_btn_jdjr3_150",Z="_btnCancel_jdjr3_171",z="_btnConfirm_jdjr3_175",t={nBaseCascaser:x,nBaseCascaserActive:R,"n-base-selection__state-border":"_n-base-selection__state-border_jdjr3_19","n-base-selection-tags":"_n-base-selection-tags_jdjr3_24","n-base-selection-input":"_n-base-selection-input_jdjr3_35","n-base-selection-input__content":"_n-base-selection-input__content_jdjr3_52","n-base-suffix":"_n-base-suffix_jdjr3_57",arrow:K,arrowSmall:j,"n-base-selection-placeholder":"_n-base-selection-placeholder_jdjr3_79",inner:U,"n-base-selection__border":"_n-base-selection__border_jdjr3_97",cascaderPopover:G,baseScrollBar:Q,baseContentTitle:F,baseContentWrap:J,tag:M,tagActive:O,btnGroup:Y,btn:X,btnCancel:Z,btnConfirm:z},V="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAaCAYAAACtv5zzAAAAAXNSR0IArs4c6QAAANZJREFUSEvtkzEKwkAQRV9AO1vR0trKysbKRvAAHtEbCDa2NlZWHkEUb6BFZCAry7LZmQ2kkU2ZzL6X+TNb0fNT9cynCNSE/yeiAbAGxsAVuKm9xwvmwAJ4ASegdhHNgI135tKIcjwCXnoHDsDdCUbADhh2lITwD7AH3v6Qp8C2gyQGPwIP+dlwi3IlSXhMIO+sEhXeJrBITPCUICWRb/62yEB/mYdrp93kWFw+IwnXOnCgNokKtwpicZngOQKpnQCrpq0z8LRcc20GFkaypgjUCEtEakRfjkkxG9oSzTgAAAAASUVORK5CYII=",W="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAaCAYAAACtv5zzAAAAAXNSR0IArs4c6QAAANtJREFUSEvt0zFOAkEYQOFv7eEi9iba0GLlDextKNUbECmpuIItFSWNmnANPIEWtoZkJ5LJDv9AQuVOs8Vm3tt5/2zjzKs5M18vCAv/r0TXmLdNJvgI+1B9i26wwqCFfuMWb5GkZgY5PDGrJJGgBK+WHBJ0wZ9a8stemoMnKQlK8FkLfkQuGeM9n0mXIIInRpUkF9TCqyX7gmPhVZIkGGKL3TOt3UBT8+i657m+cInPJBhhfSK8dJI7LJPgAq+4whSL6JML7x/wjA3u8RP9aCd6/rb1gjBhnyhM9As5gjEbhIMMwQAAAABJRU5ErkJggg==",L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAKCAYAAAC5Sw6hAAAAAXNSR0IArs4c6QAAAQdJREFUKFOVkSFuw0AQRf+sFGApwCgX6BHCgkJSEm5S1Wx3rhBVKiqIegR7mKsS85CGBJXlCLlAkUEkg6i77VR21aRx6g5Zzc7/b0d/CQBE5M57/wDAaN+3iOgdwL1zbklqyrJsCWDRF/BTR0SPzrlFCxoQ0SqEMPsPjIjWIYQ5Mx++QFplWQ6rqtqEEMZ9YES0jeN4miTJXvXfIG2KohjVdf0K4OoP2C6Kokmapm+t7gjU5KUQhY06YGqeMPPuKKtzYhEZe+83AIYn870xZmqt3Z76fm3UCkRk5r1fARg0dwdjzNxauz73eCdIxXme33zm9dQYb51zz13ZXQQ1mV3rycwvlz7gA/q9UAsdpeSGAAAAAElFTkSuQmCC",q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAKCAYAAAC5Sw6hAAAAAXNSR0IArs4c6QAAAQBJREFUKFOVkbFOAkEQhuffCx3l7VwsNCY8wnZUNNjwCMbnMBRWJob3MD4CjTRUdvsIJEYLs7NX0pHbMUdOgnocMN1kvvlmMgM6Esx8UyMi8tqFoquYM99q0ueagcFdKfJyiD8oYuZxlXRORL2meZMZTERk0SZrFeX5hSNUS1Xt7zcBWJNmo7L88n9l/0TMPEhKb6rKrZMBMaChiKx+DdlPiqLgKmktGXQeFlhlBsMQgvxwu42stX1VWiqRO/bJ7fGJPECjGOO6yYmcc733j885qY5PkewYYHF9dTnx3m+2G1lbzJKm+7MkDWxgZjGGaSOy06T0SETZmbJkYB5iDE/f85tbC9QPlh0AAAAASUVORK5CYII=",ae=I({name:"c-cascader",props:{showAudioPlayType:{type:Boolean,default:!1},childShowAllCheck:{type:Boolean,default:!0},value:{type:String,default:""},options:{type:Array,default:()=>[]},arrowType:{type:String,default:"default"},placeholder:{type:String,default:"请选择"},placement:{type:String,default:"bottom-start"},showPath:{type:Boolean,default:!1}},emits:["update:value","moreId"],setup(i,{emit:r}){const e=P({popoverShow:!1,selectParents:{},tempAudioPlayTypes:"",audioPlayTypes:"",tagActiveId:"",tagActive:{},childSelectId:null,x:0,y:0}),u=_([]),v=(a,l)=>{for(const s of l){if(a.includes(s.id)&&s.children&&s.children.length>0){let o;s.children.forEach(m=>{a.includes(m.id)&&(o=m.id)}),s.activeIndex=o}s.children&&s.children.length>0&&v(a,s.children)}},h=a=>{let l,s="";if(a.children){l=[...a.children];let o=l.length>0?l[0].id:"";i.childShowAllCheck&&(l.unshift({columnName:a.children[0].columnName,name:"全部"+a.children[0].columnName||"",id:""}),o=""),s=a.children[0].columnName,e.childSelectId=o,e.selectParents={...a,columnName:s,activeIndex:o,children:l}}else e.selectParents={}};y(()=>e.popoverShow,()=>{if(!e.popoverShow||!i.value)return;let a=c(i.value,i.options);console.log(a,"ids"),e.tagActiveId=a[0].id,i.options.forEach(o=>{o.id===e.tagActiveId&&h(o)});const l=a.findIndex(o=>o.id===i.value);a=a.slice(0,l+1);const s=a.map(o=>o.id);v(s,i.options)});const d=T(()=>{const a=i.value,l=A(a),s=[];return u.value.forEach(o=>{o.id===e.tempAudioPlayTypes&&i.showAudioPlayType&&s.push(o.name)}),e.tempAudioPlayTypes!=="SING"&&l.forEach(o=>{s.push(o.name)}),i.showPath?s.join(" / "):s[s.length-1]}),c=(a,l,s=[])=>{for(const o of l){if(o.children&&o.children.length>0){const m=c(a,o.children,[...s,{name:o.name,id:o.id}]);if(m.findIndex(N=>N.id===a)>-1)return m}if(o.id===a)return[...s,{name:o.name,id:a}]}return s},A=a=>{let l=c(a,i.options);const s=l.findIndex(o=>o.id===a);return l=l.slice(0,s+1),l},p=()=>{const a=i.options[0],l=a.children?a.children[0]:null;console.log(a,"1111111"),e.childSelectId=l==null?void 0:l.value,e.tagActiveId=(l==null?void 0:l.value)||a.value||"",e.audioPlayTypes="",e.tempAudioPlayTypes="",e.selectParents={},r("update:value",(l==null?void 0:l.value)||a.value||""),r("moreId",{childId:l==null?void 0:l.value,parentId:a.value,audioPlayTypes:""}),e.popoverShow=!1},C=()=>{e.audioPlayTypes!=="SING"?(r("update:value",e.childSelectId||e.tagActiveId),r("moreId",{childId:e.childSelectId,parentId:e.tagActiveId,audioPlayTypes:e.audioPlayTypes})):(r("update:value",""),r("moreId",{childId:"",parentId:"",audioPlayTypes:e.audioPlayTypes})),e.tempAudioPlayTypes=e.audioPlayTypes,e.popoverShow=!1};return S(()=>{const a=Object.keys(w).map(l=>({id:l,name:w[l]}));u.value=[{name:"全部场景",id:""},...a]}),()=>n(g,null,[n(k,{placement:i.placement,show:e.popoverShow,"onUpdate:show":a=>e.popoverShow=a,showArrow:!1,trigger:"click",displayDirective:"show",class:[t.cascaderPopover,"c-cascaderPopover"]},{trigger:()=>n("div",{class:[t.nBaseCascaser,"nBaseCascaser",e.popoverShow?t.nBaseCascaserActive:""],title:d.value},[n("div",{class:[t["n-base-selection-tags"],"n-base-selection-tags"]},[n("div",{class:t["n-base-selection-input"]},[n("div",{class:t["n-base-selection-input__content"]},[d.value])]),n("div",{class:[t["n-base-suffix"]]},[n("div",{class:[t.arrow,i.arrowType==="small"?t.arrowSmall:""]},[i.arrowType==="default"&&n("img",{src:e.popoverShow?W:V},null),i.arrowType==="small"&&n("img",{src:e.popoverShow?q:L},null)])])]),n("div",{class:[t["n-base-selection-placeholder"],t["n-base-selection-overlay"]]},[!d.value&&n("div",{class:t.inner},[i.placeholder])]),n("div",{class:[t["n-base-selection__border"],"n-base-selection__border"]},null),n("div",{class:t["n-base-selection__state-border"]},null)]),default:()=>n("div",{class:t.baseContent},[n(E,{class:t.baseScrollBar,style:{maxHeight:"400px"}},{default:()=>[i.showAudioPlayType&&n(g,null,[n("div",{class:t.baseContentTitle},[f("场景")]),n("div",{class:t.baseContentWrap},[u.value.map(a=>n("span",{class:[t.tag,(e.audioPlayTypes||"")==a.id&&t.tagActive],onClick:()=>{e.audioPlayTypes!==a.id&&(e.childSelectId=null),e.audioPlayTypes=a.id}},[a.name]))])]),e.audioPlayTypes!=="SING"&&n(g,null,[n("div",{class:t.baseContentTitle},[i.options[0].columnName]),n("div",{class:t.baseContentWrap},[i.options.map(a=>n("span",{class:[t.tag,(e.tagActiveId||"")==a.id&&t.tagActive],onClick:()=>{e.tagActiveId!==a.id&&(e.childSelectId=null),e.tagActiveId=a.id,h(a)}},[a.name]))]),n(b,{childShowAllCheck:i.childShowAllCheck,activeRow:e.selectParents,onSelectChildTag:a=>{e.childSelectId=a}},null)])]}),n("div",{class:t.btnGroup},[n("div",{class:[t.btn,t.btnCancel],onClick:p},[f("重置")]),n("div",{class:[t.btn,t.btnConfirm],onClick:C},[f("确认")])])])})])}}),b=I({name:"ChildNodeSearch",props:{childShowAllCheck:{type:Boolean,default:!0},activeRow:{type:Object,default:()=>({})},list:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["selectChildTag"],setup(i,{emit:r}){const{activeRow:e}=B(i),u=_({});y(()=>i.activeRow,()=>{e.value=i.activeRow,v()});const v=()=>{e.value.activeIndex?(e.value.children||[]).forEach(d=>{if(d.id===e.value.activeIndex){let c,A="";d.children&&(c=[...d.children],i.childShowAllCheck&&c.unshift({columnName:d.children[0].columnName,name:"全部"+d.children[0].columnName||"",id:""}),A=d.children[0].columnName,u.value={...d,columnName:A,activeIndex:d.activeIndex||"",children:c},r("selectChildTag",d.activeIndex||""))}}):u.value={}};return S(()=>{v()}),()=>{var h,d;return n(g,null,[((h=e.value)==null?void 0:h.id)&&n(g,null,[n("div",{class:t.baseContentTitle},[e.value.columnName]),n("div",{class:t.baseContentWrap},[(d=e.value)==null?void 0:d.children.map(c=>n("span",{class:[t.tag,(e.value.activeIndex||"")==c.id&&t.tagActive],onClick:()=>{if(i.loading)return;e.value.activeIndex=c.id;let A,p="";if(c.children){A=[...c.children];let C=A.length>0?A[0].id:"";i.childShowAllCheck&&(A.unshift({columnName:c.children[0].columnName,name:"全部"+c.children[0].columnName||"",id:""}),C=""),p=c.children[0].columnName,u.value={...c,columnName:p,activeIndex:C,children:A}}else u.value={};r("selectChildTag",e.value.activeIndex)}},[c.name]))]),n(b,{activeRow:u.value,onSelectChildTag:c=>{r("selectChildTag",c||e.value.activeIndex)}},null)])])}}});export{ae as C};
|