2 lines
5.6 KiB
JavaScript
2 lines
5.6 KiB
JavaScript
var k=Object.defineProperty,q=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var h=(u,a,t)=>a in u?k(u,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[a]=t,g=(u,a)=>{for(var t in a||(a={}))S.call(a,t)&&h(u,t,a[t]);if(v)for(var t of v(a))U.call(a,t)&&h(u,t,a[t]);return u},_=(u,a)=>q(u,P(a));var i=(u,a,t)=>new Promise((F,d)=>{var A=r=>{try{p(t.next(r))}catch(c){d(c)}},b=r=>{try{p(t.throw(r))}catch(c){d(c)}},p=r=>r.done?F(r.value):Promise.resolve(r.value).then(A,b);p((t=t.apply(u,a)).next())});import{ct as R,eB as T,a as j,r as E,f as G,H as L,o as N,j as O,x as B,p as f,k as s,aB as H,cH as M,cI as z}from"./index.0f419937.js";import{I as x}from"./index.d2e2a8db.js";import{u as K,B as W}from"./useForm.1d911aad.js";import{a as $}from"./other.b8e4a0e2.js";import{a as J,B as Q}from"./index.24ce66a3.js";import X from"./map.daa8b767.js";const se=[{title:"\u57FA\u5730\u540D\u79F0",dataIndex:"name"},{title:"\u519C\u4E1A\u7C7B\u578B",dataIndex:"industry_label"},{title:"\u662F\u5426\u5916\u90E8\u94FE\u63A5",dataIndex:"is_blank",format:u=>u?"\u662F":"\u5426"},{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:"right"}],ne=[{field:"name",label:"\u540D\u79F0",component:"Input",componentProps:{},colProps:{span:8}}],Y=[{field:"id",label:"\u57FA\u5730ID",required:!1,dynamicDisabled:!0,component:"Input",ifShow:({values:u})=>!!u.id},{field:"is_blank",label:"\u5916\u90E8\u94FE\u63A5",required:!0,component:"Switch",componentProps:{checkedChildren:"\u662F",unCheckedChildren:"\u5426"},defaultValue:!1},{field:"blank_url",label:"\u5916\u90E8\u94FE\u63A5",required:!0,component:"Input",ifShow:({values:u})=>!!u.is_blank},{field:"industry_key",label:"\u4EA7\u4E1A\u7C7B\u578B",required:!0,component:"ApiSelect",componentProps:{api:()=>i(void 0,null,function*(){return yield $()}),labelField:"name",valueField:"key"}},{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:()=>i(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:()=>i(void 0,null,function*(){return(yield T({type:"all",crop_type:1})).data.map(a=>_(g({},a),{disabled:a.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"}],Z=j({__name:"BaseDrawer",emits:["success","register"],setup(u,{emit:a}){const t=E({address:"",latitude:"",longitude:""}),F=E({}),d=E(!1),A=G(()=>d.value?"\u7F16\u8F91\u57FA\u5730":"\u65B0\u589E\u57FA\u5730"),[b,{resetFields:p,setFieldsValue:r,validate:c}]=K({labelWidth:90,baseColProps:{span:24},schemas:Y,showActionButtonGroup:!1}),[y,{setDrawerProps:I,closeDrawer:D}]=J(e=>i(this,null,function*(){p(),I({confirmLoading:!1}),d.value=e==null?void 0:e.isUpdate,s(d)&&(t.value={address:e.address,latitude:e.address_lat,longitude:e.address_lng},r(_(g({},e),{crops_ids:e.crops.map(l=>l.id),is_blank:e.is_blank==1})))}));L(t,e=>{r({address:e==null?void 0:e.address,address_lat:e==null?void 0:e.latitude,address_lng:e.longitude})});const C=(e,l)=>{F.value[e]=l},w=()=>i(this,null,function*(){try{const e=yield c();e.type=1,I({confirmLoading:!0}),e.id?yield M(e.id,e):yield z(e),D(),a("success")}finally{I({confirmLoading:!1})}});return(e,l)=>(N(),O(s(Q),H(e.$attrs,{onRegister:s(y),showFooter:"",title:s(A),width:"1000px",onOk:w}),{default:B(()=>[f(s(W),{onRegister:s(b)},{address_lng:B(({model:n,field:m})=>[f(s(x),{allowClear:"",onChange:l[0]||(l[0]=o=>C("longitude",o)),value:n[m],"onUpdate:value":o=>n[m]=o,placeholder:"\u8BF7\u8F93\u5165"},null,8,["value","onUpdate:value"])]),address_lat:B(({model:n,field:m})=>[f(s(x),{onChange:l[1]||(l[1]=o=>C("latitude",o)),value:n[m],"onUpdate:value":o=>n[m]=o,placeholder:"\u8BF7\u8F93\u5165"},null,8,["value","onUpdate:value"])]),_:1},8,["onRegister"]),f(X,{modelValue:t.value,"onUpdate:modelValue":l[2]||(l[2]=n=>t.value=n),params:F.value},null,8,["modelValue","params"])]),_:1},16,["onRegister","title"]))}});var oe=Object.freeze(Object.defineProperty({__proto__:null,default:Z},Symbol.toStringTag,{value:"Module"}));export{oe as B,Z as _,se as c,ne as s};
|