lcny-vue3-antd-admin/dist/assets/BaseDrawer.0d620194.js

2 lines
5.2 KiB
JavaScript

var h=Object.defineProperty,P=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var y=(a,t,u)=>t in a?h(a,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[t]=u,B=(a,t)=>{for(var u in t||(t={}))k.call(t,u)&&y(a,u,t[u]);if(v)for(var u of v(t))U.call(t,u)&&y(a,u,t[u]);return a},b=(a,t)=>P(a,S(t));var i=(a,t,u)=>new Promise((F,d)=>{var A=r=>{try{p(u.next(r))}catch(c){d(c)}},g=r=>{try{p(u.throw(r))}catch(c){d(c)}},p=r=>r.done?F(r.value):Promise.resolve(r.value).then(A,g);p((u=u.apply(a,t)).next())});import{ct as R,eB as T,a as j,r as C,f as G,H as L,o as N,j as O,x as _,p as f,k as l,aB as H,cH as M,cI as z}from"./index.dbfb14a0.js";import{I as D}from"./index.1dc3834d.js";import{u as K,B as W}from"./useForm.4e42dd89.js";import{a as $}from"./other.c71f9164.js";import{a as J,B as Q}from"./index.02a2e0c1.js";import X from"./map.b1314b25.js";const le=[{title:"\u57FA\u5730\u540D\u79F0",dataIndex:"name"},{title:"\u519C\u4E1A\u7C7B\u578B",dataIndex:"industry_label"},{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}],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:a})=>!!a.id},{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(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"}],Z=j({__name:"BaseDrawer",emits:["success","register"],setup(a,{emit:t}){const u=C({address:"",latitude:"",longitude:""}),F=C({}),d=C(!1),A=G(()=>d.value?"\u7F16\u8F91\u57FA\u5730":"\u65B0\u589E\u57FA\u5730"),[g,{resetFields:p,setFieldsValue:r,validate:c}]=K({labelWidth:90,baseColProps:{span:24},schemas:Y,showActionButtonGroup:!1}),[x,{setDrawerProps:I,closeDrawer:w}]=J(e=>i(this,null,function*(){p(),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 E=(e,s)=>{F.value[e]=s},q=()=>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),w(),t("success")}finally{I({confirmLoading:!1})}});return(e,s)=>(N(),O(l(Q),H(e.$attrs,{onRegister:l(x),showFooter:"",title:l(A),width:"1000px",onOk:q}),{default:_(()=>[f(l(W),{onRegister:l(g)},{address_lng:_(({model:n,field:m})=>[f(l(D),{allowClear:"",onChange:s[0]||(s[0]=o=>E("longitude",o)),value:n[m],"onUpdate:value":o=>n[m]=o,placeholder:"\u8BF7\u8F93\u5165"},null,8,["value","onUpdate:value"])]),address_lat:_(({model:n,field:m})=>[f(l(D),{onChange:s[1]||(s[1]=o=>E("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:u.value,"onUpdate:modelValue":s[2]||(s[2]=n=>u.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 _,le as c,ne as s};