EntCat-93edb117.js 3.0 KB

123456789
  1. /**
  2. * 由 Fantastic-admin 提供技术支持
  3. * Powered by Fantastic-admin
  4. * Gitee https://gitee.com/hooray/fantastic-admin
  5. * Github https://github.com/hooray/fantastic-admin
  6. */
  7. import{n as d}from"./menu-2c9c5182.js";import{aU as M}from"./index-5cddd228.js";import{j as U,r as _,J as z,o as I,a3 as r,ad as R,k as C,l as b,E as l,y as n,C as D,z as j,u as a}from"./runtime-core.esm-bundler-5fc1c360.js";import{b as y}from"./route-block-83d24a4e.js";function $(t){return d({url:"/ent/cat",method:"GET",params:t})}function q(t){return d({url:`/ent/cat/${t}`,method:"GET"})}function S(t){return d({url:"/ent/cat/add",method:"post",data:t})}function G(t){return d({url:"/ent/cat/update",method:"PUT",data:t})}function A(t){return d({url:`/ent/cat/${t}`,method:"DELETE"})}const V=U({__name:"EntCat",emits:["success"],setup(t,{expose:E,emit:c}){const u=_(),T=_({entCatTitle:[{required:!0,message:"请输入标题",trigger:"blur"}],entCatDesc:[{required:!1,message:"请输入描述",trigger:"blur"}]}),e=z({title:"",dialogVisible:!1,loading:!1,formData:{entCatId:0,entCatTitle:"",entCatDesc:""},actionType:1});I(()=>{});const v=async i=>{e.loading=!0;const{data:o}=await q(i);e.loading=!1,e.formData=o};function w(){u.value&&u.value.validate(async i=>{i&&(e.actionType===1?(await S(e.formData),e.dialogVisible=!1,c("success")):(await G(e.formData),e.dialogVisible=!1,c("success")),M.success({message:"保存成功",center:!0}))})}function h(){e.dialogVisible=!1}function f(){e.formData={entCatId:0,entCatTitle:"",entCatDesc:""}}return E({showAddModel(){f(),e.title="新增",e.actionType=1,e.dialogVisible=!0},showEditModel(i){f(),e.title="编辑",e.actionType=2,e.dialogVisible=!0,v(i)}}),(i,o)=>{const m=r("el-input"),p=r("el-form-item"),k=r("el-form"),g=r("el-button"),x=r("el-dialog"),B=R("loading");return C(),b("div",null,[l(x,{modelValue:a(e).dialogVisible,"onUpdate:modelValue":o[2]||(o[2]=s=>a(e).dialogVisible=s),title:a(e).title,width:"600px","close-on-click-modal":!1,"append-to-body":"","destroy-on-close":""},{footer:n(()=>[l(g,{size:"large",onClick:h},{default:n(()=>[D(" 取消 ")]),_:1}),l(g,{type:"primary",size:"large",onClick:w},{default:n(()=>[D(" 保存 ")]),_:1})]),default:n(()=>[j((C(),b("div",null,[l(k,{ref_key:"formRef",ref:u,model:a(e).formData,rules:a(T),"label-width":"120px","label-suffix":":"},{default:n(()=>[l(p,{label:"分类名称",prop:"entCatTitle"},{default:n(()=>[l(m,{modelValue:a(e).formData.entCatTitle,"onUpdate:modelValue":o[0]||(o[0]=s=>a(e).formData.entCatTitle=s),placeholder:"请输入标题"},null,8,["modelValue"])]),_:1}),l(p,{label:"简要说明",prop:"entCatDesc"},{default:n(()=>[l(m,{modelValue:a(e).formData.entCatDesc,"onUpdate:modelValue":o[1]||(o[1]=s=>a(e).formData.entCatDesc=s),type:"textarea",rows:"10",placeholder:"请输入简要说明"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])])),[[B,a(e).loading]])]),_:1},8,["modelValue","title"])])}}});typeof y=="function"&&y(V);const F=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{F as E,V as _,A as d,$ as g};