2024-01-30 09:49:28 +08:00
|
|
|
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.995fab54.js";import{a as ue}from"./useDictOptions.071e6d85.js";import{P as le}from"./index.1996b8ef.js";import{c as se,g as V,d as re,e as ne,f as ie}from"./product.a372b889.js";import{a as de,t as ce,e as k,d as pe}from"./index.49bc9e20.js";import{a as U}from"./monitor_threshold.7b4f5d62.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"},nul
|