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 line
3.0KB

  1. import{a as P,x as U,y as I,z as L}from"./indicatorTemplate.b913f726.js";import{d as q,b as E,r as i,o as G,c as t,e as M,f as O,g as c,k as D,h as o,i as l,j as g,F as S,N as A,x as H}from"./index.d340e473.js";const J={class:"flex justify-between items-center"},K=c("span",null,"\u6A21\u677F\u7C7B\u578B\u5217\u8868",-1),Q=["onClick"];const W=q({name:"templateType"}),ae=Object.assign(W,{setup(X){const{proxy:m}=H(),V=E({indexName:void 0}),w=i(),b=i(0),h=i([]),T=[{label:"\u5E8F\u53F7",type:"index",width:"60"},{label:"\u7C7B\u578B\u540D\u79F0",key:"name",prop:"name"},{label:"\u64CD\u4F5C",slot:"action",width:"80",fixed:"right"}],d=async(a=w.value.pageParams)=>{var s;const e=await P({...a,...V});h.value=((s=e==null?void 0:e.data)==null?void 0:s.records)||[],b.value=e.data.total},p=i(!1),k=i(),r=i({}),f=i(),$={name:[{required:!0,message:"\u8BF7\u8F93\u5165"}]},u=i(!1),x=async(a,e)=>{if(a===2){const s=await U(e.id);r.value={...s.data}}k.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),m.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),d(),u.value=!1,_(!0)}catch{u.value=!1}}})},_=()=>{r.value={},p.value=!1},Y=a=>{m.$messageBox.confirm(`\u662F\u5426\u5220\u9664${a.name}?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await L(a.id),m.$message.success("\u5220\u9664\u6210\u529F\uFF01"),await d()})};return G(()=>{d()}),(a,e)=>{const s=t("el-input"),C=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 M(),O(S,null,[c("div",null,[D("",!0),o(z,{shadow:"never"},{header:l(()=>[c("div",J,[K,o(v,{type:"primary",size:"small",icon:"Plus",onClick:e[1]||(e[1]=n=>x(1))},{default:l(()=>[g("\u65B0\u589E\u6A21\u677F\u7C7B\u578B")]),_:1})])]),default:l(()=>[o(j,{ref_key:"tableListRef",ref:w,column:T,data:h.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})=>[c("a",{onClick:y=>x(2,n.row)},"\u7F16\u8F91",8,Q),D("",!0)]),_:1},8,["data","total"])]),_:1})]),o(F,{title:k.value===1?"\u65B0\u589E\u6307\u6807":"\u7F16\u8F91\u6307\u6807","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(()=>[g(" \u4FDD\u5B58 ")]),_:1},8,["loading"]),o(v,{size:"small",onClick:_},{default:l(()=>[g(" \u5173\u95ED ")]),_:1})]),default:l(()=>[o(N,{ref_key:"formRef",ref:f,model:r.value,rules:$,"label-suffix":"\uFF1A","label-width":"130"},{default:l(()=>[o(C,{label:"\u7C7B\u578B\u540D\u79F0",prop:"name"},{default:l(()=>[o(s,{modelValue:r.value.name,"onUpdate:modelValue":e[2]||(e[2]=n=>r.value.name=n),maxlength:50,placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","model-value"])],64)}}});export{ae as default};