var Q=Object.defineProperty;var E=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var R=(u,t,e)=>t in u?Q(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e,F=(u,t)=>{for(var e in t||(t={}))W.call(t,e)&&R(u,e,t[e]);if(E)for(var e of E(t))X.call(t,e)&&R(u,e,t[e]);return u};var y=(u,t,e)=>new Promise((v,d)=>{var h=s=>{try{f(e.next(s))}catch(b){d(b)}},p=s=>{try{f(e.throw(s))}catch(b){d(b)}},f=s=>s.done?v(s.value):Promise.resolve(s.value).then(h,p);f((e=e.apply(u,t)).next())});import{u as Y,h as Z,f as q,g as $}from"./index-2a45336b.js";import{u as ee}from"./useForm-269e95cd.js";import{u as ae}from"./useSpining-af3901ce.js";import{a as c,b as i,o as te,c as ne,w as l,e as o,u as r,aa as I}from"./ant-design-vue-710243d9.js";import"./tinymce-3184e0f1.js";import"./echarts-ca5d9323.js";import"./cropper-47c8e461.js";import"./lodash-es-7cb071db.js";import"./qrcode-bec2257a.js";import"./jschardet-bd496279.js";const _e={__name:"EditDialog",emits:["ok"],setup(u,{expose:t,emit:e}){c();const{t:v}=Y(),{modal:d,showModal:h,hideModal:p,showLoading:f,hideLoading:s}=Z(),{formRecord:b,formData:n,formRef:x,formRules:C,resetForm:L}=ee(),{spining:M,showSpining:S,hideSpining:T}=ae(),U=c(v("button.cancel")),B=c(v("button.confirm"));c([]),c([]),c("1222"),c([]),c(!1),c([]),c({name:"",status:"enabled"}),C.value={name:{required:!0,message:"请输入案场名称"},status:[{required:!0,message:"请选择状态",trigger:"change"}]};function D(){h({type:"create",title:"新增"}),n.value.status="enabled"}function O(){return y(this,arguments,function*(w={}){h({type:"edit",title:"编辑"});try{S();const{data:a,success:m}=yield q.equiteType.getItem(w.id).catch();if(!m){p();return}T(),n.value=F({},a)}catch(a){I.error({content:a.message}),T()}})}function j(){x.value.validateFields().then(w=>y(this,null,function*(){try{f();const a={name:n.value.name,status:n.value.status,sequence:n.value.sequence};let m=null;switch(d.value.type){case"create":m=yield q.equiteType.createProject(a).catch(_=>{throw new Error(_)});break;case"edit":m=yield q.equiteType.updateItem(n.value.id,a).catch(()=>{throw new Error(error)});break}s(),$("http.code.success")===(m==null?void 0:m.success)&&(p(),e("ok"))}catch(a){I.error({content:a.message}),s()}})).catch(w=>{s()})}function A(){p()}function N(){L(),s()}return t({handleCreate:D,handleEdit:O}),(w,a)=>{const m=i("a-input"),_=i("a-form-item"),k=i("a-col"),P=i("a-input-number"),V=i("a-radio-group"),z=i("a-row"),G=i("a-card"),H=i("a-form"),J=i("a-spin"),K=i("a-modal");return te(),ne(K,{open:r(d).open,title:r(d).title,width:640,"confirm-loading":r(d).confirmLoading,"after-close":N,"cancel-text":U.value,"ok-text":B.value,onOk:j,onCancel:A},{default:l(()=>[o(J,{spinning:r(M)},{default:l(()=>[o(H,{ref_key:"formRef",ref:x,model:r(n),rules:r(C)},{default:l(()=>[o(G,{class:"mb-8-2"},{default:l(()=>[o(z,{gutter:12},{default:l(()=>[o(k,{span:24},{default:l(()=>[o(_,{label:"名称",name:"name"},{default:l(()=>[o(m,{placeholder:"名称",value:r(n).name,"onUpdate:value":a[0]||(a[0]=g=>r(n).name=g)},null,8,["value"])]),_:1})]),_:1}),o(k,{span:24},{default:l(()=>[o(_,{label:"排序",name:"sequence"},{default:l(()=>[o(P,{placeholder:"请输入排序",style:{width:"100%"},value:r(n).sequence,"onUpdate:value":a[1]||(a[1]=g=>r(n).sequence=g)},null,8,["value"])]),_:1})]),_:1}),o(k,{span:24},{default:l(()=>[o(_,{label:"状态",name:"status"},{default:l(()=>[o(V,{value:r(n).status,"onUpdate:value":a[2]||(a[2]=g=>r(n).status=g),options:[{label:"启用",value:"enabled"},{label:"停用",value:"disabled"}]},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["spinning"])]),_:1},8,["open","title","confirm-loading","cancel-text","ok-text"])}}};export{_e as default};
