generated from Leo_Ding/web-template
2 lines
2.4 KiB
JavaScript
2 lines
2.4 KiB
JavaScript
var N=Object.defineProperty;var y=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var g=(t,o,e)=>o in t?N(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,x=(t,o)=>{for(var e in o||(o={}))T.call(o,e)&&g(t,e,o[e]);if(y)for(var e of y(o))V.call(o,e)&&g(t,e,o[e]);return t};var b=(t,o,e)=>new Promise((m,s)=>{var u=n=>{try{r(e.next(n))}catch(a){s(a)}},h=n=>{try{r(e.throw(n))}catch(a){s(a)}},r=n=>n.done?m(n.value):Promise.resolve(n.value).then(u,h);r((e=e.apply(t,o)).next())});import{h as j,f as C,g as q}from"./index-2a45336b.js";import{u as z}from"./useForm-269e95cd.js";import{c as G}from"./lodash-es-7cb071db.js";import{a as H,b as p,o as I,c as J,w as _,e as f,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 oe={__name:"EditDictDialog",emits:["ok"],setup(t,{expose:o,emit:e}){const{modal:m,showModal:s,hideModal:u,showLoading:h,hideLoading:r}=j(),{formRecord:n,formData:a,formRef:w,formRules:D,resetForm:E}=z(),R=H("取消");function F(){s({type:"create",title:"新建字典"})}function L(d={}){s({type:"edit",title:"编辑字典"}),n.value=d,a.value=G(d)}function M(){w.value.validateFields().then(d=>b(this,null,function*(){try{h();const c=x({},d);let i=null;switch(m.value.type){case"create":i=yield C.common.create(c).catch(()=>{throw new Error});break;case"edit":i=yield C.common.update(c).catch(()=>{throw new Error});break}r(),q("http.code.success")===(i==null?void 0:i.code)&&(u(),e("ok"))}catch(c){r()}})).catch(()=>{r()})}function B(){u()}function O(){E(),r()}return o({handleCreate:F,handleEdit:L}),(d,c)=>{const i=p("a-input"),k=p("a-form-item"),U=p("a-form"),A=p("a-modal");return I(),J(A,{open:l(m).open,title:l(m).title,width:480,"confirm-loading":l(m).confirmLoading,"after-close":O,"cancel-text":R.value,onOk:M,onCancel:B},{default:_(()=>[f(U,{ref_key:"formRef",ref:w,model:l(a),rules:l(D),"label-col":{style:{width:"90px"}}},{default:_(()=>[f(k,{label:"字典名称",name:"name"},{default:_(()=>[f(i,{value:l(a).name,"onUpdate:value":c[0]||(c[0]=v=>l(a).name=v)},null,8,["value"])]),_:1}),f(k,{label:"唯一值",name:"key"},{default:_(()=>[f(i,{value:l(a).key,"onUpdate:value":c[1]||(c[1]=v=>l(a).key=v)},null,8,["value"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["open","title","confirm-loading","cancel-text"])}}};export{oe as default};
|