Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

2 lignes
5.1KB

  1. import{E as H}from"./index.108a55d4.js";import{t as J,s as K}from"./reviewTemplateConfig.637316c4.js";import{g as $,a as Q}from"./getIsShowRegionTree.7b64ce60.js";import{d as W,b as Y,r as C,o as Z,c as s,e as m,G as v,i as o,u as E,h as e,k as c,f as g,F as I,H as ee,j as N,g as te,q as le}from"./index.a2494fc2.js";const ae=["onClick"],oe={class:"footer"},ne=W({name:"reviewTemplateConfig"}),ue=Object.assign(ne,{setup(se){const{proxy:w}=le(),p=Y({regionCode:void 0,templateType:"1"}),M=l=>{p.regionCode=l.regionLevel===3?l.regionCode:void 0,y()},D=({props:l})=>{p.templateType=l.name,y()},y=async()=>{try{const l=await J({...p,templateType:p.templateType*1});t.value=l.data||{templates:[]}}catch{t.value={templates:[]}}},P=[{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(),U=()=>{t.value.templates.push({title:"",optionType:void 0,options:[{}]})},G=l=>{t.value.templates.splice(l,1)},h=l=>{t.value.templates[l].options.push({option:""})},O=(l,n)=>{t.value.templates[l].options.splice(n,1)},f=C(!1),S=async l=>{!l||await l.validate(async n=>{if(n){const r=q();f.value=!0;try{await K(r),w.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),f.value=!1}catch{f.value=!1}}})},q=()=>{var l;return{regionCode:p.regionCode,templateType:p.templateType*1,templates:((l=t.value)==null?void 0:l.templates.map((n,r)=>({...n,serialNo:r,options:n.options.map((i,b)=>({...i,serialNo:b}))})))||[]}};return Z(()=>{$(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])||y()}),(l,n)=>{const r=s("el-col"),i=s("el-tab-pane"),b=s("el-tabs"),V=s("el-input"),T=s("el-form-item"),k=s("el-option"),B=s("el-select"),X=s("svg-icon"),x=s("el-button"),F=s("table-list"),L=s("el-form"),j=s("el-card"),z=s("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(H,{params:E(Q)({SUPER_ADMIN:!1,REGION_MANAGER:!1,EXPERT_ADMIN:!1}),onGetTree:M},null,8,["params"])]),_:1})):c("",!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":n[0]||(n[0]=d=>p.templateType=d),class:"demo-tabs",onTabClick:D},{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:P,data:((d=t.value)==null?void 0:d.templates)||[],pagination:!1},{title:o(({scope:a})=>[t.value.templates[a.$index]?(m(),v(T,{key:0,prop:`templates[${a.$index}].title`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[e(V,{modelValue:t.value.templates[a.$index].title,"onUpdate:modelValue":u=>t.value.templates[a.$index].title=u},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):c("",!0)]),optionType:o(({scope:a})=>[t.value.templates[a.$index]?(m(),v(T,{key:0,prop:`templates[${a.$index}].optionType`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}]},{default:o(()=>[e(B,{modelValue:t.value.templates[a.$index].optionType,"onUpdate:modelValue":u=>t.value.templates[a.$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"])):c("",!0)]),options:o(({scope:a})=>[t.value.templates[a.$index]?(m(),g(I,{key:0},[(m(!0),g(I,null,ee(t.value.templates[a.$index].options,(u,_)=>(m(),g("div",{key:_,class:"flex items-center mb-8"},[e(T,{class:"flex-1",style:{"margin-bottom":"0"},prop:`templates[${a.$index}].options[${_}].option`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:o(()=>[e(V,{modelValue:t.value.templates[a.$index].options[_].option,"onUpdate:modelValue":A=>t.value.templates[a.$index].options[_].option=A},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),e(X,{name:"deleteIcon",class:"ml-4 cursor-pointer text-24",onClick:A=>O(a.$index,_)},null,8,["onClick"])]))),128)),e(x,{type:"primary",size:"small",class:"w-full",plain:"",icon:"Plus",onClick:u=>h(a.$index)},{default:o(()=>n[2]||(n[2]=[N("\u6DFB\u52A0\u9009\u9879")])),_:2},1032,["onClick"])],64)):c("",!0)]),action:o(({scope:a})=>[t.value.templates[a.$index]?(m(),g("a",{key:0,class:"text-danger",onClick:u=>G(a.$index)},"\u79FB\u9664",8,ae)):c("",!0)]),_:1},8,["data"])]}),_:1},8,["model"]),e(x,{type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:U},{default:o(()=>n[3]||(n[3]=[N("\u6DFB\u52A0\u610F\u89C1\u7C7B\u578B")])),_:1}),te("div",oe,[e(x,{type:"primary",loading:f.value,onClick:n[1]||(n[1]=d=>S(R.value))},{default:o(()=>n[4]||(n[4]=[N(" \u63D0\u4EA4 ")])),_:1},8,["loading"])])]),_:1})]),_:1},8,["span"])]),_:1})}}});export{ue as default};