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
4.9KB

  1. import{E as H}from"./index-29b4120c.js";import{t as J,s as K}from"./reviewTemplateConfig-2fd938ef.js";import{g as $,a as Q}from"./getIsShowRegionTree-21a24141.js";import{a as W,r as C,o as Y,b as s,c as m,L as v,h as o,u as E,f as e,j as c,d as g,F as I,H as Z,i as N,e as ee,k as te,s as le}from"./index-dd5fae99.js";const ae=["onClick"],oe={class:"footer"},ne=te({name:"reviewTemplateConfig"}),ue=Object.assign(ne,{setup(se){const{proxy:w}=le(),p=W({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:"序号",type:"index",width:"60"},{label:"意见标题",slot:"title"},{label:"选项类型",slot:"optionType",width:120},{label:"包含的选项",slot:"options"},{label:"操作",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=B();f.value=!0;try{await K(r),w.$message.success("提交成功!"),f.value=!1}catch{f.value=!1}}})},B=()=>{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 Y(()=>{$(["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"),L=s("el-select"),X=s("svg-icon"),x=s("el-button"),q=s("table-list"),F=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:"初步方案评审模版",name:"1"}),e(i,{label:"建设方案评审模版",name:"2"}),e(i,{label:"验收评审模版",name:"3"}),e(i,{label:"部门联审模版",name:"4"}),e(i,{label:"公平性审查",name:"5"})]),_:1},8,["modelValue"])]),default:o(()=>[e(F,{ref_key:"formRef",ref:R,model:t.value},{default:o(()=>{var d;return[e(q,{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:"请输入"}]},{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:"请选择"}]},{default:o(()=>[e(L,{modelValue:t.value.templates[a.$index].optionType,"onUpdate:modelValue":u=>t.value.templates[a.$index].optionType=u},{default:o(()=>[e(k,{label:"单选",value:1}),e(k,{label:"多选",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,Z(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:"请输入"}]},{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("添加选项")])),_: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)},"移除",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("添加意见类型")])),_:1}),ee("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(" 提交 ")])),_:1},8,["loading"])])]),_:1})]),_:1},8,["span"])]),_:1})}}});export{ue as default};