var $=(O,C,a)=>new Promise((r,e)=>{var x=p=>{try{d(a.next(p))}catch(c){e(c)}},V=p=>{try{d(a.throw(p))}catch(c){e(c)}},d=p=>p.done?r(p.value):Promise.resolve(p.value).then(x,V);d((a=a.apply(O,C)).next())});import{_ as M,d as z,r as N,N as F,P as G,f as s,g as u,K as T,m as o,l as i,p as b,j as _,h as k,G as U,L as I}from"./index.32929554.js";const J=["onClick"],H=z({name:"expertOpinionTempDialog"}),Q=Object.assign(H,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object,isAll:{type:Boolean,default:!1}},emits:["close","updateExpertOpinion","changeAllData"],setup(O,{emit:C}){const a=O,r=C,e=N({templates:[]}),x=N(),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:[{}]})},p=n=>{e.value.templates.splice(n,1)},c=n=>{e.value.templates[n].options.push({option:""})},A=(n,l)=>{e.value.templates[n].options.splice(l,1)},P=n=>$(this,null,function*(){!n||(yield n.validate(l=>$(this,null,function*(){var m;if(l){const h=(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};a.isAll?r("changeAllData",{expertOptionType:e.value.templates[0].optionType,expertOptions:e.value.templates[0].options}):r("updateExpertOpinion",h),r("close")}})))});return F(()=>a.visible,n=>$(this,null,function*(){var l,m;n&&(yield G(),(m=(l=a.data)==null?void 0:l.value)!=null&&m.expertOptionType?e.value={templates:[{optionType:a.data.value.expertOptionType,options:a.data.value.expertOptions}]}:e.value={templates:[]})})),(n,l)=>{const m=s("el-option"),h=s("el-select"),w=s("el-form-item"),q=s("el-input"),E=s("svg-icon"),y=s("el-button"),L=s("table-list"),R=s("el-form"),K=s("el-dialog");return u(),T(K,{"model-value":a.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=>P(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(R,{ref_key:"formRef",ref:x,model:e.value},{default:o(()=>{var D;return[i(L,{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(w,{key:0,prop:`templates[${t.$index}].optionType`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}]},{default:o(()=>[i(h,{modelValue:e.value.templates[t.$index].optionType,"onUpdate:modelValue":g=>e.value.templates[t.$index].optionType=g},{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(U,{key:0},[(u(!0),k(U,null,I(e.value.templates[t.$index].options,(g,v)=>{var j;return u(),k("div",{key:v,class:"flex items-center mb-8"},[i(w,{class:"flex-1",style:{"margin-bottom":"0"},prop:`templates[${t.$index}].options[${v}].option`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[i(q,{modelValue:e.value.templates[t.$index].options[v].option,"onUpdate:modelValue":B=>e.value.templates[t.$index].options[v].option=B},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),((j=e.value.templates[t.$index].options)==null?void 0:j.length)>1?(u(),T(E,{key:0,name:"deleteIcon",class:"ml-4 cursor-pointer text-24",onClick:B=>A(t.$index,v)},null,8,["onClick"])):_("v-if",!0)])}),128)),i(y,{type:"primary",size:"small",class:"w-full",plain:"",icon:"Plus",onClick:g=>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:g=>p(t.$index)},"\u79FB\u9664",8,J)):_("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=M(Q,[["__file","/Users/chenlixin/Documents/work/NDKJ/MyProject/ls-project-v2.0/src/pages/systemManage/templateConfig/components/expertOpinionTempDialog.vue"]]);export{X as default};
