suyuan-breed/public/admin/assets/edit.1436d4f5.js

2 lines
6.9 KiB
JavaScript
Raw Normal View History

2024-01-18 15:49:07 +08:00
import{B as z,C as Q,G as X,H as Y,c as Z,W as $,D as ee,k as ue}from"./element-plus.0aa2c80d.js";import{a as le}from"./useDictOptions.7c932a82.js";import{P as ae}from"./index.57999d76.js";import{c as C,a as te,d as oe,e as re}from"./device.2482d228.js";import"./lodash.e92d81a1.js";import{a as se,j as x,d as ne}from"./index.2fb2748f.js";import{d as I,s as U,r as v,b as ie,_ as w,a3 as de,o as r,c as m,T as a,K as o,u as V,U as c,a6 as _,J as f}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"./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 pe={class:"edit-popup"},me=["src"],ce={key:1,class:"avatar-uploader-icon"},_e=I({name:"deviceEdit"}),fe=I({..._e,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(B,{expose:P,emit:y}){const D=U(),g=U(),E=v("add"),A=v(".png, .jpg, .jpeg, image/png, image/jpeg"),R=v(`${x.baseUrl}${x.urlPrefix}/upload/image`),j=se(),M=(t,e)=>{if(t.code==0){ue.error(t.msg);return}l.image=t.data.uri},S=ie(()=>E.value=="edit"?"\u7F16\u8F91\u8BBE\u5907":"\u65B0\u589E\u8BBE\u5907"),l=w({id:"",product_id:"",code:"",name:"",video_url:"",type:"",monitor_item:"",status:"",is_online:"",image:""}),T=w({code:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BBE\u5907\u7F16\u7801",trigger:["blur"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0",trigger:["blur"]}],type:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BBE\u5907\u7C7B\u578B",trigger:["blur"]}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BBE\u5907\u72B6\u6001",trigger:["blur"]}],is_online:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u5728\u7EBF",trigger:["blur"]}]}),k=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},{optionsData:h}=le({product:{api:C,params:{all:1}}}),F=v(!1),L=async t=>{F.value=!0;const e=await C({name:t!=null?t:""});h.product=e,F.value=!1},O=async t=>{const e=await te({id:t.id});k(e)},q=async()=>{var e,n;await((e=D.value)==null?void 0:e.validate());const t={...l};E.value=="edit"?await oe(t):await re(t),(n=g.value)==null||n.close(),y("success")},G=t=>{let e="",n="";const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e=s.charAt(Math.floor(Math.random()*s.length));for(let p=0;p<t;p++){const b=Math.floor(Math.random()*d.length);n+=d.charAt(b)}return e+n},H=(t="add")=>{var e;E.value=t,l.code=G(3),(e=g.value)==null||e.open()},J=()=>{y("close")};return P({open:H,setFormData:k,getDetail:O}),(t,e)=>{const n=z,s=Q,d=X,p=Y,b=de("Plus"),K=Z,N=$,W=ee;return r(),m("div",pe,[a(ae,{ref_key:"popupRef",ref:g,title:V(S),async:!0,width:"550px",onConfirm:q,onClose:J},{default:o(()=>[a(W,{ref_key:"formRef",ref:D,model:l,"label-width":"120px",rules:T},{default:o(()=>[a(s,{label:"\u8BBE\u5907\u540D\u79F0",prop:"name"},{default:o(()=>[a(n,{modelValue:l.name,"onUpdate:modelValue":e[0]||(e[0]=u=>l.name=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u8BBE\u5907\u7C7B\u578B",prop:"type"},{default:o(()=>[a(p,{class:"flex-1",modelValue:l.type,"onUpdate:modelValue":e[1]||(e[1]=u=>l.type=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u7C7B\u578B"},{d