2 lines
6.8 KiB
JavaScript
2 lines
6.8 KiB
JavaScript
import{B as W,C as z,G as Q,H as X,c as Y,W as Z,D as ee,k as ue}from"./element-plus.0aa2c80d.js";import{a as le}from"./useDictOptions.cc1b72cb.js";import{P as ae}from"./index.3838d2e5.js";import{c as k,a as te,d as oe,e as re}from"./device.0d580ace.js";import"./lodash.e92d81a1.js";import{a as se,j as C,d as ne}from"./index.8b40bb9d.js";import{d as P,s as U,r as v,b as ie,_ as w,a3 as de,o as r,c as i,T as a,K as o,u as F,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=P({name:"deviceEdit"}),fe=P({..._e,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(B,{expose:I,emit:b}){const V=U(),x=U(),g=v("add"),h=v(".png, .jpg, .jpeg, image/png, image/jpeg"),R=v(`${C.baseUrl}${C.urlPrefix}/upload/image`),S=se(),j=(t,e)=>{if(t.code==0){ue.error(t.msg);return}l.image=t.data.uri},A=ie(()=>g.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"]}]}),y=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},{optionsData:D}=le({product:{api:k,params:{all:1}}}),E=v(!1),L=async t=>{E.value=!0;const e=await k({name:t!=null?t:""});D.product=e,E.value=!1},O=async t=>{const e=await te({id:t.id});y(e)},q=async()=>{var e,d;await((e=V.value)==null?void 0:e.validate());const t={...l};g.value=="edit"?await oe(t):await re(t),(d=x.value)==null||d.close(),b("success")},M=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)}),$=(t="add")=>{var e;g.value=t,l.code=M(),(e=x.value)==null||e.open()},G=()=>{b("close")};return I({open:$,setFormData:y,getDetail:O}),(t,e)=>{const d=W,s=z,p=Q,m=X,H=de("Plus"),J=Y,K=Z,N=ee;return r(),i("div",pe,[a(ae,{ref_key:"popupRef",ref:x,title:F(A),async:!0,width:"550px",onConfirm:q,onClose:G},{default:o(()=>[a(N,{ref_key:"formRef",ref:V,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),i(c,null,_(B.dictData.device_type,(u,n)=>(r(),f(p,{key:n,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:modelValue":e[2]||(e[2]=u=>l.product_id=u),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u4FE1\u606F","remote-method":L,loading:E.value},{default:o(()=>[(r(!0),i(c,null,_(F(D).product,(u,n)=>(r(),f(p,{key:n,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(d,{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(K,{class:"avatar-uploader",accept:h.value,modelValue:l.image,"onUpdate:modelValue":e[4]||(e[4]=u=>l.image=u),data:{cid:1},headers:{Token:F(S).token},action:R.value,"show-file-list":!1,"on-success":j},{default:o(()=>[l.image?(r(),i("img",{key:0,src:l.image,class:"avatar"},null,8,me)):(r(),i("div",ce,[a(J,null,{default:o(()=>[a(H)]),_:1})]))]),_:1},8,["accept","modelValue","headers","action"])]),_:1}),a(s,{label:"\u76D1\u6D4B\u9879",prop:"monitor_item"},{default:o(()=>[a(m,{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),i(c,null,_(B.dictData.monitor_item,(u,n)=>(r(),f(p,{key:n,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(d,{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(m,{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),i(c,null,_(B.dictData.device_status,(u,n)=>(r(),f(p,{key:n,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(m,{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),i(c,null,_(B.dictData.device_online_status,(u,n)=>(r(),f(p,{key:n,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const Ze=ne(fe,[["__scopeId","data-v-afdf25a4"]]);export{Ze as default};
|