2024-02-22 17:19:17 +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.ae8e286c.js";import{a as oe}from"./useDictOptions.40b26c73.js";import{P as ie}from"./index.a9e38e26.js";import{c as U,d as V,a as re,e as de,f as ne}from"./device.5a2c0852.js";import"./lodash.e92d81a1.js";import{a as se,e as x,d as pe}from"./index.71fc8348.js";import{d as P,s as w,r as E,b as me,_ as h,a3 as ce,o as i,c as n,T as a,K as o,u as b,U as f,a6 as v,J as s,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=P({name:"deviceEdit"}),ge=P({...Be,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(B,{expose:R,emit:C}){const k=w(),F=w(),y=E("add"),A=E(".png, .jpg, .jpeg, image/png, image/jpeg"),S=E(`${x.baseUrl}${x.urlPrefix}/upload/image`),j=se(),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=h({id:"",product_id:"",code:"",iccid:"",name:"",video_url:"",type:"",monitor_item:[],status:"",is_online:"",image:""}),O=h({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:""}).catch(p=>{t.iccid="",t.monitor_item=""});e.length!=0&&(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}}}),m=E(!1),$=async u=>{m.value=!0;const e=await U({name:u!=null?u:""});g.product=e,m.value=!1},G=async u=>{m.value=!0;const e=await V({deviceId:u!=null?u:""});g.deviceIccids=e,m.value=!1},H=async u=>{const e=await re({id:u.id});I(e)},J=async()=>{var e,p;await((e=k.value)==null?void 0:e.validate());const u={...t};y.value=="edit"?await de(u):await ne(u),(p=F.value)==null||p.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 p=Y,d=Z,c=q,_=ee,Q=ce("Plus"),z=te,W=le,X=ue;return i(),n("div",_e,[a(ie,{ref_key:"popupRef",ref:F,title:b(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(p,{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\u578
|