var V=Object.defineProperty;var g=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var b=(n,a,e)=>a in n?V(n,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[a]=e,x=(n,a)=>{for(var e in a||(a={}))j.call(a,e)&&b(n,e,a[e]);if(g)for(var e of g(a))z.call(a,e)&&b(n,e,a[e]);return n};var C=(n,a,e)=>new Promise((d,_)=>{var y=l=>{try{i(e.next(l))}catch(p){_(p)}},h=l=>{try{i(e.throw(l))}catch(p){_(p)}},i=l=>l.done?d(l.value):Promise.resolve(l.value).then(y,h);i((e=e.apply(n,a)).next())});import{h as G,f as E}from"./index-2a45336b.js";import{u as H}from"./useForm-269e95cd.js";import{c as I}from"./lodash-es-7cb071db.js";import{b as c,o as J,c as K,w as f,e as m,u as o}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 ae={__name:"EditDialog",emits:["ok"],setup(n,{expose:a,emit:e}){const{modal:d,showModal:_,hideModal:y,showLoading:h,hideLoading:i}=G(),{formRef:l,formRules:p,formRecord:w,formData:r,resetForm:R}=H();p.value={key1:{required:!0,message:"请输入任务名称"},key2:{required:!0,message:"请选择开始时间"},key3:{required:!0,message:"请选择任务负责人"}};function U(){_({type:"create",title:"新建"})}function q(k={}){_({type:"edit",title:"编辑"}),w.value=k,r.value=I(k)}function D(){l.value.validateFields().then(k=>C(this,null,function*(){try{h();const t=x({},k);let u=null;switch(d.value.type){case"create":u=yield E.common.create(t).catch(()=>{throw new Error});break;case"edit":u=yield E.common.update(w.value.id,t).catch(()=>{throw new Error});break}i(),(u==null?void 0:u.code)===200&&(y(),e("ok"))}catch(t){i()}})).catch(()=>{i()})}function F(){y()}function L(){R()}return a({handleCreate:U,handleEdit:q}),(k,t)=>{const u=c("a-input"),v=c("a-form-item"),M=c("a-date-picker"),B=c("a-select"),O=c("a-textarea"),A=c("a-form"),N=c("a-modal");return J(),K(N,{open:o(d).open,title:o(d).title,"confirm-loading":o(d).confirmLoading,"after-close":L,onOk:D,onCancel:F},{default:f(()=>[m(A,{ref_key:"formRef",ref:l,"scroll-to-first-error":"",layout:"vertical",model:o(r),rules:o(p)},{default:f(()=>[m(v,{label:"任务名称",name:"key1"},{default:f(()=>[m(u,{value:o(r).key1,"onUpdate:value":t[0]||(t[0]=s=>o(r).key1=s)},null,8,["value"])]),_:1}),m(v,{label:"开始时间",name:"key2"},{default:f(()=>[m(M,{value:o(r).key2,"onUpdate:value":t[1]||(t[1]=s=>o(r).key2=s)},null,8,["value"])]),_:1}),m(v,{label:"任务负责人",name:"key3"},{default:f(()=>[m(B,{value:o(r).key3,"onUpdate:value":t[2]||(t[2]=s=>o(r).key3=s)},null,8,["value"])]),_:1}),m(v,{label:"产品描述",name:"key4"},{default:f(()=>[m(O,{value:o(r).key4,"onUpdate:value":t[3]||(t[3]=s=>o(r).key4=s)},null,8,["value"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["open","title","confirm-loading"])}}};export{ae as default};
