You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.8KB

  1. var Z=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var B=(i,s,e)=>s in i?Z(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e,$=(i,s)=>{for(var e in s||(s={}))ae.call(s,e)&&B(i,e,s[e]);if(S)for(var e of S(s))le.call(s,e)&&B(i,e,s[e]);return i},C=(i,s)=>ee(i,te(s));var E=(i,s,e)=>new Promise((V,T)=>{var f=r=>{try{t(e.next(r))}catch(v){T(v)}},k=r=>{try{t(e.throw(r))}catch(v){T(v)}},t=r=>r.done?V(r.value):Promise.resolve(r.value).then(f,k);t((e=e.apply(i,s)).next())});import{E as oe}from"./index.642e7e4c.js";import{t as ne,s as se}from"./reviewTemplateConfig.68830b0b.js";import{g as h,a as pe}from"./getIsShowRegionTree.b965db88.js";import{d as ie,b as me,r as M,o as re,c as p,e as d,I as N,i as n,u as D,h as a,k as b,f as R,F as X,J as ue,j as P,g as de,x as ce}from"./index.3fb2f955.js";const _e=["onClick"],fe={class:"footer"},ve=ie({name:"reviewTemplateConfig"}),$e=Object.assign(ve,{setup(i){const{proxy:s}=ce(),e=me({regionCode:void 0,templateType:"1"}),V=l=>{e.regionCode=l.regionLevel===3?l.regionCode:void 0,f()},T=({props:l})=>{e.templateType=l.name,f()},f=()=>E(this,null,function*(){try{const l=yield ne(C($({},e),{templateType:e.templateType*1}));t.value=l.data||{templates:[]}}catch(l){t.value={templates:[]}}}),k=[{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=M({templates:[]}),r=M(),v=()=>{t.value.templates.push({title:"",optionType:void 0,options:[{}]})},q=l=>{t.value.templates.splice(l,1)},F=l=>{t.value.templates[l].options.push({option:""})},L=(l,m)=>{t.value.templates[l].options.splice(m,1)},x=M(!1),j=l=>E(this,null,function*(){!l||(yield l.validate(m=>E(this,null,function*(){if(m){const c=z();x.value=!0;try{yield se(c),s.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),x.value=!1}catch(u){x.value=!1}}})))}),z=()=>{var l;return{regionCode:e.regionCode,templateType:e.templateType*1,templates:((l=t.value)==null?void 0:l.templates.map((m,c)=>C($({},m),{serialNo:c,options:m.options.map((u,A)=>C($({},u),{serialNo:A}))})))||[]}};return re(()=>{h(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])||f()}),(l,m)=>{const c=p("el-col"),u=p("el-tab-pane"),A=p("el-tabs"),U=p("el-input"),I=p("el-form-item"),G=p("el-option"),J=p("el-select"),H=p("svg-icon"),w=p("el-button"),K=p("table-list"),Q=p("el-form"),W=p("el-card"),Y=p("el-row");return d(),N(Y,{gutter:16},{default:n(()=>[D(h)(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])?(d(),N(c,{key:0,style:{"padding-right":"16px"},span:4},{default:n(()=>[a(oe,{params:D(pe)({SUPER_ADMIN:!1,REGION_MANAGER:!1,EXPERT_ADMIN:!1}),onGetTree:V},null,8,["params"])]),_:1})):b("",!0),a(c,{span:D(h)(["SUPER_ADMIN","REGION_MANAGER","EXPERT_ADMIN"])?20:24},{default:n(()=>[a(W,{class:"w-full tab-card footerCard"},{header:n(()=>[a(A,{modelValue:e.templateType,"onUpdate:modelValue":m[0]||(m[0]=g=>e.templateType=g),class:"demo-tabs",onTabClick:T},{default:n(()=>[a(u,{label:"\u521D\u6B65\u65B9\u6848\u8BC4\u5BA1\u6A21\u7248",name:"1"}),a(u,{label:"\u5EFA\u8BBE\u65B9\u6848\u8BC4\u5BA1\u6A21\u7248",name:"2"}),a(u,{label:"\u9A8C\u6536\u8BC4\u5BA1\u6A21\u7248",name:"3"}),a(u,{label:"\u90E8\u95E8\u8054\u5BA1\u6A21\u7248",name:"4"}),a(u,{label:"\u516C\u5E73\u6027\u5BA1\u67E5",name:"5"})]),_:1},8,["modelValue"])]),default:n(()=>[a(Q,{ref_key:"formRef",ref:r,model:t.value},{default:n(()=>{var g;return[a(K,{ref:"tableListRef",column:k,data:((g=t.value)==null?void 0:g.templates)||[],pagination:!1},{title:n(({scope:o})=>[t.value.templates[o.$index]?(d(),N(I,{key:0,prop:`templates[${o.$index}].title`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:n(()=>[a(U,{modelValue:t.value.templates[o.$index].title,"onUpdate:modelValue":_=>t.value.templates[o.$index].title=_},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):b("",!0)]),optionType:n(({scope:o})=>[t.value.templates[o.$index]?(d(),N(I,{key:0,prop:`templates[${o.$index}].optionType`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}]},{default:n(()=>[a(J,{modelValue:t.value.templates[o.$index].optionType,"onUpdate:modelValue":_=>t.value.templates[o.$index].optionType=_},{default:n(()=>[a(G,{label:"\u5355\u9009",value:1}),a(G,{label:"\u591A\u9009",value:2})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):b("",!0)]),options:n(({scope:o})=>[t.value.templates[o.$index]?(d(),R(X,{key:0},[(d(!0),R(X,null,ue(t.value.templates[o.$index].options,(_,y)=>(d(),R("div",{key:y,class:"flex items-center mb-8"},[a(I,{class:"flex-1",style:{"margin-bottom":"0"},prop:`templates[${o.$index}].options[${y}].option`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},{default:n(()=>[a(U,{modelValue:t.value.templates[o.$index].options[y].option,"onUpdate:modelValue":O=>t.value.templates[o.$index].options[y].option=O},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),a(H,{name:"deleteIcon",class:"ml-4 cursor-pointer text-24",onClick:O=>L(o.$index,y)},null,8,["onClick"])]))),128)),a(w,{type:"primary",size:"small",class:"w-full",plain:"",icon:"Plus",onClick:_=>F(o.$index)},{default:n(()=>[P("\u6DFB\u52A0\u9009\u9879")]),_:2},1032,["onClick"])],64)):b("",!0)]),action:n(({scope:o})=>[t.value.templates[o.$index]?(d(),R("a",{key:0,class:"text-danger",onClick:_=>q(o.$index)},"\u79FB\u9664",8,_e)):b("",!0)]),_:1},8,["data"])]}),_:1},8,["model"]),a(w,{type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:v},{default:n(()=>[P("\u6DFB\u52A0\u610F\u89C1\u7C7B\u578B")]),_:1}),de("div",fe,[a(w,{type:"primary",loading:x.value,onClick:m[1]||(m[1]=g=>j(r.value))},{default:n(()=>[P(" \u63D0\u4EA4 ")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["span"])]),_:1})}}});export{$e as default};