var g=(C,O,n)=>new Promise((r,e)=>{var x=s=>{try{d(n.next(s))}catch(c){e(c)}},V=s=>{try{d(n.throw(s))}catch(c){e(c)}},d=s=>s.done?r(s.value):Promise.resolve(s.value).then(x,V);d((n=n.apply(C,O)).next())});import{_ as E,d as F,r as U,N as G,P as I,f as p,g as u,K as T,m as o,l as i,p as b,j as _,h as k,G as B,L as J}from"./index.9fabe127.js";const A=["onClick"],H=F({name:"expertOpinionTempDialog"}),Q=Object.assign(H,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close","update:data"],setup(C,{emit:O}){const n=C,r=O,e=U({templates:[]}),x=U(),V=[{label:"\u9009\u9879\u7C7B\u578B",slot:"optionType",width:120},{label:"\u5305\u542B\u7684\u9009\u9879",slot:"options"},{label:"\u64CD\u4F5C",slot:"action",width:60}],d=()=>{e.value.templates.push({optionType:void 0,options:[{}]})},s=a=>{e.value.templates.splice(a,1)},c=a=>{e.value.templates[a].options.push({option:""})},P=(a,l)=>{e.value.templates[a].options.splice(l,1)},q=a=>g(this,null,function*(){!a||(yield a.validate(l=>g(this,null,function*(){var m;if(l){const w=(m=e.value.templates)!=null&&m.length?{value:{expertOptionType:e.value.templates[0].optionType,expertOptions:e.value.templates[0].options}}:{optionType:void 0,options:void 0};r("update:data",w),r("close")}})))});return G(()=>n.visible,a=>g(this,null,function*(){var l,m;a&&(yield I(),(m=(l=n.data)==null?void 0:l.value)!=null&&m.expertOptionType?e.value={templates:[{optionType:n.data.value.expertOptionType,options:n.data.value.expertOptions}]}:e.value={templates:[]})})),(a,l)=>{const m=p("el-option"),w=p("el-select"),h=p("el-form-item"),L=p("el-input"),R=p("svg-icon"),y=p("el-button"),K=p("table-list"),M=p("el-form"),z=p("el-dialog");return u(),T(z,{"model-value":n.visible,title:"\u4E13\u5BB6\u610F\u89C1\u6A21\u677F",width:"65%","destroy-on-close":"","close-on-click-modal":!1,onClose:l[2]||(l[2]=f=>r("close"))},{footer:o(()=>[i(y,{type:"primary",onClick:l[0]||(l[0]=f=>q(x.value))},{default:o(()=>[b(" \u63D0\u4EA4 ")]),_:1}),i(y,{onClick:l[1]||(l[1]=f=>r("close"))},{default:o(()=>[b(" \u5173\u95ED ")]),_:1})]),default:o(()=>{var f;return[i(M,{ref_key:"formRef",ref:x,model:e.value},{default:o(()=>{var D;return[i(K,{ref:"tableListRef",column:V,data:((D=e.value)==null?void 0:D.templates)||[],pagination:!1,"empty-temp":!1},{optionType:o(({scope:t})=>[e.value.templates[t.$index]?(u(),T(h,{key:0,prop:`templates[${t.$index}].optionType`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}]},{default:o(()=>[i(w,{modelValue:e.value.templates[t.$index].optionType,"onUpdate:modelValue":$=>e.value.templates[t.$index].optionType=$},{default:o(()=>[i(m,{label:"\u5355\u9009",value:1}),i(m,{label:"\u591A\u9009",value:2})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):_("v-if",!0)]),options:o(({scope:t})=>[e.value.templates[t.$index]?(u(),k(B,{key:0},[(u(!0),k(B,null,J(e.value.templates[t.$index].options,($,v)=>{var j;return u(),k("div",{key:v,class:"flex items-center mb-8"},[i(h,{class:"flex-1",style:{"margin-bottom":"0"},prop:`templates[${t.$index}].options[${v}].option`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[i(L,{modelValue:e.value.templates[t.$index].options[v].option,"onUpdate:modelValue":N=>e.value.templates[t.$index].options[v].option=N},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),((j=e.value.templates[t.$index].options)==null?void 0:j.length)>1?(u(),T(R,{key:0,name:"deleteIcon",class:"ml-4 cursor-pointer text-24",onClick:N=>P(t.$index,v)},null,8,["onClick"])):_("v-if",!0)])}),128)),i(y,{type:"primary",size:"small",class:"w-full",plain:"",icon:"Plus",onClick:$=>c(t.$index)},{default:o(()=>[b("\u6DFB\u52A0\u9009\u9879")]),_:2},1032,["onClick"])],64)):_("v-if",!0)]),action:o(({scope:t})=>[e.value.templates[t.$index]?(u(),k("a",{key:0,class:"text-danger",onClick:$=>s(t.$index)},"\u79FB\u9664",8,A)):_("v-if",!0)]),_:1},8,["data"])]}),_:1},8,["model"]),(f=e.value.templates)!=null&&f.length?_("v-if",!0):(u(),T(y,{key:0,type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:d},{default:o(()=>[b("\u6DFB\u52A0\u610F\u89C1\u7C7B\u578B")]),_:1}))]}),_:1},8,["model-value"])}}}),X=E(Q,[["__file","/Users/chenlixin/Documents/work/NDKJ/MyProject/ls-project-v2.0/src/pages/systemManage/templateConfig/components/expertOpinionTempDialog.vue"]]);export{X as default};
