2024-01-30 09:49:28 +08:00
|
|
|
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",mode
|