2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
import{B as X,C as Y,c as Z,P as q,G as ee,H as oe,D as te,k as ae}from"./element-plus.ae8e286c.js";import{a as ue}from"./useDictOptions.40b26c73.js";import{P as le}from"./index.a9e38e26.js";import{c as se,g as V,d as re,e as ne,f as ie}from"./product.ad2ff5ef.js";import{a as de,t as ce,e as k,d as pe}from"./index.71fc8348.js";import{a as U}from"./monitor_threshold.e3c3ddf3.js";import{d as P,s as A,r as c,b as me,_ as D,a3 as _e,o as n,c as p,T as u,K as l,u as _,J as F,U as w,a6 as B,Q as fe}from"./@vue.108c970a.js";import"./@vueuse.d3d080b7.js";import"./@element-plus.d6eabd08.js";import"./lodash-es.29c53eac.js";import"./dayjs.664390f6.js";import"./axios.4ebfdb3f.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.e92d81a1.js";import"./vue-router.ed788fee.js";import"./pinia.eff1ffd5.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.dbf33394.js";import"./color.e1b5fced.js";import"./clone.0a4e8ac3.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.f174a91e.js";import"./ms.a9ae1d6d.js";import"./nprogress.d7c3ab1b.js";import"./vue-clipboard3.add720e2.js";import"./clipboard.01ea18f5.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(be,{expose:H,emit:E}){const b=A(),f=A(),g=c("add"),R=c(".png, .jpg, .jpeg, image/png, image/jpeg"),S=c(`${k.baseUrl}${k.urlPrefix}/upload/image`),I=de(),L=(o,e)=>{if(o.code==0){ae.error(o.msg);return}t.image=o.data.uri},j=me(()=>g.value=="edit"?"\u7F16\u8F91\u4EA7\u54C1":"\u65B0\u589E\u4EA7\u54C1");c("");const t=D({id:"",user_id:"",root:0,fence_house_id:"",code:"",name:"",desc:"",image:"",status:""}),M=D({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=ce(t.create_time,"yyyy-mm-dd hh:MM:ss")},T=async o=>{const e=await se({id:o.id});C(e)},{optionsData:d}=ue({user:{api:V},fenceHouse:{api:U}}),i=c(!1),O=async o=>{i.value=!0;const e=await V({keyword:o!=null?o:""});d.user=e,i.value=!1},N=o=>{d.fenceHouse=[],t.fence_house_id="",x({user_id:o})},x=async o=>{typeof o=="string"&&(o={fence_house_name:o}),i.value=!0;const e=await U(o);d.fenceHouse=e,i.value=!1},$=async()=>{var e,s;await((e=b.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")},G=()=>"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)}),J=(o="add")=>{var e;g.value=o,(e=f.value)==null||e.open(),t.code=G(),ie().then(s=>{var m;const r=(m=s.user.root)!=null?m:0;t.root=r,o=="edit"&&x({user_id:t.user_id})}).catch(s=>{console.log("err",s)})},K=()=>{E("close")};return H({open:J,setFormData:C,getDetail:T}),(o,e)=>{const s=X,r=Y,m=_e("Plus"),Q=Z,z=q,y=ee,h=oe,W=te;return n(),p("div",ge,[u(le,{ref_key:"popupRef",ref:f,title:_(j),async:!0,width:"550px",onConfirm:$,onClose:K},{default:l(()=>[u(W,{ref_key:"formRef",ref:b,model:t,"label-width":"90px",rules:M},{default:l(()=>[u(r,{label:"\u4EA7\u54C1\u540D\u79F0",prop:"name"},{default:l(()=>[u(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}),u(r,{label:"\u4EA7\u54C1\u7F16\u53F7",prop:"code"},{default:l(()=>[u(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}),u(r,{label:"\u4EA7\u54C1\u4ECB\u7ECD",prop:"desc"},{default:l(()=>[u(s,{modelValue:t.desc,"onUpdate:modelValue":e[2]||(e[2]=a=>t.desc=a)},null,8,["modelValue"])]),_:1}),u(r,{label:"\u4EA7\u54C1\u56FE",prop:"image"},{default:l(()=>[u(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:_(I).token},action:S.value,"show-file-list":!1,"on-success":L},{default:l(()=>[t.image?(n(),p("img",{key:0,src:t.image,class:"avatar"},null,8,xe)):(n(),p("div",ve,[u(Q,null,{default:l(()=>[u(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:l(()=>[u(h,{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":O,onChange:N,loading:i.value,clearable:""},{default:l(()=>[(n(!0),p(w,null,B(_(d).user,(a,v)=>(n(),F(y,{key:v,label:a.userinfo,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})):fe("",!0),u(r,{label:"\u6240\u5C5E\u680F\u820D",prop:"fence_house_id"},{default:l(()=>[u(h,{modelValue:t.fence_house_id,"onUpdate:modelValue":e[5]||(e[5]=a=>t.fence_house_id=a),remote:"",filterable:"",placeholder:"\u8BF7\u9009\u62E9","remote-method":x,loading:i.value,clearable:""},{default:l(()=>[(n(!0),p(w,null,B(_(d).fenceHouse,(a,v)=>(n(),F(y,{key:v,label:a.fencehouseinfo,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const so=pe(Ee,[["__scopeId","data-v-a39c76a6"]]);export{so as default};
|