import{a2 as e,e as a,T as l,ba as s,bb as t,a as c,o as u,h as n,w as o,i as d,j as i,t as f,k as r,F as m,l as p,A as v,z as _,S as k}from"./index-WeUkftbp.js";import{_ as x}from"./_plugin-vue_export-helper.BCo6x5W8.js";const h=x({__name:"index",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},columns:{type:Array,default:[]},defaultIndex:{type:Array,default:[]}},emits:["cancel","confirm","change"],setup(x,{emit:h}){const g=x,{show:y,title:b,columns:S,defaultIndex:j}=e(g),C=a({value:[],selected:[],list:[],animationData:{}});let w=h;l((()=>[y.value]),(e=>{e[0]&&A()}),{deep:!0,immediate:!0});const A=()=>{C.value=j.value,S.value.forEach(((e,a)=>{e.selected=!1,C.value.indexOf(e.value.toString())>=0&&(e.selected=!0)}))},I=()=>{w("change",{selected:C.selected,value:C.value})},z=()=>{w("cancel")};return(e,a)=>{const l=_,x=k;return s((u(),n(l,{class:"popup"},{default:o((()=>[d(l,{class:"bg"}),d(l,{class:"selectMultiple"},{default:o((()=>[d(l,{class:"multipleBody"},{default:o((()=>[d(l,{class:"title"},{default:o((()=>[d(l,{class:"close",onClick:z},{default:o((()=>[i(" 取消 ")])),_:1}),d(l,{class:"name"},{default:o((()=>[i(f(C.title),1)])),_:1}),d(l,{class:"confirm",onClick:I},{default:o((()=>[i(" 确定 ")])),_:1})])),_:1}),d(l,{class:"list"},{default:o((()=>[d(l,{class:"mask mask-top"}),d(l,{class:"mask mask-bottom"}),d(x,{class:"diet-list","scroll-y":"true"},{default:o((()=>[(u(!0),r(m,null,p(c(S),((e,a)=>(u(),n(l,{class:v(["check-flex",["item",e.selected?"checked":""]]),onClick:l=>((e,a)=>{C.value.indexOf(a.value.toString())>=0?S.value[e].selected=!1:S.value[e].selected=!0,C.value=[],C.selected=[],S.value.forEach(((e,a)=>{e.selected&&(C.value.push(e.value.toString()),C.selected.push({text:e.text||e.name,value:e.value}))}))})(a,e)},{default:o((()=>[d(l,null,{default:o((()=>[i(f(e.text||e.name),1)])),_:2},1024),e.selected?(u(),n(l,{key:0,class:"icon iconfont icon-a-zu9739-01"})):(u(),n(l,{key:1,class:"icon iconfont icon-a-juxing8761biankuang"}))])),_:2},1032,["class","onClick"])))),256))])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},512)),[[t,c(y)]])}}},[["__scopeId","data-v-0addb9d2"]]);export{h as m};
