1 |
- import{a as I}from"./contants-84ba384e-1743496079034.js";import{d as w,e as P,r as _,a5 as y,J as T,q as S,f as t,ar as k,ai as C,k as f,b4 as x}from"./index-32ff339b-1743496079034.js";import{N as B}from"./Scrollbar-116ac88a-1743496079034.js";const E="_nBaseCascaser_jdjr3_1",R="_nBaseCascaserActive_jdjr3_16",K="_arrow_jdjr3_64",U="_arrowSmall_jdjr3_72",j="_inner_jdjr3_93",G="_cascaderPopover_jdjr3_113",Q="_baseScrollBar_jdjr3_120",J="_baseContentTitle_jdjr3_123",F="_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",n={nBaseCascaser:E,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:U,"n-base-selection-placeholder":"_n-base-selection-placeholder_jdjr3_79",inner:j,"n-base-selection__border":"_n-base-selection__border_jdjr3_97",cascaderPopover:G,baseScrollBar:Q,baseContentTitle:J,baseContentWrap:F,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=w({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(o,{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 i;s.children.forEach(m=>{a.includes(m.id)&&(i=m.id)}),s.activeIndex=i}s.children&&s.children.length>0&&v(a,s.children)}},h=a=>{let l,s="";if(a.children){l=[...a.children];let i=a.activeIndex?a.activeIndex:l.length>0?l[0].id:"";o.childShowAllCheck&&(l.unshift({columnName:a.children[0].columnName,name:"全部"+a.children[0].columnName||"",id:""}),i=""),s=a.children[0].columnName,e.childSelectId=i,e.selectParents={...a,columnName:s,activeIndex:i,children:l}}else e.selectParents={}};y(()=>e.popoverShow,()=>{if(!e.popoverShow||!o.value)return;let a=c(o.value,o.options);const l=a.findIndex(i=>i.id===o.value);a=a.slice(0,l+1);const s=a.map(i=>i.id);v(s,o.options),e.tagActiveId=a[0].id,o.options.forEach(i=>{i.id===e.tagActiveId&&h(i)})});const d=T(()=>{const a=o.value,l=A(a),s=[];return u.value.forEach(i=>{i.id===e.tempAudioPlayTypes&&o.showAudioPlayType&&s.push(i.name)}),e.tempAudioPlayTypes!=="SING"&&l.forEach(i=>{s.push(i.name)}),o.showPath?s.join(" / "):s[s.length-1]}),c=(a,l,s=[])=>{for(const i of l){if(i.children&&i.children.length>0){const m=c(a,i.children,[...s,{name:i.name,id:i.id}]);if(m.findIndex(N=>N.id===a)>-1)return m}if(i.id===a)return[...s,{name:i.name,id:a}]}return s},A=a=>{let l=c(a,o.options);const s=l.findIndex(i=>i.id===a);return l=l.slice(0,s+1),l},p=()=>{const a=o.options[0],l=a.children?a.children[0]:null;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},g=()=>{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(I).map(l=>({id:l,name:I[l]}));u.value=[{name:"全部场景",id:""},...a]}),()=>t(k,{placement:o.placement,show:e.popoverShow,"onUpdate:show":a=>e.popoverShow=a,showArrow:!1,trigger:"click",displayDirective:"show",class:[n.cascaderPopover,"c-cascaderPopover"]},{trigger:()=>t("div",{class:[n.nBaseCascaser,"nBaseCascaser",e.popoverShow?n.nBaseCascaserActive:""],title:d.value},[t("div",{class:[n["n-base-selection-tags"],"n-base-selection-tags"]},[t("div",{class:n["n-base-selection-input"]},[t("div",{class:n["n-base-selection-input__content"]},[d.value])]),t("div",{class:[n["n-base-suffix"]]},[t("div",{class:[n.arrow,o.arrowType==="small"?n.arrowSmall:""]},[o.arrowType==="default"&&t("img",{src:e.popoverShow?W:V},null),o.arrowType==="small"&&t("img",{src:e.popoverShow?q:L},null)])])]),t("div",{class:[n["n-base-selection-placeholder"],n["n-base-selection-overlay"]]},[!d.value&&t("div",{class:n.inner},[o.placeholder])]),t("div",{class:[n["n-base-selection__border"],"n-base-selection__border"]},null),t("div",{class:n["n-base-selection__state-border"]},null)]),default:()=>t("div",{class:n.baseContent},[t(B,{class:n.baseScrollBar,style:{maxHeight:"400px"}},{default:()=>[o.showAudioPlayType&&t(C,null,[t("div",{class:n.baseContentTitle},[f("场景")]),t("div",{class:n.baseContentWrap},[u.value.map(a=>t("span",{class:[n.tag,(e.audioPlayTypes||"")==a.id&&n.tagActive],onClick:()=>{e.audioPlayTypes!==a.id&&(e.childSelectId=null),e.audioPlayTypes=a.id}},[a.name]))])]),e.audioPlayTypes!=="SING"&&t(C,null,[t("div",{class:n.baseContentTitle},[o.options[0].columnName]),t("div",{class:n.baseContentWrap},[o.options.map(a=>t("span",{class:[n.tag,(e.tagActiveId||"")==a.id&&n.tagActive],onClick:()=>{e.tagActiveId!==a.id&&(e.childSelectId=null),e.tagActiveId=a.id,h(a)}},[a.name]))]),t(b,{childShowAllCheck:o.childShowAllCheck,activeRow:e.selectParents,onSelectChildTag:a=>{e.childSelectId=a}},null)])]}),t("div",{class:n.btnGroup},[t("div",{class:[n.btn,n.btnCancel],onClick:p},[f("重置")]),t("div",{class:[n.btn,n.btnConfirm],onClick:g},[f("确认")])])])})}}),b=w({name:"ChildNodeSearch",props:{childShowAllCheck:{type:Boolean,default:!0},activeRow:{type:Object,default:()=>({})},list:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["selectChildTag"],setup(o,{emit:r}){const{activeRow:e}=x(o),u=_({});y(()=>o.activeRow,()=>{e.value=o.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],o.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 t(C,null,[((h=e.value)==null?void 0:h.id)&&t(C,null,[t("div",{class:n.baseContentTitle},[e.value.columnName]),t("div",{class:n.baseContentWrap},[(d=e.value)==null?void 0:d.children.map(c=>t("span",{class:[n.tag,(e.value.activeIndex||"")==c.id&&n.tagActive],onClick:()=>{if(o.loading)return;e.value.activeIndex=c.id;let A,p="";if(c.children){A=[...c.children];let g=A.length>0?A[0].id:"";o.childShowAllCheck&&(A.unshift({columnName:c.children[0].columnName,name:"全部"+c.children[0].columnName||"",id:""}),g=""),p=c.children[0].columnName,u.value={...c,columnName:p,activeIndex:g,children:A}}else u.value={};r("selectChildTag",e.value.activeIndex)}},[c.name]))]),t(b,{activeRow:u.value,onSelectChildTag:c=>{r("selectChildTag",c||e.value.activeIndex)}},null)])])}}});export{ae as C};
|