index.html 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  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>总功率(W)</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. }
  1121. }, 1000);
  1122. },
  1123. // 总体监控赋值
  1124. async queryTotalStatus(){
  1125. this.productType={... productTypeData}.productType;
  1126. if( this.productType=='1'){
  1127. this.showExternal=true;
  1128. this.totalFormList= {... initialTotalFormList}
  1129. if(this.threeType=='1'){
  1130. this.summary= this.totalFormList[0];
  1131. }else if(this.threeType=='2'){
  1132. this.summary= this.totalFormList[1];
  1133. }else if(this.threeType=='3'){
  1134. this.summary= this.totalFormList[2];
  1135. }
  1136. }else{
  1137. this.summary={... initialFormData};
  1138. }
  1139. this.channelList={...channelAllList};
  1140. this.channelList1 = {...channelAllList1};
  1141. this.powerThresholdList = {...initialYzFormList};
  1142. this.ysszList = {...channelAllList1};
  1143. if({...his_alarm}!=null){
  1144. this.statusData.alarm1 = Object.keys({...his_alarm}).length;
  1145. var alarmds={...his_alarm};
  1146. this.his_alarmd=[]
  1147. for(var i=0;i<Object.keys({...his_alarm}).length ;i++){
  1148. var open=alarmds[i];
  1149. open.number=i+1;
  1150. open.date= (open.date.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1151. open.waning_context= (open.waning_context.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1152. if(open.type==0){
  1153. open.type='电量信息报警'
  1154. }else if(open.type==1){
  1155. open.type='传感器报警'
  1156. }
  1157. this.his_alarmd.push(open)
  1158. }
  1159. }
  1160. if({...sensorc_list}!=null && Object.keys({...sensorc_list}).length>0){
  1161. let sencorList={...sensorc_list};
  1162. for(const key in sencorList){
  1163. if(sencorList[key].info.type==0){ // 温湿度
  1164. if(sencorList[key].info.status==1){ // 在线
  1165. try{
  1166. let sensor_val =sencorList[key].sensor_val
  1167. this.statusData.temperature=sensor_val[1].val.toFixed(2)
  1168. if(sensor_val[1].s_alarm & 0x1){ // 上限
  1169. this.statusData.tempcolorStyle='color: red;font-weight: bold;'
  1170. }else if(sensor_val[1].s_alarm & 0x2){ // 下限
  1171. this.statusData.tempcolorStyle='color: #ff00ff;font-weight: bold;'
  1172. }else{
  1173. this.statusData.tempcolorStyle=''
  1174. }
  1175. this.statusData.humidity=sensor_val[0].val.toFixed(2)
  1176. if(sensor_val[0].s_alarm & 0x1){ // 上限
  1177. this.statusData.humcolorStylesx='color: red;font-weight: bold;'
  1178. }else if(sensor_val[0].s_alarm & 0x2){ // 下限
  1179. this.statusData.humcolorStylesx='color: #ff00ff;font-weight: bold;'
  1180. }else{
  1181. this.statusData.humcolorStylesx=''
  1182. }
  1183. }catch (e) {
  1184. console.log("温湿度传感器赋值失败")
  1185. }
  1186. }else{
  1187. this.statusData.temperatureStatus=0;
  1188. this.statusData.temperature='离线'
  1189. this.statusData.humidity='离线'
  1190. }
  1191. }else if(sencorList[key].info.type==1){ // 烟雾
  1192. if(sencorList[key].info.status==1) { // 在线
  1193. try{
  1194. let sensor_val =sencorList[key].sensor_val
  1195. this.statusData.waterLeak=sensor_val[0].s_alarm.act
  1196. }catch (e) {
  1197. console.log("烟雾传感器赋值失败")
  1198. }
  1199. }else {
  1200. this.statusData.waterLeakStatus=0;
  1201. this.statusData.waterLeak='离线'
  1202. }
  1203. }else if(sencorList[key].info.type==4){ // C02
  1204. if(sencorList[key].info.status==1) {
  1205. // 在线
  1206. try{
  1207. let sensor_val =sencorList[key].sensor_val
  1208. this.statusData.smoke=sensor_val[0].val.toFixed(2)
  1209. if(sensor_val[0] & 0x1 ){ // 上限
  1210. this.statusData.smokecolorStylesx='color: red;font-weight: bold;'
  1211. }else if(sensor_val[0] & 0x2){ // 下限
  1212. this.statusData.smokecolorStylesx='color: #ff00ff;font-weight: bold;'
  1213. }else{
  1214. this.statusData.smokecolorStylesx=''
  1215. }
  1216. }catch (e) {
  1217. console.log("CO2传感器赋值失败")
  1218. }
  1219. }else{
  1220. this.statusData.smokeStatus=0;
  1221. this.statusData.smoke='离线'
  1222. }
  1223. }
  1224. }
  1225. }
  1226. },
  1227. //网络设置
  1228. wlszForm_vack:null,
  1229. async queryTotalStatus2(){
  1230. if(this.wlszForm_vack==null && {...network_data}!=null && Object.keys({...network_data}).length>0){
  1231. this.wlszForm = {...network_data};
  1232. this.wlszForm.ipaddr= (this.wlszForm.ipaddr.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1233. this.wlszForm.mask= (this.wlszForm.mask.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1234. this.wlszForm.gateway= (this.wlszForm.gateway.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1235. this.wlszForm.dns1= (this.wlszForm.dns1.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1236. this.wlszForm.dns2= (this.wlszForm.dns2.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1237. this.wlszForm_vack = {...network_data};
  1238. }
  1239. },
  1240. //485
  1241. wlszForm2_vack:null,
  1242. async queryTotalStatus3(){
  1243. if( this.wlszForm2_vack==null && {...cas_data}!=null && Object.keys({...cas_data}).length>0){
  1244. this.wlszForm2 = {...cas_data};
  1245. this.wlszForm2_vack = {...cas_data};
  1246. }
  1247. },
  1248. // snmp
  1249. wlszForm3_back:null,
  1250. async queryTotalStatus4(){
  1251. if(this.wlszForm3_back==null){
  1252. if( {...snmp_data}!=null && Object.keys({...snmp_data}).length>0){
  1253. this.wlszForm3 = {...snmp_data};
  1254. this.wlszForm3.publics= (this.wlszForm3.publics.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1255. this.wlszForm3.trap_ip= (this.wlszForm3.trap_ip.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1256. this.wlszForm3.mode= this.wlszForm3.mode ;
  1257. this.wlszForm3.version= this.wlszForm3.version ;
  1258. this.wlszForm3.trapmode= this.wlszForm3.trapmode ;
  1259. this.wlszForm3_back = {...snmp_data};
  1260. // if(this.wlszForm3!=null && this.wlszForm3.version=='SNMP V3'){
  1261. // this.snmpShow=true;
  1262. // }else{
  1263. // this.snmpShow=false;
  1264. // // this.wlszForm3={}
  1265. // }
  1266. }
  1267. }
  1268. },
  1269. // 设备信息
  1270. wlszForm4_back:null,
  1271. async queryTotalStatus5(){
  1272. if(this.wlszForm4_back==null && {...lang_data}!=null && Object.keys({...lang_data}).length>0){
  1273. this.wlszForm4 = {...lang_data};
  1274. this.wlszForm4_back = {...lang_data};
  1275. this.wlszForm4.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1276. this.wlszForm5.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1277. this.wlszForm4.sys_time= (this.wlszForm4.sys_time.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1278. this.systemTime=new Date(this.wlszForm4.sys_time);
  1279. // 计时器为空,操作
  1280. setInterval(() => {
  1281. var date= this.systemTime ;
  1282. var year = date.getFullYear();
  1283. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  1284. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  1285. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  1286. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  1287. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  1288. this.dateTime= year + '-' + month + '-' + day + ' ' + hours+ ':' + minutes + ':' + seconds;
  1289. this.systemTime=new Date(date.getTime()+1000);
  1290. }, 1000);
  1291. }
  1292. },
  1293. // 三相切换赋值
  1294. async toggleThreeDevices(type){
  1295. this.threeType=type;
  1296. if(type=='1'){
  1297. this.summary= this.totalFormList[0];
  1298. }else if(type=='2'){
  1299. this.summary= this.totalFormList[1];
  1300. }else if(type=='3'){
  1301. this.summary= this.totalFormList[2];
  1302. }
  1303. },
  1304. // 传感器查询
  1305. async sensorStatusMonitoring(){
  1306. const params={};
  1307. params.type="listMapQuery";
  1308. params.productId=this.productId;
  1309. },
  1310. async channelStatusMonitoring(){
  1311. const params={};
  1312. params.type="listQuery";
  1313. params.productId=this.productId;
  1314. },
  1315. showXtsjModal:false,
  1316. showScfjModal:false,
  1317. popMessage:'',
  1318. wlszForm4:{
  1319. "lang": "",
  1320. "tzone": "",
  1321. "route": "",
  1322. "ver": "",
  1323. "sys_time":"",
  1324. "len": 52
  1325. },
  1326. wlszForm5:{
  1327. "lang": "",
  1328. "tzone": "",
  1329. "route": "",
  1330. "ver": "",
  1331. "sys_time":"",
  1332. "len": 52
  1333. },
  1334. showSaveModal: false,
  1335. popType: '',
  1336. popMessage:'',
  1337. sqs:[{"id":8,"name":"东8区"},{"id":-8,"name":"西8区"},{"id":0,"name":"任意时区"}],
  1338. currentDate: new Date(),
  1339. selectedDate: null,
  1340. selectedHour: 12,
  1341. selectedMinute: 0,
  1342. selectedSecond: 0,
  1343. isPickerVisible: false,
  1344. files: [],
  1345. isDragover: false,
  1346. isUploading: false,
  1347. nextFileId: 1,
  1348. years:[],
  1349. months:[],
  1350. dayAll:[],
  1351. hours:[],
  1352. minutes:[],
  1353. dateForm:{},
  1354. // 日期新方法
  1355. get daysNew() {
  1356. const currentYear = new Date().getFullYear();
  1357. for (let i = currentYear - 20; i <= currentYear + 5; i++) {
  1358. this.years.push({
  1359. id:i,
  1360. name:i+'年'
  1361. })
  1362. };
  1363. // 初始化月份
  1364. for (let i = 1; i <= 12; i++) {
  1365. this.months.push({
  1366. id:i,
  1367. name:i+'月'
  1368. })
  1369. }
  1370. this.updateDays();
  1371. for (let i = 0; i < 24; i++) {
  1372. this.hours.push({
  1373. id:i,
  1374. name:i
  1375. })
  1376. }
  1377. // 初始化分钟
  1378. for (let i = 0; i < 60; i++) {
  1379. this.minutes.push({
  1380. id:i,
  1381. name:i
  1382. })
  1383. }
  1384. },
  1385. updateDays(){
  1386. if(this.dateForm.year==null || this.dateForm.month==null){
  1387. return
  1388. }
  1389. const year = parseInt(this.dateForm.year);
  1390. const month = parseInt(this.dateForm.month);
  1391. // 如果年月未选择,默认显示31天
  1392. let daysInMonth = 1;
  1393. if (year && month) {
  1394. // 计算所选年月有多少天
  1395. daysInMonth = new Date(year, month, 0).getDate();
  1396. }
  1397. this.dayAll=[];
  1398. // 添加日期选项
  1399. for (let i = 1; i <= daysInMonth; i++) {
  1400. this.dayAll.push({
  1401. id:i,
  1402. name:i
  1403. })
  1404. }
  1405. this.dateForm.day=null;
  1406. },
  1407. // 日期选择方法
  1408. showPicker() {
  1409. // this.dateForm.year='';
  1410. // this.dateForm.month='';
  1411. // this.dateForm.day='';
  1412. // this.dateForm.hour='';
  1413. // this.dateForm.minute='';
  1414. // this.dateForm.second='';
  1415. this.isPickerVisible = true;
  1416. // 如果没有选择日期,默认使用今天
  1417. if (!this.selectedDate) {
  1418. this.selectedDate = new Date();
  1419. }
  1420. var date=new Date(this.wlszForm4.sys_time);
  1421. this.dateForm.year = date.getFullYear();
  1422. this.dateForm.month = date.getMonth() + 1 < 10 ? (date.getMonth() + 1) : date.getMonth() + 1;
  1423. if( this.dateForm.month !=null){
  1424. this.updateDays();
  1425. }
  1426. this.dateForm.day = date.getDate() < 10 ? date.getDate() : date.getDate();
  1427. this.dateForm.hour = date.getHours() < 10 ? date.getHours() : date.getHours();
  1428. this.dateForm.minute= date.getMinutes() < 10 ? date.getMinutes() : date.getMinutes();
  1429. this.dateForm.second= date.getSeconds() < 10 ? date.getSeconds() : date.getSeconds();
  1430. // 设置当前时间为选择的时间
  1431. const now = new Date();
  1432. this.selectedHour = now.getHours();
  1433. this.selectedMinute = now.getMinutes();
  1434. this.selectedSecond = now.getSeconds();
  1435. },
  1436. clearSelection() {
  1437. this.selectedDate = null;
  1438. this.selectedHour = 0;
  1439. this.selectedMinute = 0;
  1440. this.selectedSecond = 0;
  1441. },
  1442. confirmSelection() {
  1443. var month=this.dateForm.month<10?'0'+this.dateForm.month:this.dateForm.month
  1444. var day=this.dateForm.day<10?'0'+this.dateForm.day:this.dateForm.day
  1445. var hour=this.dateForm.hour<10?'0'+this.dateForm.hour:this.dateForm.hour
  1446. var minute=this.dateForm.minute<10?'0'+this.dateForm.minute:this.dateForm.minute
  1447. var second=this.dateForm.second<10?'0'+this.dateForm.second:this.dateForm.second
  1448. this.wlszForm4.sys_time=this.dateForm.year+'-'+month+'-'+day+' '+ hour+':'+ minute+':'+ second;
  1449. this.isPickerVisible = false;
  1450. },
  1451. async sbxxQuery(){
  1452. // this.wlszForm4= await this.data.data
  1453. },
  1454. async stxjClick(){
  1455. this.showSaveModal = true
  1456. this.popMessage="确认要提交吗?";
  1457. this.wlszForm4.type="NtpSave";
  1458. this.saveDataAll=this.wlszForm4;
  1459. this.popType='sjsz';
  1460. },
  1461. showXtsjModalClick(){
  1462. this.clearSelection();
  1463. this.showXtsjModal=true;
  1464. },
  1465. // 上传附件方法
  1466. showFjscModalClick(){
  1467. this.showScfjModal=true;
  1468. this.wlszForm5=JSON.parse(JSON.stringify( this.wlszForm4));
  1469. },
  1470. selectFiles() {
  1471. this.$refs.fileInput.click();
  1472. },
  1473. handleFileSelect(e) {
  1474. const selectedFiles = Array.from(e.target.files);
  1475. this.files = [];
  1476. this.addFiles(selectedFiles);
  1477. // 清空input,允许重复选择相同文件
  1478. e.target.value = '';
  1479. },
  1480. handleDrop(e) {
  1481. this.isDragover = false;
  1482. const droppedFiles = Array.from(e.dataTransfer.files);
  1483. this.addFiles(droppedFiles);
  1484. },
  1485. addFiles(fileList) {
  1486. fileList.forEach(file => {
  1487. this.files.push({
  1488. id: this.nextFileId++,
  1489. file: file,
  1490. name: file.name,
  1491. size: file.size,
  1492. type: file.type,
  1493. status: 'pending', // pending, uploading, success, error
  1494. progress: 0
  1495. });
  1496. });
  1497. },
  1498. clearFiles() {
  1499. this.files = [];
  1500. this.showScfjModal=false;
  1501. },
  1502. async uploadFiles() {
  1503. if (this.files.length === 0) return;
  1504. if(this.wlszForm5.ver=='' || this.wlszForm5.ver==null){
  1505. return
  1506. }
  1507. this.isUploading = true;
  1508. for (const fileObj of this.files) {
  1509. if (fileObj.status === 'success') continue;
  1510. sys_up_settings(this.wlszForm5.ver,fileObj.file)
  1511. this.clearFiles()
  1512. }
  1513. this.isUploading = false;
  1514. },
  1515. // 初始化事件监听
  1516. initEventListeners() {
  1517. document.addEventListener('vue-command', (event) => {
  1518. if (event.detail.type === 'process') {
  1519. this.processData(event.detail.source);
  1520. } else if (event.detail.type === 'update') {
  1521. this.updateData(event.detail.data);
  1522. }
  1523. });
  1524. }
  1525. }).mount();
  1526. // 将方法暴露到全局
  1527. window.externalIncrement = () => {
  1528. app.externalIncrement();
  1529. };
  1530. });
  1531. </script>
  1532. </body>
  1533. </html>