|
- import{E as J}from"./index.b273650f.js";import{t as H,s as K}from"./reviewTemplateConfig.ba1e51b1.js";import{g as $,a as Q}from"./getIsShowRegionTree.01dd95cf.js";import{d as W,b as Y,r as C,o as Z,c as n,e as m,I as v,i as o,u as E,h as e,k as _,f as g,F as I,J as ee,j as N,g as te,x as ae}from"./index.ac8ca1e3.js";const le=["onClick"],oe={class:"footer"},ne=W({name:"reviewTemplateConfig"}),ue=Object.assign(ne,{setup(se){const{proxy:w}=ae(),p=Y({regionCode:void 0,templateType:"1"}),h=a=>{p.regionCode=a.regionLevel===3?a.regionCode:void 0,y()},M=({props:a})=>{p.templateType=a.name,y()},y=async()=>{try{const a=await H({...p,templateType:p.templateType*1});t.value=a.data||{templates:[]}}catch{t.value={templates:[]}}},D=[{label:"\u5E8F\u53F7",type:"index",width:"60"},{label:"\u610F\u89C1\u6807\u9898",slot:"title"},{label:"\u9009\u9879\u7C7B\u578B",slot:"optionType",width:120},{label:"\u5305\u542B\u7684\u9009\u9879",slot:"options"},{label:"\u64CD\u4F5C",slot:"action",width:60}],t=C({templates:[]}),R=C(),P=()=>{t.value.templates.push({title:"",optionType:void 0,options:[{}]})},U=a=>{t.value.templates.splice(a,1)},G=a=>{t.value.templates[a].options.push({option:""})},O=(a,s)=>{t.value.templates[a].options.splice(s,1)},f=C(!1),S=async a=>{!a||await a.validate(async s=>{if(s){const r=B();f.value=!0;try{await K(r),w.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),f.value=!1}catch{f.value=!1}}})},B=()=>{var a;return{regionCode:p.regionCode,templateType:p.templateType*1,templates:((a=t.value)==null?void 0:a.templates.map((s,r)=>({...s,serialNo:r,options:s.options.map((i,b)=>({...i,serialNo:b}))})))||[]}};return Z(()=>{$(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])||y()}),(a,s)=>{const r=n("el-col"),i=n("el-tab-pane"),b=n("el-tabs"),V=n("el-input"),T=n("el-form-item"),k=n("el-option"),X=n("el-select"),q=n("svg-icon"),x=n("el-button"),F=n("table-list"),L=n("el-form"),j=n("el-card"),z=n("el-row");return m(),v(z,{gutter:16},{default:o(()=>[E($)(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])?(m(),v(r,{key:0,style:{"padding-right":"16px"},span:4},{default:o(()=>[e(J,{params:E(Q)({SUPER_ADMIN:!1,REGION_MANAGER:!1,EXPERT_ADMIN:!1}),onGetTree:h},null,8,["params"])]),_:1})):_("",!0),e(r,{span:E($)(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])?20:24},{default:o(()=>[e(j,{class:"w-full tab-card footerCard"},{header:o(()=>[e(b,{modelValue:p.templateType,"onUpdate:modelValue":s[0]||(s[0]=d=>p.templateType=d),class:"demo-tabs",onTabClick:M},{default:o(()=>[e(i,{label:"\u521D\u6B65\u65B9\u6848\u8BC4\u5BA1\u6A21\u7248",name:"1"}),e(i,{label:"\u5EFA\u8BBE\u65B9\u6848\u8BC4\u5BA1\u6A21\u7248",name:"2"}),e(i,{label:"\u9A8C\u6536\u8BC4\u5BA1\u6A21\u7248",name:"3"}),e(i,{label:"\u90E8\u95E8\u8054\u5BA1\u6A21\u7248",name:"4"}),e(i,{label:"\u516C\u5E73\u6027\u5BA1\u67E5",name:"5"})]),_:1},8,["modelValue"])]),default:o(()=>[e(L,{ref_key:"formRef",ref:R,model:t.value},{default:o(()=>{var d;return[e(F,{ref:"tableListRef",column:D,data:((d=t.value)==null?void 0:d.templates)||[],pagination:!1},{title:o(({scope:l})=>[t.value.templates[l.$index]?(m(),v(T,{key:0,prop:`templates[${l.$index}].title`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[e(V,{modelValue:t.value.templates[l.$index].title,"onUpdate:modelValue":u=>t.value.templates[l.$index].title=u},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):_("",!0)]),optionType:o(({scope:l})=>[t.value.templates[l.$index]?(m(),v(T,{key:0,prop:`templates[${l.$index}].optionType`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}]},{default:o(()=>[e(X,{modelValue:t.value.templates[l.$index].optionType,"onUpdate:modelValue":u=>t.value.templates[l.$index].optionType=u},{default:o(()=>[e(k,{label:"\u5355\u9009",value:1}),e(k,{label:"\u591A\u9009",value:2})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):_("",!0)]),options:o(({scope:l})=>[t.value.templates[l.$index]?(m(),g(I,{key:0},[(m(!0),g(I,null,ee(t.value.templates[l.$index].options,(u,c)=>(m(),g("div",{key:c,class:"flex items-center mb-8"},[e(T,{class:"flex-1",style:{"margin-bottom":"0"},prop:`templates[${l.$index}].options[${c}].option`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[e(V,{modelValue:t.value.templates[l.$index].options[c].option,"onUpdate:modelValue":A=>t.value.templates[l.$index].options[c].option=A},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),e(q,{name:"deleteIcon",class:"ml-4 cursor-pointer text-24",onClick:A=>O(l.$index,c)},null,8,["onClick"])]))),128)),e(x,{type:"primary",size:"small",class:"w-full",plain:"",icon:"Plus",onClick:u=>G(l.$index)},{default:o(()=>[N("\u6DFB\u52A0\u9009\u9879")]),_:2},1032,["onClick"])],64)):_("",!0)]),action:o(({scope:l})=>[t.value.templates[l.$index]?(m(),g("a",{key:0,class:"text-danger",onClick:u=>U(l.$index)},"\u79FB\u9664",8,le)):_("",!0)]),_:1},8,["data"])]}),_:1},8,["model"]),e(x,{type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:P},{default:o(()=>[N("\u6DFB\u52A0\u610F\u89C1\u7C7B\u578B")]),_:1}),te("div",oe,[e(x,{type:"primary",loading:f.value,onClick:s[1]||(s[1]=d=>S(R.value))},{default:o(()=>[N(" \u63D0\u4EA4 ")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["span"])]),_:1})}}});export{ue as default};
|