Files
aiot-platform-ui/apps/web-antd/dist/js/config-6cXe01IS.js
lzh 35c3d0e06e
All checks were successful
Web UI CI/CD / build-and-deploy (push) Successful in 8s
chore: build and deploy web-antd
2026-03-18 16:18:59 +08:00

2 lines
3.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var d=(m,N,t)=>new Promise((S,u)=>{var r=a=>{try{e(t.next(a))}catch(s){u(s)}},c=a=>{try{e(t.throw(a))}catch(s){u(s)}},e=a=>a.done?S(a.value):Promise.resolve(a.value).then(r,c);e((t=t.apply(m,N)).next())});import{s as B,u as I}from"./index-BOcos87w.js";import{I as j}from"./constants-B5TthjFC.js";import{cp as V,bP as M,ay as p,a9 as J,ac as P}from"./bootstrap-CW2RsBQq.js";import{m as F,b9 as i,bF as L,aa as T,ad as C,b2 as l,j as U,ab as f,ae as O,u as o,bp as A,ac as k,bJ as g,ai as y}from"../jse/index-index-Cy8amzIl.js";const G={key:0,class:"json-viewer-container"},H={class:"json-code"},q={class:"mt-5 text-center"},z=F({name:"DeviceDetailConfig",__name:"config",props:{device:{}},emits:["success"],setup(m,{emit:N}){const t=m,S=N,u=i(!1),r=i(!1),c=i(!1),e=i({}),a=i("");L(()=>{try{e.value=t.device.config?JSON.parse(t.device.config):{},a.value=JSON.stringify(e.value,null,2)}catch(v){e.value={},a.value="{}"}});const s=i(!1),_=T(()=>{try{return typeof e.value=="string"?JSON.stringify(JSON.parse(e.value),null,2):JSON.stringify(e.value,null,2)}catch(v){return JSON.stringify(e.value,null,2)}});function h(){s.value=!0,a.value=JSON.stringify(e.value,null,2)}function D(){try{e.value=t.device.config?JSON.parse(t.device.config):{},a.value=JSON.stringify(e.value,null,2)}catch(v){e.value={},a.value="{}"}s.value=!1}function b(){return d(this,null,function*(){try{e.value=JSON.parse(a.value)}catch(v){console.error("JSON格式错误:",v),J.error({content:"JSON格式错误请修正后再提交"});return}c.value=!0;try{yield x(),s.value=!1}finally{c.value=!1}})}function w(){return d(this,null,function*(){r.value=!0;try{yield B({deviceId:t.device.id,method:j.CONFIG_PUSH.method,params:e.value}),J.success({content:"配置推送成功!"})}finally{r.value=!1}})}function x(){return d(this,null,function*(){try{u.value=!0,yield I({id:t.device.id,config:JSON.stringify(e.value)}),J.success({content:"更新成功!"}),S("success")}finally{u.value=!1}})}return(v,n)=>(l(),C("div",null,[U(o(V),{class:"my-4",description:"如需编辑文件,请点击下方编辑按钮",message:"支持远程更新设备的配置文件(JSON 格式),可以在下方编辑配置模板,对设备的系统参数、网络参数等进行远程配置。配置完成后,需点击「配置推送」按钮,设备即可进行远程配置。","show-icon":"",type:"info"}),s.value?(l(),f(o(M),{key:1,value:a.value,"onUpdate:value":n[0]||(n[0]=E=>a.value=E),rows:20,class:"json-editor",placeholder:"请输入 JSON 格式的配置信息"},null,8,["value"])):(l(),C("div",G,[O("pre",H,[O("code",null,A(_.value),1)])])),O("div",q,[s.value?(l(),f(o(p),{key:0,onClick:D},{default:g(()=>[...n[1]||(n[1]=[y("取消",-1)])]),_:1})):k("",!0),s.value?(l(),f(o(p),{key:1,loading:c.value,type:"primary",onClick:b},{default:g(()=>[...n[2]||(n[2]=[y(" 保存 ",-1)])]),_:1},8,["loading"])):(l(),f(o(p),{key:2,onClick:h},{default:g(()=>[...n[3]||(n[3]=[y("编辑",-1)])]),_:1})),s.value?k("",!0):(l(),f(o(p),{key:3,loading:r.value,type:"primary",onClick:w},{default:g(()=>[...n[4]||(n[4]=[y(" 配置推送 ",-1)])]),_:1},8,["loading"]))])]))}}),Y=P(z,[["__scopeId","data-v-9456c5bf"]]);export{Y as default};