lcny-vue3-antd-admin/dist/assets/RankingDrawer.e863ae4e.js

2 lines
4.2 KiB
JavaScript

var x=Object.defineProperty,A=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var w=(e,a,t)=>a in e?x(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,B=(e,a)=>{for(var t in a||(a={}))S.call(a,t)&&w(e,t,a[t]);if(D)for(var t of D(a))k.call(a,t)&&w(e,t,a[t]);return e},_=(e,a)=>A(e,P(a));var d=(e,a,t)=>new Promise((u,c)=>{var f=n=>{try{l(t.next(n))}catch(i){c(i)}},p=n=>{try{l(t.throw(n))}catch(i){c(i)}},l=n=>n.done?u(n.value):Promise.resolve(n.value).then(f,p);l((t=t.apply(e,a)).next())});import{B as q}from"./BasicForm.c0f0b49b.js";import{u as j}from"./useForm.413d35f8.js";import{bT as O,eD as R,a as T,v as L,f as V,k as m,o as z,j as U,z as G,n as H,aH as M}from"./index.867f48c0.js";import{a as g,u as N,c as W}from"./other.96563ff1.js";import{T as $}from"./index.0a1c386f.js";import{a as J,B as K}from"./index.8577e943.js";import{d as Q}from"./defaultsDeep.8eeaca18.js";function v(e){const a=[];return Object.keys(e).forEach(t=>{a.push({label:e[t],value:t})}),a}const ue=[{title:"\u7C7B\u578B",dataIndex:"type"},{title:"\u8BBE\u5907\u7F16\u53F7",dataIndex:"sn"},{title:"\u57FA\u5730",dataIndex:"base_name"},{title:"\u76D1\u63A7\u70B9",dataIndex:"monitoring_point"},{title:"\u72B6\u6001",dataIndex:"status",customRender:({record:e})=>{var p,l;const a=e.status,u=[{value:0,color:"red",label:"\u7981\u7528"},{value:1,color:"green",label:"\u5728\u7EBF"},{value:2,color:"pink",label:"\u79BB\u7EBF"},{value:3,color:"orange",label:"\u6545\u969C"}].find(n=>n.value===a),c=(p=u==null?void 0:u.color)!=null?p:"red",f=(l=u==null?void 0:u.label)!=null?l:a;return O($,{color:c},()=>f)}},{width:180,title:"\u64CD\u4F5C",dataIndex:"action",align:"center",fixed:void 0}],le=[{field:"year",label:"\u5E74\u4EFD",component:"ApiSelect",componentProps:{api:R,labelField:"name",valueField:"id"},colProps:{span:6}},{field:"crop",label:"\u519C\u4F5C\u7269",component:"ApiSelect",componentProps:{api:()=>d(void 0,null,function*(){const e=yield g();return v(e)})},colProps:{span:6}}],X=[{field:"id",label:"ID",required:!1,dynamicDisabled:!0,component:"Input",ifShow:({values:e})=>!!e.id},{field:"time_year",label:"\u5E74\u4EFD",required:!0,component:"DatePicker",componentProps:{mode:"year"}},{field:"quarter",label:"\u5B63\u5EA6",required:!0,component:"Input"},{field:"crop_id",label:"\u519C\u4F5C\u7269",required:!0,component:"ApiSelect",componentProps:{api:()=>d(void 0,null,function*(){const e=yield g();return v(e)})}},{field:"base_id",label:"\u533A\u57DF",required:!0,component:"ApiSelect",componentProps:{api:()=>d(void 0,null,function*(){const e=yield g();return v(e)})}},{field:"yield",label:"\u4EA7\u91CF",required:!0,component:"Input"},{field:"cultivated",label:"\u79CD\u517B\u6B96\u9762\u79EF",required:!0,component:"Input"},{field:"output",label:"\u4EA7\u503C",required:!0,component:"Input"}],Y=T({__name:"RankingDrawer",emits:["success","register"],setup(e,{emit:a}){const t=L(!1),u=V(()=>t.value?"\u7F16\u8F91\u8BBE\u5907":"\u65B0\u589E\u8BBE\u5907"),[c,{resetFields:f,setFieldsValue:p,validate:l}]=j({labelWidth:120,baseColProps:{span:24},schemas:X,showActionButtonGroup:!1}),[n,{setDrawerProps:i,closeDrawer:h}]=J(r=>d(this,null,function*(){var o;if(f(),i({confirmLoading:!1}),t.value=r==null?void 0:r.isUpdate,m(t)){const s=Object.assign({},B(B({},r),r==null?void 0:r.extends)),F=yield g();yield p(_(B({},s),{agricultural_base_id:s.base_id,type:(o=E(F).find(b=>b.label==s.type))==null?void 0:o.value}))}})),E=r=>{const o=[];return Object.keys(r).forEach(s=>{o.push({label:r[s],value:s})}),o},C=(r,o)=>{const s={};var F=r.pop();return r.reduce((b,y)=>b[y]=b[y]||{},s)[F]=o,s},I=()=>d(this,null,function*(){try{const r=yield l();let o={};for(const s in r)o=Q({},o,C(s.split("."),r[s]));i({confirmLoading:!0}),r.id?yield N(r.id,o):yield W(o),h(),a("success")}finally{i({confirmLoading:!1})}});return(r,o)=>(z(),U(m(K),M(r.$attrs,{onRegister:m(n),showFooter:"",title:m(u),width:"500px",onOk:I}),{default:G(()=>[H(m(q),{onRegister:m(c)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}});var ie=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"}));export{ie as R,Y as _,ue as c,le as s};