index.html 56 KB

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