2 lines
6.9 KiB
JavaScript
2 lines
6.9 KiB
JavaScript
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"},{default:o(()=>[(r(!0),m(c,null,_(B.dictData.device_type,(u,i)=>(r(),f(d,{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(p,{modelValue:l.product_id,"onUpdate:modelValue":e[2]||(e[2]=u=>l.product_id=u),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u4FE1\u606F","remote-method":L,loading:F.value},{default:o(()=>[(r(!0),m(c,null,_(V(h).product,(u,i)=>(r(),f(d,{key:i,label:u.productinfo,value:u.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),a(s,{label:"\u8BBE\u5907\u7F16\u7801",prop:"code"},{default:o(()=>[a(n,{modelValue:l.code,"onUpdate:modelValue":e[3]||(e[3]=u=>l.code=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BBE\u5907\u7F16\u7801"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u8BBE\u5907\u56FE",prop:"image"},{default:o(()=>[a(N,{class:"avatar-uploader",accept:A.value,modelValue:l.image,"onUpdate:modelValue":e[4]||(e[4]=u=>l.image=u),data:{cid:1},headers:{Token:V(j).token},action:R.value,"show-file-list":!1,"on-success":M},{default:o(()=>[l.image?(r(),m("img",{key:0,src:l.image,class:"avatar"},null,8,me)):(r(),m("div",ce,[a(K,null,{default:o(()=>[a(b)]),_:1})]))]),_:1},8,["accept","modelValue","headers","action"])]),_:1}),a(s,{label:"\u76D1\u6D4B\u9879",prop:"monitor_item"},{default:o(()=>[a(p,{class:"flex-1",modelValue:l.monitor_item,"onUpdate:modelValue":e[5]||(e[5]=u=>l.monitor_item=u),multiple:"",clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u76D1\u6D4B\u9879"},{default:o(()=>[(r(!0),m(c,null,_(B.dictData.monitor_item,(u,i)=>(r(),f(d,{key:i,label:u.name,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(s,{label:"\u89C6\u9891\u5730\u5740",prop:"video_url"},{default:o(()=>[a(n,{modelValue:l.video_url,"onUpdate:modelValue":e[6]||(e[6]=u=>l.video_url=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u89C6\u9891\u5730\u5740"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u8BBE\u5907\u72B6\u6001",prop:"status"},{default:o(()=>[a(p,{class:"flex-1",modelValue:l.status,"onUpdate:modelValue":e[7]||(e[7]=u=>l.status=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u72B6\u6001"},{default:o(()=>[(r(!0),m(c,null,_(B.dictData.device_status,(u,i)=>(r(),f(d,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(s,{label:"\u662F\u5426\u5728\u7EBF",prop:"is_online"},{default:o(()=>[a(p,{class:"flex-1",modelValue:l.is_online,"onUpdate:modelValue":e[8]||(e[8]=u=>l.is_online=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u5728\u7EBF"},{default:o(()=>[(r(!0),m(c,null,_(B.dictData.device_online_status,(u,i)=>(r(),f(d,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const $e=ne(fe,[["__scopeId","data-v-b77ae2a8"]]);export{$e as default};
|