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

  1. import{a as L,x as P,y as U,z as q}from"./indicatorTemplate.03f35a25.js";import{d as I,b as E,r as i,o as G,c as t,e as M,f as O,g as m,k as V,h as o,i as l,j as g,F as S,L as A,q as H}from"./index.1cbb0c88.js";const J={class:"flex justify-between items-center"},K=["onClick"];const Q=I({name:"templateType"}),ee=Object.assign(Q,{setup(W){const{proxy:c}=H(),h=E({indexName:void 0}),w=i(),b=i(0),k=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 L({...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:"\u8BF7\u8F93\u5165"}]},u=i(!1),C=async(a,e)=>{if(a===2){const s=await P(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 U(s),c.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),d(),u.value=!1,_(!0)}catch{u.value=!1}}})},_=()=>{r.value={},p.value=!1},X=a=>{c.$messageBox.confirm(`\u662F\u5426\u5220\u9664${a.name}?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await q(a.id),c.$message.success("\u5220\u9664\u6210\u529F\uFF01"),await d()})};return G(()=>{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 M(),O(S,null,[m("div",null,[V("",!0),o(z,{shadow:"never"},{header:l(()=>[m("div",J,[e[7]||(e[7]=m("span",null,"\u6A21\u677F\u7C7B\u578B\u5217\u8868",-1)),o(v,{type:"primary",size:"small",icon:"Plus",onClick:e[1]||(e[1]=n=>C(1))},{default:l(()=>e[6]||(e[6]=[g("\u65B0\u589E\u6A21\u677F\u7C7B\u578B")])),_: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)},"\u7F16\u8F91",8,K),V("",!0)]),_:1},8,["data","total"])]),_:1})]),o(F,{title:x.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(()=>e[8]||(e[8]=[g(" \u4FDD\u5B58 ")])),_:1},8,["loading"]),o(v,{size:"small",onClick:_},{default:l(()=>e[9]||(e[9]=[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(D,{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{ee as default};