device-history.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <template>
  2. <div>
  3. <div class="my-title">历史记录</div>
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  5. <el-form-item label="上报时间">
  6. <el-date-picker
  7. v-model="dataForm.date"
  8. value-format="yyyy-MM-dd HH:mm:ss"
  9. type="datetimerange"
  10. range-separator="至"
  11. start-placeholder="开始时间"
  12. end-placeholder="结束时间">
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button @click="search()">查询</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-table
  20. :data="dataList"
  21. border
  22. v-loading="dataListLoading"
  23. style="width: 100%;">
  24. <el-table-column
  25. label="序号"
  26. type="index"
  27. width="50"
  28. align="center">
  29. </el-table-column>
  30. <el-table-column
  31. prop="deviceName"
  32. header-align="center"
  33. align="center"
  34. min-width="120"
  35. label="设备编号">
  36. </el-table-column>
  37. <el-table-column
  38. prop="deviceTimeStr"
  39. header-align="center"
  40. align="center"
  41. min-width="160"
  42. :show-overflow-tooltip="true"
  43. label="上报时间">
  44. </el-table-column>
  45. <el-table-column
  46. prop="serverTimeStr"
  47. header-align="center"
  48. align="center"
  49. min-width="160"
  50. :show-overflow-tooltip="true"
  51. label="系统接收时间">
  52. </el-table-column>
  53. <el-table-column
  54. prop="version"
  55. header-align="center"
  56. align="center"
  57. min-width="100"
  58. label="协议版本">
  59. </el-table-column>
  60. <el-table-column
  61. prop="ack"
  62. header-align="center"
  63. align="center"
  64. min-width="100"
  65. label="是否需要响应">
  66. <template slot-scope="scope">
  67. <span>{{ scope.row.ack === '0'?'否':'是' }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. prop="longitude"
  72. header-align="center"
  73. align="center"
  74. min-width="100"
  75. label="纬度">
  76. </el-table-column>
  77. <el-table-column
  78. prop="latitude"
  79. header-align="center"
  80. align="center"
  81. min-width="100"
  82. :show-overflow-tooltip="true"
  83. label="经度">
  84. </el-table-column>
  85. <el-table-column
  86. header-align="center"
  87. align="center"
  88. min-width="150"
  89. label="NC软件版本">
  90. <template slot-scope="scope">
  91. <span v-for="item in scope.row.points" v-if="item.name==='NCVersion'">{{ item.value }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. header-align="center"
  96. align="center"
  97. label="NC名称">
  98. <template slot-scope="scope">
  99. <span v-for="item in scope.row.points" v-if="item.name==='NCInfo'">{{ item.value }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. header-align="center"
  104. align="center"
  105. min-width="100"
  106. label="第一轴下一指令">
  107. <template slot-scope="scope">
  108. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos1'">{{ item.value }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. header-align="center"
  113. align="center"
  114. min-width="100"
  115. label="第二轴下一指令">
  116. <template slot-scope="scope">
  117. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos2'">{{ item.value }}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column
  121. header-align="center"
  122. align="center"
  123. min-width="100"
  124. label="第三轴下一指令">
  125. <template slot-scope="scope">
  126. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos3'">{{ item.value }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column
  130. header-align="center"
  131. align="center"
  132. min-width="100"
  133. label="第四轴下一指令">
  134. <template slot-scope="scope">
  135. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos4'">{{ item.value }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column
  139. header-align="center"
  140. align="center"
  141. min-width="100"
  142. label="第五轴下一指令">
  143. <template slot-scope="scope">
  144. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos5'">{{ item.value }}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. header-align="center"
  149. align="center"
  150. min-width="100"
  151. label="第六轴下一指令">
  152. <template slot-scope="scope">
  153. <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos6'">{{ item.value }}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column
  157. header-align="center"
  158. align="center"
  159. min-width="100"
  160. label="自动运行时间">
  161. <template slot-scope="scope">
  162. <span v-for="item in scope.row.points" v-if="item.name==='RunTime'">{{ formatTime(item.value) }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column
  166. header-align="center"
  167. align="center"
  168. min-width="100"
  169. label="自动启动时间">
  170. <template slot-scope="scope">
  171. <span v-for="item in scope.row.points" v-if="item.name==='StartTime'">{{ formatTime(item.value) }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. header-align="center"
  176. align="center"
  177. min-width="90"
  178. label="循环时间">
  179. <template slot-scope="scope">
  180. <span v-for="item in scope.row.points" v-if="item.name==='CycleTime'">{{ item.value }}</span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. header-align="center"
  185. align="center"
  186. min-width="90"
  187. label="上电时间">
  188. <template slot-scope="scope">
  189. <span v-for="item in scope.row.points" v-if="item.name==='KeepAliveTime'">{{ formatTime(item.value) }}</span>
  190. </template>
  191. </el-table-column>
  192. <el-table-column
  193. header-align="center"
  194. align="center"
  195. min-width="90"
  196. label="系统日期">
  197. <template slot-scope="scope">
  198. <span v-for="item in scope.row.points" v-if="item.name==='SystemDate'">{{ formatDate(item.value) }}</span>
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. header-align="center"
  203. align="center"
  204. min-width="90"
  205. label="系统时间">
  206. <template slot-scope="scope">
  207. <span v-for="item in scope.row.points" v-if="item.name==='SystemTime'">{{ formatTime(item.value) }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column
  211. header-align="center"
  212. align="center"
  213. min-width="100"
  214. :show-overflow-tooltip="true"
  215. label="主程序名">
  216. <template slot-scope="scope">
  217. <span v-for="item in scope.row.points" v-if="item.name==='MainProName'">{{ item.value }}</span>
  218. </template>
  219. </el-table-column>
  220. <el-table-column
  221. header-align="center"
  222. align="center"
  223. min-width="90"
  224. label="当前运行程序号">
  225. <template slot-scope="scope">
  226. <span v-for="item in scope.row.points" v-if="item.name==='CuRunProNum'">{{ item.value }}</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column
  230. header-align="center"
  231. align="center"
  232. min-width="120"
  233. :show-overflow-tooltip="true"
  234. label="当前运行程序内容">
  235. <template slot-scope="scope">
  236. <span v-for="item in scope.row.points" v-if="item.name==='CuRunProContent'">{{ item.value }}</span>
  237. </template>
  238. </el-table-column>
  239. <el-table-column
  240. header-align="center"
  241. align="center"
  242. min-width="120"
  243. :show-overflow-tooltip="true"
  244. label="设备报警">
  245. <template slot-scope="scope">
  246. <span v-for="item in scope.row.points" v-if="item.name==='AlarmMsg'">{{ item.value }}</span>
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. header-align="center"
  251. align="center"
  252. min-width="100"
  253. :show-overflow-tooltip="true"
  254. label="进给设定转速FA">
  255. <template slot-scope="scope">
  256. <span v-for="item in scope.row.points" v-if="item.name==='FeedSetSpeed'">{{ item.value }}</span>
  257. </template>
  258. </el-table-column>
  259. <el-table-column
  260. header-align="center"
  261. align="center"
  262. min-width="100"
  263. :show-overflow-tooltip="true"
  264. label="进给实际速度FE">
  265. <template slot-scope="scope">
  266. <span v-for="item in scope.row.points" v-if="item.name==='FeedActualSpeed'">{{ item.value }}</span>
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. header-align="center"
  271. align="center"
  272. min-width="90"
  273. label="主轴设定转速">
  274. <template slot-scope="scope">
  275. <span v-for="item in scope.row.points" v-if="item.name==='SpindleSetSpeed'">{{ item.value }}</span>
  276. </template>
  277. </el-table-column>
  278. <el-table-column
  279. header-align="center"
  280. align="center"
  281. min-width="90"
  282. label="主轴实际转速">
  283. <template slot-scope="scope">
  284. <span v-for="item in scope.row.points" v-if="item.name==='SpindleActualSpeed'">{{ item.value }}</span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column
  288. header-align="center"
  289. align="center"
  290. min-width="90"
  291. label="主轴倍率">
  292. <template slot-scope="scope">
  293. <span v-for="item in scope.row.points" v-if="item.name==='SpindleRate'">{{ item.value }}</span>
  294. </template>
  295. </el-table-column>
  296. <el-table-column
  297. header-align="center"
  298. align="center"
  299. min-width="90"
  300. label="进给倍率">
  301. <template slot-scope="scope">
  302. <span v-for="item in scope.row.points" v-if="item.name==='FeedRate'">{{ item.value }}</span>
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. header-align="center"
  307. align="center"
  308. min-width="90"
  309. label="快速移动倍率">
  310. <template slot-scope="scope">
  311. <span v-for="item in scope.row.points" v-if="item.name==='MoveRate'">{{ item.value }}</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column
  315. header-align="center"
  316. align="center"
  317. min-width="90"
  318. label="主轴负载">
  319. <template slot-scope="scope">
  320. <span v-for="item in scope.row.points" v-if="item.name==='SpindleLoad'">{{ item.value }}</span>
  321. </template>
  322. </el-table-column>
  323. <el-table-column
  324. header-align="center"
  325. align="center"
  326. min-width="90"
  327. label="第一轴伺服轴负载">
  328. <template slot-scope="scope">
  329. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad1'">{{ item.value }}</span>
  330. </template>
  331. </el-table-column>
  332. <el-table-column
  333. header-align="center"
  334. align="center"
  335. min-width="90"
  336. label="第二轴伺服轴负载">
  337. <template slot-scope="scope">
  338. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad2'">{{ item.value }}</span>
  339. </template>
  340. </el-table-column>
  341. <el-table-column
  342. header-align="center"
  343. align="center"
  344. min-width="90"
  345. label="第三轴伺服轴负载">
  346. <template slot-scope="scope">
  347. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad3'">{{ item.value }}</span>
  348. </template>
  349. </el-table-column>
  350. <el-table-column
  351. header-align="center"
  352. align="center"
  353. min-width="90"
  354. label="第四轴伺服轴负载">
  355. <template slot-scope="scope">
  356. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad4'">{{ item.value }}</span>
  357. </template>
  358. </el-table-column>
  359. <el-table-column
  360. header-align="center"
  361. align="center"
  362. min-width="90"
  363. label="第五轴伺服轴负载">
  364. <template slot-scope="scope">
  365. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad5'">{{ item.value }}</span>
  366. </template>
  367. </el-table-column>
  368. <el-table-column
  369. header-align="center"
  370. align="center"
  371. min-width="100"
  372. label="第六轴伺服轴负载">
  373. <template slot-scope="scope">
  374. <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad6'">{{ item.value }}</span>
  375. </template>
  376. </el-table-column>
  377. <el-table-column
  378. header-align="center"
  379. align="center"
  380. min-width="100"
  381. label="设备运行模式">
  382. <template slot-scope="scope">
  383. <span v-for="item in scope.row.points" v-if="item.name==='RunMode'">{{ item.value }}</span>
  384. </template>
  385. </el-table-column>
  386. <el-table-column
  387. header-align="center"
  388. align="center"
  389. min-width="100"
  390. label="设备运行状态">
  391. <template slot-scope="scope">
  392. <span v-for="item in scope.row.points" v-if="item.name==='RunStatus'">{{ item.value }}</span>
  393. </template>
  394. </el-table-column>
  395. <el-table-column
  396. header-align="center"
  397. align="center"
  398. min-width="100"
  399. label="当前刀具号">
  400. <template slot-scope="scope">
  401. <span v-for="item in scope.row.points" v-if="item.name==='CulToolNum'">{{ item.value }}</span>
  402. </template>
  403. </el-table-column>
  404. <el-table-column
  405. header-align="center"
  406. align="center"
  407. min-width="100"
  408. label="设备急停状态">
  409. <template slot-scope="scope">
  410. <span v-for="item in scope.row.points" v-if="item.name==='EmergencyStop'">{{ item.value }}</span>
  411. </template>
  412. </el-table-column>
  413. <el-table-column
  414. header-align="center"
  415. align="center"
  416. min-width="100"
  417. label="G代码状态">
  418. <template slot-scope="scope">
  419. <span v-for="item in scope.row.points" v-if="item.name==='GCodeStatus'">{{ item.value }}</span>
  420. </template>
  421. </el-table-column>
  422. <el-table-column
  423. header-align="center"
  424. align="center"
  425. min-width="100"
  426. label="累计生产件数">
  427. <template slot-scope="scope">
  428. <span v-for="item in scope.row.points" v-if="item.name==='ProductCounts'">{{ item.value }}</span>
  429. </template>
  430. </el-table-column>
  431. <el-table-column
  432. header-align="center"
  433. align="center"
  434. min-width="100"
  435. label="第一轴机械坐标">
  436. <template slot-scope="scope">
  437. <span v-for="item in scope.row.points" v-if="item.name==='MacPos1'">{{ item.value }}</span>
  438. </template>
  439. </el-table-column>
  440. <el-table-column
  441. header-align="center"
  442. align="center"
  443. min-width="100"
  444. label="第二轴机械坐标">
  445. <template slot-scope="scope">
  446. <span v-for="item in scope.row.points" v-if="item.name==='MacPos2'">{{ item.value }}</span>
  447. </template>
  448. </el-table-column>
  449. <el-table-column
  450. header-align="center"
  451. align="center"
  452. min-width="100"
  453. label="第三轴机械坐标">
  454. <template slot-scope="scope">
  455. <span v-for="item in scope.row.points" v-if="item.name==='MacPos3'">{{ item.value }}</span>
  456. </template>
  457. </el-table-column>
  458. <el-table-column
  459. header-align="center"
  460. align="center"
  461. min-width="100"
  462. label="第四轴机械坐标">
  463. <template slot-scope="scope">
  464. <span v-for="item in scope.row.points" v-if="item.name==='MacPos4'">{{ item.value }}</span>
  465. </template>
  466. </el-table-column>
  467. <el-table-column
  468. header-align="center"
  469. align="center"
  470. min-width="100"
  471. label="第五轴机械坐标">
  472. <template slot-scope="scope">
  473. <span v-for="item in scope.row.points" v-if="item.name==='MacPos5'">{{ item.value }}</span>
  474. </template>
  475. </el-table-column>
  476. <el-table-column
  477. header-align="center"
  478. align="center"
  479. min-width="100"
  480. label="第六轴机械坐标">
  481. <template slot-scope="scope">
  482. <span v-for="item in scope.row.points" v-if="item.name==='MacPos6'">{{ item.value }}</span>
  483. </template>
  484. </el-table-column>
  485. <el-table-column
  486. header-align="center"
  487. align="center"
  488. min-width="100"
  489. label="第一轴工件坐标">
  490. <template slot-scope="scope">
  491. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos1'">{{ item.value }}</span>
  492. </template>
  493. </el-table-column>
  494. <el-table-column
  495. header-align="center"
  496. align="center"
  497. min-width="100"
  498. label="第二轴工件坐标">
  499. <template slot-scope="scope">
  500. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos2'">{{ item.value }}</span>
  501. </template>
  502. </el-table-column>
  503. <el-table-column
  504. header-align="center"
  505. align="center"
  506. min-width="100"
  507. label="第三轴工件坐标">
  508. <template slot-scope="scope">
  509. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos3'">{{ item.value }}</span>
  510. </template>
  511. </el-table-column>
  512. <el-table-column
  513. header-align="center"
  514. align="center"
  515. min-width="100"
  516. label="第四轴工件坐标">
  517. <template slot-scope="scope">
  518. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos4'">{{ item.value }}</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column
  522. header-align="center"
  523. align="center"
  524. min-width="100"
  525. label="第五轴工件坐标">
  526. <template slot-scope="scope">
  527. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos5'">{{ item.value }}</span>
  528. </template>
  529. </el-table-column>
  530. <el-table-column
  531. header-align="center"
  532. align="center"
  533. min-width="100"
  534. label="第六轴工件坐标">
  535. <template slot-scope="scope">
  536. <span v-for="item in scope.row.points" v-if="item.name==='WorkPos6'">{{ item.value }}</span>
  537. </template>
  538. </el-table-column>
  539. <el-table-column
  540. header-align="center"
  541. align="center"
  542. min-width="100"
  543. label="第一轴当前(相对)坐标">
  544. <template slot-scope="scope">
  545. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos1'">{{ item.value }}</span>
  546. </template>
  547. </el-table-column>
  548. <el-table-column
  549. header-align="center"
  550. align="center"
  551. min-width="100"
  552. label="第二轴当前(相对)坐标">
  553. <template slot-scope="scope">
  554. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos2'">{{ item.value }}</span>
  555. </template>
  556. </el-table-column>
  557. <el-table-column
  558. header-align="center"
  559. align="center"
  560. min-width="100"
  561. label="第三轴当前(相对)坐标">
  562. <template slot-scope="scope">
  563. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos3'">{{ item.value }}</span>
  564. </template>
  565. </el-table-column>
  566. <el-table-column
  567. header-align="center"
  568. align="center"
  569. min-width="100"
  570. label="第四轴当前(相对)坐标">
  571. <template slot-scope="scope">
  572. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos4'">{{ item.value }}</span>
  573. </template>
  574. </el-table-column>
  575. <el-table-column
  576. header-align="center"
  577. align="center"
  578. min-width="100"
  579. label="第五轴当前(相对)坐标">
  580. <template slot-scope="scope">
  581. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos5'">{{ item.value }}</span>
  582. </template>
  583. </el-table-column>
  584. <el-table-column
  585. header-align="center"
  586. align="center"
  587. min-width="100"
  588. label="第六轴当前(相对)坐标">
  589. <template slot-scope="scope">
  590. <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos6'">{{ item.value }}</span>
  591. </template>
  592. </el-table-column>
  593. <el-table-column
  594. header-align="center"
  595. align="center"
  596. min-width="100"
  597. label="第一轴剩余坐标">
  598. <template slot-scope="scope">
  599. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos1'">{{ item.value }}</span>
  600. </template>
  601. </el-table-column>
  602. <el-table-column
  603. header-align="center"
  604. align="center"
  605. min-width="100"
  606. label="第二轴剩余坐标">
  607. <template slot-scope="scope">
  608. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos2'">{{ item.value }}</span>
  609. </template>
  610. </el-table-column>
  611. <el-table-column
  612. header-align="center"
  613. align="center"
  614. min-width="100"
  615. label="第三轴剩余坐标">
  616. <template slot-scope="scope">
  617. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos3'">{{ item.value }}</span>
  618. </template>
  619. </el-table-column>
  620. <el-table-column
  621. header-align="center"
  622. align="center"
  623. min-width="100"
  624. label="第四轴剩余坐标">
  625. <template slot-scope="scope">
  626. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos4'">{{ item.value }}</span>
  627. </template>
  628. </el-table-column>
  629. <el-table-column
  630. header-align="center"
  631. align="center"
  632. min-width="100"
  633. label="第五轴剩余坐标">
  634. <template slot-scope="scope">
  635. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos5'">{{ item.value }}</span>
  636. </template>
  637. </el-table-column>
  638. <el-table-column
  639. header-align="center"
  640. align="center"
  641. min-width="100"
  642. label="第六轴剩余坐标">
  643. <template slot-scope="scope">
  644. <span v-for="item in scope.row.points" v-if="item.name==='DistancePos6'">{{ item.value }}</span>
  645. </template>
  646. </el-table-column>
  647. </el-table>
  648. <el-pagination
  649. @size-change="sizeChangeHandle"
  650. @current-change="currentChangeHandle"
  651. :current-page="pageIndex"
  652. :page-sizes="[10, 20, 50, 100]"
  653. :page-size="pageSize"
  654. :total="totalPage"
  655. layout="total, sizes, prev, pager, next, jumper">
  656. </el-pagination>
  657. <span slot="footer" class="dialog-footer">
  658. <el-button @click="onChose">返回</el-button>
  659. </span>
  660. </div>
  661. </template>
  662. <script>
  663. import {formatDate, formatTime} from '@/utils/date-util'
  664. export default {
  665. name: 'device-history',
  666. components: {
  667. },
  668. data () {
  669. return {
  670. code: 0,
  671. dataForm: {},
  672. dataList: [],
  673. pageIndex: 1,
  674. pageSize: 10,
  675. totalPage: 0,
  676. dataListLoading: false,
  677. dataListSelections: []
  678. }
  679. },
  680. methods: {
  681. formatDate,
  682. formatTime,
  683. async init (code) {
  684. this.code = code
  685. this.search()
  686. },
  687. onChose () {
  688. this.$emit('onChose')
  689. },
  690. // 查询
  691. search () {
  692. this.pageIndex = 1
  693. this.getDataList()
  694. },
  695. // 获取数据列表
  696. getDataList () {
  697. this.dataListLoading = true
  698. this.addOrUpdateVisible = false
  699. this.$http({
  700. url: this.$http.adornUrl('/iot-platform/data-gateway/history'),
  701. method: 'get',
  702. params: this.$http.adornParams({
  703. 'current': this.pageIndex,
  704. 'size': this.pageSize,
  705. 'code': this.code,
  706. 'timeStart': this.dataForm.date ? this.dataForm.date[0] : null,
  707. 'timeEnd': this.dataForm.date ? this.dataForm.date[1] : null
  708. })
  709. }).then(({data}) => {
  710. if (data && data.code === '200') {
  711. this.dataList = data.data.records
  712. this.totalPage = Number(data.data.total)
  713. } else {
  714. this.dataList = []
  715. this.totalPage = 0
  716. }
  717. this.dataListLoading = false
  718. })
  719. },
  720. // 每页数
  721. sizeChangeHandle (val) {
  722. this.pageSize = val
  723. this.pageIndex = 1
  724. this.getDataList()
  725. },
  726. // 当前页
  727. currentChangeHandle (val) {
  728. this.pageIndex = val
  729. this.getDataList()
  730. },
  731. // 多选
  732. selectionChangeHandle (val) {
  733. this.dataListSelections = val
  734. },
  735. // 详情
  736. detailHandle (row) {
  737. // todo
  738. }
  739. }
  740. }
  741. </script>
  742. <style scoped>
  743. </style>