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

2 lines
3.6 KiB
JavaScript

var n=(a,c,r)=>new Promise((i,s)=>{var d=t=>{try{o(r.next(t))}catch(l){s(l)}},p=t=>{try{o(r.throw(t))}catch(l){s(l)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,p);o((r=r.apply(a,c)).next())});import{ct as D,J as w,a as h,r as b,f as A,o as x,j as I,x as v,p as F,k as u,aB as S,ex as q,eC as P,e3 as B,eI as k,eJ as T}from"./index.db2a1f5e.js";import{B as Y,v as N}from"./BasicForm.151d387a.js";import{u as R}from"./useForm.94ea9811.js";import{a as j,B as U}from"./index.ef735b4e.js";const W=[{title:"\u57FA\u5730\u540D\u79F0",dataIndex:"base_name"},{title:"\u519C\u4F5C\u7269\u540D\u79F0",dataIndex:"crop_name"},{title:"\u5E74\u4EFD",dataIndex:"time_year",customRender:({text:a})=>a+"\u5E74"},{title:"\u5B63\u5EA6",dataIndex:"quarter"},{title:"\u4EA7\u91CF",dataIndex:"yield"},{title:"\u4EA7\u503C",dataIndex:"output"},{title:"\u8015\u79CD\u9762\u79EF",dataIndex:"cultivated"},{width:180,title:"\u64CD\u4F5C",dataIndex:"action",align:"center",fixed:void 0}],H=[{field:"year",label:"\u5E74\u4EFD",component:"DatePicker",componentProps:{picker:"year",mode:"year"},colProps:{span:6}}],L=[{field:"id",label:"ID",required:!1,dynamicDisabled:!0,component:"Input",ifShow:({values:a})=>!!a.id},{field:"time_year",label:"\u5E74\u4EFD",component:"DatePicker",required:!0,componentProps:{picker:"year",mode:"year"}},{field:"quarter",label:"\u5B63\u5EA6",component:"Select",required:!0,componentProps:{options:[{label:"\u7B2C\u4E00\u5B63\u5EA6",value:"1"},{label:"\u7B2C\u4E8C\u5B63\u5EA6",value:"2"},{label:"\u7B2C\u4E09\u5B63\u5EA6",value:"3"},{label:"\u7B2C\u56DB\u5B63\u5EA6",value:"4"}]}},{field:"base_id",label:"\u533A\u57DF",component:"ApiSelect",required:!0,componentProps:{api:()=>n(void 0,null,function*(){const{data:a}=yield D({type:1,page:1,per_page:99999});return a}),labelField:"name",valueField:"id"}},{field:"yield",label:"\u4EA7\u91CF",required:!0,component:"InputNumber"},{field:"output",label:"\u4EA7\u503C",required:!0,component:"InputNumber"},{label:"\u519C\u4F5C\u7269",field:"crop_id",slot:"crop",component:"TreeSelect",required:!0},{field:"cultivated",label:"\u8015\u79CD\u9762\u79EF",required:!0,component:"InputNumber"}];const O=h({__name:"BaseDrawer",emits:["success","register"],setup(a,{emit:c}){const r=b(!1),i=b([]),s=A(()=>r.value?"\u7F16\u8F91\u4EA7\u91CF":"\u65B0\u589E\u4EA7\u91CF"),[d,{resetFields:p,setFieldsValue:o,validate:t}]=R({labelWidth:120,baseColProps:{span:24},schemas:L,showActionButtonGroup:!1}),[l,{setDrawerProps:m,closeDrawer:g}]=j(e=>n(this,null,function*(){if(p(),m({confirmLoading:!1}),u(i).length===0){const _=yield q({type:"all",crop_type:1});i.value=P(_.data,0,"parent_id","id","children","key")}r.value=e==null?void 0:e.isUpdate,u(r)&&(yield o({id:e.id,quarter:e.quarter.toString(),time_year:B(e.time_year.toString()),base_id:e.base_id,yield:e.yield,output:e.output,crop_id:e.crop_id,cultivated:e.cultivated}))})),E=()=>n(this,null,function*(){try{const e=yield t();e.time_year=B(e.time_year.toString()).format("YYYY"),e.type=1,m({confirmLoading:!0}),e.id?yield k(e.id,e):yield T(e),g(),c("success")}finally{m({confirmLoading:!1})}});return(e,_)=>(x(),I(u(U),S(e.$attrs,{onRegister:u(l),showFooter:"",title:u(s),width:"500px",onOk:E}),{default:v(()=>[F(u(Y),{onRegister:u(d)},{crop:v(({model:f,field:y})=>[F(u(N),{value:f[y],"onUpdate:value":C=>f[y]=C,"tree-data":i.value,placeholder:"\u8BF7\u9009\u62E9",fieldNames:{children:"children",label:"name",value:"id"}},null,8,["value","onUpdate:value","tree-data"])]),_:1},8,["onRegister"])]),_:1},16,["onRegister","title"]))}});var J=w(O,[["__scopeId","data-v-5a9fd472"]]),K=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"}));export{J as B,K as a,W as c,H as s};