2 lines
6.6 KiB
JavaScript
2 lines
6.6 KiB
JavaScript
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:modelValue":e[2]||(e[2]=u=>l.product_id=u),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u4FE1\u606F","remote-method":L,loading:g.value},{default:o(()=>[(r(!0),n(c,null,_(b(k).product,(u,i)=>(r(),f(p,{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(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:"\u4EA7\u54C1\u56FE",prop:"image"},{default:o(()=>[a(N,{class:"avatar-uploader",accept:R.value,modelValue:l.image,"onUpdate:modelValue":e[4]||(e[4]=u=>l.image=u),data:{cid:1},headers:{Token:b(h).token},action:A.value,"show-file-list":!1,"on-success":j},{default:o(()=>[l.image?(r(),n("img",{key:0,src:l.image,class:"avatar"},null,8,pe)):(r(),n("div",me,[a(M,null,{default:o(()=>[a(K)]),_: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),n(c,null,_(B.dictData.monitor_item,(u,i)=>(r(),f(p,{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(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),n(c,null,_(B.dictData.device_status,(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:"\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),n(c,null,_(B.dictData.device_online_status,(u,i)=>(r(),f(p,{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 Ye=se(_e,[["__scopeId","data-v-10b2acf1"]]);export{Ye as default};
|