2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
import{B as H,C as X,c as Y,W as Z,Q as ee,R as oe,D as te,k as ae}from"./element-plus.5df6f736.js";import{u as le}from"./useDictOptions.a0a89dbc.js";import{P as ue}from"./index.1a7ccb5b.js";import{c as se,g as h,d as k,e as re,f as ne,h as de}from"./product.57d55fc4.js";import{a as ie,t as pe,j as U,d as me}from"./index.eba5ee3f.js";import{d as P,s as A,r as c,b as ce,_ as w,a3 as _e,o as n,c as p,T as l,K as u,u as _,J as F,U as B,a6 as D,Q as fe}from"./@vue.108c970a.js";import"./@vueuse.d3d080b7.js";import"./@element-plus.d6eabd08.js";import"./lodash-es.29c53eac.js";import"./dayjs.50c3b6f7.js";import"./axios.c2a2014a.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./@popperjs.36402333.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./lodash.33f675f2.js";import"./vue-router.ed788fee.js";import"./pinia.eff1ffd5.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.5d5b8bda.js";import"./color.da05fa89.js";import"./clone.06747a68.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.1c707d7b.js";import"./ms.a9ae1d6d.js";import"./nprogress.fc605139.js";import"./vue-clipboard3.dc900a40.js";import"./clipboard.6beb87aa.js";import"./echarts.8d7a50ae.js";import"./zrender.1084fa23.js";import"./tslib.60310f1a.js";import"./highlight.js.4ebdf9a4.js";import"./@highlightjs.241b9b5d.js";const ge={class:"edit-popup"},xe=["src"],ve={key:1,class:"avatar-uploader-icon"},Fe=P({name:"productEdit"}),Ee=P({...Fe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(ye,{expose:L,emit:E}){const y=A(),f=A(),g=c("add"),R=c(".png, .jpg, .jpeg, image/png, image/jpeg"),S=c(`${U.baseUrl}${U.urlPrefix}/upload/image`),j=ie(),I=(o,e)=>{if(o.code==0){ae.error(o.msg);return}t.image=o.data.uri},M=ce(()=>g.value=="edit"?"\u7F16\u8F91\u4EA7\u54C1":"\u65B0\u589E\u4EA7\u54C1"),t=w({id:"",user_id:"",root:0,land_id:"",code:"",name:"",desc:"",image:"",status:""}),T=w({code:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u7F16\u53F7",trigger:["blur"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u540D\u79F0",trigger:["blur"]}]}),C=async o=>{for(const e in t)o[e]!=null&&o[e]!=null&&(t[e]=o[e]);t.create_time=pe(t.create_time,"yyyy-mm-dd hh:MM:ss")},O=async o=>{const e=await se({id:o.id});C(e)},{optionsData:i}=le({user:{api:h},land:{api:k}}),d=c(!1),N=async o=>{d.value=!0;const e=await h({keyword:o!=null?o:""});i.user=e,d.value=!1},Q=o=>{i.land=[],t.land_id="",x(o)},x=async o=>{d.value=!0;const e=await k({user_id:o!=null?o:""});d.value=!1,i.land=e,d.value=!1},$=async()=>{var e,s;await((e=y.value)==null?void 0:e.validate());const o={...t};g.value=="edit"?await re(o):await ne(o),(s=f.value)==null||s.close(),E("success")},J=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){const e=Math.random()*16|0;return(o=="x"?e:e&3|8).toString(16)}),K=(o="add")=>{var e;g.value=o,(e=f.value)==null||e.open(),t.code=J(),de().then(s=>{var m;const r=(m=s.user.root)!=null?m:0;t.root=r,o=="edit"&&x(t.user_id)}).catch(s=>{console.log("err",s)})},W=()=>{E("close")};return L({open:K,setFormData:C,getDetail:O}),(o,e)=>{const s=H,r=X,m=_e("Plus"),q=Y,z=Z,b=ee,V=oe,G=te;return n(),p("div",ge,[l(ue,{ref_key:"popupRef",ref:f,title:_(M),async:!0,width:"550px",onConfirm:$,onClose:W},{default:u(()=>[l(G,{ref_key:"formRef",ref:y,model:t,"label-width":"90px",rules:T},{default:u(()=>[l(r,{label:"\u4EA7\u54C1\u540D\u79F0",prop:"name"},{default:u(()=>[l(s,{modelValue:t.name,"onUpdate:modelValue":e[0]||(e[0]=a=>t.name=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(r,{label:"\u4EA7\u54C1\u7F16\u53F7",prop:"code"},{default:u(()=>[l(s,{modelValue:t.code,"onUpdate:modelValue":e[1]||(e[1]=a=>t.code=a),clearable:"",disabled:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u7F16\u53F7"},null,8,["modelValue"])]),_:1}),l(r,{label:"\u4EA7\u54C1\u4ECB\u7ECD",prop:"desc"},{default:u(()=>[l(s,{modelValue:t.desc,"onUpdate:modelValue":e[2]||(e[2]=a=>t.desc=a)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u4EA7\u54C1\u56FE",prop:"image"},{default:u(()=>[l(z,{class:"avatar-uploader",accept:R.value,modelValue:t.image,"onUpdate:modelValue":e[3]||(e[3]=a=>t.image=a),data:{cid:1},headers:{Token:_(j).token},action:S.value,"show-file-list":!1,"on-success":I},{default:u(()=>[t.image?(n(),p("img",{key:0,src:t.image,class:"avatar"},null,8,xe)):(n(),p("div",ve,[l(q,null,{default:u(()=>[l(m)]),_:1})]))]),_:1},8,["accept","modelValue","headers","action"])]),_:1}),t.root==1?(n(),F(r,{key:0,label:"\u6240\u5C5E\u7528\u6237",prop:"user_id"},{default:u(()=>[l(V,{modelValue:t.user_id,"onUpdate:modelValue":e[4]||(e[4]=a=>t.user_id=a),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u4FE1\u606F","remote-method":N,onChange:Q,loading:d.value},{default:u(()=>[(n(!0),p(B,null,D(_(i).user,(a,v)=>(n(),F(b,{key:v,label:a.userinfo,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})):fe("",!0),l(r,{label:"\u6240\u5C5E\u571F\u5730",prop:"land_id"},{default:u(()=>[l(V,{modelValue:t.land_id,"onUpdate:modelValue":e[5]||(e[5]=a=>t.land_id=a),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u571F\u5730\u4FE1\u606F","remote-method":x,loading:d.value},{default:u(()=>[(n(!0),p(B,null,D(_(i).land,(a,v)=>(n(),F(b,{key:v,label:a.landinfo,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const uo=me(Ee,[["__scopeId","data-v-76853e85"]]);export{uo as default};
|