2 lines
4.9 KiB
JavaScript
2 lines
4.9 KiB
JavaScript
var y=Object.defineProperty,P=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var D=(a,t,u)=>t in a?y(a,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[t]=u,B=(a,t)=>{for(var u in t||(t={}))U.call(t,u)&&D(a,u,t[u]);if(E)for(var u of E(t))k.call(t,u)&&D(a,u,t[u]);return a},b=(a,t)=>P(a,S(t));var m=(a,t,u)=>new Promise((F,d)=>{var A=r=>{try{i(u.next(r))}catch(p){d(p)}},g=r=>{try{i(u.throw(r))}catch(p){d(p)}},i=r=>r.done?F(r.value):Promise.resolve(r.value).then(A,g);i((u=u.apply(a,t)).next())});import{ct as R,eB as T,a as j,r as _,f as G,H as L,o as N,j as O,x as v,p as f,k as l,aB as H,cH as M,cI as z}from"./index.b6a86aa9.js";import{I as x}from"./index.ac3f8fb1.js";import{u as W,B as $}from"./useForm.ee465e13.js";import{a as J,B as K}from"./index.458732c3.js";import Q from"./map.ba4a0bb9.js";const re=[{title:"\u57FA\u5730\u540D\u79F0",dataIndex:"name"},{title:"\u6392\u5E8F",dataIndex:"sort"},{title:"\u57FA\u5730\u8D1F\u8D23\u4EBA",dataIndex:"person"},{title:"\u57FA\u5730\u519C\u4F5C\u7269",dataIndex:"crops"},{title:"\u57FA\u5730\u7ECF\u5EA6",dataIndex:"address_lng"},{title:"\u57FA\u5730\u7EAC\u5EA6",dataIndex:"address_lat"},{title:"\u57FA\u5730\u5730\u5740",dataIndex:"address"},{title:"\u57FA\u5730\u9762\u79EF",dataIndex:"areas"},{title:"\u79CD\u517B\u6B96\u9762\u79EF",dataIndex:"cultivated"},{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}],se=[{field:"name",label:"\u540D\u79F0",component:"Input",componentProps:{},colProps:{span:8}}],X=[{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:"sort",label:"\u6392\u5E8F",required:!0,component:"InputNumber",componentProps:{min:0,precision:0},defaultValue:0},{field:"person",label:"\u57FA\u5730\u8D1F\u8D23\u4EBA",required:!0,component:"Input"},{field:"areas",label:"\u57FA\u5730\u9762\u79EF",required:!0,component:"Input"},{field:"cultivated",label:"\u79CD\u517B\u6B96\u9762\u79EF",required:!0,component:"Input"},{field:"workforce",label:"\u57FA\u5730\u4EBA\u6570",required:!0,component:"Input"},{field:"parent_id",label:"\u57CE\u9547",required:!0,component:"ApiSelect",componentProps:{api:()=>m(void 0,null,function*(){return(yield R({type:2})).data}),labelField:"name",valueField:"id"}},{field:"crops_ids",label:"\u57FA\u5730\u519C\u4F5C\u7269",required:!0,component:"ApiSelect",componentProps:{api:()=>m(void 0,null,function*(){return(yield T({type:"all",crop_type:1})).data.map(t=>b(B({},t),{disabled:t.is_end===0}))}),labelField:"name",valueField:"id",mode:"multiple"}},{field:"address",label:"\u57FA\u5730\u5730\u5740",required:!0,component:"Input"},{field:"description",label:"\u57FA\u5730\u4ECB\u7ECD",required:!1,component:"InputTextArea"},{field:"address_lng",label:"\u57FA\u5730\u7ECF\u5EA6",required:!1,component:"Input",slot:"address_lng"},{field:"address_lat",label:"\u57FA\u5730\u7EAC\u5EA6",required:!1,component:"Input",slot:"address_lat"}],Y=j({__name:"BaseDrawer",emits:["success","register"],setup(a,{emit:t}){const u=_({address:"",latitude:"",longitude:""}),F=_({}),d=_(!1),A=G(()=>d.value?"\u7F16\u8F91\u57FA\u5730":"\u65B0\u589E\u57FA\u5730"),[g,{resetFields:i,setFieldsValue:r,validate:p}]=W({labelWidth:90,baseColProps:{span:24},schemas:X,showActionButtonGroup:!1}),[h,{setDrawerProps:I,closeDrawer:q}]=J(e=>m(this,null,function*(){i(),I({confirmLoading:!1}),d.value=e==null?void 0:e.isUpdate,l(d)&&(u.value={address:e.address,latitude:e.address_lat,longitude:e.address_lng},r(b(B({},e),{crops_ids:e.crops.map(s=>s.id)})))}));L(u,e=>{r({address:e==null?void 0:e.address,address_lat:e==null?void 0:e.latitude,address_lng:e.longitude})});const C=(e,s)=>{F.value[e]=s},w=()=>m(this,null,function*(){try{const e=yield p();e.type=1,I({confirmLoading:!0}),e.id?yield M(e.id,e):yield z(e),q(),t("success")}finally{I({confirmLoading:!1})}});return(e,s)=>(N(),O(l(K),H(e.$attrs,{onRegister:l(h),showFooter:"",title:l(A),width:"1000px",onOk:w}),{default:v(()=>[f(l($),{onRegister:l(g)},{address_lng:v(({model:o,field:c})=>[f(l(x),{allowClear:"",onChange:s[0]||(s[0]=n=>C("longitude",n)),value:o[c],"onUpdate:value":n=>o[c]=n,placeholder:"\u8BF7\u8F93\u5165"},null,8,["value","onUpdate:value"])]),address_lat:v(({model:o,field:c})=>[f(l(x),{onChange:s[1]||(s[1]=n=>C("latitude",n)),value:o[c],"onUpdate:value":n=>o[c]=n,placeholder:"\u8BF7\u8F93\u5165"},null,8,["value","onUpdate:value"])]),_:1},8,["onRegister"]),f(Q,{modelValue:u.value,"onUpdate:modelValue":s[2]||(s[2]=o=>u.value=o),params:F.value},null,8,["modelValue","params"])]),_:1},16,["onRegister","title"]))}});var le=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"}));export{le as B,Y as _,re as c,se as s};
|