index-5f5a4216-1724872791500.js 8.5 KB

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