2024-01-03 14:05:40 +08:00
|
|
|
import{B as W,C as z,Q as G,R as H,c as X,W as Y,D as Z,k as ee}from"./element-plus.5df6f736.js";import{u as ue}from"./useDictOptions.c318e94c.js";import{P as le}from"./index.3156c470.js";import{c as C,a as ae,d as te,e as oe}from"./device.314a9eb3.js";import"./lodash.33f675f2.js";import{a as re,j as x,d as se}from"./index.dab55926.js";import{d as P,s as U,r as v,b as ie,_ as w,a3 as ne,o as r,c as n,T as a,K as o,u as b,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.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"./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 de={class:"edit-popup"},pe=["src"],me={key:1,class:"avatar-uploader-icon"},ce=P({name:"deviceEdit"}),_e=P({...ce,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(B,{expose:I,emit:V}){const y=U(),E=U(),F=v("add"),R=v(".png, .jpg, .jpeg, image/png, image/jpeg"),A=v(`${x.baseUrl}${x.urlPrefix}/upload/image`),h=re(),j=(t,e)=>{if(t.code==0){ee.error(t.msg);return}l.image=t.data.uri},S=ie(()=>F.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"]}]}),D=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},{optionsData:k}=ue({product:{api:C,params:{all:1}}}),g=v(!1),L=async t=>{g.value=!0;const e=await C({name:t!=null?t:""});k.product=e,g.value=!1},O=async t=>{const e=await ae({id:t.id});D(e)},q=async()=>{var e,d;await((e=y.value)==null?void 0:e.validate());const t={...l};F.value=="edit"?await te(t):await oe(t),(d=E.value)==null||d.close(),V("success")},$=(t="add")=>{var e;F.value=t,(e=E.value)==null||e.open()},J=()=>{V("close")};return I({open:$,setFormData:D,getDetail:O}),(t,e)=>{const d=W,s=z,p=G,m=H,K=ne("Plus"),M=X,N=Y,Q=Z;return r(),n("div",de,[a(le,{ref_key:"popupRef",ref:E,title:b(S),async:!0,width:"550px",onConfirm:q,onClose:J},{default:o(()=>[a(Q,{ref_key:"formRef",ref:y,model:l,"label-width":"120px",rules:T},{default:o(()=>[a(s,{label:"\u8BBE\u5907\u540D\u79F0",prop:"name"},{default:o(()=>[a(d,{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(m,{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"},{default:o(()=>[(r(!0),n(c,null,_(B.dictData.device_type,(u,i)=>(r(),f(p,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(s,{label:"\u6240\u5C5E\u4EA7\u54C1",prop:"product_id"},{default:o(()=>[a(m,{modelValue:l.product_id,"onUpdate:modelVa
|