zhonghai_admin/index/assets/EditDialog-8c0b4204.js
2025-08-18 11:04:38 +08:00

2 lines
2.3 KiB
JavaScript

var A=Object.defineProperty;var k=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var g=(t,o,e)=>o in t?A(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,y=(t,o)=>{for(var e in o||(o={}))N.call(o,e)&&g(t,e,o[e]);if(k)for(var e of k(o))U.call(o,e)&&g(t,e,o[e]);return t};var C=(t,o,e)=>new Promise((i,s)=>{var f=a=>{try{r(e.next(a))}catch(c){s(c)}},_=a=>{try{r(e.throw(a))}catch(c){s(c)}},r=a=>a.done?i(a.value):Promise.resolve(a.value).then(f,_);r((e=e.apply(t,o)).next())});import{h as V,f as b}from"./index-2a45336b.js";import{u as j}from"./useForm-269e95cd.js";import{c as z}from"./lodash-es-7cb071db.js";import{b as p,o as G,c as H,w as h,e as w,u as l}from"./ant-design-vue-710243d9.js";import"./tinymce-3184e0f1.js";import"./echarts-ca5d9323.js";import"./cropper-47c8e461.js";import"./qrcode-bec2257a.js";import"./jschardet-bd496279.js";const Z={__name:"EditDialog",emits:["ok"],setup(t,{expose:o,emit:e}){const{modal:i,showModal:s,hideModal:f,showLoading:_,hideLoading:r}=V(),{formRef:a,formRules:c,formRecord:v,formData:u,resetForm:x}=j();c.value={title:{required:!0,message:"请输入标题"}};function E(){s({type:"create",title:"新建"})}function R(d={}){s({type:"edit",title:"编辑"}),v.value=d,u.value=z(d)}function D(){a.value.validateFields().then(d=>C(this,null,function*(){try{_();const m=y({},d);let n=null;switch(i.value.type){case"create":n=yield b.common.create(m).catch(()=>{throw new Error});break;case"edit":n=yield b.common.update(v.value.id,m).catch(()=>{throw new Error});break}r(),(n==null?void 0:n.code)===200&&(f(),e("ok"))}catch(m){r()}})).catch(()=>{r()})}function F(){f()}function L(){x()}return o({handleCreate:E,handleEdit:R}),(d,m)=>{const n=p("a-input"),M=p("a-form-item"),B=p("a-form"),O=p("a-modal");return G(),H(O,{open:l(i).open,title:l(i).title,"confirm-loading":l(i).confirmLoading,"after-close":L,onOk:D,onCancel:F},{default:h(()=>[w(B,{ref_key:"formRef",ref:a,"scroll-to-first-error":"",model:l(u),rules:l(c),"label-col":{style:{width:"80px"}}},{default:h(()=>[w(M,{label:"标题",name:"title"},{default:h(()=>[w(n,{value:l(u).title,"onUpdate:value":m[0]||(m[0]=q=>l(u).title=q)},null,8,["value"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["open","title","confirm-loading"])}}};export{Z as default};