lcny-vue3-antd-admin/dist/assets/BaseDrawer.c304db46.js

2 lines
3.8 KiB
JavaScript

var D=Object.defineProperty,x=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var _=(a,t,u)=>t in a?D(a,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[t]=u,f=(a,t)=>{for(var u in t||(t={}))v.call(t,u)&&_(a,u,t[u]);if(g)for(var u of g(t))y.call(t,u)&&_(a,u,t[u]);return a},A=(a,t)=>x(a,h(t));var c=(a,t,u)=>new Promise((i,l)=>{var p=r=>{try{s(u.next(r))}catch(d){l(d)}},m=r=>{try{s(u.throw(r))}catch(d){l(d)}},s=r=>r.done?i(r.value):Promise.resolve(r.value).then(p,m);s((u=u.apply(a,t)).next())});import{B as q}from"./BasicForm.c0f0b49b.js";import{u as w}from"./useForm.413d35f8.js";import{ez as S,a as k,v as I,f as P,k as o,K as R,o as T,j as U,z as j,n as b,aH as z,cT as G,cU as L}from"./index.867f48c0.js";import{a as O,B as M}from"./index.8577e943.js";import H from"./map.b2cc0ad9.js";const Z=[{title:"\u57FA\u5730\u540D\u79F0",dataIndex:"name"},{title:"\u57FA\u5730\u8D1F\u8D23\u4EBA",dataIndex:"person"},{title:"\u57FA\u5730\u519C\u4F5C\u7269",dataIndex:"crops"},{title:"\u57FA\u5730\u7ECF\u5EA6",dataIndex:"address_lat"},{title:"\u57FA\u5730\u7EAC\u5EA6",dataIndex:"address_lng"},{title:"\u57FA\u5730\u5730\u5740",dataIndex:"address"},{title:"\u57FA\u5730\u9762\u79EF",dataIndex:"areas"},{title:"\u57FA\u5730\u5C31\u4E1A\u4EBA\u6570",dataIndex:"workforce"},{title:"\u57FA\u5730\u63CF\u8FF0",dataIndex:"description"},{width:180,title:"\u64CD\u4F5C",dataIndex:"action",align:"center",fixed:void 0}],V=[],K=[{field:"id",label:"\u57FA\u5730ID",required:!1,dynamicDisabled:!0,component:"Input",ifShow:({values:a})=>!!a.id},{field:"name",label:"\u57FA\u5730\u540D\u79F0",required:!0,component:"Input"},{field:"address",label:"\u57FA\u5730\u5730\u5740",required:!0,component:"Input"},{field:"person",label:"\u57FA\u5730\u8D1F\u8D23\u4EBA",required:!0,component:"Input"},{field:"areas",label:"\u57FA\u5730\u9762\u79EF",required:!0,component:"Input"},{field:"workforce",label:"\u57FA\u5730\u4EBA\u6570",required:!0,component:"Input"},{field:"crops_ids",label:"\u57FA\u5730\u519C\u4F5C\u7269",required:!0,component:"ApiSelect",componentProps:{api:()=>c(void 0,null,function*(){return(yield S({type:"all",crop_type:1})).map(t=>A(f({},t),{disabled:t.is_end===1}))}),labelField:"name",valueField:"id",mode:"multiple"}},{field:"description",label:"\u57FA\u5730\u4ECB\u7ECD",required:!1,component:"InputTextArea"},{field:"address_lat",label:"\u57FA\u5730\u7ECF\u5EA6",required:!1,component:"Input"},{field:"address_lng",label:"\u57FA\u5730\u7EAC\u5EA6",required:!1,component:"Input"}],N=k({__name:"BaseDrawer",emits:["success","register"],setup(a,{emit:t}){const u=I({address:"",latitude:"",longitude:""}),i=I(!1),l=P(()=>i.value?"\u7F16\u8F91\u57FA\u5730":"\u65B0\u589E\u57FA\u5730"),[p,{resetFields:m,setFieldsValue:s,validate:r}]=w({labelWidth:90,baseColProps:{span:24},schemas:K,showActionButtonGroup:!1}),[d,{setDrawerProps:F,closeDrawer:B}]=O(e=>c(this,null,function*(){m(),F({confirmLoading:!1}),i.value=e==null?void 0:e.isUpdate,o(i)&&(u.value={address:e.address,latitude:e.address_lat,longitude:e.address_lng},s(A(f({},e),{crops_ids:e.crops.map(n=>n.id)})))}));R(u,e=>{s({address:e==null?void 0:e.address,address_lat:e==null?void 0:e.latitude,address_lng:e.longitude})});const C=()=>c(this,null,function*(){try{const e=yield r();e.type=1,F({confirmLoading:!0}),e.id?yield G(e.id,e):yield L(e),B(),t("success")}finally{F({confirmLoading:!1})}});return(e,n)=>(T(),U(o(M),z(e.$attrs,{onRegister:o(d),showFooter:"",title:o(l),width:"1000px",onOk:C}),{default:j(()=>[b(o(q),{onRegister:o(p)},null,8,["onRegister"]),b(H,{modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=E=>u.value=E)},null,8,["modelValue"])]),_:1},16,["onRegister","title"]))}});var ee=Object.freeze(Object.defineProperty({__proto__:null,default:N},Symbol.toStringTag,{value:"Module"}));export{ee as B,N as _,Z as c,V as s};