Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index-6ca2d7d1.js 2.9KB

1
  1. import{a as P,x as U,y as I,z as L}from"./indicatorTemplate-ca1642c9.js";import{a as q,r as i,o as E,b as t,c as G,d as M,e as m,j as V,f as o,h as l,i as g,F as O,k as S,C as A,s as H}from"./index-dd5fae99.js";const J={class:"flex justify-between items-center"},K=["onClick"];const Q=S({name:"templateType"}),ee=Object.assign(Q,{setup(W){const{proxy:c}=H(),h=q({indexName:void 0}),w=i(),b=i(0),k=i([]),T=[{label:"序号",type:"index",width:"60"},{label:"类型名称",key:"name",prop:"name"},{label:"操作",slot:"action",width:"80",fixed:"right"}],d=async(a=w.value.pageParams)=>{var s;const e=await P({...a,...h});k.value=((s=e==null?void 0:e.data)==null?void 0:s.records)||[],b.value=e.data.total},p=i(!1),x=i(),r=i({}),f=i(),$={name:[{required:!0,message:"请输入"}]},u=i(!1),C=async(a,e)=>{if(a===2){const s=await U(e.id);r.value={...s.data}}x.value=a,p.value=!0,await A(),f.value.clearValidate()},B=async a=>{a&&await a.validate(async e=>{if(e){u.value=!0;const s={id:r.value.id||void 0,name:r.value.name||""};try{await I(s),c.$message.success("提交成功!"),d(),u.value=!1,_(!0)}catch{u.value=!1}}})},_=()=>{r.value={},p.value=!1},X=a=>{c.$messageBox.confirm(`是否删除${a.name}?`,"提示!",{type:"warning"}).then(async()=>{await L(a.id),c.$message.success("删除成功!"),await d()})};return E(()=>{d()}),(a,e)=>{const s=t("el-input"),D=t("el-form-item");t("el-col");const v=t("el-button");t("el-row");const N=t("el-form"),z=t("el-card"),R=t("el-switch"),j=t("table-list"),F=t("el-dialog");return G(),M(O,null,[m("div",null,[V("",!0),o(z,{shadow:"never"},{header:l(()=>[m("div",J,[e[7]||(e[7]=m("span",null,"模板类型列表",-1)),o(v,{type:"primary",size:"small",icon:"Plus",onClick:e[1]||(e[1]=n=>C(1))},{default:l(()=>e[6]||(e[6]=[g("新增模板类型")])),_:1})])]),default:l(()=>[o(j,{ref_key:"tableListRef",ref:w,column:T,data:k.value,total:b.value,onGetTableData:d},{isDisplay:l(({scope:n})=>[o(R,{modelValue:n.row.isDisplay,"onUpdate:modelValue":y=>n.row.isDisplay=y,"before-change":()=>a.changeIsDisplay(n.row)},null,8,["modelValue","onUpdate:modelValue","before-change"])]),action:l(({scope:n})=>[m("a",{onClick:y=>C(2,n.row)},"编辑",8,K),V("",!0)]),_:1},8,["data","total"])]),_:1})]),o(F,{title:x.value===1?"新增指标":"编辑指标","model-value":p.value,onClose:_},{footer:l(()=>[o(v,{type:"primary",size:"small",loading:u.value,onClick:e[3]||(e[3]=n=>B(f.value))},{default:l(()=>e[8]||(e[8]=[g(" 保存 ")])),_:1},8,["loading"]),o(v,{size:"small",onClick:_},{default:l(()=>e[9]||(e[9]=[g(" 关闭 ")])),_:1})]),default:l(()=>[o(N,{ref_key:"formRef",ref:f,model:r.value,rules:$,"label-suffix":":","label-width":"130"},{default:l(()=>[o(D,{label:"类型名称",prop:"name"},{default:l(()=>[o(s,{modelValue:r.value.name,"onUpdate:modelValue":e[2]||(e[2]=n=>r.value.name=n),maxlength:50,placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","model-value"])],64)}}});export{ee as default};