suyuan-breed/public/admin/assets/edit.15e0814b.js

2 lines
8.9 KiB
JavaScript
Raw Permalink Normal View History

2024-02-22 17:19:17 +08:00
import{B as oe,C as re,G as se,H as ne,c as de,P as ie,D as pe,k as ce}from"./element-plus.ae8e286c.js";import{y as me}from"./@element-plus.d6eabd08.js";import{P as fe}from"./index.a9e38e26.js";import{r as y,a as _e,e as S,d as ge}from"./index.71fc8348.js";import"./lodash.e92d81a1.js";import{a as ve,b as be,c as ye,d as Fe,e as Be,f as Ve}from"./common.e26c7223.js";import{a as Ee}from"./useDictOptions.40b26c73.js";import{g as P}from"./land.24df685b.js";import{d as I,s as j,r as b,b as Ae,_ as A,o as r,c as p,T as t,K as o,u as B,U as _,a6 as g,a as we,J as c}from"./@vue.108c970a.js";function ze(d){return y.get({url:"/farm.farm/lists",params:d})}function De(d){return y.post({url:"/farm.farm/add",params:d})}function Ce(d){return y.post({url:"/farm.farm/edit",params:d})}function Ge(d){return y.post({url:"/farm.farm/delete",params:d})}function Oe(d){return y.get({url:"/farm.farm/detail",params:d})}const ke={class:"edit-popup"},Ue={class:"avatar-uploader-icon"},he=["src"],Le=I({name:"farmEdit"}),xe=I({...Le,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(d,{expose:R,emit:w}){const D=j(),V=j(),F=b("add"),T=b(".png, .jpg, .jpeg, image/png, image/jpeg"),q=b(`${S.baseUrl}${S.urlPrefix}/upload/image`),M=_e();b(""),b(!1),b(!1);const N=(u,a)=>{if(u.code==0){ce.error(u.msg);return}l.pic.push(u.data.uri)},$=Ae(()=>(F.value=="edit"&&(k(),U(),h(),L(),x()),F.value=="edit"?"\u7F16\u8F91\u517B\u6B96\u57FA\u5730":"\u65B0\u589E\u517B\u6B96\u57FA\u5730")),l=A({id:"",farm_name:"",user_id:0,farm_type:"",breed_type:"",form_scale:"",master:"",master_contact:"",province:"",city:"",area:"",street:"",village:"",bridge:"",address:"",pic:[],longitude:"",latitude:""}),z=A({}),{optionsData:C}=Ee({user:{api:P}}),E=b(!1),G=async u=>{E.value=!0;const a=await P({keyword:u!=null?u:""});C.user=a,E.value=!1},O=async u=>{for(const a in l)u[a]!=null&&u[a]!=null&&(l[a]=u[a])},H=async u=>{const a=await Oe({id:u.id});O(a)},J=async()=>{var a,v;await((a=D.value)==null?void 0:a.validate());const u={...l};F.value=="edit"?await Ce(u):await De(u),(v=V.value)==null||v.close(),w("success")},K=(u="add")=>{var a;F.value=u,(a=V.value)==null||a.open()},Q=()=>{w("close")},i=A({provinceOptions:[],cityOptions:[],areaOptions:[],streetOptions:[],villageOptions:[],brigadeOptions:[]});function W(u){k()}function X(u){U()}function Y(u){h()}function Z(u){L()}function ee(u){x()}const ae=async()=>{const u=await ve({});i.provinceOptions=u},k=async()=>{const u=await be({city:l.province});i.cityOptions=u},U=async()=>{const u=await ye({area:l.city});i.areaOptions=u},h=async()=>{const u=await Fe({street:l.area});i.streetOptions=u},L=async()=>{const u=await Be({village:l.street});i.villageOptions=u},x=async()=>{const u=await Ve();i.brigadeOptions=u};return ae(),R({open:K,setFormData:O,getDetail:H}),(u,a)=>{const v=oe,n=re,m=se,f=ne,le=de,ue=ie,te=pe;return r(),p("div",ke,[t(fe,{ref_key:"popupRef",ref:V,title:B($),async:!0,width:"550px",onConfirm:J,onClose:Q},{default:o(()=>[t(te,{ref_key:"formRef",ref:D,model:l,"label-width":"90px",rules:z},{default:o(()=>[t(n,{label:"\u540D\u79F0",prop:"farm_name"},{default:o(()=>[t(v,{modelValue:l.farm_name,"onUpdate:modelValue":a[0]||(a[0]=e=>l.farm_name=e),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u6240\u5C5E\u7528\u6237",prop:"user_id"},{default:o(()=>[t(f,{modelValue:l.user_id,"onUpdate:modelValue":a[1]||(a[1]=e=>l.user_id=e),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u4FE1\u606F","remote-method":G,loading:E.value},{default:o(()=>[(r(!0),p(_,null,g(B(C).user,(e,s)=>(r(),c(m,{key:s,label:e.userinfo,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),t(n,{label:"\u517B\u6B96\u57FA\u5730\u7C7B\u578B",prop:"farm_type"},{default:o(()=>[t(f,{class:"flex-1",modelValue:l.farm_type,"onUpdate:modelValue":a[2]||(a[2]=e=>l.farm_type=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u517B\u6B96\u57FA\u5730\u7C7B\u578B"},{default:o(()=>[(r(!0),p(_,null,g(d.dictData.farm_type,(e,s)=>(r(),c(m,{key:s,label:e.name,value:p