index.html 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <!--<meta http-equiv="refresh" content="0; url=/src/index2.html">-->
  6. <!-- 0表示立即跳转 -->
  7. <script src="api/petite-vue.min.js" defer></script>
  8. <!--<script src="./api/axios.min.js"></script>-->
  9. <script src="api/data.js"></script>
  10. <script src="api/ws.js"></script>
  11. <script src="api/display_data.js"></script>
  12. <script src="api/operation.js"></script>
  13. <script src="api/channel_display.js"></script>
  14. <!--<script src="./api/pagination.js"></script>-->
  15. <!--<script src="./api/Threshold_Adjust.js"></script>-->
  16. <!--<script src="./api/system_alarm.js"></script>-->
  17. <script src="api/sys_paras.js"></script>
  18. <!-- CSS 文件 -->
  19. <link rel="stylesheet" href="css/index.css">
  20. </head>
  21. <body>
  22. <div class="tab-container">
  23. <div class="tab-header">
  24. <button class="tab-btn active" style="margin-left: 30%;" data-tab="tab1">状态监控</button>
  25. <button class="tab-btn" data-tab="tab2">⽹络配置</button>
  26. <button class="tab-btn" data-tab="tab3">485配置</button>
  27. <button class="tab-btn" data-tab="tab4">SNMP</button>
  28. <button class="tab-btn" data-tab="tab5">设备信息</button>
  29. <span style="text-align: center;line-height: 50px;margin-left: 20%;">{{dateTime}}</span>
  30. </div>
  31. <div class="tab-content active" id="tab1">
  32. <!--<iframe class="tab-iframe" src="/src/pdu.html"></iframe>-->
  33. <div id="app" @vue:mounted="fetchData" class="container">
  34. <!-- 上部:总设备信息 -->
  35. <div class="summary-section">
  36. <div class="left-buttons">
  37. <button v-show="showExternal" @click="toggleThreeDevices(1)" class="btn btn-energy">L1</button>
  38. <button v-show="showExternal" @click="toggleThreeDevices(2)" class="btn btn-threshold">L2</button>
  39. <button v-show="showExternal" @click="toggleThreeDevices(3)" class="btn btn-delay">L3</button>
  40. </div>
  41. <div class="button-container">
  42. <div class="left-buttons">
  43. <button @click="showFzszModal = true;" class="btn btn-threshold">阈值设置</button>
  44. <button @click="showysszModal=true" class="btn btn-delay">延时设置</button>
  45. <button @click=" hdlsz()" class="btn btn-energy">耗电量重置</button>
  46. </div>
  47. <div class="right-buttons">
  48. <button @click="toggleAllDevices(true)" class=" btn btn-energy">总开</button>
  49. <button @click="toggleAllDevices(false)" class="btn btn-close">总关</button>
  50. </div>
  51. </div>
  52. <table class="summary-table">
  53. <thead>
  54. <tr>
  55. <th>总电压(V)</th>
  56. <th>总电流(A)</th>
  57. <th>总功率(KW)</th>
  58. <!--<th>总频率(HZ)</th>-->
  59. <th>总耗电量(Kwh)</th>
  60. </tr>
  61. </thead>
  62. <tbody style="height: 50px;">
  63. <tr>
  64. <td>{{ summary.totalVoltage }}</td>
  65. <td>{{ summary.totalCurrent }}</td>
  66. <td >{{ summary.totalPower }}</td>
  67. <!--<td >{{ summary.totalFrequency }}</td>-->
  68. <td >{{ summary.totalEnergy }}</td>
  69. </tr>
  70. </tbody>
  71. </table>
  72. <div class="summary-actions">
  73. </div>
  74. </div>
  75. <!-- 中部:设备管理列表 -->
  76. <div class="table-container">
  77. <div class="scrollable-table">
  78. <table class="device-table">
  79. <thead>
  80. <tr>
  81. <th>通道名称</th>
  82. <th>相序</th>
  83. <th>电压(V)</th>
  84. <th>电流(A)</th>
  85. <th>功率(W)</th>
  86. <th>频率(HZ)</th>
  87. <th>耗电量(Kwh)</th>
  88. <th>开启延时(S)</th>
  89. <th>关闭延时(S)</th>
  90. <th>状态</th>
  91. <th>操作</th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <tr v-for="device in channelList">
  96. <td >{{ device.productChName }}</td>
  97. <td >{{ device.productPhOrder }}</td>
  98. <td v-if="device.colorStyledy!=''" :style="device.colorStyledy">{{ device.productChVoltage }}</td>
  99. <td v-else :style="device.colorStyledy2">{{ device.productChVoltage }}</td>
  100. <td :style="device.colorStyledl">{{ device.productChCurrent }}</td>
  101. <td :style="device.colorStylegl">{{ device.productChPower }}</td>
  102. <td>{{ device.productChPowerFreq }}</td>
  103. <td :style="device.colorStylehdl">{{ device.productChConsumption }}</td>
  104. <td >{{ device.firingInterval }}</td>
  105. <td >{{ device.closeInterval }}</td>
  106. <td :class="device.productChStatus ? 'status-active' : 'status-inactive'">
  107. {{ device.productChStatus==1 ? '接通' : '断开' }}
  108. </td>
  109. <td>
  110. <button @click="toggleDeviceStatus(device)"
  111. :class="device.productChStatus ? 'btn btn-close' : 'btn btn-on'">
  112. {{ device.productChStatus==1 ? '关闭' : '开启' }}
  113. </button>
  114. </td>
  115. </tr>
  116. </tbody>
  117. </table>
  118. </div>
  119. </div>
  120. <!-- 下部:状态显示 -->
  121. <div class="status-section">
  122. <div class="status-boxes">
  123. <div class="status-box">
  124. <h3>温度</h3>
  125. <p v-if="statusData.temperatureStatus==0" style="color: red">{{ statusData.temperature }}</p>
  126. <p v-else :style="statusData.tempcolorStyle">{{ statusData.temperature }} </p>
  127. </div>
  128. <div class="status-box">
  129. <h3>湿度</h3>
  130. <p v-if="statusData.temperatureStatus==0" style="color: red">{{ statusData.humidity }}</p>
  131. <p v-else :style="statusData.humcolorStylesx">{{ statusData.humidity }} </p>
  132. </div>
  133. <div class="status-box">
  134. <h3>烟雾</h3>
  135. <p v-if="statusData.waterLeakStatus==0" style="color: red">{{ statusData.waterLeak }}</p>
  136. <p v-else>{{ statusData.waterLeak }} </p>
  137. </div>
  138. <div class="status-box">
  139. <h3>CO2</h3>
  140. <p v-if="statusData.smokeStatus==0" style="color: red">{{ statusData.smoke }}</p>
  141. <p v-else :style="statusData.smokecolorStylesx">{{ statusData.smoke }} </p>
  142. </div>
  143. <div class="status-box" @click="showFzszModalgj=true" style=" cursor: pointer; position: relative; ">
  144. <h3>报警</h3>
  145. <p>{{ statusData.alarm1 }}</p>
  146. </div>
  147. </div>
  148. </div>
  149. <!-- 耗电量设置弹窗内容 -->
  150. <div v-if="showFormModal" class="modal-overlay" >
  151. <div class="modal-content">
  152. <h2>耗电量重置</h2>
  153. <!-- 下拉选择 -->
  154. <div class="form-group" >
  155. <label>通道:</label>
  156. <div class="select-header">
  157. <p class="hint">提示:使用Ctrl/Cmd键进行多选</p>
  158. <button class="select-all" @click="toggleSelectAll2">
  159. {{ formData.productChIds.length === Object.keys(channelList1).length ? '取消全选' : '全选' }}
  160. </button>
  161. </div>
  162. <select v-model="formData.productChIds" multiple >
  163. <option v-for="option in channelList1" :value="option.productChId">{{ option.productChName }}</option>
  164. </select>
  165. <div class="selected-items">
  166. <h3>已选通道:</h3>
  167. <div class="selected-tags">
  168. <span v-if="formData.productChIds.length === 0" class="no-selection">暂无选择</span>
  169. <div v-for="id in formData.productChIds" :key="id" class="tag">
  170. {{ getOptionName2(id) }}
  171. <button @click="removeOption2(id)">×</button>
  172. </div>
  173. </div>
  174. </div>
  175. <!--<label>通道:</label>-->
  176. <!--<select v-model="formData.channel_power_infro" class="custom-select">-->
  177. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择耗电量复位通道...</option>-->
  178. <!--<option v-for="option in channelList1" :value="option.channel_power_infro">{{ option.productChName }}</option>-->
  179. <!--</select>-->
  180. </div>
  181. <!-- 表单按钮 -->
  182. <div class="form-actions">
  183. <button type="button" class="btn btn-energy" @click="hdlczClickClose()">取消</button>
  184. <button class="btn btn-energy" @click="hdlczClick()" >提交</button>
  185. </div>
  186. </div>
  187. </div>
  188. <!-- 阈值设置弹窗内容 -->
  189. <div @vue:mounted="fzszData" v-if="showFzszModal" class="modal-overlay" >
  190. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  191. <h2>阈值设置</h2>
  192. <button @click="handleUpdateList()" style="margin: 10px;" :class=" 'btn btn-on'">批量设置 </button>
  193. <div class="scrollable-table" style=" max-height: 60vh; ">
  194. <table class="device-table">
  195. <thead>
  196. <tr>
  197. <th>通道名称</th>
  198. <th>通道号</th>
  199. <th>电流上限</th>
  200. <th>电压上限</th>
  201. <th>电压下限</th>
  202. <th>功率上限</th>
  203. <th>耗电量上限</th>
  204. <th>操作</th>
  205. </tr>
  206. </thead>
  207. <tbody>
  208. <tr v-for="power in powerThresholdList" :key="power.productChId">
  209. <td>{{ power.productChName }}</td>
  210. <td>{{ power.productChId }}</td>
  211. <td>{{ power.currentUpperAction }}</td>
  212. <td>{{ power.voltageUpperAction }}</td>
  213. <td>{{ power.voltageDownAction }}</td>
  214. <td>{{ power.powerUpperAction }}</td>
  215. <td>{{ power.alarmContentUpperAction }}</td>
  216. <td>
  217. <button @click="handleUpdate(power)" :class=" 'btn btn-on'">
  218. {{ '设置' }}
  219. </button>
  220. </td>
  221. </tr>
  222. </tbody>
  223. </table>
  224. </div>
  225. <!-- 表单按钮 -->
  226. <div class="button-footer form-actions">
  227. <button type="button" class="btn btn-energy" @click="fzscClickClose()">取消</button>
  228. </div>
  229. </div>
  230. </div>
  231. <!-- 阈值设置单设备弹窗内容 -->
  232. <div v-if="showFzszModal2" class="modal-overlay" >
  233. <div class="modal-content">
  234. <div class="form-group" v-if="fzscData.list=='1'" >
  235. <label>通道:</label>
  236. <div class="select-header">
  237. <p class="hint">提示:使用Ctrl/Cmd键进行多选</p>
  238. <button class="select-all" @click="toggleSelectAll">
  239. {{ fzscData.productChIds.length === Object.keys(channelList1).length ? '取消全选' : '全选' }}
  240. </button>
  241. </div>
  242. <select v-model="fzscData.productChIds" multiple >
  243. <option v-for="option in channelList1" :value="option.productChId">{{ option.productChName }}</option>
  244. </select>
  245. <div class="selected-items">
  246. <h3>已选通道:</h3>
  247. <div class="selected-tags">
  248. <span v-if="fzscData.productChIds.length === 0" class="no-selection">暂无选择</span>
  249. <div v-for="id in fzscData.productChIds" :key="id" class="tag">
  250. {{ getOptionName(id) }}
  251. <button @click="removeOption(id)">×</button>
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256. <div class="form-group" v-if="fzscData.list==''">
  257. <label>通道号:</label>
  258. <input type="text" v-model="fzscData.productChId" readonly >
  259. </div>
  260. <div class="form-group" >
  261. <label>电流上限:</label>
  262. <input type="text" v-model="fzscData.currentUpperAction">
  263. </div>
  264. <div class="form-group" >
  265. <label>电压上限:</label>
  266. <input type="text" v-model="fzscData.voltageUpperAction">
  267. </div>
  268. <div class="form-group" >
  269. <label>电压下限:</label>
  270. <input type="text" v-model="fzscData.voltageDownAction">
  271. </div>
  272. <div class="form-group" >
  273. <label>功率上限:</label>
  274. <input type="text" v-model="fzscData.powerUpperAction">
  275. </div>
  276. <div class="form-group" >
  277. <label>耗电量上限:</label>
  278. <input type="text" v-model="fzscData.alarmContentUpperAction">
  279. </div>
  280. <!-- 表单按钮 -->
  281. <div class="form-actions">
  282. <button class="btn btn-energy" @click="fzscClick()" >提交</button>
  283. <button type="button" class="btn btn-energy" @click="fzscClickClose2()">取消</button>
  284. </div>
  285. </div>
  286. </div>
  287. <!-- 延时设置列表 -->
  288. <div @vue:mounted="ysszData" v-if="showysszModal" class="modal-overlay" >
  289. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  290. <h2>延时设置</h2>
  291. <div class="scrollable-table" style=" max-height: 60vh; ">
  292. <table class="device-table">
  293. <thead>
  294. <tr>
  295. <th>通道名称</th>
  296. <th>通道号</th>
  297. <th>开启时间</th>
  298. <th>关闭时间</th>
  299. <th>操作</th>
  300. </tr>
  301. </thead>
  302. <tbody>
  303. <tr v-for="power in ysszList" :key="power.productChId">
  304. <td>{{ power.productChName }}</td>
  305. <td>{{ power.productChId }}</td>
  306. <td>{{ power.firingInterval }}</td>
  307. <td>{{ power.closeInterval }}</td>
  308. <td>
  309. <button @click="ysszhandleUpdate(power)" :class=" 'btn btn-on'">
  310. {{ '设置' }}
  311. </button>
  312. </td>
  313. </tr>
  314. </tbody>
  315. </table>
  316. </div>
  317. <!-- 表单按钮 -->
  318. <div class="button-footer form-actions">
  319. <button type="button" class="btn btn-energy" @click="ysszClickClose()">取消</button>
  320. </div>
  321. </div>
  322. </div>
  323. <!-- 延时设置内容 -->
  324. <div v-if="showysszModal2" class="modal-overlay2" >
  325. <div class="modal-content">
  326. <div class="form-group" >
  327. <label>通道号:</label>
  328. <input type="text" v-model="ysszData2.productChId" readonly >
  329. </div>
  330. <div class="form-group" >
  331. <label>开启时间(S):</label>
  332. <input type="text" v-model="ysszData2.firingInterval">
  333. </div>
  334. <div class="form-group" >
  335. <label>关闭时间(S):</label>
  336. <input type="text" v-model="ysszData2.closeInterval">
  337. </div>
  338. <!-- 表单按钮 -->
  339. <div class="form-actions">
  340. <button class="btn btn-energy" @click="ysszClick()" >提交</button>
  341. <button type="button" class="btn btn-energy" @click="ysszClickClose2()">取消</button>
  342. </div>
  343. </div>
  344. </div>
  345. <!--告警信息弹窗-->
  346. <div v-if="showFzszModalgj" class="modal-overlay" >
  347. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  348. <div class="scrollable-table" style=" max-height: 60vh; ">
  349. <table class="device-table">
  350. <thead>
  351. <tr>
  352. <th>序号</th>
  353. <th>报警时间</th>
  354. <th>报警类型</th>
  355. <th>报警信息</th>
  356. </tr>
  357. </thead>
  358. <tbody>
  359. <tr v-for="(item, index) in his_alarmd" :key="index">
  360. <td>{{ item.number }}</td>
  361. <td>{{ item.date }}</td>
  362. <td>{{ item.type }}</td>
  363. <td>{{ item.waning_context }}</td>
  364. </tr>
  365. </tbody>
  366. </table>
  367. </div>
  368. <!-- 表单按钮 -->
  369. <div class="button-footer form-actions">
  370. <button type="button" class="btn btn-energy" @click="fzscClickClosegj()">取消</button>
  371. </div>
  372. </div>
  373. </div>
  374. </div>
  375. </div>
  376. <!--网络配置-->
  377. <div class="tab-content" id="tab2" @vue:mounted="wkszQuery">
  378. <div >
  379. <div class="modal-content">
  380. <div class="form-group" >
  381. <label>选择模式:</label>
  382. <select v-model="wlszForm.mode" class="custom-select">
  383. <option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>
  384. <option v-for="option in modes" :value="option.id">{{ option.name }}</option>
  385. </select>
  386. </div>
  387. <div class="form-group" >
  388. <label>IP:</label>
  389. <input type="text" v-model="wlszForm.ipaddr" >
  390. </div>
  391. <div class="form-group" >
  392. <label>掩码:</label>
  393. <input type="text" v-model="wlszForm.mask" >
  394. </div>
  395. <div class="form-group" >
  396. <label>网关:</label>
  397. <input type="text" v-model="wlszForm.gateway" >
  398. </div>
  399. <div class="form-group" >
  400. <label>DNS1:</label>
  401. <input type="text" v-model="wlszForm.dns1" >
  402. </div>
  403. <div class="form-group" >
  404. <label>DNS2:</label>
  405. <input type="text" v-model="wlszForm.dns2" >
  406. </div>
  407. <!--<div class="form-group" >-->
  408. <!--<label>DHCP:</label>-->
  409. <!--<input type="text" v-model="wlszForm.dhcp" >-->
  410. <!--</div>-->
  411. <!-- 表单按钮 -->
  412. <div class="form-actions">
  413. <button class="btn btn-energy" @click="submitForm('wksz')" >确定</button>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <!--485配置-->
  419. <div class="tab-content" id="tab3" @vue:mounted="rsQuery">
  420. <div class="modal-content">
  421. <div class="form-group" >
  422. <select v-model="wlszForm2.mode" class="custom-select">
  423. <option :value="null" disabled selected hidden style="color: #aaa;">请选择耗电量复位通道...</option>
  424. <option v-for="option in modes2" :value="option.id">{{ option.name }}</option>
  425. </select>
  426. </div>
  427. <div class="form-group" >
  428. <label>地址:</label>
  429. <input type="text" v-model="wlszForm2.addr" >
  430. </div>
  431. <div class="form-group" >
  432. <label>波特率:</label>
  433. <input type="text" v-model="wlszForm2.baud" >
  434. </div>
  435. <!-- 表单按钮 -->
  436. <div class="form-actions">
  437. <button class="btn btn-energy" @click="submitForm('rs')" >确定</button>
  438. </div>
  439. </div>
  440. </div>
  441. <!--SNMP配置-->
  442. <div class="tab-content" id="tab4" >
  443. <div class="modal-content">
  444. <div class="form-group" >
  445. <label>社团项:</label>
  446. <input type="text" v-model="wlszForm3.publics" >
  447. </div>
  448. <!--<div class="form-group" >-->
  449. <!--<label>Trap IP:</label>-->
  450. <!--<select v-model="wlszForm3.version" @change="handleChange" class="custom-select">-->
  451. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  452. <!--<option v-for="option in SNMPs" :value="option.id">{{ option.name }}</option>-->
  453. <!--</select>-->
  454. <!--</div>-->
  455. <div class="form-group" >
  456. <label>Trap IP:</label>
  457. <input type="text" v-model="wlszForm3.trap_ip" >
  458. </div>
  459. <!--<div class="form-group" v-if="snmpShow">-->
  460. <!--<label>用户名:</label>-->
  461. <!--<input type="text" v-model="wlszForm3.yhm" >-->
  462. <!--</div>-->
  463. <!--<div class="form-group" v-if="snmpShow">-->
  464. <!--<label>认证协议:</label>-->
  465. <!--<select v-model="wlszForm3.mode" class="custom-select">-->
  466. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  467. <!--<option v-for="option in rzxys" :value="option.id">{{ option.name }}</option>-->
  468. <!--</select>-->
  469. <!--</div>-->
  470. <!--<div class="form-group" v-if="snmpShow">-->
  471. <!--<label>认证密码:</label>-->
  472. <!--<input type="text" v-model="wlszForm3.rzmm" >-->
  473. <!--</div>-->
  474. <!--<div class="form-group" v-if="snmpShow">-->
  475. <!--<label>加密协议:</label>-->
  476. <!--<select v-model="wlszForm3.trapmode" class="custom-select">-->
  477. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  478. <!--<option v-for="option in jmxys" :value="option.id">{{ option.name }}</option>-->
  479. <!--</select>-->
  480. <!--</div>-->
  481. <!--<div class="form-group" v-if="snmpShow">-->
  482. <!--<label>加密密码:</label>-->
  483. <!--<input type="text" v-model="wlszForm3.jmmm" >-->
  484. <!--</div>-->
  485. <!-- 表单按钮 -->
  486. <div class="form-actions">
  487. <button class="btn btn-energy" @click="submitForm('snmp')" >确定</button>
  488. </div>
  489. </div>
  490. </div>
  491. <!--设备信息-->
  492. <div class="tab-content" id="tab5" >
  493. <!--<iframe class="tab-iframe" src="/src/sbsz.html"></iframe>-->
  494. <div class="divAll" >
  495. <!--设备信息-->
  496. <div class="modal-content" @vue:mounted="sbxxQuery">
  497. <div class="form-group" >
  498. <label>系统时间:</label>
  499. <input type="text" style="width: 70%" v-model="wlszForm4.sys_time" >
  500. <button style="margin-left: 10px;" class="btn btn-energy" @click="showXtsjModalClick()">设置</button>
  501. </div>
  502. <div class="form-group" >
  503. <label>固件版本:</label>
  504. <input type="text" style="width: 70%" v-model="wlszForm4.ver" >
  505. <!--<button style="margin-left: 10px;" class="btn btn-energy" @click="showFjscModalClick()" >升级</button>-->
  506. </div>
  507. </div>
  508. <!--设备系统时间设置-->
  509. <div v-if="showXtsjModal" class="modal-overlay2" >
  510. <div class="modal-content" >
  511. <h2>时间设置</h2>
  512. <!-- 下拉选择 -->
  513. <div class="form-group" >
  514. <label>时区:</label>
  515. <select v-model="wlszForm4.tzone" class="custom-select">
  516. <option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>
  517. <option v-for="option in sqs" :value="option.id">{{ option.name }}</option>
  518. </select>
  519. </div>
  520. <div class="form-group" >
  521. <label for="selectedDate">选择日期:</label>
  522. <div class="date-input-container">
  523. <input
  524. v-model="wlszForm4.sys_time"
  525. type="text"
  526. id="selectedDate"
  527. class="date-input"
  528. placeholder="点击选择日期"
  529. @click="showPicker"
  530. >
  531. <div class="calendar-icon">
  532. <i class="fas fa-calendar-alt"></i>
  533. </div>
  534. </div>
  535. <!--<div class="datetime-modal" v-if="isPickerVisible">-->
  536. <div class="modal-overlay2" v-if="isPickerVisible">
  537. <div class="modal-content">
  538. <div class="form-group" >
  539. <label>日期:</label>
  540. <select v-model="dateForm.year" style="width: 25%" >
  541. <option v-for="option in years" :value="option.id">{{ option.name }}</option>
  542. </select>
  543. <select v-model="dateForm.month" @change="updateDays" style="width: 25%" >
  544. <option v-for="option in months" :value="option.id">{{ option.name }}</option>
  545. </select>
  546. <select v-model="dateForm.day" style="width: 25%" >
  547. <option v-for="option in dayAll" :value="option.id">{{ option.name }}</option>
  548. </select>
  549. </div>
  550. <div class="form-group" >
  551. <label>时间:</label>
  552. <select v-model="dateForm.hour" style="width: 25%" >
  553. <option v-for="option in hours" :value="option.id">{{ option.name }}</option>
  554. </select>
  555. <select v-model="dateForm.minute" style="width: 25%" >
  556. <option v-for="option in minutes" :value="option.id">{{ option.name }}</option>
  557. </select>
  558. <select v-model="dateForm.second" style="width: 25%" >
  559. <option v-for="option in minutes" :value="option.id">{{ option.name }}</option>
  560. </select>
  561. </div>
  562. <button class="btn btn-energy" @click="confirmSelection"> 确认 </button>
  563. <button class="btn btn-energy" @click="isPickerVisible = false">取消 </button>
  564. </div>
  565. </div>
  566. </div>
  567. <!-- 表单按钮 -->
  568. <div class="form-actions" >
  569. <button class="btn btn-energy" @click="stxjClick()" >提交</button>
  570. <button type="button" class="btn btn-energy" @click="showXtsjModal=false">取消</button>
  571. </div>
  572. </div>
  573. </div>
  574. <!--附件上传-->
  575. <div v-if="showScfjModal" class="modal-overlay2" >
  576. <div class="upload-container" style=" background: white;width: 400px">
  577. <div class="form-group" >
  578. <label>固件版本:</label>
  579. <input type="text" style="width: 100%" v-model="wlszForm5.ver" >
  580. </div>
  581. <div class="upload-area"
  582. :class="{ dragover: isDragover }"
  583. @click="selectFiles"
  584. @dragover.prevent="isDragover = true"
  585. @dragleave="isDragover = false"
  586. @drop.prevent="handleDrop">
  587. <div class="upload-text">
  588. <h3>拖放文件到此处上传或选择文件</h3>
  589. <!--<p>支持单个或多个文件上传,最大支持200MB</p>-->
  590. </div>
  591. <input type="file" class="file-input" multiple @change="handleFileSelect" ref="fileInput">
  592. </div>
  593. <div class="files-list" v-if="files.length > 0">
  594. <h3>已选择文件 ({{ files.length }})</h3>
  595. <div class="file-item" v-for="file in files" :key="file.id">
  596. <div class="file-info">
  597. <div class="file-name">{{ file.name }}</div>
  598. </div>
  599. </div>
  600. </div>
  601. <div class="actions">
  602. <button class="btn" @click="uploadFiles" :disabled="files.length === 0 || isUploading || wlszForm5.ver==''">
  603. <i class="fas fa-upload"></i> 保存
  604. </button>
  605. <button class="btn btn-secondary" @click="clearFiles" >
  606. <i class="fas fa-times"></i> 取消
  607. </button>
  608. </div>
  609. </div>
  610. </div>
  611. </div>
  612. </div>
  613. <!-- 保存确认弹框 -->
  614. <div class="modal-overlay2" v-if="showSaveModal">
  615. <div class="modal-content">
  616. <h2>系统提示</h2>
  617. <p>{{popMessage}}</p>
  618. <div class="form-actions">
  619. <button class="btn btn-energy" @click="showSaveModal = false">取消</button>
  620. <button class="btn btn-energy" @click="saveData12()">确定</button>
  621. </div>
  622. </div>
  623. </div>
  624. </div>
  625. <script type="module">
  626. let activePageIntervalId1 = null;
  627. let activePageIntervalId2= null;
  628. let activePageIntervalId3 = null;
  629. let activePageIntervalId4 = null;
  630. let activePageIntervalId5 = null;
  631. let tabId = 'tab1';
  632. document.addEventListener('DOMContentLoaded', function() {
  633. const tabBtns = document.querySelectorAll('.tab-btn');
  634. const tabContents = document.querySelectorAll('.tab-content');
  635. tabBtns.forEach(btn => {
  636. btn.addEventListener('click', function() {
  637. // 移除所有按钮和内容的active类
  638. tabBtns.forEach(btn => btn.classList.remove('active'));
  639. tabContents.forEach(content => content.classList.remove('active'));
  640. // 为当前按钮添加active类
  641. this.classList.add('active');
  642. // 显示对应的内容
  643. tabId = this.getAttribute('data-tab');
  644. document.getElementById(tabId).classList.add('active');
  645. if(tabId=='tab1'){
  646. function1();
  647. }else if(tabId=='tab2'){
  648. function2();
  649. }else if(tabId=='tab3'){
  650. function3();
  651. }else if(tabId=='tab4'){
  652. function4();
  653. }else if(tabId=='tab5'){
  654. function5();
  655. }
  656. });
  657. });
  658. const today = new Date();
  659. today.setHours(0, 0, 0, 0);
  660. const app = PetiteVue.createApp({
  661. snmpShow:false,
  662. showXtsjModal:false,
  663. productType:"",
  664. productId:"",
  665. productNumber:"",
  666. channelList1:[],
  667. ysszList:[],
  668. ysszData2:{},
  669. timeData:{},
  670. popMessage:'',
  671. dateTime:'',
  672. systemTime:'',
  673. wlszForm:{
  674. mode:'',
  675. ipaddr:'',
  676. mask:'',
  677. gateway:'',
  678. dns1:'',
  679. dns2:'',
  680. dhcp:'',
  681. type:''
  682. },
  683. wlszForm2:{
  684. mode:'',
  685. addr:'',
  686. baud:''
  687. },
  688. wlszForm3:{
  689. mode:'',
  690. publics:'',
  691. version:'',
  692. yhm:'',
  693. rzmm:'',
  694. trapmode:'',
  695. jmmm:'',
  696. trap_ip:'',
  697. },
  698. readonlyvalidate: false,
  699. showSaveModal: false,
  700. showDeleteModal: false,
  701. message: '',
  702. messageType: '',
  703. popType: '',
  704. popMessage:'',
  705. modes:[{"id":0,"name":"自动"},{"id":1,"name":"手动"}],
  706. modes2:[{"id":0,"name":"主机模式"},{"id":1,"name":"从机模式"}],
  707. SNMPs:[{"id":"SNMP V1","name":"SNMP V1"},{"id":"SNMP V2c","name":"SNMP V2c"},{"id":"SNMP V3","name":"SNMP V3"}],
  708. rzxys:[{"id":"MD5","name":"MD5"},{"id":"SHA","name":"SHA"},{"id":"SHA-224","name":"SHA-224"},{"id":"SHA-256","name":"SHA-256"},{"id":"SHA-384","name":"SHA-384"},{"id":"SHA-512","name":"SHA-512"}],
  709. jmxys:[{"id":"0","name":"无"},{"id":"DES","name":"DES"},{"id":"AES","name":"AES"}],
  710. async stxjClickClose(){
  711. this.showXtsjModal=false
  712. },
  713. async wkszQuery(){
  714. },
  715. async rsQuery(){
  716. },
  717. async submitForm(type){
  718. this.showSaveModal = true
  719. this.popMessage="确认要提交吗?";
  720. if(type=='wksz'){
  721. this.saveDataAll=this.wlszForm;
  722. this.popType='wksz';
  723. this.saveDataAll.len=241
  724. }else if(type=='rs'){
  725. this.saveDataAll=this.wlszForm2;
  726. this.saveDataAll.len=6;
  727. this.popType='rs';
  728. }else if(type=='snmp'){
  729. this.saveDataAll=this.wlszForm3;
  730. this.saveDataAll.len=45
  731. this.popType='snmp';
  732. }
  733. },
  734. async saveData12(){
  735. if(this.popType=='wksz'){
  736. network_settings(this.saveDataAll)
  737. }else if(this.popType=='rs'){
  738. modbus_settings(this.saveDataAll)
  739. }else if(this.popType=='snmp'){
  740. snmp_settings(this.saveDataAll)
  741. }else if(this.popType=='zkzg'){
  742. if( this.saveDataAll.type=='close'){
  743. all_close();
  744. }else if( this.saveDataAll.type=='open'){
  745. all_open();
  746. }
  747. }else if(this.popType=='yssz'){
  748. delay_update(this.saveDataAll.channel_power_infro)
  749. this.ysszClickClose2()
  750. }else if(this.popType=='hdlcz'){
  751. for(const ket in this.saveDataAll.channel_power_infros){
  752. power_reset(this.saveDataAll.channel_power_infros[ket])
  753. }
  754. this.hdlczClickClose()
  755. }else if(this.popType=='fzsz'){
  756. if(this.saveDataAll.list=='1'){
  757. for(const ket in this.saveDataAll.channel_power_infros){
  758. threshold_update(this.saveDataAll.channel_power_infros[ket])
  759. }
  760. }else{
  761. threshold_update(this.saveDataAll.channel_power_infro)
  762. }
  763. this.fzscClickClose2()
  764. }else if(this.popType=='tdkg'){
  765. if( this.saveDataAll.type=='close'){
  766. single_close({...j_data},{...channel_power_infro},this.saveDataAll.productChId);
  767. }else if( this.saveDataAll.type=='open'){
  768. single_open({...j_data},{...channel_power_infro},this.saveDataAll.productChId);
  769. }
  770. }else if(this.popType=='sjsz'){
  771. sys_settings(this.saveDataAll)
  772. this.showSaveModal = false
  773. this.showXtsjModal=false
  774. }
  775. this.showSaveModal=false
  776. this.saveDataAll={};
  777. this.popType='';
  778. // alert("操作成功")
  779. },
  780. handleChange(value){
  781. if(this.wlszForm3.version=='SNMP V3'){
  782. this.snmpShow=true;
  783. }else{
  784. this.snmpShow=false;
  785. this.wlszForm3.yhm='';
  786. this.wlszForm3.mode='';
  787. this.wlszForm3.rzmm='';
  788. this.wlszForm3.jmxy='';
  789. this.wlszForm3.jmmm='';
  790. this.wlszForm3.trapmode='' ;
  791. }
  792. },
  793. showSaveModal: false,
  794. showDeleteModal: false,
  795. message: '',
  796. messageType: '',
  797. // 消息和UI状态
  798. message: '',
  799. messages: [],
  800. // 状态
  801. showExternal:false,
  802. // 耗电量设置
  803. showFormModal:false,
  804. // 阈值设置
  805. showFzszModal:false,
  806. //告警
  807. showFzszModalgj:false,
  808. showFzszModal2:false,
  809. showysszModal:false,
  810. showysszModal2:false,
  811. formData:{productChName:null,productChId:null,channel_power_infro:null,productChIds:[]},
  812. powerThresholdList:[],
  813. fzscData:{
  814. productChIds:[]
  815. },
  816. items: [],
  817. newItem: '',
  818. loading: false,
  819. error: null,
  820. summary: {...initialFormData},
  821. channelList: [
  822. {
  823. productChName: '通道1',
  824. productPhOrder: 'A相',
  825. productChVoltage: '220V',
  826. productChCurrent: '10A',
  827. productChPower: '2.2kW',
  828. productChPowerFreq: '50Hz',
  829. productChConsumption: '15kWh',
  830. firingInterval: '5s',
  831. closeInterval: '3s',
  832. productChId: '3221',
  833. status: true
  834. },
  835. ],
  836. statusData: {
  837. temperatureStatus:1,
  838. temperature: '',
  839. humidity: '',
  840. waterLeak: '',
  841. waterLeakStatus: 1,
  842. smoke: '',
  843. smokeStatus: 1,
  844. alarm1: ''
  845. },
  846. productType:"",
  847. threeType:"1",
  848. productId:"",
  849. productNumber:"",
  850. channelList1:[],
  851. ysszList:[],
  852. totalFormList:[],
  853. his_alarmd:[],
  854. ysszData2:{},
  855. popMessage:'',
  856. popType:'',
  857. saveDataAll:null,
  858. // 计算属性
  859. get connectionStatus() {
  860. if (this.isConnected) return 'connected';
  861. if (this.isConnecting) return 'connecting';
  862. return 'disconnected';
  863. },
  864. get statusText() {
  865. if (this.isConnected) return '已连接到 WebSocket 服务器';
  866. if (this.isConnecting) return '正在连接...';
  867. return '未连接';
  868. },
  869. async toggleDeviceStatus(device) {
  870. var command="";
  871. const params={};
  872. params.productChId=device.productChId;
  873. // if(device.productChStatus=='1'){
  874. // command='channelclose';
  875. // this.popMessage="确认要关闭此通道吗?";
  876. // params.type="close";
  877. // }else{
  878. // command='channelopen';
  879. // this.popMessage="确认要打开此通道吗?";
  880. // params.type="open";
  881. // }
  882. if(device.productChStatus=='1'){
  883. single_close({...j_data},{...channel_power_infro},device.productChId);
  884. }else{
  885. single_open({...j_data},{...channel_power_infro},device.productChId);
  886. }
  887. // const result = await confirmAction({
  888. // title: message
  889. // });
  890. // this.showSaveModal = true
  891. // this.saveDataAll=params;
  892. // this.popType='tdkg';
  893. },
  894. /** 阈值设置按钮操作 */
  895. handleUpdate(row) {
  896. this.fzscData = JSON.parse(JSON.stringify(row));
  897. this.fzscData.list='';
  898. this.showFzszModal2 = true;
  899. // this.title = this.$t('pz');
  900. },
  901. getOptionName(id) {
  902. for(const key in this.channelList1){
  903. if(this.channelList1[key].productChId===id){
  904. return this.channelList1[key].productChName
  905. break
  906. }
  907. }
  908. ;
  909. },
  910. removeOption(id) {
  911. this.fzscData.productChIds = this.fzscData.productChIds.filter(optId => optId !== id);
  912. },
  913. toggleSelectAll() {
  914. if (this.fzscData.productChIds.length === Object.keys(this.channelList1).length ) {
  915. this.fzscData.productChIds = [];
  916. } else {
  917. for(const key in this.channelList1){
  918. this.fzscData.productChIds.push(this.channelList1[key].productChId)
  919. }
  920. // this.fzscData.productChIds = this.channelList1.map(option => option.productChId);
  921. }
  922. },
  923. getOptionName2(id) {
  924. for(const key in this.channelList1){
  925. if(this.channelList1[key].productChId===id){
  926. return this.channelList1[key].productChName
  927. break
  928. }
  929. }
  930. ;
  931. },
  932. removeOption2(id) {
  933. this.formData.productChIds = this.formData.productChIds.filter(optId => optId !== id);
  934. },
  935. toggleSelectAll2() {
  936. if (this.formData.productChIds.length === Object.keys(this.channelList1).length ) {
  937. this.formData.productChIds = [];
  938. } else {
  939. for(const key in this.channelList1){
  940. this.formData.productChIds.push(this.channelList1[key].productChId)
  941. }
  942. // this.fzscData.productChIds = this.channelList1.map(option => option.productChId);
  943. }
  944. },
  945. /** 阈值设置按钮操作 */
  946. handleUpdateList() {
  947. this.fzscData.list='1';
  948. this.fzscData.productChIds=[];
  949. this.fzscData.currentUpperAction='';
  950. this.fzscData.voltageUpperAction='';
  951. this.fzscData.voltageDownAction='';
  952. this.fzscData.powerUpperAction='';
  953. this.fzscData.alarmContentUpperAction='';
  954. this.showFzszModal2 = true;
  955. // this.title = this.$t('pz');
  956. },
  957. ysszhandleUpdate(row) {
  958. this.ysszData2 = JSON.parse(JSON.stringify(row));
  959. this.showysszModal2 = true;
  960. // this.title = this.$t('pz');
  961. },
  962. // 查询阈值设置列表
  963. async fzszData(){
  964. },
  965. // 查询延时设置列表
  966. async ysszData(){
  967. },
  968. hdlczClickClose(){
  969. this.showFormModal = false
  970. this.formData.channel_power_infro=null;
  971. },
  972. fzscClickClose(){
  973. this.showFzszModal = false;
  974. this.powerThresholdList=[];
  975. // this.formData.productChId=null;
  976. },
  977. fzscClickClosegj(){
  978. this.showFzszModalgj = false;
  979. },
  980. fzscClickClose2(){
  981. this.showFzszModal2 = false
  982. // this.formData.productChId=null;
  983. },
  984. ysszClickClose(){
  985. this.showysszModal = false;
  986. this.ysszList=[];
  987. },
  988. ysszClickClose2(){
  989. this.showysszModal2 = false;
  990. },
  991. hdlsz(){
  992. this.formData.productChIds=[]
  993. this.showFormModal = true
  994. },
  995. // 耗电量重置
  996. async hdlczClick(){
  997. const params={};
  998. let lists=[]
  999. console.log( this.formData.productChIds)
  1000. for( const id in this.formData.productChIds){
  1001. for( const key in this.powerThresholdList ){
  1002. if(this.formData.productChIds[id]== this.powerThresholdList[key].productChId){
  1003. lists.push(this.powerThresholdList[key].channel_power_infro);
  1004. break
  1005. }
  1006. }
  1007. }
  1008. params.channel_power_infros= lists;
  1009. // params.channel_power_infro=this.formData.channel_power_infro;
  1010. this.popMessage="确认要重置此通道吗?";
  1011. // const result = await confirmAction({
  1012. // title: message
  1013. // });
  1014. this.showSaveModal = true
  1015. this.saveDataAll=params;
  1016. this.popType='hdlcz';
  1017. },
  1018. // 阈值设置保存
  1019. async fzscClick(){
  1020. const params={};
  1021. params.list=this.fzscData.list;
  1022. if(this.fzscData.list=='1'){
  1023. if(this.fzscData.productChIds.length==0){
  1024. alert("请选择通道")
  1025. return
  1026. }
  1027. if(this.fzscData.alarmContentUpperAction=='' || this.fzscData.currentUpperAction=='' || this.fzscData.voltageDownAction=='' || this.fzscData.voltageUpperAction==''){
  1028. alert("存在未设置项,请重试")
  1029. return
  1030. }
  1031. if(this.fzscData.voltageUpperAction!=0 && this.fzscData.voltageDownAction !=0 && this.fzscData.voltageUpperAction* 10<=this.fzscData.voltageDownAction* 10){
  1032. alert("电压上限需要大于下限")
  1033. return
  1034. }
  1035. let lists=[]
  1036. for( const id in this.fzscData.productChIds){
  1037. for( const key in this.powerThresholdList ){
  1038. if(this.fzscData.productChIds[id]== this.powerThresholdList[key].productChId){
  1039. let param=this.powerThresholdList[key].channel_power_infro;
  1040. param.thr.w_upper=this.fzscData.alarmContentUpperAction* 1000;
  1041. param.thr.c_upper=this.fzscData.currentUpperAction* 10;
  1042. param.thr.p_upper=this.fzscData.powerUpperAction* 1000;
  1043. param.thr.v_lower=this.fzscData.voltageDownAction* 10;
  1044. param.thr.v_upper=this.fzscData.voltageUpperAction* 10;
  1045. lists.push(param);
  1046. break
  1047. }
  1048. }
  1049. }
  1050. params.channel_power_infros= lists;
  1051. }else{
  1052. params.channel_power_infro=this.fzscData.channel_power_infro;
  1053. params.channel_power_infro.thr.w_upper=this.fzscData.alarmContentUpperAction* 1000;
  1054. params.channel_power_infro.thr.c_upper=this.fzscData.currentUpperAction* 10;
  1055. params.channel_power_infro.thr.p_upper=this.fzscData.powerUpperAction* 1000;
  1056. params.channel_power_infro.thr.v_lower=this.fzscData.voltageDownAction* 10;
  1057. params.channel_power_infro.thr.v_upper=this.fzscData.voltageUpperAction* 10;
  1058. }
  1059. this.popMessage="确认要保存吗?";
  1060. // const result = await confirmAction({
  1061. // title: message
  1062. // });
  1063. this.showSaveModal = true
  1064. this.saveDataAll=params;
  1065. this.popType='fzsz';
  1066. },
  1067. // 延时设置保存
  1068. async ysszClick(){
  1069. const params={};
  1070. params.channel_power_infro=this.ysszData2.channel_power_infro;
  1071. params.channel_power_infro.info.start_delay=this.ysszData2.firingInterval;
  1072. params.channel_power_infro.info.stop_delay=this.ysszData2.closeInterval;
  1073. this.popMessage="确认要保存吗?";
  1074. this.showSaveModal = true
  1075. this.saveDataAll=params;
  1076. this.popType='yssz';
  1077. },
  1078. // 总开总关
  1079. async toggleAllDevices(status) {
  1080. const params={};
  1081. params.productId=this.productId;
  1082. params.type= "open"
  1083. this.popMessage="确认要开启设备下所有通道吗?";
  1084. if(status){
  1085. params.type= "open"
  1086. this.popMessage="确认要开启设备下所有通道吗?";
  1087. }else{
  1088. params.type= "close"
  1089. this.popMessage="确认要关闭设备下所有通道吗?";
  1090. }
  1091. // const result = await confirmAction({
  1092. // title: message
  1093. // });
  1094. this.showSaveModal = true;
  1095. this.saveDataAll=params;
  1096. this.popType='zkzg';
  1097. },
  1098. // 获取数据方法
  1099. async fetchData() {
  1100. function5();
  1101. this.queryTotalStatus5();
  1102. if (activePageIntervalId1 != null) {
  1103. clearInterval(activePageIntervalId1);
  1104. };
  1105. activePageIntervalId1 = setInterval(() => {
  1106. if(tabId=='tab1'){
  1107. function1();
  1108. this.queryTotalStatus();
  1109. if(this.wlszForm4.sys_time=='' || this.wlszForm4.sys_time==null){
  1110. this.queryTotalStatus5();
  1111. }
  1112. }else if(tabId=='tab2'){
  1113. this.queryTotalStatus2();
  1114. }else if(tabId=='tab3'){
  1115. this.queryTotalStatus3();
  1116. }else if(tabId=='tab4'){
  1117. this.queryTotalStatus4();
  1118. }else if(tabId=='tab5'){
  1119. this.queryTotalStatus5();
  1120. var js={};
  1121. on_ws_msg(js);
  1122. }
  1123. }, 100);
  1124. },
  1125. // 总体监控赋值
  1126. async queryTotalStatus(){
  1127. this.productType={... productTypeData}.productType;
  1128. if( this.productType=='1'){
  1129. this.showExternal=true;
  1130. this.totalFormList= {... initialTotalFormList}
  1131. if(this.threeType=='1'){
  1132. this.summary= this.totalFormList[0];
  1133. }else if(this.threeType=='2'){
  1134. this.summary= this.totalFormList[1];
  1135. }else if(this.threeType=='3'){
  1136. this.summary= this.totalFormList[2];
  1137. }
  1138. }else{
  1139. this.summary={... initialFormData};
  1140. }
  1141. this.channelList={...channelAllList};
  1142. this.channelList1 = {...channelAllList1};
  1143. this.powerThresholdList = {...initialYzFormList};
  1144. this.ysszList = {...channelAllList1};
  1145. if({...his_alarm}!=null){
  1146. this.statusData.alarm1 = Object.keys({...his_alarm}).length;
  1147. var alarmds={...his_alarm};
  1148. this.his_alarmd=[]
  1149. for(var i=0;i<Object.keys({...his_alarm}).length ;i++){
  1150. var open=alarmds[i];
  1151. open.number=i+1;
  1152. open.date= (open.date.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1153. open.waning_context= (open.waning_context.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1154. if(open.type==0){
  1155. open.type='电量信息报警'
  1156. }else if(open.type==1){
  1157. open.type='传感器报警'
  1158. }
  1159. this.his_alarmd.push(open)
  1160. }
  1161. }
  1162. if({...sensorc_list}!=null && Object.keys({...sensorc_list}).length>0){
  1163. let sencorList={...sensorc_list};
  1164. for(const key in sencorList){
  1165. if(sencorList[key].info.type==0){ // 温湿度
  1166. if(sencorList[key].info.status==1){ // 在线
  1167. try{
  1168. let sensor_val =sencorList[key].sensor_val
  1169. this.statusData.temperature=sensor_val[1].val.toFixed(2)
  1170. if(sensor_val[1].s_alarm & 0x1){ // 上限
  1171. this.statusData.tempcolorStyle='color: red;font-weight: bold;'
  1172. }else if(sensor_val[1].s_alarm & 0x2){ // 下限
  1173. this.statusData.tempcolorStyle='color: #ff00ff;font-weight: bold;'
  1174. }else{
  1175. this.statusData.tempcolorStyle=''
  1176. }
  1177. this.statusData.humidity=sensor_val[0].val.toFixed(2)
  1178. if(sensor_val[0].s_alarm & 0x1){ // 上限
  1179. this.statusData.humcolorStylesx='color: red;font-weight: bold;'
  1180. }else if(sensor_val[0].s_alarm & 0x2){ // 下限
  1181. this.statusData.humcolorStylesx='color: #ff00ff;font-weight: bold;'
  1182. }else{
  1183. this.statusData.humcolorStylesx=''
  1184. }
  1185. }catch (e) {
  1186. console.log("温湿度传感器赋值失败")
  1187. }
  1188. }else{
  1189. this.statusData.temperatureStatus=0;
  1190. this.statusData.temperature='离线'
  1191. this.statusData.humidity='离线'
  1192. }
  1193. }else if(sencorList[key].info.type==1){ // 烟雾
  1194. if(sencorList[key].info.status==1) { // 在线
  1195. try{
  1196. let sensor_val =sencorList[key].sensor_val
  1197. this.statusData.waterLeak=sensor_val[0].s_alarm.act
  1198. }catch (e) {
  1199. console.log("烟雾传感器赋值失败")
  1200. }
  1201. }else {
  1202. this.statusData.waterLeakStatus=0;
  1203. this.statusData.waterLeak='离线'
  1204. }
  1205. }else if(sencorList[key].info.type==4){ // C02
  1206. if(sencorList[key].info.status==1) {
  1207. // 在线
  1208. try{
  1209. let sensor_val =sencorList[key].sensor_val
  1210. this.statusData.smoke=sensor_val[0].val.toFixed(2)
  1211. if(sensor_val[0] & 0x1 ){ // 上限
  1212. this.statusData.smokecolorStylesx='color: red;font-weight: bold;'
  1213. }else if(sensor_val[0] & 0x2){ // 下限
  1214. this.statusData.smokecolorStylesx='color: #ff00ff;font-weight: bold;'
  1215. }else{
  1216. this.statusData.smokecolorStylesx=''
  1217. }
  1218. }catch (e) {
  1219. console.log("CO2传感器赋值失败")
  1220. }
  1221. }else{
  1222. this.statusData.smokeStatus=0;
  1223. this.statusData.smoke='离线'
  1224. }
  1225. }
  1226. }
  1227. }
  1228. },
  1229. //网络设置
  1230. wlszForm_vack:null,
  1231. async queryTotalStatus2(){
  1232. if(this.wlszForm_vack==null && {...network_data}!=null && Object.keys({...network_data}).length>0){
  1233. this.wlszForm = {...network_data};
  1234. this.wlszForm.ipaddr= (this.wlszForm.ipaddr.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1235. this.wlszForm.mask= (this.wlszForm.mask.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1236. this.wlszForm.gateway= (this.wlszForm.gateway.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1237. this.wlszForm.dns1= (this.wlszForm.dns1.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1238. this.wlszForm.dns2= (this.wlszForm.dns2.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1239. this.wlszForm_vack = {...network_data};
  1240. }
  1241. },
  1242. //485
  1243. wlszForm2_vack:null,
  1244. async queryTotalStatus3(){
  1245. if( this.wlszForm2_vack==null && {...cas_data}!=null && Object.keys({...cas_data}).length>0){
  1246. this.wlszForm2 = {...cas_data};
  1247. this.wlszForm2_vack = {...cas_data};
  1248. }
  1249. },
  1250. // snmp
  1251. wlszForm3_back:null,
  1252. async queryTotalStatus4(){
  1253. if(this.wlszForm3_back==null){
  1254. if( {...snmp_data}!=null && Object.keys({...snmp_data}).length>0){
  1255. this.wlszForm3 = {...snmp_data};
  1256. this.wlszForm3.publics= (this.wlszForm3.publics.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1257. this.wlszForm3.trap_ip= (this.wlszForm3.trap_ip.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1258. this.wlszForm3.mode= this.wlszForm3.mode ;
  1259. this.wlszForm3.version= this.wlszForm3.version ;
  1260. this.wlszForm3.trapmode= this.wlszForm3.trapmode ;
  1261. this.wlszForm3_back = {...snmp_data};
  1262. // if(this.wlszForm3!=null && this.wlszForm3.version=='SNMP V3'){
  1263. // this.snmpShow=true;
  1264. // }else{
  1265. // this.snmpShow=false;
  1266. // // this.wlszForm3={}
  1267. // }
  1268. }
  1269. }
  1270. },
  1271. // 设备信息
  1272. wlszForm4_back:null,
  1273. async queryTotalStatus5(){
  1274. if(this.wlszForm4_back==null && {...lang_data}!=null && Object.keys({...lang_data}).length>0){
  1275. this.wlszForm4 = {...lang_data};
  1276. this.wlszForm4_back = {...lang_data};
  1277. this.wlszForm4.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1278. this.wlszForm5.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1279. this.wlszForm4.sys_time= (this.wlszForm4.sys_time.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1280. this.systemTime=new Date(this.wlszForm4.sys_time);
  1281. // 计时器为空,操作
  1282. setInterval(() => {
  1283. var date= this.systemTime ;
  1284. var year = date.getFullYear();
  1285. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  1286. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  1287. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  1288. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  1289. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  1290. this.dateTime= year + '-' + month + '-' + day + ' ' + hours+ ':' + minutes + ':' + seconds;
  1291. this.systemTime=new Date(date.getTime()+1000);
  1292. }, 1000);
  1293. }
  1294. },
  1295. // 三相切换赋值
  1296. async toggleThreeDevices(type){
  1297. this.threeType=type;
  1298. if(type=='1'){
  1299. this.summary= this.totalFormList[0];
  1300. }else if(type=='2'){
  1301. this.summary= this.totalFormList[1];
  1302. }else if(type=='3'){
  1303. this.summary= this.totalFormList[2];
  1304. }
  1305. },
  1306. // 传感器查询
  1307. async sensorStatusMonitoring(){
  1308. const params={};
  1309. params.type="listMapQuery";
  1310. params.productId=this.productId;
  1311. },
  1312. async channelStatusMonitoring(){
  1313. const params={};
  1314. params.type="listQuery";
  1315. params.productId=this.productId;
  1316. },
  1317. showXtsjModal:false,
  1318. showScfjModal:false,
  1319. popMessage:'',
  1320. wlszForm4:{
  1321. "lang": "",
  1322. "tzone": "",
  1323. "route": "",
  1324. "ver": "",
  1325. "sys_time":"",
  1326. "len": 52
  1327. },
  1328. wlszForm5:{
  1329. "lang": "",
  1330. "tzone": "",
  1331. "route": "",
  1332. "ver": "",
  1333. "sys_time":"",
  1334. "len": 52
  1335. },
  1336. showSaveModal: false,
  1337. popType: '',
  1338. popMessage:'',
  1339. sqs:[{"id":8,"name":"东8区"},{"id":-8,"name":"西8区"},{"id":0,"name":"任意时区"}],
  1340. currentDate: new Date(),
  1341. selectedDate: null,
  1342. selectedHour: 12,
  1343. selectedMinute: 0,
  1344. selectedSecond: 0,
  1345. isPickerVisible: false,
  1346. files: [],
  1347. isDragover: false,
  1348. isUploading: false,
  1349. nextFileId: 1,
  1350. years:[],
  1351. months:[],
  1352. dayAll:[],
  1353. hours:[],
  1354. minutes:[],
  1355. dateForm:{},
  1356. // 日期新方法
  1357. get daysNew() {
  1358. const currentYear = new Date().getFullYear();
  1359. for (let i = currentYear - 20; i <= currentYear + 5; i++) {
  1360. this.years.push({
  1361. id:i,
  1362. name:i+'年'
  1363. })
  1364. };
  1365. // 初始化月份
  1366. for (let i = 1; i <= 12; i++) {
  1367. this.months.push({
  1368. id:i,
  1369. name:i+'月'
  1370. })
  1371. }
  1372. this.updateDays();
  1373. for (let i = 0; i < 24; i++) {
  1374. this.hours.push({
  1375. id:i,
  1376. name:i
  1377. })
  1378. }
  1379. // 初始化分钟
  1380. for (let i = 0; i < 60; i++) {
  1381. this.minutes.push({
  1382. id:i,
  1383. name:i
  1384. })
  1385. }
  1386. },
  1387. updateDays(){
  1388. if(this.dateForm.year==null || this.dateForm.month==null){
  1389. return
  1390. }
  1391. const year = parseInt(this.dateForm.year);
  1392. const month = parseInt(this.dateForm.month);
  1393. // 如果年月未选择,默认显示31天
  1394. let daysInMonth = 1;
  1395. if (year && month) {
  1396. // 计算所选年月有多少天
  1397. daysInMonth = new Date(year, month, 0).getDate();
  1398. }
  1399. this.dayAll=[];
  1400. // 添加日期选项
  1401. for (let i = 1; i <= daysInMonth; i++) {
  1402. this.dayAll.push({
  1403. id:i,
  1404. name:i
  1405. })
  1406. }
  1407. this.dateForm.day=null;
  1408. },
  1409. // 日期选择方法
  1410. showPicker() {
  1411. // this.dateForm.year='';
  1412. // this.dateForm.month='';
  1413. // this.dateForm.day='';
  1414. // this.dateForm.hour='';
  1415. // this.dateForm.minute='';
  1416. // this.dateForm.second='';
  1417. this.isPickerVisible = true;
  1418. // 如果没有选择日期,默认使用今天
  1419. if (!this.selectedDate) {
  1420. this.selectedDate = new Date();
  1421. }
  1422. var date=new Date(this.wlszForm4.sys_time);
  1423. this.dateForm.year = date.getFullYear();
  1424. this.dateForm.month = date.getMonth() + 1 < 10 ? (date.getMonth() + 1) : date.getMonth() + 1;
  1425. if( this.dateForm.month !=null){
  1426. this.updateDays();
  1427. }
  1428. this.dateForm.day = date.getDate() < 10 ? date.getDate() : date.getDate();
  1429. this.dateForm.hour = date.getHours() < 10 ? date.getHours() : date.getHours();
  1430. this.dateForm.minute= date.getMinutes() < 10 ? date.getMinutes() : date.getMinutes();
  1431. this.dateForm.second= date.getSeconds() < 10 ? date.getSeconds() : date.getSeconds();
  1432. // 设置当前时间为选择的时间
  1433. const now = new Date();
  1434. this.selectedHour = now.getHours();
  1435. this.selectedMinute = now.getMinutes();
  1436. this.selectedSecond = now.getSeconds();
  1437. },
  1438. clearSelection() {
  1439. this.selectedDate = null;
  1440. this.selectedHour = 0;
  1441. this.selectedMinute = 0;
  1442. this.selectedSecond = 0;
  1443. },
  1444. confirmSelection() {
  1445. var month=this.dateForm.month<10?'0'+this.dateForm.month:this.dateForm.month
  1446. var day=this.dateForm.day<10?'0'+this.dateForm.day:this.dateForm.day
  1447. var hour=this.dateForm.hour<10?'0'+this.dateForm.hour:this.dateForm.hour
  1448. var minute=this.dateForm.minute<10?'0'+this.dateForm.minute:this.dateForm.minute
  1449. var second=this.dateForm.second<10?'0'+this.dateForm.second:this.dateForm.second
  1450. this.wlszForm4.sys_time=this.dateForm.year+'-'+month+'-'+day+' '+ hour+':'+ minute+':'+ second;
  1451. this.isPickerVisible = false;
  1452. },
  1453. async sbxxQuery(){
  1454. // this.wlszForm4= await this.data.data
  1455. },
  1456. async stxjClick(){
  1457. this.showSaveModal = true
  1458. this.popMessage="确认要提交吗?";
  1459. this.wlszForm4.type="NtpSave";
  1460. this.saveDataAll=this.wlszForm4;
  1461. this.popType='sjsz';
  1462. },
  1463. showXtsjModalClick(){
  1464. this.clearSelection();
  1465. this.showXtsjModal=true;
  1466. },
  1467. // 上传附件方法
  1468. showFjscModalClick(){
  1469. this.showScfjModal=true;
  1470. this.wlszForm5=JSON.parse(JSON.stringify( this.wlszForm4));
  1471. },
  1472. selectFiles() {
  1473. this.$refs.fileInput.click();
  1474. },
  1475. handleFileSelect(e) {
  1476. const selectedFiles = Array.from(e.target.files);
  1477. this.files = [];
  1478. this.addFiles(selectedFiles);
  1479. // 清空input,允许重复选择相同文件
  1480. e.target.value = '';
  1481. },
  1482. handleDrop(e) {
  1483. this.isDragover = false;
  1484. const droppedFiles = Array.from(e.dataTransfer.files);
  1485. this.addFiles(droppedFiles);
  1486. },
  1487. addFiles(fileList) {
  1488. fileList.forEach(file => {
  1489. this.files.push({
  1490. id: this.nextFileId++,
  1491. file: file,
  1492. name: file.name,
  1493. size: file.size,
  1494. type: file.type,
  1495. status: 'pending', // pending, uploading, success, error
  1496. progress: 0
  1497. });
  1498. });
  1499. },
  1500. clearFiles() {
  1501. this.files = [];
  1502. this.showScfjModal=false;
  1503. },
  1504. async uploadFiles() {
  1505. if (this.files.length === 0) return;
  1506. if(this.wlszForm5.ver=='' || this.wlszForm5.ver==null){
  1507. return
  1508. }
  1509. this.isUploading = true;
  1510. for (const fileObj of this.files) {
  1511. if (fileObj.status === 'success') continue;
  1512. sys_up_settings(this.wlszForm5.ver,fileObj.file)
  1513. this.clearFiles()
  1514. }
  1515. this.isUploading = false;
  1516. },
  1517. // 初始化事件监听
  1518. initEventListeners() {
  1519. document.addEventListener('vue-command', (event) => {
  1520. if (event.detail.type === 'process') {
  1521. this.processData(event.detail.source);
  1522. } else if (event.detail.type === 'update') {
  1523. this.updateData(event.detail.data);
  1524. }
  1525. });
  1526. }
  1527. }).mount();
  1528. // 将方法暴露到全局
  1529. window.externalIncrement = () => {
  1530. app.externalIncrement();
  1531. };
  1532. });
  1533. </script>
  1534. </body>
  1535. </html>