suyuan-breed/public/admin/assets/edit.94795686.js

2 lines
8.2 KiB
JavaScript
Raw Normal View History

2024-01-30 09:49:28 +08:00
import{B as ae,C as le,G as te,H as ue,c as oe,P as re,D as ne,k as se}from"./element-plus.995fab54.js";import{y as de}from"./@element-plus.d6eabd08.js";import{P as ie}from"./index.1996b8ef.js";import{r as y,a as pe,e as L,d as ce}from"./index.49bc9e20.js";import"./lodash.e92d81a1.js";import{a as me,b as fe,c as _e,d as ge,e as ve,f as be}from"./common.90057959.js";import{d as S,s as x,r as b,b as ye,_ as V,o as r,c as p,T as u,K as o,u as E,U as g,a6 as v,a as Fe,J as c}from"./@vue.108c970a.js";function je(d){return y.get({url:"/farm.farm/lists",params:d})}function Be(d){return y.post({url:"/farm.farm/add",params:d})}function Ve(d){return y.post({url:"/farm.farm/edit",params:d})}function Ie(d){return y.post({url:"/farm.farm/delete",params:d})}function Ee(d){return y.get({url:"/farm.farm/detail",params:d})}const Ae={class:"edit-popup"},we={class:"avatar-uploader-icon"},Ce=["src"],De=S({name:"farmEdit"}),Oe=S({...De,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(d,{expose:P,emit:A}){const w=x(),B=x(),F=b("add"),q=b(".png, .jpg, .jpeg, image/png, image/jpeg"),j=b(`${L.baseUrl}${L.urlPrefix}/upload/image`),I=pe();b(""),b(!1),b(!1);const R=(t,a)=>{if(t.code==0){se.error(t.msg);return}l.image=t.data.uri},T=ye(()=>(F.value=="edit"&&(D(),O(),k(),h(),U()),F.value=="edit"?"\u7F16\u8F91\u517B\u6B96\u57FA\u5730":"\u65B0\u589E\u517B\u6B96\u57FA\u5730")),l=V({id:"",farm_name:"",farm_type:"",breed_type:"",form_scale:"",master:"",master_contact:"",province:"",city:"",area:"",street:"",village:"",bridge:"",address:"",image:""}),M=V({}),C=async t=>{for(const a in l)t[a]!=null&&t[a]!=null&&(l[a]=t[a])},N=async t=>{const a=await Ee({id:t.id});C(a)},$=async()=>{var a,m;await((a=w.value)==null?void 0:a.validate());const t={...l};F.value=="edit"?await Ve(t):await Be(t),(m=B.value)==null||m.close(),A("success")},z=(t="add")=>{var a;F.value=t,(a=B.value)==null||a.open()},G=()=>{A("close")},i=V({provinceOptions:[],cityOptions:[],areaOptions:[],streetOptions:[],villageOptions:[],brigadeOptions:[]});function H(t){D()}function J(t){O()}function K(t){k()}function Q(t){h()}function W(t){U()}const X=async()=>{const t=await me({});i.provinceOptions=t},D=async()=>{const t=await fe({city:l.province});i.cityOptions=t},O=async()=>{const t=await _e({area:l.city});i.areaOptions=t},k=async()=>{const t=await ge({street:l.area});i.streetOptions=t},h=async()=>{const t=await ve({village:l.street});i.villageOptions=t},U=async()=>{const t=await be();i.brigadeOptions=t};return X(),P({open:z,setFormData:C,getDetail:N}),(t,a)=>{const m=ae,s=le,f=te,_=ue,Y=oe,Z=re,ee=ne;return r(),p("div",Ae,[u(ie,{ref_key:"popupRef",ref:B,title:E(T),async:!0,width:"550px",onConfirm:$,onClose:G},{default:o(()=>[u(ee,{ref_key:"formRef",ref:w,model:l,"label-width":"90px",rules:M},{default:o(()=>[u(s,{label:"\u540D\u79F0",prop:"farm_name"},{default:o(()=>[u(m,{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}),u(s,{label:"\u517B\u6B96\u57FA\u5730\u7C7B\u578B",prop:"farm_type"},{default:o(()=>[u(_,{class:"flex-1",modelValue:l.farm_type,"onUpdate:modelValue":a[1]||(a[1]=e=>l.farm_type=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u517B\u6B96\u57FA\u5730\u7C7B\u578B"},{default:o(()=>[(r(!0),p(g,null,v(d.dictData.farm_type,(e,n)=>(r(),c(f,{key:n,label:e.name,value:parseInt(e.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u517B\u6B96\u79CD\u7C7B",prop:"breed_type"},{default:o(()=>[u(_,{class:"flex-1",modelValue:l.breed_type,"onUpdate:modelValue":a[2]||(a[2]=e=>l.breed_type=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u517B\u6B96\u79CD\u7C7B"},{default:o(()=>[(r(!0),p(g,null,v(d.dictData.breed_type,(e,n)=>(r(),c(f,{key:n,label:e.name,value:parseInt(e.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u517B\u6B96\u573A\u89C4\u6A21",prop:"form_scale"},{default:o(()=>[u(m,{modelValue:l.form_scale,"onUpdate:modelValue":a[3]||(a[3]=e=>l.form_scale=e),clearable:"",placehold