2 lines
7.6 KiB
JavaScript
2 lines
7.6 KiB
JavaScript
import{B as Y,C as Z,G as q,H as ee,c as te,P as le,D as ue,k as ae}from"./element-plus.995fab54.js";import{a as oe}from"./useDictOptions.071e6d85.js";import{P as ie}from"./index.1996b8ef.js";import{c as U,d as V,a as re,e as de,f as se}from"./device.33b52ef9.js";import"./lodash.e92d81a1.js";import{a as ne,e as x,d as pe}from"./index.49bc9e20.js";import{d as h,s as w,r as b,b as me,_ as P,a3 as ce,o as i,c as s,T as a,K as o,u as E,U as f,a6 as v,J as n,Q as D}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 _e={class:"edit-popup"},fe=["src"],ve={key:1,class:"avatar-uploader-icon"},Be=h({name:"deviceEdit"}),ge=h({...Be,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(B,{expose:R,emit:C}){const k=w(),F=w(),y=b("add"),A=b(".png, .jpg, .jpeg, image/png, image/jpeg"),S=b(`${x.baseUrl}${x.urlPrefix}/upload/image`),j=ne(),L=(u,e)=>{if(u.code==0){ae.error(u.msg);return}t.image=u.data.uri},T=me(()=>y.value=="edit"?"\u7F16\u8F91\u8BBE\u5907":"\u65B0\u589E\u8BBE\u5907"),t=P({id:"",product_id:"",code:"",iccid:"",name:"",video_url:"",type:"",monitor_item:[],status:"",is_online:"",image:""}),O=P({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"]}]}),N=async u=>{const e=await V({deviceId:u!=null?u:""});t.iccid=e[0].iccid,e[0].type==0&&(t.monitor_item=["temperature"]),e[0].type==1&&(t.monitor_item=["ambient_temperature","ambient_humidity"]),e[0].type==2&&(t.monitor_item=["nitrogen"]),e[0].type==3&&(t.monitor_item=["methane"]),e[0].type==4&&(t.monitor_item=["noise"]),e[0].type==5&&(t.monitor_item=["fireproof"])},I=async u=>{for(const e in t)u[e]!=null&&u[e]!=null&&(t[e]=u[e])},{optionsData:g}=oe({product:{api:U,params:{all:1}},deviceIccids:{api:V,params:{all:1}}}),p=b(!1),$=async u=>{p.value=!0;const e=await U({name:u!=null?u:""});g.product=e,p.value=!1},G=async u=>{p.value=!0;const e=await V({deviceId:u!=null?u:""});g.deviceIccids=e,p.value=!1},H=async u=>{const e=await re({id:u.id});I(e)},J=async()=>{var e,m;await((e=k.value)==null?void 0:e.validate());const u={...t};y.value=="edit"?await de(u):await se(u),(m=F.value)==null||m.close(),C("success")},K=(u="add")=>{var e;y.value=u,(e=F.value)==null||e.open()},M=()=>{C("close")};return R({open:K,setFormData:I,getDetail:H}),(u,e)=>{const m=Y,d=Z,c=q,_=ee,Q=ce("Plus"),z=te,W=le,X=ue;return i(),s("div",_e,[a(ie,{ref_key:"popupRef",ref:F,title:E(T),async:!0,width:"550px",onConfirm:J,onClose:M},{default:o(()=>[a(X,{ref_key:"formRef",ref:k,model:t,"label-width":"120px",rules:O},{default:o(()=>[a(d,{label:"\u8BBE\u5907\u540D\u79F0",prop:"name"},{default:o(()=>[a(m,{modelValue:t.name,"onUpdate:modelValue":e[0]||(e[0]=l=>t.name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u8BBE\u5907\u7C7B\u578B",prop:"type"},{default:o(()=>[a(_,{class:"flex-1",modelValue:t.type,"onUpdate:modelValue":e[1]||(e[1]=l=>t.type=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u7C7B\u578B"},{default:o(()=>[(i(!0),s(f,null,v(B.dictData.device_type,(l,r)=>(i(),n(c,{key:r,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(d,{label:"\u6240\u5C5E\u4EA7\u54C1",prop:"product_id"},{default:o(()=>[a(_,{modelValue:t.product_id,"onUpdate:modelValue":e[2]||(e[2]=l=>t.product_id=l),remote:"",filterable:"",placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u4FE1\u606F","remote-method":$,loading:p.value},{default:o(()=>[(i(!0),s(f,null,v(E(g).product,(l,r)=>(i(),n(c,{key:r,label:l.productinfo,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),t.type==1?(i(),n(d,{key:0,label:"\u8BBE\u5907\u7F16\u7801",prop:"code",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BBE\u5907\u7F16\u7801",trigger:["blur"]}]},{default:o(()=>[a(_,{modelValue:t.code,"onUpdate:modelValue":e[3]||(e[3]=l=>t.code=l),remote:"",filterable:"","remote-method":G,onChange:N,loading:p.value},{default:o(()=>[(i(!0),s(f,null,v(E(g).deviceIccids,(l,r)=>(i(),n(c,{key:r,label:l.device_sn,value:l.device_sn},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})):D("",!0),t.type==1?(i(),n(d,{key:1,label:"\u786C\u4EF6ICCID",prop:"iccid"},{default:o(()=>[a(m,{modelValue:t.iccid,"onUpdate:modelValue":e[4]||(e[4]=l=>t.iccid=l),disabled:"",placeholder:"\u8BF7\u8F93\u5165ICCID"},null,8,["modelValue"])]),_:1})):D("",!0),t.type==1?(i(),n(d,{key:2,label:"\u76D1\u6D4B\u9879",prop:"monitor_item"},{default:o(()=>[a(_,{class:"flex-1",modelValue:t.monitor_item,"onUpdate:modelValue":e[5]||(e[5]=l=>t.monitor_item=l),multiple:"",disabled:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u76D1\u6D4B\u9879"},{default:o(()=>[(i(!0),s(f,null,v(B.dictData.monitor_item,(l,r)=>(i(),n(c,{key:r,label:l.name,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):D("",!0),a(d,{label:"\u8BBE\u5907\u56FE",prop:"image"},{default:o(()=>[a(W,{class:"avatar-uploader",accept:A.value,modelValue:t.image,"onUpdate:modelValue":e[6]||(e[6]=l=>t.image=l),data:{cid:1},headers:{Token:E(j).token},action:S.value,"show-file-list":!1,"on-success":L},{default:o(()=>[t.image?(i(),s("img",{key:0,src:t.image,class:"avatar"},null,8,fe)):(i(),s("div",ve,[a(z,null,{default:o(()=>[a(Q)]),_:1})]))]),_:1},8,["accept","modelValue","headers","action"])]),_:1}),a(d,{label:"\u89C6\u9891\u5730\u5740",prop:"video_url"},{default:o(()=>[a(m,{modelValue:t.video_url,"onUpdate:modelValue":e[7]||(e[7]=l=>t.video_url=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u89C6\u9891\u5730\u5740"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u8BBE\u5907\u72B6\u6001",prop:"status"},{default:o(()=>[a(_,{class:"flex-1",modelValue:t.status,"onUpdate:modelValue":e[8]||(e[8]=l=>t.status=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BBE\u5907\u72B6\u6001"},{default:o(()=>[(i(!0),s(f,null,v(B.dictData.device_status,(l,r)=>(i(),n(c,{key:r,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(d,{label:"\u662F\u5426\u5728\u7EBF",prop:"is_online"},{default:o(()=>[a(_,{class:"flex-1",modelValue:t.is_online,"onUpdate:modelValue":e[9]||(e[9]=l=>t.is_online=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u5728\u7EBF"},{default:o(()=>[(i(!0),s(f,null,v(B.dictData.device_online_status,(l,r)=>(i(),n(c,{key:r,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const lt=pe(ge,[["__scopeId","data-v-9a830be6"]]);export{lt as default};
|