index.html 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453
  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" style="padding: 0 0 0 15px;">
  37. <button v-show="showExternal" :class="{spanALL:isSpanALL}" @click="toggleThreeDevices(4)" class="btn btn-energy">总</button>
  38. <button v-show="showExternal" :class="{spana:isSpana}" @click="toggleThreeDevices(1)" class="btn btn-energy">L1</button>
  39. <button v-show="showExternal" :class="{spanb:isSpanb}" @click="toggleThreeDevices(2)" class="btn btn-threshold">L2</button>
  40. <button v-show="showExternal" :class="{spanc:isSpanc}" @click="toggleThreeDevices(3)" class="btn btn-delay">L3</button>
  41. </div>
  42. <div class="button-container">
  43. <div class="left-buttons">
  44. <button @click="showFzszModal = true;" class="btn btn-threshold">阈值设置</button>
  45. <button @click="showysszModal=true" class="btn btn-delay">延时设置</button>
  46. <button @click=" hdlsz()" class="btn btn-energy">耗电量重置</button>
  47. </div>
  48. <div class="right-buttons">
  49. <button @click="toggleAllDevices(true)" class=" btn btn-energy">总开</button>
  50. <button @click="toggleAllDevices(false)" class="btn btn-close">总关</button>
  51. </div>
  52. </div>
  53. <table class="summary-table">
  54. <thead>
  55. <tr>
  56. <th>{{ summary.threeType }}总电压(V)</th>
  57. <th>{{ summary.threeType }}总电流(A)</th>
  58. <th>{{ summary.threeType }}总功率(KW)</th>
  59. <!--<th>总频率(HZ)</th>-->
  60. <th>{{ summary.threeType }}总耗电量(Kwh)</th>
  61. </tr>
  62. </thead>
  63. <tbody style="height: 50px;">
  64. <tr>
  65. <td>{{ summary.totalVoltage }}</td>
  66. <td>{{ summary.totalCurrent }}</td>
  67. <td >{{ summary.totalPower }}</td>
  68. <!--<td >{{ summary.totalFrequency }}</td>-->
  69. <td >{{ summary.totalEnergy }}</td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. <div class="summary-actions">
  74. </div>
  75. </div>
  76. <!-- 中部:设备管理列表 -->
  77. <div class="table-container">
  78. <div class="scrollable-table">
  79. <!--普通直流-->
  80. <table v-if="productType =='0' " class="device-table">
  81. <thead>
  82. <tr>
  83. <th>通道名称</th>
  84. <th>电压(V)</th>
  85. <th>电流(A)</th>
  86. <th>功率(Kw)</th>
  87. <th>频率(Hz)</th>
  88. <th>耗电量(Kwh)</th>
  89. <th>功率因素</th>
  90. <th>开启延时(S)</th>
  91. <th>关闭延时(S)</th>
  92. <th>状态</th>
  93. <th>操作</th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. <tr v-for="device in channelList">
  98. <td >{{ device.productChName }}</td>
  99. <td v-if="device.colorStyledy!=''" :style="device.colorStyledy">{{ device.productChVoltage }}</td>
  100. <td v-else :style="device.colorStyledy2">{{ device.productChVoltage }}</td>
  101. <td :style="device.colorStyledl">{{ device.productChCurrent }}</td>
  102. <td :style="device.colorStylegl">{{ device.productChPower }}</td>
  103. <td>{{ device.productChPowerFreq }}</td>
  104. <td :style="device.colorStylehdl">{{ device.productChConsumption }}</td>
  105. <td>{{ device.productChPowerFactor }}</td>
  106. <td >{{ device.firingInterval }}</td>
  107. <td >{{ device.closeInterval }}</td>
  108. <td :class="device.productChStatus ? 'status-active' : 'status-inactive'">
  109. {{ device.productChStatus==1 ? '接通' : '断开' }}
  110. </td>
  111. <td>
  112. <button @click="toggleDeviceStatus(device)"
  113. :class="device.productChStatus ? 'btn btn-close' : 'btn btn-on'">
  114. {{ device.productChStatus==1 ? '关闭' : '开启' }}
  115. </button>
  116. </td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. <!--普通直流-->
  121. <table v-if="productType =='1' " class="device-table">
  122. <thead>
  123. <tr>
  124. <th>通道名称</th>
  125. <th>电压(V)</th>
  126. <th>电流(A)</th>
  127. <th>功率(Kw)</th>
  128. <th>耗电量(Kwh)</th>
  129. <th>开启延时(S)</th>
  130. <th>关闭延时(S)</th>
  131. <th>状态</th>
  132. <th>操作</th>
  133. </tr>
  134. </thead>
  135. <tbody>
  136. <tr v-for="device in channelList">
  137. <td >{{ device.productChName }}</td>
  138. <td v-if="device.colorStyledy!=''" :style="device.colorStyledy">{{ device.productChVoltage }}</td>
  139. <td v-else :style="device.colorStyledy2">{{ device.productChVoltage }}</td>
  140. <td :style="device.colorStyledl">{{ device.productChCurrent }}</td>
  141. <td :style="device.colorStylegl">{{ device.productChPower }}</td>
  142. <td :style="device.colorStylehdl">{{ device.productChConsumption }}</td>
  143. <td >{{ device.firingInterval }}</td>
  144. <td >{{ device.closeInterval }}</td>
  145. <td :class="device.productChStatus ? 'status-active' : 'status-inactive'">
  146. {{ device.productChStatus==1 ? '接通' : '断开' }}
  147. </td>
  148. <td>
  149. <button @click="toggleDeviceStatus(device)"
  150. :class="device.productChStatus ? 'btn btn-close' : 'btn btn-on'">
  151. {{ device.productChStatus==1 ? '关闭' : '开启' }}
  152. </button>
  153. </td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. <!--3相进3相出-->
  158. <table id="deviceTable" v-if="productType=='3'" class="device-table">
  159. <thead>
  160. <tr>
  161. <th>通道名称</th>
  162. <th>相序</th>
  163. <th>电压(V)</th>
  164. <th>电流(A)</th>
  165. <th>功率(Kw)</th>
  166. <th>频率(HZ)</th>
  167. <th>耗电量(Kwh)</th>
  168. <th>功率因素</th>
  169. <th>开启延时(S)</th>
  170. <th>关闭延时(S)</th>
  171. <th>状态</th>
  172. <th>操作</th>
  173. </tr>
  174. </thead>
  175. <tbody id="tableBody">
  176. <!-- 动态生成 -->
  177. </tbody>
  178. </table>
  179. <!--3相进2相出-->
  180. <table id="deviceTableTwo" v-if="productType=='6'" class="device-table">
  181. <thead>
  182. <tr>
  183. <th>通道名称</th>
  184. <th>相序</th>
  185. <th>电压(V)</th>
  186. <th>电流(A)</th>
  187. <th>功率(Kw)</th>
  188. <th>频率(Hz)</th>
  189. <th>耗电量(Kwh)</th>
  190. <th>功率因素</th>
  191. <th>开启延时(S)</th>
  192. <th>关闭延时(S)</th>
  193. <th>状态</th>
  194. <th>操作</th>
  195. </tr>
  196. </thead>
  197. <tbody id="tableBodyTwo">
  198. <!-- 动态生成 -->
  199. </tbody>
  200. </table>
  201. <!--3相进1相出-->
  202. <table v-if="productType=='4' || productType=='5' " class="device-table">
  203. <thead>
  204. <tr>
  205. <th>通道名称</th>
  206. <th>相序</th>
  207. <th>电压(V)</th>
  208. <th>电流(A)</th>
  209. <th>功率(Kw)</th>
  210. <th>频率(Hz)</th>
  211. <th>耗电量(Kwh)</th>
  212. <th>功率因素</th>
  213. <th>开启延时(S)</th>
  214. <th>关闭延时(S)</th>
  215. <th>状态</th>
  216. <th>操作</th>
  217. </tr>
  218. </thead>
  219. <tbody>
  220. <tr v-for="device in channelList">
  221. <td >{{ device.productChName }}</td>
  222. <td >{{ device.productPhOrder }}</td>
  223. <td v-if="device.colorStyledy!=''" :style="device.colorStyledy">{{ device.productChVoltage }}</td>
  224. <td v-else :style="device.colorStyledy2">{{ device.productChVoltage }}</td>
  225. <td :style="device.colorStyledl">{{ device.productChCurrent }}</td>
  226. <td :style="device.colorStylegl">{{ device.productChPower }}</td>
  227. <td>{{ device.productChPowerFreq }}</td>
  228. <td :style="device.colorStylehdl">{{ device.productChConsumption }}</td>
  229. <td>{{ device.productChPowerFactor }}</td>
  230. <td >{{ device.firingInterval }}</td>
  231. <td >{{ device.closeInterval }}</td>
  232. <td :class="device.productChStatus ? 'status-active' : 'status-inactive'">
  233. {{ device.productChStatus==1 ? '接通' : '断开' }}
  234. </td>
  235. <td>
  236. <button @click="toggleDeviceStatus(device)"
  237. :class="device.productChStatus ? 'btn btn-close' : 'btn btn-on'">
  238. {{ device.productChStatus==1 ? '关闭' : '开启' }}
  239. </button>
  240. </td>
  241. </tr>
  242. </tbody>
  243. </table>
  244. </div>
  245. </div>
  246. <!-- 下部:状态显示 -->
  247. <div class="status-section">
  248. <div class="status-boxes">
  249. <div class="status-box">
  250. <h3>温度(℃)</h3>
  251. <p v-if="statusData.temperatureStatus==0" style="color: red">{{ statusData.temperature }}</p>
  252. <p v-else :style="statusData.tempcolorStyle">{{ statusData.temperature }} </p>
  253. </div>
  254. <div class="status-box">
  255. <h3>湿度(%)</h3>
  256. <p v-if="statusData.temperatureStatus==0" style="color: red">{{ statusData.humidity }}</p>
  257. <p v-else :style="statusData.humcolorStylesx">{{ statusData.humidity }} </p>
  258. </div>
  259. <div class="status-box">
  260. <h3>烟雾</h3>
  261. <p v-if="statusData.waterLeakStatus==0" style="color: red">{{ statusData.waterLeak }}</p>
  262. <p v-else>{{ statusData.waterLeak }} </p>
  263. </div>
  264. <div class="status-box">
  265. <h3>CO2(PPM)</h3>
  266. <p v-if="statusData.smokeStatus==0" style="color: red">{{ statusData.smoke }}</p>
  267. <p v-else :style="statusData.smokecolorStylesx">{{ statusData.smoke }} </p>
  268. </div>
  269. <div class="status-box" @click="showFzszModalgj=true" style=" cursor: pointer; position: relative; ">
  270. <h3>报警</h3>
  271. <p>{{ statusData.alarm1 }}</p>
  272. </div>
  273. </div>
  274. </div>
  275. <!-- 耗电量设置弹窗内容 -->
  276. <div v-if="showFormModal" class="modal-overlay" >
  277. <div class="modal-content">
  278. <h2>耗电量重置</h2>
  279. <!-- 下拉选择 -->
  280. <div class="form-group" >
  281. <label>通道:</label>
  282. <div class="select-header">
  283. <p class="hint">提示:使用Ctrl/Cmd键进行多选</p>
  284. <button class="select-all" @click="toggleSelectAll2">
  285. {{ formData.productChIds.length === Object.keys(channelList1).length ? '取消全选' : '全选' }}
  286. </button>
  287. </div>
  288. <select v-model="formData.productChIds" multiple >
  289. <option v-for="option in channelList1" :value="option.productChId">{{ option.productChName }}</option>
  290. </select>
  291. <div class="selected-items">
  292. <h3>已选通道:</h3>
  293. <div class="selected-tags">
  294. <span v-if="formData.productChIds.length === 0" class="no-selection">暂无选择</span>
  295. <div v-for="id in formData.productChIds" :key="id" class="tag">
  296. {{ getOptionName2(id) }}
  297. <button @click="removeOption2(id)">×</button>
  298. </div>
  299. </div>
  300. </div>
  301. <!--<label>通道:</label>-->
  302. <!--<select v-model="formData.channel_power_infro" class="custom-select">-->
  303. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择耗电量复位通道...</option>-->
  304. <!--<option v-for="option in channelList1" :value="option.channel_power_infro">{{ option.productChName }}</option>-->
  305. <!--</select>-->
  306. </div>
  307. <!-- 表单按钮 -->
  308. <div class="form-actions">
  309. <button type="button" class="btn btn-energy" @click="hdlczClickClose()">取消</button>
  310. <button class="btn btn-energy" @click="hdlczClick()" >提交</button>
  311. </div>
  312. </div>
  313. </div>
  314. <!-- 阈值设置弹窗内容 -->
  315. <div @vue:mounted="fzszData" v-if="showFzszModal" class="modal-overlay" >
  316. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  317. <h2>阈值设置</h2>
  318. <button @click="handleUpdateList()" style="margin: 10px;" :class=" 'btn btn-on'">批量设置 </button>
  319. <div class="scrollable-table" style=" max-height: 60vh; ">
  320. <table class="device-table">
  321. <thead>
  322. <tr>
  323. <th>通道名称</th>
  324. <th>通道号</th>
  325. <th>电流上限(A)</th>
  326. <th>电压上限(V)</th>
  327. <th>电压下限(V)</th>
  328. <th>功率上限(KW)</th>
  329. <th>耗电量上限(Kwh)</th>
  330. <th>操作</th>
  331. </tr>
  332. </thead>
  333. <tbody>
  334. <tr v-for="power in powerThresholdList" :key="power.productChId">
  335. <td>{{ power.productChName }}</td>
  336. <td>{{ power.productChId }}</td>
  337. <td>{{ power.currentUpperAction }}</td>
  338. <td>{{ power.voltageUpperAction }}</td>
  339. <td>{{ power.voltageDownAction }}</td>
  340. <td>{{ power.powerUpperAction }}</td>
  341. <td>{{ power.alarmContentUpperAction }}</td>
  342. <td>
  343. <button @click="handleUpdate(power)" :class=" 'btn btn-on'">
  344. {{ '设置' }}
  345. </button>
  346. </td>
  347. </tr>
  348. </tbody>
  349. </table>
  350. </div>
  351. <!-- 表单按钮 -->
  352. <div class="button-footer form-actions">
  353. <button type="button" class="btn btn-energy" @click="fzscClickClose()">取消</button>
  354. </div>
  355. </div>
  356. </div>
  357. <!-- 阈值设置单设备弹窗内容 -->
  358. <div v-if="showFzszModal2" class="modal-overlay" >
  359. <div class="modal-content">
  360. <div class="form-group" v-if="fzscData.list=='1'" >
  361. <label>通道:</label>
  362. <div class="select-header">
  363. <p class="hint">提示:使用Ctrl/Cmd键进行多选</p>
  364. <button class="select-all" @click="toggleSelectAll">
  365. {{ fzscData.productChIds.length === Object.keys(channelList1).length ? '取消全选' : '全选' }}
  366. </button>
  367. </div>
  368. <select v-model="fzscData.productChIds" multiple >
  369. <option v-for="option in channelList1" :value="option.productChId">{{ option.productChName }}</option>
  370. </select>
  371. <div class="selected-items">
  372. <h3>已选通道:</h3>
  373. <div class="selected-tags">
  374. <span v-if="fzscData.productChIds.length === 0" class="no-selection">暂无选择</span>
  375. <div v-for="id in fzscData.productChIds" :key="id" class="tag">
  376. {{ getOptionName(id) }}
  377. <button @click="removeOption(id)">×</button>
  378. </div>
  379. </div>
  380. </div>
  381. </div>
  382. <div class="form-group" v-if="fzscData.list==''">
  383. <label>通道号:</label>
  384. <input type="text" v-model="fzscData.productChId" readonly >
  385. </div>
  386. <div class="form-group" >
  387. <label>电流上限(A):</label>
  388. <input type="text" v-model="fzscData.currentUpperAction">
  389. </div>
  390. <div class="form-group" >
  391. <label>电压上限(V):</label>
  392. <input type="text" v-model="fzscData.voltageUpperAction">
  393. </div>
  394. <div class="form-group" >
  395. <label>电压下限(V):</label>
  396. <input type="text" v-model="fzscData.voltageDownAction">
  397. </div>
  398. <div class="form-group" >
  399. <label>功率上限(KW):</label>
  400. <input type="text" v-model="fzscData.powerUpperAction">
  401. </div>
  402. <div class="form-group" >
  403. <label>耗电量上限(Kwh):</label>
  404. <input type="text" v-model="fzscData.alarmContentUpperAction">
  405. </div>
  406. <!-- 表单按钮 -->
  407. <div class="form-actions">
  408. <button class="btn btn-energy" @click="fzscClick()" >提交</button>
  409. <button type="button" class="btn btn-energy" @click="fzscClickClose2()">取消</button>
  410. </div>
  411. </div>
  412. </div>
  413. <!-- 延时设置列表 -->
  414. <div @vue:mounted="ysszData" v-if="showysszModal" class="modal-overlay" >
  415. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  416. <h2>延时设置</h2>
  417. <div class="scrollable-table" style=" max-height: 60vh; ">
  418. <table class="device-table">
  419. <thead>
  420. <tr>
  421. <th>通道名称</th>
  422. <th>通道号</th>
  423. <th>开启时间</th>
  424. <th>关闭时间</th>
  425. <th>操作</th>
  426. </tr>
  427. </thead>
  428. <tbody>
  429. <tr v-for="power in ysszList" :key="power.productChId">
  430. <td>{{ power.productChName }}</td>
  431. <td>{{ power.productChId }}</td>
  432. <td>{{ power.firingInterval }}</td>
  433. <td>{{ power.closeInterval }}</td>
  434. <td>
  435. <button @click="ysszhandleUpdate(power)" :class=" 'btn btn-on'">
  436. {{ '设置' }}
  437. </button>
  438. </td>
  439. </tr>
  440. </tbody>
  441. </table>
  442. </div>
  443. <!-- 表单按钮 -->
  444. <div class="button-footer form-actions">
  445. <button type="button" class="btn btn-energy" @click="ysszClickClose()">取消</button>
  446. </div>
  447. </div>
  448. </div>
  449. <!-- 延时设置内容 -->
  450. <div v-if="showysszModal2" class="modal-overlay2" >
  451. <div class="modal-content">
  452. <div class="form-group" >
  453. <label>通道号:</label>
  454. <input type="text" v-model="ysszData2.productChId" readonly >
  455. </div>
  456. <div class="form-group" >
  457. <label>开启时间(S):</label>
  458. <input type="text" v-model="ysszData2.firingInterval">
  459. </div>
  460. <div class="form-group" >
  461. <label>关闭时间(S):</label>
  462. <input type="text" v-model="ysszData2.closeInterval">
  463. </div>
  464. <!-- 表单按钮 -->
  465. <div class="form-actions">
  466. <button class="btn btn-energy" @click="ysszClick()" >提交</button>
  467. <button type="button" class="btn btn-energy" @click="ysszClickClose2()">取消</button>
  468. </div>
  469. </div>
  470. </div>
  471. <!--告警信息弹窗-->
  472. <div v-if="showFzszModalgj" class="modal-overlay" >
  473. <div class="modal-content" style="max-width: 100%;overflow-y: hidden">
  474. <div class="scrollable-table" style=" max-height: 60vh; ">
  475. <table class="device-table">
  476. <thead>
  477. <tr>
  478. <th>序号</th>
  479. <th>报警时间</th>
  480. <th>报警类型</th>
  481. <th>报警信息</th>
  482. </tr>
  483. </thead>
  484. <tbody>
  485. <tr v-for="(item, index) in his_alarmd" :key="index">
  486. <td>{{ item.number }}</td>
  487. <td>{{ item.date }}</td>
  488. <td>{{ item.type }}</td>
  489. <td>{{ item.waning_context }}</td>
  490. </tr>
  491. </tbody>
  492. </table>
  493. </div>
  494. <!-- 表单按钮 -->
  495. <div class="button-footer form-actions">
  496. <button type="button" class="btn btn-energy" @click="fzscClickClosegj()">取消</button>
  497. </div>
  498. </div>
  499. </div>
  500. </div>
  501. </div>
  502. <!--网络配置-->
  503. <div class="tab-content" id="tab2" @vue:mounted="wkszQuery">
  504. <div >
  505. <div class="modal-content">
  506. <div class="form-group" >
  507. <label>选择模式:</label>
  508. <select v-model="wlszForm.mode" class="custom-select">
  509. <option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>
  510. <option v-for="option in modes" :value="option.id">{{ option.name }}</option>
  511. </select>
  512. </div>
  513. <div class="form-group" >
  514. <label>IP:</label>
  515. <input type="text" v-model="wlszForm.ipaddr" >
  516. </div>
  517. <div class="form-group" >
  518. <label>掩码:</label>
  519. <input type="text" v-model="wlszForm.mask" >
  520. </div>
  521. <div class="form-group" >
  522. <label>网关:</label>
  523. <input type="text" v-model="wlszForm.gateway" >
  524. </div>
  525. <div class="form-group" >
  526. <label>DNS1:</label>
  527. <input type="text" v-model="wlszForm.dns1" >
  528. </div>
  529. <div class="form-group" >
  530. <label>DNS2:</label>
  531. <input type="text" v-model="wlszForm.dns2" >
  532. </div>
  533. <!--<div class="form-group" >-->
  534. <!--<label>DHCP:</label>-->
  535. <!--<input type="text" v-model="wlszForm.dhcp" >-->
  536. <!--</div>-->
  537. <!-- 表单按钮 -->
  538. <div class="form-actions">
  539. <button class="btn btn-energy" @click="submitForm('wksz')" >确定</button>
  540. </div>
  541. </div>
  542. </div>
  543. </div>
  544. <!--485配置-->
  545. <div class="tab-content" id="tab3" @vue:mounted="rsQuery">
  546. <div class="modal-content">
  547. <div class="form-group" >
  548. <select v-model="wlszForm2.mode" class="custom-select">
  549. <option :value="null" disabled selected hidden style="color: #aaa;">请选择耗电量复位通道...</option>
  550. <option v-for="option in modes2" :value="option.id">{{ option.name }}</option>
  551. </select>
  552. </div>
  553. <div class="form-group" >
  554. <label>地址:</label>
  555. <input type="text" v-model="wlszForm2.addr" >
  556. </div>
  557. <div class="form-group" >
  558. <label>波特率:</label>
  559. <input type="text" v-model="wlszForm2.baud" >
  560. </div>
  561. <!-- 表单按钮 -->
  562. <div class="form-actions">
  563. <button class="btn btn-energy" @click="submitForm('rs')" >确定</button>
  564. </div>
  565. </div>
  566. </div>
  567. <!--SNMP配置-->
  568. <div class="tab-content" id="tab4" >
  569. <div class="modal-content">
  570. <div class="form-group" >
  571. <label>社团项:</label>
  572. <input type="text" v-model="wlszForm3.publics" >
  573. </div>
  574. <!--<div class="form-group" >-->
  575. <!--<label>Trap IP:</label>-->
  576. <!--<select v-model="wlszForm3.version" @change="handleChange" class="custom-select">-->
  577. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  578. <!--<option v-for="option in SNMPs" :value="option.id">{{ option.name }}</option>-->
  579. <!--</select>-->
  580. <!--</div>-->
  581. <div class="form-group" >
  582. <label>Trap IP:</label>
  583. <input type="text" v-model="wlszForm3.trap_ip" >
  584. </div>
  585. <!--<div class="form-group" v-if="snmpShow">-->
  586. <!--<label>用户名:</label>-->
  587. <!--<input type="text" v-model="wlszForm3.yhm" >-->
  588. <!--</div>-->
  589. <!--<div class="form-group" v-if="snmpShow">-->
  590. <!--<label>认证协议:</label>-->
  591. <!--<select v-model="wlszForm3.mode" class="custom-select">-->
  592. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  593. <!--<option v-for="option in rzxys" :value="option.id">{{ option.name }}</option>-->
  594. <!--</select>-->
  595. <!--</div>-->
  596. <!--<div class="form-group" v-if="snmpShow">-->
  597. <!--<label>认证密码:</label>-->
  598. <!--<input type="text" v-model="wlszForm3.rzmm" >-->
  599. <!--</div>-->
  600. <!--<div class="form-group" v-if="snmpShow">-->
  601. <!--<label>加密协议:</label>-->
  602. <!--<select v-model="wlszForm3.trapmode" class="custom-select">-->
  603. <!--<option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>-->
  604. <!--<option v-for="option in jmxys" :value="option.id">{{ option.name }}</option>-->
  605. <!--</select>-->
  606. <!--</div>-->
  607. <!--<div class="form-group" v-if="snmpShow">-->
  608. <!--<label>加密密码:</label>-->
  609. <!--<input type="text" v-model="wlszForm3.jmmm" >-->
  610. <!--</div>-->
  611. <!-- 表单按钮 -->
  612. <div class="form-actions">
  613. <button class="btn btn-energy" @click="submitForm('snmp')" >确定</button>
  614. </div>
  615. </div>
  616. </div>
  617. <!--设备信息-->
  618. <div class="tab-content" id="tab5" >
  619. <!--<iframe class="tab-iframe" src="/src/sbsz.html"></iframe>-->
  620. <div class="divAll" >
  621. <!--设备信息-->
  622. <div class="modal-content" @vue:mounted="sbxxQuery">
  623. <div class="form-group" >
  624. <label>系统时间:</label>
  625. <input type="text" style="width: 70%" v-model="wlszForm4.sys_time" >
  626. <button style="margin-left: 10px;" class="btn btn-energy" @click="showXtsjModalClick()">设置</button>
  627. </div>
  628. <div class="form-group" >
  629. <label>固件版本:</label>
  630. <input type="text" style="width: 70%" v-model="wlszForm4.ver" >
  631. <!--<button style="margin-left: 10px;" class="btn btn-energy" @click="showFjscModalClick()" >升级</button>-->
  632. </div>
  633. </div>
  634. <!--设备系统时间设置-->
  635. <div v-if="showXtsjModal" class="modal-overlay2" >
  636. <div class="modal-content" >
  637. <h2>时间设置</h2>
  638. <!-- 下拉选择 -->
  639. <div class="form-group" >
  640. <label>时区:</label>
  641. <select v-model="wlszForm4.tzone" class="custom-select">
  642. <option :value="null" disabled selected hidden style="color: #aaa;">请选择...</option>
  643. <option v-for="option in sqs" :value="option.id">{{ option.name }}</option>
  644. </select>
  645. </div>
  646. <div class="form-group" >
  647. <label for="selectedDate">选择日期:</label>
  648. <div class="date-input-container">
  649. <input
  650. v-model="wlszForm4.sys_time"
  651. type="text"
  652. id="selectedDate"
  653. class="date-input"
  654. placeholder="点击选择日期"
  655. @click="showPicker"
  656. >
  657. <div class="calendar-icon">
  658. <i class="fas fa-calendar-alt"></i>
  659. </div>
  660. </div>
  661. <!--<div class="datetime-modal" v-if="isPickerVisible">-->
  662. <div class="modal-overlay2" v-if="isPickerVisible">
  663. <div class="modal-content">
  664. <div class="form-group" >
  665. <label>日期:</label>
  666. <select v-model="dateForm.year" style="width: 25%" >
  667. <option v-for="option in years" :value="option.id">{{ option.name }}</option>
  668. </select>
  669. <select v-model="dateForm.month" @change="updateDays" style="width: 25%" >
  670. <option v-for="option in months" :value="option.id">{{ option.name }}</option>
  671. </select>
  672. <select v-model="dateForm.day" style="width: 25%" >
  673. <option v-for="option in dayAll" :value="option.id">{{ option.name }}</option>
  674. </select>
  675. </div>
  676. <div class="form-group" >
  677. <label>时间:</label>
  678. <select v-model="dateForm.hour" style="width: 25%" >
  679. <option v-for="option in hours" :value="option.id">{{ option.name }}</option>
  680. </select>
  681. <select v-model="dateForm.minute" style="width: 25%" >
  682. <option v-for="option in minutes" :value="option.id">{{ option.name }}</option>
  683. </select>
  684. <select v-model="dateForm.second" style="width: 25%" >
  685. <option v-for="option in minutes" :value="option.id">{{ option.name }}</option>
  686. </select>
  687. </div>
  688. <button class="btn btn-energy" @click="confirmSelection"> 确认 </button>
  689. <button class="btn btn-energy" @click="isPickerVisible = false">取消 </button>
  690. </div>
  691. </div>
  692. </div>
  693. <!-- 表单按钮 -->
  694. <div class="form-actions" >
  695. <button class="btn btn-energy" @click="stxjClick()" >提交</button>
  696. <button type="button" class="btn btn-energy" @click="showXtsjModal=false">取消</button>
  697. </div>
  698. </div>
  699. </div>
  700. <!--附件上传-->
  701. <div v-if="showScfjModal" class="modal-overlay2" >
  702. <div class="upload-container" style=" background: white;width: 400px">
  703. <div class="form-group" >
  704. <label>固件版本:</label>
  705. <input type="text" style="width: 100%" v-model="wlszForm5.ver" >
  706. </div>
  707. <div class="upload-area"
  708. :class="{ dragover: isDragover }"
  709. @click="selectFiles"
  710. @dragover.prevent="isDragover = true"
  711. @dragleave="isDragover = false"
  712. @drop.prevent="handleDrop">
  713. <div class="upload-text">
  714. <h3>拖放文件到此处上传或选择文件</h3>
  715. <!--<p>支持单个或多个文件上传,最大支持200MB</p>-->
  716. </div>
  717. <input type="file" class="file-input" multiple @change="handleFileSelect" ref="fileInput">
  718. </div>
  719. <div class="files-list" v-if="files.length > 0">
  720. <h3>已选择文件 ({{ files.length }})</h3>
  721. <div class="file-item" v-for="file in files" :key="file.id">
  722. <div class="file-info">
  723. <div class="file-name">{{ file.name }}</div>
  724. </div>
  725. </div>
  726. </div>
  727. <div class="actions">
  728. <button class="btn" @click="uploadFiles" :disabled="files.length === 0 || isUploading || wlszForm5.ver==''">
  729. <i class="fas fa-upload"></i> 保存
  730. </button>
  731. <button class="btn btn-secondary" @click="clearFiles" >
  732. <i class="fas fa-times"></i> 取消
  733. </button>
  734. </div>
  735. </div>
  736. </div>
  737. </div>
  738. </div>
  739. <!-- 保存确认弹框 -->
  740. <div class="modal-overlay2" v-if="showSaveModal">
  741. <div class="modal-content">
  742. <h2>系统提示</h2>
  743. <p>{{popMessage}}</p>
  744. <div class="form-actions">
  745. <button class="btn btn-energy" @click="showSaveModal = false">取消</button>
  746. <button class="btn btn-energy" @click="saveData12()">确定</button>
  747. </div>
  748. </div>
  749. </div>
  750. </div>
  751. <script type="module">
  752. let activePageIntervalId1 = null;
  753. let activePageIntervalId2= null;
  754. let activePageIntervalId3 = null;
  755. let activePageIntervalId4 = null;
  756. let activePageIntervalId5 = null;
  757. let tabId = 'tab1';
  758. document.addEventListener('DOMContentLoaded', function() {
  759. const tabBtns = document.querySelectorAll('.tab-btn');
  760. const tabContents = document.querySelectorAll('.tab-content');
  761. tabBtns.forEach(btn => {
  762. btn.addEventListener('click', function() {
  763. // 移除所有按钮和内容的active类
  764. tabBtns.forEach(btn => btn.classList.remove('active'));
  765. tabContents.forEach(content => content.classList.remove('active'));
  766. // 为当前按钮添加active类
  767. this.classList.add('active');
  768. // 显示对应的内容
  769. tabId = this.getAttribute('data-tab');
  770. document.getElementById(tabId).classList.add('active');
  771. if(tabId=='tab1'){
  772. function1();
  773. }else if(tabId=='tab2'){
  774. function2();
  775. }else if(tabId=='tab3'){
  776. function3();
  777. }else if(tabId=='tab4'){
  778. function4();
  779. }else if(tabId=='tab5'){
  780. function5();
  781. }
  782. });
  783. });
  784. const today = new Date();
  785. today.setHours(0, 0, 0, 0);
  786. const app = PetiteVue.createApp({
  787. snmpShow:false,
  788. showXtsjModal:false,
  789. productType:"",
  790. productId:"",
  791. productNumber:"",
  792. channelList1:[],
  793. ysszList:[],
  794. ysszData2:{},
  795. timeData:{},
  796. popMessage:'',
  797. dateTime:'',
  798. systemTime:'',
  799. wlszForm:{
  800. mode:'',
  801. ipaddr:'',
  802. mask:'',
  803. gateway:'',
  804. dns1:'',
  805. dns2:'',
  806. dhcp:'',
  807. type:''
  808. },
  809. wlszForm2:{
  810. mode:'',
  811. addr:'',
  812. baud:''
  813. },
  814. wlszForm3:{
  815. mode:'',
  816. publics:'',
  817. version:'',
  818. yhm:'',
  819. rzmm:'',
  820. trapmode:'',
  821. jmmm:'',
  822. trap_ip:'',
  823. },
  824. readonlyvalidate: false,
  825. showSaveModal: false,
  826. showDeleteModal: false,
  827. message: '',
  828. messageType: '',
  829. popType: '',
  830. popMessage:'',
  831. modes:[{"id":0,"name":"自动"},{"id":1,"name":"手动"}],
  832. modes2:[{"id":0,"name":"主机模式"},{"id":1,"name":"从机模式"}],
  833. SNMPs:[{"id":"SNMP V1","name":"SNMP V1"},{"id":"SNMP V2c","name":"SNMP V2c"},{"id":"SNMP V3","name":"SNMP V3"}],
  834. 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"}],
  835. jmxys:[{"id":"0","name":"无"},{"id":"DES","name":"DES"},{"id":"AES","name":"AES"}],
  836. async stxjClickClose(){
  837. this.showXtsjModal=false
  838. },
  839. async wkszQuery(){
  840. },
  841. async rsQuery(){
  842. },
  843. async submitForm(type){
  844. this.showSaveModal = true
  845. this.popMessage="确认要提交吗?";
  846. if(type=='wksz'){
  847. this.saveDataAll=this.wlszForm;
  848. this.popType='wksz';
  849. this.saveDataAll.len=241
  850. }else if(type=='rs'){
  851. this.saveDataAll=this.wlszForm2;
  852. this.saveDataAll.len=6;
  853. this.popType='rs';
  854. }else if(type=='snmp'){
  855. this.saveDataAll=this.wlszForm3;
  856. this.saveDataAll.len=45
  857. this.popType='snmp';
  858. }
  859. },
  860. async saveData12(){
  861. if(this.popType=='wksz'){
  862. network_settings(this.saveDataAll)
  863. }else if(this.popType=='rs'){
  864. modbus_settings(this.saveDataAll)
  865. }else if(this.popType=='snmp'){
  866. snmp_settings(this.saveDataAll)
  867. }else if(this.popType=='zkzg'){
  868. if( this.saveDataAll.type=='close'){
  869. all_close();
  870. }else if( this.saveDataAll.type=='open'){
  871. all_open();
  872. }
  873. }else if(this.popType=='yssz'){
  874. delay_update(this.saveDataAll.channel_power_infro)
  875. this.ysszClickClose2()
  876. }else if(this.popType=='hdlcz'){
  877. for(const ket in this.saveDataAll.channel_power_infros){
  878. power_reset(this.saveDataAll.channel_power_infros[ket])
  879. }
  880. this.hdlczClickClose()
  881. }else if(this.popType=='fzsz'){
  882. if(this.saveDataAll.list=='1'){
  883. for(const ket in this.saveDataAll.channel_power_infros){
  884. threshold_update(this.saveDataAll.channel_power_infros[ket])
  885. }
  886. }else{
  887. threshold_update(this.saveDataAll.channel_power_infro)
  888. }
  889. this.fzscClickClose2()
  890. }else if(this.popType=='tdkg'){
  891. if( this.saveDataAll.type=='close'){
  892. single_close({...j_data},{...channel_power_infro},this.saveDataAll.productChId);
  893. }else if( this.saveDataAll.type=='open'){
  894. single_open({...j_data},{...channel_power_infro},this.saveDataAll.productChId);
  895. }
  896. }else if(this.popType=='sjsz'){
  897. sys_settings(this.saveDataAll)
  898. this.showSaveModal = false
  899. this.showXtsjModal=false
  900. }
  901. this.showSaveModal=false
  902. this.saveDataAll={};
  903. this.popType='';
  904. // alert("操作成功")
  905. },
  906. handleChange(value){
  907. if(this.wlszForm3.version=='SNMP V3'){
  908. this.snmpShow=true;
  909. }else{
  910. this.snmpShow=false;
  911. this.wlszForm3.yhm='';
  912. this.wlszForm3.mode='';
  913. this.wlszForm3.rzmm='';
  914. this.wlszForm3.jmxy='';
  915. this.wlszForm3.jmmm='';
  916. this.wlszForm3.trapmode='' ;
  917. }
  918. },
  919. showSaveModal: false,
  920. showDeleteModal: false,
  921. message: '',
  922. messageType: '',
  923. // 消息和UI状态
  924. message: '',
  925. messages: [],
  926. // 状态
  927. showExternal:false,
  928. // 耗电量设置
  929. showFormModal:false,
  930. // 阈值设置
  931. showFzszModal:false,
  932. //告警
  933. showFzszModalgj:false,
  934. showFzszModal2:false,
  935. showysszModal:false,
  936. showysszModal2:false,
  937. formData:{productChName:null,productChId:null,channel_power_infro:null,productChIds:[]},
  938. powerThresholdList:[],
  939. fzscData:{
  940. productChIds:[]
  941. },
  942. items: [],
  943. newItem: '',
  944. loading: false,
  945. error: null,
  946. summary: {...initialFormData},
  947. channelList: [
  948. {
  949. productChName: '通道1',
  950. productPhOrder: 'A相',
  951. productChVoltage: '220V',
  952. productChCurrent: '10A',
  953. productChPower: '2.2kW',
  954. productChPowerFreq: '50Hz',
  955. productChConsumption: '15kWh',
  956. firingInterval: '5s',
  957. closeInterval: '3s',
  958. productChId: '3221',
  959. status: true
  960. },
  961. ],
  962. statusData: {
  963. temperatureStatus:1,
  964. temperature: '',
  965. humidity: '',
  966. waterLeak: '',
  967. waterLeakStatus: 1,
  968. smoke: '',
  969. smokeStatus: 1,
  970. alarm1: ''
  971. },
  972. productType:"",
  973. threeType:"4",
  974. productId:"",
  975. productNumber:"",
  976. channelList1:[],
  977. ysszList:[],
  978. totalFormList:[],
  979. his_alarmd:[],
  980. ysszData2:{},
  981. popMessage:'',
  982. popType:'',
  983. saveDataAll:null,
  984. // 计算属性
  985. get connectionStatus() {
  986. if (this.isConnected) return 'connected';
  987. if (this.isConnecting) return 'connecting';
  988. return 'disconnected';
  989. },
  990. get statusText() {
  991. if (this.isConnected) return '已连接到 WebSocket 服务器';
  992. if (this.isConnecting) return '正在连接...';
  993. return '未连接';
  994. },
  995. async toggleDeviceStatus(device) {
  996. var command="";
  997. const params={};
  998. params.productChId=device.productChId;
  999. // if(device.productChStatus=='1'){
  1000. // command='channelclose';
  1001. // this.popMessage="确认要关闭此通道吗?";
  1002. // params.type="close";
  1003. // }else{
  1004. // command='channelopen';
  1005. // this.popMessage="确认要打开此通道吗?";
  1006. // params.type="open";
  1007. // }
  1008. if(device==null || device.productChId==undefined ){
  1009. return
  1010. }
  1011. if(device.productChStatus=='1'){
  1012. single_close({...j_data},{...channel_power_infro},device.productChId);
  1013. }else{
  1014. single_open({...j_data},{...channel_power_infro},device.productChId);
  1015. }
  1016. // const result = await confirmAction({
  1017. // title: message
  1018. // });
  1019. // this.showSaveModal = true
  1020. // this.saveDataAll=params;
  1021. // this.popType='tdkg';
  1022. },
  1023. /** 阈值设置按钮操作 */
  1024. handleUpdate(row) {
  1025. this.fzscData = JSON.parse(JSON.stringify(row));
  1026. this.fzscData.list='';
  1027. this.showFzszModal2 = true;
  1028. // this.title = this.$t('pz');
  1029. },
  1030. getOptionName(id) {
  1031. for(const key in this.channelList1){
  1032. if(this.channelList1[key].productChId===id){
  1033. return this.channelList1[key].productChName
  1034. break
  1035. }
  1036. }
  1037. ;
  1038. },
  1039. removeOption(id) {
  1040. this.fzscData.productChIds = this.fzscData.productChIds.filter(optId => optId !== id);
  1041. },
  1042. toggleSelectAll() {
  1043. if (this.fzscData.productChIds.length === Object.keys(this.channelList1).length ) {
  1044. this.fzscData.productChIds = [];
  1045. } else {
  1046. for(const key in this.channelList1){
  1047. this.fzscData.productChIds.push(this.channelList1[key].productChId)
  1048. }
  1049. // this.fzscData.productChIds = this.channelList1.map(option => option.productChId);
  1050. }
  1051. },
  1052. getOptionName2(id) {
  1053. for(const key in this.channelList1){
  1054. if(this.channelList1[key].productChId===id){
  1055. return this.channelList1[key].productChName
  1056. break
  1057. }
  1058. }
  1059. ;
  1060. },
  1061. removeOption2(id) {
  1062. this.formData.productChIds = this.formData.productChIds.filter(optId => optId !== id);
  1063. },
  1064. toggleSelectAll2() {
  1065. if (this.formData.productChIds.length === Object.keys(this.channelList1).length ) {
  1066. this.formData.productChIds = [];
  1067. } else {
  1068. for(const key in this.channelList1){
  1069. this.formData.productChIds.push(this.channelList1[key].productChId)
  1070. }
  1071. // this.fzscData.productChIds = this.channelList1.map(option => option.productChId);
  1072. }
  1073. },
  1074. /** 阈值设置按钮操作 */
  1075. handleUpdateList() {
  1076. this.fzscData.list='1';
  1077. this.fzscData.productChIds=[];
  1078. this.fzscData.currentUpperAction='';
  1079. this.fzscData.voltageUpperAction='';
  1080. this.fzscData.voltageDownAction='';
  1081. this.fzscData.powerUpperAction='';
  1082. this.fzscData.alarmContentUpperAction='';
  1083. this.showFzszModal2 = true;
  1084. // this.title = this.$t('pz');
  1085. },
  1086. ysszhandleUpdate(row) {
  1087. this.ysszData2 = JSON.parse(JSON.stringify(row));
  1088. this.showysszModal2 = true;
  1089. // this.title = this.$t('pz');
  1090. },
  1091. // 查询阈值设置列表
  1092. async fzszData(){
  1093. },
  1094. // 查询延时设置列表
  1095. async ysszData(){
  1096. },
  1097. hdlczClickClose(){
  1098. this.showFormModal = false
  1099. this.formData.channel_power_infro=null;
  1100. },
  1101. fzscClickClose(){
  1102. this.showFzszModal = false;
  1103. this.powerThresholdList=[];
  1104. // this.formData.productChId=null;
  1105. },
  1106. fzscClickClosegj(){
  1107. this.showFzszModalgj = false;
  1108. },
  1109. fzscClickClose2(){
  1110. this.showFzszModal2 = false
  1111. // this.formData.productChId=null;
  1112. },
  1113. ysszClickClose(){
  1114. this.showysszModal = false;
  1115. this.ysszList=[];
  1116. },
  1117. ysszClickClose2(){
  1118. this.showysszModal2 = false;
  1119. },
  1120. hdlsz(){
  1121. this.formData.productChIds=[]
  1122. this.showFormModal = true
  1123. },
  1124. // 耗电量重置
  1125. async hdlczClick(){
  1126. const params={};
  1127. let lists=[]
  1128. console.log( this.formData.productChIds)
  1129. for( const id in this.formData.productChIds){
  1130. for( const key in this.powerThresholdList ){
  1131. if(this.formData.productChIds[id]== this.powerThresholdList[key].productChId){
  1132. lists.push(this.powerThresholdList[key].channel_power_infro);
  1133. break
  1134. }
  1135. }
  1136. }
  1137. params.channel_power_infros= lists;
  1138. // params.channel_power_infro=this.formData.channel_power_infro;
  1139. this.popMessage="确认要重置此通道吗?";
  1140. // const result = await confirmAction({
  1141. // title: message
  1142. // });
  1143. this.showSaveModal = true
  1144. this.saveDataAll=params;
  1145. this.popType='hdlcz';
  1146. },
  1147. // 阈值设置保存
  1148. async fzscClick(){
  1149. const params={};
  1150. params.list=this.fzscData.list;
  1151. if(this.fzscData.list=='1'){
  1152. if(this.fzscData.productChIds.length==0){
  1153. alert("请选择通道")
  1154. return
  1155. }
  1156. if(this.fzscData.alarmContentUpperAction=='' || this.fzscData.currentUpperAction=='' || this.fzscData.voltageDownAction=='' || this.fzscData.voltageUpperAction==''){
  1157. alert("存在未设置项,请重试")
  1158. return
  1159. }
  1160. if(this.fzscData.voltageUpperAction!=0 && this.fzscData.voltageDownAction !=0 && this.fzscData.voltageUpperAction* 10<=this.fzscData.voltageDownAction* 10){
  1161. alert("电压上限需要大于下限")
  1162. return
  1163. }
  1164. let lists=[]
  1165. for( const id in this.fzscData.productChIds){
  1166. for( const key in this.powerThresholdList ){
  1167. if(this.fzscData.productChIds[id]== this.powerThresholdList[key].productChId){
  1168. let param=this.powerThresholdList[key].channel_power_infro;
  1169. param.thr.w_upper=this.fzscData.alarmContentUpperAction* 100;
  1170. param.thr.c_upper=this.fzscData.currentUpperAction* 100;
  1171. param.thr.p_upper=this.fzscData.powerUpperAction * 100 * 1000;
  1172. param.thr.v_lower=this.fzscData.voltageDownAction* 100;
  1173. param.thr.v_upper=this.fzscData.voltageUpperAction* 100;
  1174. lists.push(param);
  1175. break
  1176. }
  1177. }
  1178. }
  1179. params.channel_power_infros= lists;
  1180. }else{
  1181. params.channel_power_infro=this.fzscData.channel_power_infro;
  1182. params.channel_power_infro.thr.w_upper=this.fzscData.alarmContentUpperAction* 100;
  1183. params.channel_power_infro.thr.c_upper=this.fzscData.currentUpperAction* 100;
  1184. params.channel_power_infro.thr.p_upper=this.fzscData.powerUpperAction* 100 * 1000;
  1185. params.channel_power_infro.thr.v_lower=this.fzscData.voltageDownAction* 100;
  1186. params.channel_power_infro.thr.v_upper=this.fzscData.voltageUpperAction* 100;
  1187. }
  1188. this.popMessage="确认要保存吗?";
  1189. // const result = await confirmAction({
  1190. // title: message
  1191. // });
  1192. this.showSaveModal = true
  1193. this.saveDataAll=params;
  1194. this.popType='fzsz';
  1195. },
  1196. // 延时设置保存
  1197. async ysszClick(){
  1198. const params={};
  1199. params.channel_power_infro=this.ysszData2.channel_power_infro;
  1200. params.channel_power_infro.info.start_delay=this.ysszData2.firingInterval;
  1201. params.channel_power_infro.info.stop_delay=this.ysszData2.closeInterval;
  1202. this.popMessage="确认要保存吗?";
  1203. this.showSaveModal = true
  1204. this.saveDataAll=params;
  1205. this.popType='yssz';
  1206. },
  1207. // 总开总关
  1208. async toggleAllDevices(status) {
  1209. const params={};
  1210. params.productId=this.productId;
  1211. params.type= "open"
  1212. this.popMessage="确认要开启设备下所有通道吗?";
  1213. if(status){
  1214. params.type= "open"
  1215. this.popMessage="确认要开启设备下所有通道吗?";
  1216. }else{
  1217. params.type= "close"
  1218. this.popMessage="确认要关闭设备下所有通道吗?";
  1219. }
  1220. // const result = await confirmAction({
  1221. // title: message
  1222. // });
  1223. this.showSaveModal = true;
  1224. this.saveDataAll=params;
  1225. this.popType='zkzg';
  1226. },
  1227. async groupByChannel(data) {
  1228. const groups = {};
  1229. for(var i=0;i<Object.keys(data).length;i++){
  1230. const item=data[i];
  1231. if (!groups[item.productChName]) {
  1232. groups[item.productChName] = [];
  1233. }
  1234. groups[item.productChName].push(item);
  1235. }
  1236. return groups;
  1237. },
  1238. // 切换设备状态
  1239. async toggleDeviceStatus1(device) {
  1240. // 这里应该发送API请求更新状态
  1241. alert(`切换设备状态:\n通道: ${device.productChName}\n相序: ${device.productPhOrder}\n当前状态: ${device.productChStatus == 1 ? '接通' : '断开'}`);
  1242. // 模拟状态切换
  1243. device.productChStatus = device.productChStatus == 1 ? 0 : 1;
  1244. // 重新渲染表格
  1245. renderTable(mockData);
  1246. },
  1247. // 辅助函数:获取当前表格数据
  1248. async getTableData(tableBody) {
  1249. const data = {};
  1250. const rows = tableBody.querySelectorAll('tr');
  1251. for(var i=0;i<Object.keys(rows).length;i++){
  1252. const row=rows[i];
  1253. const nameCell = row.querySelector('td:first-child');
  1254. if (nameCell) {
  1255. const channelName = nameCell.textContent;
  1256. if (!data[channelName]) {
  1257. data[channelName] = [];
  1258. }
  1259. // 这里简化了,实际需要提取更多数据
  1260. data[channelName].push({ channelName });
  1261. }
  1262. }
  1263. console.log(data)
  1264. return data;
  1265. },
  1266. // 三相出渲染表格
  1267. isTableRendered:false,
  1268. async renderTable(data) {
  1269. const tableBody = document.getElementById('tableBody');
  1270. if(!this.isTableRendered){
  1271. const groups = {};
  1272. for(var i=0;i<Object.keys(data).length;i++){
  1273. const item=data[i];
  1274. if (!groups[item.productChName]) {
  1275. groups[item.productChName] = [];
  1276. }
  1277. groups[item.productChName].push(item);
  1278. }
  1279. // this.getTableData(tableBody);
  1280. // 清空现有内容
  1281. if(tableBody){
  1282. tableBody.innerHTML = ''
  1283. }
  1284. ;
  1285. // 遍历每个通道组
  1286. Object.keys(groups).forEach(channelName => {
  1287. const channelGroup = groups[channelName];
  1288. const rowSpan = channelGroup.length;
  1289. // 为每个通道组创建行
  1290. channelGroup.forEach((device, index) => {
  1291. const row = document.createElement('tr');
  1292. // 第一行:显示所有列
  1293. if (index === 0) {
  1294. // 通道名称(合并行)
  1295. const nameCell = document.createElement('td');
  1296. nameCell.textContent = device.productChName;
  1297. nameCell.rowSpan = rowSpan;
  1298. row.appendChild(nameCell);
  1299. // 相序
  1300. const phaseCell = document.createElement('td');
  1301. phaseCell.textContent = device.productPhOrder;
  1302. row.appendChild(phaseCell);
  1303. // 电压
  1304. const voltageCell = document.createElement('td');
  1305. voltageCell.innerHTML = device.productChVoltage;
  1306. voltageCell.style = device.colorStyledy || device.colorStyledy2;
  1307. // 使用classList添加多个class
  1308. voltageCell.classList.add('delay-cell');
  1309. voltageCell.id = `delay-cell-dy-${device.productChId}-${device.productPhOrder}`;
  1310. row.appendChild(voltageCell);
  1311. // 电流
  1312. const currentCell = document.createElement('td');
  1313. currentCell.innerHTML = device.productChCurrent;
  1314. currentCell.style = device.colorStyledl;
  1315. // 使用classList添加多个class
  1316. currentCell.classList.add('delay-cell');
  1317. currentCell.id = `delay-cell-dl-${device.productChId}-${device.productPhOrder}`;
  1318. row.appendChild(currentCell);
  1319. // 功率
  1320. const powerCell = document.createElement('td');
  1321. powerCell.innerHTML = device.productChPower;
  1322. powerCell.style = device.colorStylegl;
  1323. // 使用classList添加多个class
  1324. powerCell.classList.add('delay-cell');
  1325. powerCell.id = `delay-cell-gl-${device.productChId}-${device.productPhOrder}`;
  1326. row.appendChild(powerCell);
  1327. // 频率
  1328. const freqCell = document.createElement('td');
  1329. freqCell.textContent = device.productChPowerFreq;
  1330. // 使用classList添加多个class
  1331. freqCell.classList.add('delay-cell');
  1332. freqCell.id = `delay-cell-pl-${device.productChId}-${device.productPhOrder}`;
  1333. row.appendChild(freqCell);
  1334. // 耗电量
  1335. const consumptionCell = document.createElement('td');
  1336. consumptionCell.innerHTML = device.productChConsumption;
  1337. consumptionCell.style = device.colorStylehdl;
  1338. // 使用classList添加多个class
  1339. consumptionCell.classList.add('delay-cell');
  1340. consumptionCell.id = `delay-cell-hdl-${device.productChId}-${device.productPhOrder}`;
  1341. row.appendChild(consumptionCell);
  1342. // 功率因素
  1343. const PowerFactorCell = document.createElement('td');
  1344. PowerFactorCell.innerHTML = device.productChPowerFactor;
  1345. // PowerFactorCell.style = device.productChPowerFactor;
  1346. // 使用classList添加多个class
  1347. PowerFactorCell.classList.add('delay-cell');
  1348. PowerFactorCell.id = `delay-cell-glys-${device.productChId}-${device.productPhOrder}`;
  1349. row.appendChild(PowerFactorCell);
  1350. // 开启延时(合并行)
  1351. const firingCell = document.createElement('td');
  1352. firingCell.textContent = device.firingInterval;
  1353. // 使用classList添加多个class
  1354. firingCell.classList.add('delay-cell');
  1355. firingCell.id = `delay-cell-kq-${device.productChId}-${device.productPhOrder}`;
  1356. firingCell.rowSpan = rowSpan;
  1357. row.appendChild(firingCell);
  1358. // 关闭延时(合并行)
  1359. const closeCell = document.createElement('td');
  1360. closeCell.textContent = device.closeInterval;
  1361. // 使用classList添加多个class
  1362. closeCell.classList.add('delay-cell');
  1363. closeCell.id = `delay-cell-gb-${device.productChId}-${device.productPhOrder}`;
  1364. closeCell.rowSpan = rowSpan;
  1365. row.appendChild(closeCell);
  1366. // 状态(合并行,显示所有相的状态)
  1367. const statusCell = document.createElement('td');
  1368. statusCell.innerHTML = `
  1369. <span class="${device.productChStatus ? 'status-active' : 'status-inactive'} status-span" data-device-id="${device.id || device.productChId}">
  1370. ${device.productChStatus == 1 ? '接通' : '断开'}
  1371. </span>
  1372. `;
  1373. statusCell.rowSpan = rowSpan;
  1374. row.appendChild(statusCell);
  1375. // 操作(合并行,为每相提供操作按钮)
  1376. const actionCell = document.createElement('td');
  1377. const actionDiv = document.createElement('div');
  1378. const button = document.createElement('button');
  1379. button.className = `btn ${device.productChStatus ? 'btn-close' : 'btn-on'} btn-control`;
  1380. button.textContent = device.productChStatus == 1 ? '关闭' : '开启';
  1381. button.dataset.deviceId = device.id || device.productChId;
  1382. button.onclick = () => this.toggleDeviceStatus(device);
  1383. actionDiv.appendChild(button);
  1384. actionCell.appendChild(actionDiv);
  1385. actionCell.rowSpan = rowSpan;
  1386. row.appendChild(actionCell);
  1387. } else {
  1388. // 后续行:只显示需要重复的列
  1389. // 相序
  1390. const phaseCell = document.createElement('td');
  1391. phaseCell.textContent = device.productPhOrder;
  1392. row.appendChild(phaseCell);
  1393. // 电压
  1394. const voltageCell = document.createElement('td');
  1395. voltageCell.innerHTML = device.productChVoltage;
  1396. voltageCell.style = device.colorStyledy || device.colorStyledy2;
  1397. // 使用classList添加多个class
  1398. voltageCell.classList.add('delay-cell');
  1399. voltageCell.id = `delay-cell-dy-${device.productChId}-${device.productPhOrder}`;
  1400. row.appendChild(voltageCell);
  1401. // 电流
  1402. const currentCell = document.createElement('td');
  1403. currentCell.innerHTML = device.productChCurrent;
  1404. // 使用classList添加多个class
  1405. currentCell.classList.add('delay-cell');
  1406. currentCell.id = `delay-cell-dl-${device.productChId}-${device.productPhOrder}`;
  1407. currentCell.style = device.colorStyledl;
  1408. row.appendChild(currentCell);
  1409. // 功率
  1410. const powerCell = document.createElement('td');
  1411. powerCell.innerHTML = device.productChPower;
  1412. // 使用classList添加多个class
  1413. powerCell.classList.add('delay-cell');
  1414. powerCell.id = `delay-cell-gl-${device.productChId}-${device.productPhOrder}`;
  1415. powerCell.style = device.colorStylegl;
  1416. row.appendChild(powerCell);
  1417. // 频率
  1418. const freqCell = document.createElement('td');
  1419. freqCell.textContent = device.productChPowerFreq;
  1420. // 使用classList添加多个class
  1421. freqCell.classList.add('delay-cell');
  1422. freqCell.id = `delay-cell-pl-${device.productChId}-${device.productPhOrder}`;
  1423. row.appendChild(freqCell);
  1424. // 耗电量
  1425. const consumptionCell = document.createElement('td');
  1426. consumptionCell.innerHTML = device.productChConsumption;
  1427. consumptionCell.style = device.colorStylehdl;
  1428. // 使用classList添加多个class
  1429. consumptionCell.classList.add('delay-cell');
  1430. consumptionCell.id = `delay-cell-hdl-${device.productChId}-${device.productPhOrder}`;
  1431. row.appendChild(consumptionCell);
  1432. // 功率因素
  1433. const powerFactorCell = document.createElement('td');
  1434. powerFactorCell.textContent = device.productChPowerFactor;
  1435. // 使用classList添加多个class
  1436. powerFactorCell.classList.add('delay-cell');
  1437. powerFactorCell.id = `delay-cell-glys-${device.productChId}-${device.productPhOrder}`;
  1438. row.appendChild(powerFactorCell);
  1439. // 注意:合并的列在后续行中不需要再创建
  1440. }
  1441. if(tableBody){
  1442. tableBody.appendChild(row);
  1443. }
  1444. });
  1445. });
  1446. if(tableBody!=null){
  1447. this.isTableRendered=true
  1448. // this.setupEventDelegation();
  1449. }
  1450. }else{
  1451. this.updateTableData(data);
  1452. }
  1453. },
  1454. // 事件委托设置
  1455. async setupEventDelegation() {
  1456. const tableBody = document.getElementById('tableBody');
  1457. if (!tableBody) return;
  1458. tableBody.addEventListener('click', (e) => {
  1459. const button = e.target.closest('button.btn-control');
  1460. if (button) {
  1461. const deviceId = button.dataset.productChId;
  1462. // 从当前数据中查找设备
  1463. const device = this.findDeviceById(deviceId);
  1464. if (device) {
  1465. this.toggleDeviceStatus(device);
  1466. }
  1467. }
  1468. });
  1469. },
  1470. // 更新数据
  1471. async updateTableData(data) {
  1472. // 更新每个设备的状态显示
  1473. for(var i=0;i<Object.keys(data).length;i++){
  1474. const device=data[i];
  1475. const deviceId = device.id || device.productChId;
  1476. const productPhOrder = device.productPhOrder
  1477. // 更新电压
  1478. const voltageCell = document.querySelector(`td.delay-cell[id="delay-cell-dy-${deviceId}-${productPhOrder}"]`);
  1479. if (voltageCell) {
  1480. voltageCell.textContent = device.productChVoltage;
  1481. voltageCell.style = device.colorStyledy || device.colorStyledy2;
  1482. }
  1483. // 更新电流
  1484. const currentCell = document.querySelector(`td.delay-cell[id="delay-cell-dl-${deviceId}-${productPhOrder}"]`);
  1485. if (currentCell) {
  1486. currentCell.textContent = device.productChCurrent;
  1487. currentCell.style = device.colorStyledl;
  1488. }
  1489. // 更新功率
  1490. const powerCell = document.querySelector(`td.delay-cell[id="delay-cell-gl-${deviceId}-${productPhOrder}"]`);
  1491. if (powerCell) {
  1492. powerCell.textContent = device.productChPower;
  1493. powerCell.style = device.colorStylegl;
  1494. }
  1495. // 更新频率
  1496. const freqCell = document.querySelector(`td.delay-cell[id="delay-cell-pl-${deviceId}-${productPhOrder}"]`);
  1497. if (freqCell) {
  1498. freqCell.textContent = device.productChPowerFreq;
  1499. }
  1500. // 更新耗电量
  1501. const consumptionCell = document.querySelector(`td.delay-cell[id="delay-cell-hdl-${deviceId}-${productPhOrder}"]`);
  1502. if (consumptionCell) {
  1503. consumptionCell.textContent = device.productChConsumption;
  1504. consumptionCell.style = device.colorStylehdl;
  1505. }
  1506. // 更新功率因素
  1507. const firingCell = document.querySelector(`td.delay-cell[id="delay-cell-glys-${deviceId}-${productPhOrder}"]`);
  1508. if (firingCell) {
  1509. firingCell.textContent = device.productChPowerFactor
  1510. }
  1511. // 更新开启延时
  1512. const PowerFactorCell = document.querySelector(`td.delay-cell[id="delay-cell-kq-${deviceId}-${productPhOrder}"]`);
  1513. if (PowerFactorCell) {
  1514. PowerFactorCell.textContent = device.firingInterval
  1515. }
  1516. // 更新关闭延时
  1517. const closeCell = document.querySelector(`td.delay-cell[id="delay-cell-gb-${deviceId}-${productPhOrder}"]`);
  1518. if (closeCell) {
  1519. closeCell.textContent = device.closeInterval
  1520. }
  1521. // 更新状态文本
  1522. const statusSpan = document.querySelector(`span.status-span[data-device-id="${deviceId}"]`);
  1523. if (statusSpan) {
  1524. statusSpan.textContent = device.productChStatus == 1 ? '接通' : '断开';
  1525. statusSpan.className = `status-span ${device.productChStatus ? 'status-active' : 'status-inactive'}`;
  1526. }
  1527. // 更新按钮
  1528. const button = document.querySelector(`button.btn-control[data-device-id="${deviceId}"]`);
  1529. if (button) {
  1530. button.textContent = device.productChStatus == 1 ? '关闭' : '开启';
  1531. button.className = `btn btn-control ${device.productChStatus ? 'btn-close' : 'btn-on'}`;
  1532. button.onclick = () => this.toggleDeviceStatus(device);
  1533. }
  1534. }
  1535. },
  1536. // 辅助函数
  1537. async findDeviceById(deviceId) {
  1538. // 根据实际情况从数据源查找
  1539. return window.currentTableData?.find(item =>
  1540. item.id === deviceId || item.productId === deviceId
  1541. );
  1542. },
  1543. // 两相相出渲染表格
  1544. isTableRenderedTwo:false,
  1545. async renderTableTwo(data) {
  1546. const tableBody = document.getElementById('tableBodyTwo');
  1547. if(!this.isTableRenderedTwo){
  1548. const groups = {};
  1549. for(var i=0;i<Object.keys(data).length;i++){
  1550. const item=data[i];
  1551. if (!groups[item.productChName]) {
  1552. groups[item.productChName] = [];
  1553. }
  1554. groups[item.productChName].push(item);
  1555. }
  1556. // 清空现有内容
  1557. if(tableBody){
  1558. tableBody.innerHTML = ''
  1559. }
  1560. ;
  1561. // 遍历每个通道组
  1562. Object.keys(groups).forEach(channelName => {
  1563. const channelGroup = groups[channelName];
  1564. const rowSpan = channelGroup.length;
  1565. // 为每个通道组创建行
  1566. channelGroup.forEach((device, index) => {
  1567. const row = document.createElement('tr');
  1568. // 第一行:显示所有列
  1569. if (index === 0) {
  1570. // 通道名称(合并行)
  1571. const nameCell = document.createElement('td');
  1572. nameCell.textContent = device.productChName;
  1573. nameCell.rowSpan = rowSpan;
  1574. row.appendChild(nameCell);
  1575. // 相序
  1576. const phaseCell = document.createElement('td');
  1577. phaseCell.textContent = device.productPhOrder;
  1578. row.appendChild(phaseCell);
  1579. // 电压
  1580. const voltageCell = document.createElement('td');
  1581. voltageCell.innerHTML = device.productChVoltage;
  1582. voltageCell.style = device.colorStyledy || device.colorStyledy2;
  1583. // 使用classList添加多个class
  1584. voltageCell.classList.add('delay-cell');
  1585. voltageCell.id = `delay-cell-dy-${device.productChId}-${device.productPhOrder}`;
  1586. row.appendChild(voltageCell);
  1587. // 电流
  1588. const currentCell = document.createElement('td');
  1589. currentCell.innerHTML = device.productChCurrent;
  1590. currentCell.style = device.colorStyledl;
  1591. // 使用classList添加多个class
  1592. currentCell.classList.add('delay-cell');
  1593. currentCell.id = `delay-cell-dl-${device.productChId}-${device.productPhOrder}`;
  1594. row.appendChild(currentCell);
  1595. // 功率
  1596. const powerCell = document.createElement('td');
  1597. powerCell.innerHTML = device.productChPower;
  1598. powerCell.style = device.colorStylegl;
  1599. // 使用classList添加多个class
  1600. powerCell.classList.add('delay-cell');
  1601. powerCell.id = `delay-cell-gl-${device.productChId}-${device.productPhOrder}`;
  1602. row.appendChild(powerCell);
  1603. // 频率
  1604. const freqCell = document.createElement('td');
  1605. freqCell.textContent = device.productChPowerFreq;
  1606. // 使用classList添加多个class
  1607. freqCell.classList.add('delay-cell');
  1608. freqCell.id = `delay-cell-pl-${device.productChId}-${device.productPhOrder}`;
  1609. row.appendChild(freqCell);
  1610. // 耗电量
  1611. const consumptionCell = document.createElement('td');
  1612. consumptionCell.innerHTML = device.productChConsumption;
  1613. consumptionCell.style = device.colorStylehdl;
  1614. // 使用classList添加多个class
  1615. consumptionCell.classList.add('delay-cell');
  1616. consumptionCell.id = `delay-cell-hdl-${device.productChId}-${device.productPhOrder}`;
  1617. row.appendChild(consumptionCell);
  1618. // 功率因素
  1619. const PowerFactorCell = document.createElement('td');
  1620. PowerFactorCell.innerHTML = device.productChConsumption;
  1621. PowerFactorCell.style = device.productChPowerFactor;
  1622. // 使用classList添加多个class
  1623. PowerFactorCell.classList.add('delay-cell');
  1624. PowerFactorCell.id = `delay-cell-glys-${device.productChId}-${device.productPhOrder}`;
  1625. row.appendChild(PowerFactorCell);
  1626. // 开启延时(合并行)
  1627. const firingCell = document.createElement('td');
  1628. firingCell.textContent = device.firingInterval;
  1629. // 使用classList添加多个class
  1630. firingCell.classList.add('delay-cell');
  1631. firingCell.id = `delay-cell-kq-${device.productChId}-${device.productPhOrder}`;
  1632. firingCell.rowSpan = rowSpan;
  1633. row.appendChild(firingCell);
  1634. // 关闭延时(合并行)
  1635. const closeCell = document.createElement('td');
  1636. closeCell.textContent = device.closeInterval;
  1637. // 使用classList添加多个class
  1638. closeCell.classList.add('delay-cell');
  1639. closeCell.id = `delay-cell-gb-${device.productChId}-${device.productPhOrder}`;
  1640. closeCell.rowSpan = rowSpan;
  1641. row.appendChild(closeCell);
  1642. // 状态(合并行,显示所有相的状态)
  1643. const statusCell = document.createElement('td');
  1644. statusCell.innerHTML = `
  1645. <span class="${device.productChStatus ? 'status-active' : 'status-inactive'} status-span" data-device-id="${device.id || device.productChId}">
  1646. ${device.productChStatus == 1 ? '接通' : '断开'}
  1647. </span>
  1648. `;
  1649. statusCell.rowSpan = rowSpan;
  1650. row.appendChild(statusCell);
  1651. // 操作(合并行,为每相提供操作按钮)
  1652. const actionCell = document.createElement('td');
  1653. const actionDiv = document.createElement('div');
  1654. const button = document.createElement('button');
  1655. button.className = `btn ${device.productChStatus ? 'btn-close' : 'btn-on'} btn-control`;
  1656. button.textContent = device.productChStatus == 1 ? '关闭' : '开启';
  1657. button.dataset.deviceId = device.id || device.productChId;
  1658. button.onclick = () => this.toggleDeviceStatus(device);
  1659. actionDiv.appendChild(button);
  1660. actionCell.appendChild(actionDiv);
  1661. actionCell.rowSpan = rowSpan;
  1662. row.appendChild(actionCell);
  1663. } else {
  1664. // 后续行:只显示需要重复的列
  1665. // 相序
  1666. const phaseCell = document.createElement('td');
  1667. phaseCell.textContent = device.productPhOrder;
  1668. row.appendChild(phaseCell);
  1669. // 电压
  1670. const voltageCell = document.createElement('td');
  1671. voltageCell.innerHTML = device.productChVoltage;
  1672. voltageCell.style = device.colorStyledy || device.colorStyledy2;
  1673. // 使用classList添加多个class
  1674. voltageCell.classList.add('delay-cell');
  1675. voltageCell.id = `delay-cell-dy-${device.productChId}-${device.productPhOrder}`;
  1676. row.appendChild(voltageCell);
  1677. // 电流
  1678. const currentCell = document.createElement('td');
  1679. currentCell.innerHTML = device.productChCurrent;
  1680. currentCell.style = device.colorStyledl;
  1681. // 使用classList添加多个class
  1682. currentCell.classList.add('delay-cell');
  1683. currentCell.id = `delay-cell-dl-${device.productChId}-${device.productPhOrder}`;
  1684. row.appendChild(currentCell);
  1685. // 功率
  1686. const powerCell = document.createElement('td');
  1687. powerCell.innerHTML = device.productChPower;
  1688. powerCell.style = device.colorStylegl;
  1689. // 使用classList添加多个class
  1690. powerCell.classList.add('delay-cell');
  1691. powerCell.id = `delay-cell-gl-${device.productChId}-${device.productPhOrder}`;
  1692. row.appendChild(powerCell);
  1693. // 频率
  1694. const freqCell = document.createElement('td');
  1695. freqCell.textContent = device.productChPowerFreq;
  1696. // 使用classList添加多个class
  1697. freqCell.classList.add('delay-cell');
  1698. freqCell.id = `delay-cell-pl-${device.productChId}-${device.productPhOrder}`;
  1699. row.appendChild(freqCell);
  1700. // 耗电量
  1701. const consumptionCell = document.createElement('td');
  1702. consumptionCell.innerHTML = device.productChConsumption;
  1703. consumptionCell.style = device.colorStylehdl;
  1704. // 使用classList添加多个class
  1705. consumptionCell.classList.add('delay-cell');
  1706. consumptionCell.id = `delay-cell-hdl-${device.productChId}-${device.productPhOrder}`;
  1707. row.appendChild(consumptionCell);
  1708. // 功率因素
  1709. const powerFactorCell = document.createElement('td');
  1710. powerFactorCell.textContent = device.productChPowerFactor;
  1711. // 使用classList添加多个class
  1712. powerFactorCell.classList.add('delay-cell');
  1713. powerFactorCell.id = `delay-cell-glys-${device.productChId}-${device.productPhOrder}`;
  1714. row.appendChild(powerFactorCell);
  1715. // 注意:合并的列在后续行中不需要再创建
  1716. }
  1717. if(tableBody){
  1718. tableBody.appendChild(row);
  1719. }
  1720. });
  1721. });
  1722. if(tableBody!=null){
  1723. this.isTableRenderedTwo=true;
  1724. this.setupEventDelegation();
  1725. }
  1726. }else{
  1727. this.updateTableData(data);
  1728. }
  1729. },
  1730. // 获取数据方法
  1731. async fetchData() {
  1732. function5();
  1733. this.queryTotalStatus5();
  1734. if (activePageIntervalId1 != null) {
  1735. clearInterval(activePageIntervalId1);
  1736. };
  1737. activePageIntervalId1 = setInterval(() => {
  1738. if(tabId=='tab1'){
  1739. // on_ws_msg(this.js2);
  1740. function1();
  1741. this.queryTotalStatus();
  1742. if(this.wlszForm4.sys_time=='' || this.wlszForm4.sys_time==null){
  1743. this.queryTotalStatus5();
  1744. }
  1745. }else if(tabId=='tab2'){
  1746. this.queryTotalStatus2();
  1747. }else if(tabId=='tab3'){
  1748. this.queryTotalStatus3();
  1749. }else if(tabId=='tab4'){
  1750. this.queryTotalStatus4();
  1751. }else if(tabId=='tab5'){
  1752. this.queryTotalStatus5();
  1753. var js={};
  1754. on_ws_msg(js);
  1755. }
  1756. }, 200);
  1757. },
  1758. // 总体监控赋值
  1759. async queryTotalStatus(){
  1760. this.productType={... productTypeData}.productType;
  1761. if( this.productType=='3' || this.productType=='4' || this.productType=='5' || this.productType=='6' ){
  1762. this.showExternal=true;
  1763. this.totalFormList= {... initialTotalFormList}
  1764. if(this.threeType=='1'){
  1765. this.summary= this.totalFormList[0];
  1766. this.summary.threeType="L1";
  1767. }else if(this.threeType=='2'){
  1768. this.summary= this.totalFormList[1];
  1769. this.summary.threeType="L2";
  1770. }else if(this.threeType=='3'){
  1771. this.summary= this.totalFormList[2];
  1772. this.summary.threeType="L3";
  1773. }else if(this.threeType=='4'){
  1774. this.summary ={... initialAllFormData};
  1775. this.summary.threeType="";
  1776. }
  1777. }else{
  1778. this.summary={... initialFormData};
  1779. }
  1780. this.channelList={...channelAllList};
  1781. this.channelList1 = {...channelAllList1};
  1782. // console.log("三相进2相出")
  1783. // console.log( this.channelList)
  1784. if( this.productType=='3'){
  1785. // 渲染表格
  1786. this.renderTable( this.channelList);
  1787. }else if( this.productType=='6'){
  1788. // 渲染表格
  1789. this.renderTableTwo( this.channelList);
  1790. }
  1791. this.powerThresholdList = {...initialYzFormList};
  1792. this.ysszList = {...channelAllList1};
  1793. if({...his_alarm}!=null){
  1794. this.statusData.alarm1 = Object.keys({...his_alarm}).length;
  1795. var alarmds={...his_alarm};
  1796. this.his_alarmd=[]
  1797. for(var i=0;i<Object.keys({...his_alarm}).length ;i++){
  1798. var open=alarmds[i];
  1799. open.number=i+1;
  1800. open.date= (open.date.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1801. open.waning_context= (open.waning_context.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1802. if(open.type==0){
  1803. open.type='电量信息报警'
  1804. }else if(open.type==1){
  1805. open.type='传感器报警'
  1806. }
  1807. this.his_alarmd.push(open)
  1808. }
  1809. }
  1810. if({...sensorc_list}!=null && Object.keys({...sensorc_list}).length>0){
  1811. let sencorList={...sensorc_list};
  1812. for(const key in sencorList){
  1813. if(sencorList[key].info.type==0){ // 温湿度
  1814. if(sencorList[key].info.status==1){ // 在线
  1815. try{
  1816. let sensor_val =sencorList[key].sensor_val
  1817. this.statusData.temperature=sensor_val[1].val.toFixed(2)
  1818. if(sensor_val[1].s_alarm & 0x1){ // 上限
  1819. this.statusData.tempcolorStyle='color: red;font-weight: bold;'
  1820. }else if(sensor_val[1].s_alarm & 0x2){ // 下限
  1821. this.statusData.tempcolorStyle='color: #ff00ff;font-weight: bold;'
  1822. }else{
  1823. this.statusData.tempcolorStyle=''
  1824. }
  1825. this.statusData.humidity=sensor_val[0].val.toFixed(2)
  1826. if(sensor_val[0].s_alarm & 0x1){ // 上限
  1827. this.statusData.humcolorStylesx='color: red;font-weight: bold;'
  1828. }else if(sensor_val[0].s_alarm & 0x2){ // 下限
  1829. this.statusData.humcolorStylesx='color: #ff00ff;font-weight: bold;'
  1830. }else{
  1831. this.statusData.humcolorStylesx=''
  1832. }
  1833. }catch (e) {
  1834. console.log("温湿度传感器赋值失败")
  1835. }
  1836. }else{
  1837. this.statusData.temperatureStatus=0;
  1838. this.statusData.temperature='离线'
  1839. this.statusData.humidity='离线'
  1840. }
  1841. }else if(sencorList[key].info.type==1){ // 烟雾
  1842. if(sencorList[key].info.status==1) { // 在线
  1843. try{
  1844. let sensor_val =sencorList[key].sensor_val
  1845. this.statusData.waterLeak=sensor_val[0].s_alarm.act
  1846. }catch (e) {
  1847. console.log("烟雾传感器赋值失败")
  1848. }
  1849. }else {
  1850. this.statusData.waterLeakStatus=0;
  1851. this.statusData.waterLeak='离线'
  1852. }
  1853. }else if(sencorList[key].info.type==4){ // C02
  1854. if(sencorList[key].info.status==1) {
  1855. // 在线
  1856. try{
  1857. let sensor_val =sencorList[key].sensor_val
  1858. this.statusData.smoke=sensor_val[0].val.toFixed(2)
  1859. if(sensor_val[0] & 0x1 ){ // 上限
  1860. this.statusData.smokecolorStylesx='color: red;font-weight: bold;'
  1861. }else if(sensor_val[0] & 0x2){ // 下限
  1862. this.statusData.smokecolorStylesx='color: #ff00ff;font-weight: bold;'
  1863. }else{
  1864. this.statusData.smokecolorStylesx=''
  1865. }
  1866. }catch (e) {
  1867. console.log("CO2传感器赋值失败")
  1868. }
  1869. }else{
  1870. this.statusData.smokeStatus=0;
  1871. this.statusData.smoke='离线'
  1872. }
  1873. }
  1874. }
  1875. }
  1876. },
  1877. //网络设置
  1878. wlszForm_vack:null,
  1879. async queryTotalStatus2(){
  1880. if(this.wlszForm_vack==null && {...network_data}!=null && Object.keys({...network_data}).length>0){
  1881. this.wlszForm = {...network_data};
  1882. this.wlszForm.ipaddr= (this.wlszForm.ipaddr.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1883. this.wlszForm.mask= (this.wlszForm.mask.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1884. this.wlszForm.gateway= (this.wlszForm.gateway.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1885. this.wlszForm.dns1= (this.wlszForm.dns1.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1886. this.wlszForm.dns2= (this.wlszForm.dns2.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1887. this.wlszForm_vack = {...network_data};
  1888. }
  1889. },
  1890. //485
  1891. wlszForm2_vack:null,
  1892. async queryTotalStatus3(){
  1893. if( this.wlszForm2_vack==null && {...cas_data}!=null && Object.keys({...cas_data}).length>0){
  1894. this.wlszForm2 = {...cas_data};
  1895. this.wlszForm2_vack = {...cas_data};
  1896. }
  1897. },
  1898. // snmp
  1899. wlszForm3_back:null,
  1900. async queryTotalStatus4(){
  1901. if(this.wlszForm3_back==null){
  1902. if( {...snmp_data}!=null && Object.keys({...snmp_data}).length>0){
  1903. this.wlszForm3 = {...snmp_data};
  1904. this.wlszForm3.publics= (this.wlszForm3.publics.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1905. this.wlszForm3.trap_ip= (this.wlszForm3.trap_ip.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1906. this.wlszForm3.mode= this.wlszForm3.mode ;
  1907. this.wlszForm3.version= this.wlszForm3.version ;
  1908. this.wlszForm3.trapmode= this.wlszForm3.trapmode ;
  1909. this.wlszForm3_back = {...snmp_data};
  1910. // if(this.wlszForm3!=null && this.wlszForm3.version=='SNMP V3'){
  1911. // this.snmpShow=true;
  1912. // }else{
  1913. // this.snmpShow=false;
  1914. // // this.wlszForm3={}
  1915. // }
  1916. }
  1917. }
  1918. },
  1919. // 设备信息
  1920. wlszForm4_back:null,
  1921. async queryTotalStatus5(){
  1922. if(this.wlszForm4_back==null && {...lang_data}!=null && Object.keys({...lang_data}).length>0){
  1923. this.wlszForm4 = {...lang_data};
  1924. this.wlszForm4_back = {...lang_data};
  1925. this.wlszForm4.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1926. this.wlszForm5.ver= (this.wlszForm4.ver.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1927. this.wlszForm4.sys_time= (this.wlszForm4.sys_time.replace(/\\u0000/g, '\u0000')).replace(/\u0000/g, '');
  1928. this.systemTime=new Date(this.wlszForm4.sys_time);
  1929. // 计时器为空,操作
  1930. setInterval(() => {
  1931. var date= this.systemTime ;
  1932. var year = date.getFullYear();
  1933. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  1934. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  1935. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  1936. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  1937. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  1938. this.dateTime= year + '-' + month + '-' + day + ' ' + hours+ ':' + minutes + ':' + seconds;
  1939. this.systemTime=new Date(date.getTime()+1000);
  1940. }, 1000);
  1941. }
  1942. },
  1943. isSpanALL:false,
  1944. isSpana:true,
  1945. isSpanb:true,
  1946. isSpanc:true,
  1947. // 三相切换赋值
  1948. async toggleThreeDevices(type){
  1949. this.threeType=type;
  1950. if(type=='1'){
  1951. this.summary= this.totalFormList[0];
  1952. this.isSpana=false;
  1953. this.isSpanb=true;
  1954. this.isSpanc=true;
  1955. this.isSpanALL=true;
  1956. }else if(type=='2'){
  1957. this.summary= this.totalFormList[1];
  1958. this.isSpana=true;
  1959. this.isSpanb=false;
  1960. this.isSpanc=true;
  1961. this.isSpanALL=true;
  1962. }else if(type=='3'){
  1963. this.summary= this.totalFormList[2];
  1964. this.isSpana=true;
  1965. this.isSpanb=true;
  1966. this.isSpanc=false;
  1967. this.isSpanALL=true;
  1968. }else if(type=='4'){
  1969. this.summary ={... initialAllFormData};
  1970. this.isSpana=true;
  1971. this.isSpanb=true;
  1972. this.isSpanc=true;
  1973. this.isSpanALL=false;
  1974. }
  1975. },
  1976. // 传感器查询
  1977. async sensorStatusMonitoring(){
  1978. const params={};
  1979. params.type="listMapQuery";
  1980. params.productId=this.productId;
  1981. },
  1982. async channelStatusMonitoring(){
  1983. const params={};
  1984. params.type="listQuery";
  1985. params.productId=this.productId;
  1986. },
  1987. showXtsjModal:false,
  1988. showScfjModal:false,
  1989. popMessage:'',
  1990. wlszForm4:{
  1991. "lang": "",
  1992. "tzone": "",
  1993. "route": "",
  1994. "ver": "",
  1995. "sys_time":"",
  1996. "len": 52
  1997. },
  1998. wlszForm5:{
  1999. "lang": "",
  2000. "tzone": "",
  2001. "route": "",
  2002. "ver": "",
  2003. "sys_time":"",
  2004. "len": 52
  2005. },
  2006. showSaveModal: false,
  2007. popType: '',
  2008. popMessage:'',
  2009. sqs:[{"id":8,"name":"东8区"},{"id":-8,"name":"西8区"},{"id":0,"name":"任意时区"}],
  2010. currentDate: new Date(),
  2011. selectedDate: null,
  2012. selectedHour: 12,
  2013. selectedMinute: 0,
  2014. selectedSecond: 0,
  2015. isPickerVisible: false,
  2016. files: [],
  2017. isDragover: false,
  2018. isUploading: false,
  2019. nextFileId: 1,
  2020. years:[],
  2021. months:[],
  2022. dayAll:[],
  2023. hours:[],
  2024. minutes:[],
  2025. dateForm:{},
  2026. // 日期新方法
  2027. get daysNew() {
  2028. const currentYear = new Date().getFullYear();
  2029. for (let i = currentYear - 20; i <= currentYear + 5; i++) {
  2030. this.years.push({
  2031. id:i,
  2032. name:i+'年'
  2033. })
  2034. };
  2035. // 初始化月份
  2036. for (let i = 1; i <= 12; i++) {
  2037. this.months.push({
  2038. id:i,
  2039. name:i+'月'
  2040. })
  2041. }
  2042. this.updateDays();
  2043. for (let i = 0; i < 24; i++) {
  2044. this.hours.push({
  2045. id:i,
  2046. name:i
  2047. })
  2048. }
  2049. // 初始化分钟
  2050. for (let i = 0; i < 60; i++) {
  2051. this.minutes.push({
  2052. id:i,
  2053. name:i
  2054. })
  2055. }
  2056. },
  2057. updateDays(){
  2058. if(this.dateForm.year==null || this.dateForm.month==null){
  2059. return
  2060. }
  2061. const year = parseInt(this.dateForm.year);
  2062. const month = parseInt(this.dateForm.month);
  2063. // 如果年月未选择,默认显示31天
  2064. let daysInMonth = 1;
  2065. if (year && month) {
  2066. // 计算所选年月有多少天
  2067. daysInMonth = new Date(year, month, 0).getDate();
  2068. }
  2069. this.dayAll=[];
  2070. // 添加日期选项
  2071. for (let i = 1; i <= daysInMonth; i++) {
  2072. this.dayAll.push({
  2073. id:i,
  2074. name:i
  2075. })
  2076. }
  2077. this.dateForm.day=null;
  2078. },
  2079. // 日期选择方法
  2080. showPicker() {
  2081. // this.dateForm.year='';
  2082. // this.dateForm.month='';
  2083. // this.dateForm.day='';
  2084. // this.dateForm.hour='';
  2085. // this.dateForm.minute='';
  2086. // this.dateForm.second='';
  2087. this.isPickerVisible = true;
  2088. // 如果没有选择日期,默认使用今天
  2089. if (!this.selectedDate) {
  2090. this.selectedDate = new Date();
  2091. }
  2092. var date=new Date(this.wlszForm4.sys_time);
  2093. this.dateForm.year = date.getFullYear();
  2094. this.dateForm.month = date.getMonth() + 1 < 10 ? (date.getMonth() + 1) : date.getMonth() + 1;
  2095. if( this.dateForm.month !=null){
  2096. this.updateDays();
  2097. }
  2098. this.dateForm.day = date.getDate() < 10 ? date.getDate() : date.getDate();
  2099. this.dateForm.hour = date.getHours() < 10 ? date.getHours() : date.getHours();
  2100. this.dateForm.minute= date.getMinutes() < 10 ? date.getMinutes() : date.getMinutes();
  2101. this.dateForm.second= date.getSeconds() < 10 ? date.getSeconds() : date.getSeconds();
  2102. // 设置当前时间为选择的时间
  2103. const now = new Date();
  2104. this.selectedHour = now.getHours();
  2105. this.selectedMinute = now.getMinutes();
  2106. this.selectedSecond = now.getSeconds();
  2107. },
  2108. clearSelection() {
  2109. this.selectedDate = null;
  2110. this.selectedHour = 0;
  2111. this.selectedMinute = 0;
  2112. this.selectedSecond = 0;
  2113. },
  2114. confirmSelection() {
  2115. var month=this.dateForm.month<10?'0'+this.dateForm.month:this.dateForm.month
  2116. var day=this.dateForm.day<10?'0'+this.dateForm.day:this.dateForm.day
  2117. var hour=this.dateForm.hour<10?'0'+this.dateForm.hour:this.dateForm.hour
  2118. var minute=this.dateForm.minute<10?'0'+this.dateForm.minute:this.dateForm.minute
  2119. var second=this.dateForm.second<10?'0'+this.dateForm.second:this.dateForm.second
  2120. this.wlszForm4.sys_time=this.dateForm.year+'-'+month+'-'+day+' '+ hour+':'+ minute+':'+ second;
  2121. this.isPickerVisible = false;
  2122. },
  2123. async sbxxQuery(){
  2124. // this.wlszForm4= await this.data.data
  2125. },
  2126. async stxjClick(){
  2127. this.showSaveModal = true
  2128. this.popMessage="确认要提交吗?";
  2129. this.wlszForm4.type="NtpSave";
  2130. this.saveDataAll=this.wlszForm4;
  2131. this.popType='sjsz';
  2132. },
  2133. showXtsjModalClick(){
  2134. this.clearSelection();
  2135. this.showXtsjModal=true;
  2136. },
  2137. // 上传附件方法
  2138. showFjscModalClick(){
  2139. this.showScfjModal=true;
  2140. this.wlszForm5=JSON.parse(JSON.stringify( this.wlszForm4));
  2141. },
  2142. selectFiles() {
  2143. this.$refs.fileInput.click();
  2144. },
  2145. handleFileSelect(e) {
  2146. const selectedFiles = Array.from(e.target.files);
  2147. this.files = [];
  2148. this.addFiles(selectedFiles);
  2149. // 清空input,允许重复选择相同文件
  2150. e.target.value = '';
  2151. },
  2152. handleDrop(e) {
  2153. this.isDragover = false;
  2154. const droppedFiles = Array.from(e.dataTransfer.files);
  2155. this.addFiles(droppedFiles);
  2156. },
  2157. addFiles(fileList) {
  2158. fileList.forEach(file => {
  2159. this.files.push({
  2160. id: this.nextFileId++,
  2161. file: file,
  2162. name: file.name,
  2163. size: file.size,
  2164. type: file.type,
  2165. status: 'pending', // pending, uploading, success, error
  2166. progress: 0
  2167. });
  2168. });
  2169. },
  2170. clearFiles() {
  2171. this.files = [];
  2172. this.showScfjModal=false;
  2173. },
  2174. async uploadFiles() {
  2175. if (this.files.length === 0) return;
  2176. if(this.wlszForm5.ver=='' || this.wlszForm5.ver==null){
  2177. return
  2178. }
  2179. this.isUploading = true;
  2180. for (const fileObj of this.files) {
  2181. if (fileObj.status === 'success') continue;
  2182. sys_up_settings(this.wlszForm5.ver,fileObj.file)
  2183. this.clearFiles()
  2184. }
  2185. this.isUploading = false;
  2186. },
  2187. // 初始化事件监听
  2188. initEventListeners() {
  2189. document.addEventListener('vue-command', (event) => {
  2190. if (event.detail.type === 'process') {
  2191. this.processData(event.detail.source);
  2192. } else if (event.detail.type === 'update') {
  2193. this.updateData(event.detail.data);
  2194. }
  2195. });
  2196. }
  2197. }).mount();
  2198. // 将方法暴露到全局
  2199. window.externalIncrement = () => {
  2200. app.externalIncrement();
  2201. };
  2202. });
  2203. </script>
  2204. </body>
  2205. </html>