DetcotrRecord.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <div class="historyRecord">
  3. <div class="">
  4. <div class="sum-title">
  5. {{detctorRs.Title}}
  6. </div>
  7. <span class="link" @click="link(detctorRs.Url)">
  8. more+
  9. </span>
  10. <el-table
  11. :data="tableData"
  12. stripe
  13. :default-sort="{prop: 'date', order: 'descending'}"
  14. style="width: 100%">
  15. <el-table-column
  16. prop="DetectorName"
  17. label="探测器"
  18. align="center"
  19. >
  20. </el-table-column>
  21. <el-table-column
  22. prop="WirelessType"
  23. label="类型"
  24. sortable
  25. :formatter="filterWirelessTypeName"
  26. >
  27. </el-table-column>
  28. <el-table-column
  29. prop="UpdateAtMilleSec"
  30. label="时间"
  31. width="160"
  32. align="center"
  33. sortable
  34. :formatter="filterTime"
  35. >
  36. </el-table-column>
  37. </el-table>
  38. <br>
  39. <div v-show="allTableData.length != 0">
  40. <el-pagination
  41. background
  42. layout="prev, pager, next"
  43. :total="pageination.total"
  44. :page-size="pageination.pageItem"
  45. @current-change="pageChange"
  46. ></el-pagination>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import Global from '../Global.js'
  53. export default {
  54. data() {
  55. return {
  56. pageination: {
  57. pageItem: 8,
  58. pageoptions: pageOptions(),
  59. total: 30,
  60. pageIndex: 1,
  61. },
  62. draw: 1,
  63. start: 0,
  64. recordsTotal: 0,
  65. tableData: [],
  66. allTableData: [],
  67. limit: '9',
  68. multipleSort: false,
  69. loading: true,
  70. fileList: [],
  71. multipleSelection: [],
  72. detectedmac: '',
  73. }
  74. },
  75. props: ['detctorRs'],
  76. watch: {
  77. detctorRs: {
  78. handler(val, oldName) {
  79. this.loading = false;
  80. if (!val.Rs) {
  81. this.allTableData = [];
  82. this.recordsTotal = 0;
  83. } else {
  84. this.allTableData = val.Rs;
  85. console.log(this.allTableData);
  86. this.recordsTotal = val.Rs.length;
  87. }
  88. // 设置分页数据
  89. this.setPaginations();
  90. },
  91. deep: true,
  92. immediate: true
  93. },
  94. },
  95. methods: {
  96. link(url) {
  97. this.$router.push({path: url, query: {x: 0}});
  98. },
  99. // 设置分页数据
  100. setPaginations() {
  101. // 分页属性
  102. let that = this;
  103. that.pageination.total = that.recordsTotal;
  104. // 默认分页
  105. that.tableData = that.allTableData.filter((item, index) => {
  106. return index < that.pageination.pageItem;
  107. });
  108. },
  109. // 每页显示数量
  110. handleSizeChange() {
  111. let that = this;
  112. that.tableData = that.allTableData.filter((item, index) => {
  113. return index < that.pageination.pageItem;
  114. });
  115. that.draw = that.pageination.pageItem;
  116. },
  117. // 翻页
  118. pageChange(pageIndex) {
  119. let that = this;
  120. // 获取当前页
  121. let index = that.pageination.pageItem * (pageIndex - 1);
  122. // 数据总数
  123. let nums = that.pageination.pageItem * pageIndex;
  124. // 容器
  125. let tables = [];
  126. for (var i = index; i < nums; i++) {
  127. if (that.allTableData[i]) {
  128. tables.push(that.allTableData[i])
  129. }
  130. this.tableData = tables;
  131. }
  132. that.start = index * that.draw;
  133. },
  134. // 自动排序
  135. sortChange(params) {
  136. console.log(params)
  137. },
  138. // 过滤设备类型
  139. filterWirelessTypeName(value) {
  140. return filterWirelessType(value.WirelessType);
  141. },
  142. filterTime(value) {
  143. return filterTimeToString(value.UpdateAtMilleSec);
  144. }
  145. }
  146. ,
  147. }
  148. </script>
  149. <style scoped>
  150. .historyRecord {
  151. width: 100%;
  152. overflow: hidden;
  153. display: block;
  154. margin: 0 auto;
  155. }
  156. .sum-title {
  157. width: 150px;
  158. height: 36px;
  159. font-size: 16px;
  160. line-height: 36px;
  161. color: #6DC1FF;
  162. margin: 0 auto;
  163. text-align: center;
  164. background: url("../assets/img/main/tit.png") top center no-repeat;
  165. background-size: 100%;
  166. }
  167. .link {
  168. position: relative;
  169. bottom: 20px;
  170. float: right;
  171. color: #6DC1FF;
  172. margin-right: 10px;
  173. cursor: pointer;
  174. }
  175. .el-table {
  176. position: relative;
  177. bottom: 20px;
  178. width: 100%;
  179. height: 110px;
  180. overflow: hidden;
  181. display: block;
  182. margin: 0 auto;
  183. margin-top: 0px;
  184. font-size: 14px;
  185. color: #6DC1FF;
  186. }
  187. .el-table, .el-table__expanded-cell {
  188. background: none;
  189. }
  190. /deep/ .el-table th, /deep/ .el-table tr {
  191. background: none;
  192. color: #6DC1FF;
  193. border: none;
  194. }
  195. /deep/ .el-table td, /deep/ .el-table th.is-leaf {
  196. border: none;
  197. }
  198. /deep/ .el-button--primary.is-active, /deep/ .el-button--primary:active, /deep/ .el-button--primary {
  199. background: none;
  200. border: 1px solid #005EA2;
  201. color: #6DC1FF;
  202. }
  203. /deep/ .el-button--primary {
  204. background: none;
  205. border: 1px solid #005EA2;
  206. color: #6DC1FF;
  207. }
  208. .el-table--border::after, .el-table--group::after, .el-table::before {
  209. display: none;
  210. }
  211. .el-pagination.is-background .btn-next.disabled, /deep/ .el-pagination.is-background .btn-next:disabled, /deep/ .el-pagination.is-background .btn-prev.disabled, .el-pagination.is-background .btn-prev:disabled, /deep/ .el-pagination.is-background .el-pager li.disabled {
  212. color: #6DC1FF;
  213. }
  214. /deep/ .el-pagination.is-background .btn-next, /deep/ .el-pagination.is-background .btn-prev, .el-pagination.is-background .el-pager li {
  215. background-color: #061B44;
  216. }
  217. /deep/ .el-pagination__jump {
  218. display: none !important;
  219. }
  220. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  221. color: #002540;
  222. background-color: #6DC1FF;
  223. }
  224. /deep/ .el-pagination__total {
  225. color: #6DC1FF;
  226. }
  227. /deep/ .el-table--enable-row-hover .el-table__body tr:hover > td {
  228. background: rgba(27, 86, 200, 0.77);
  229. }
  230. /deep/ .el-table--striped .el-table__body tr.el-table__row--striped:hover > td {
  231. background: rgba(27, 86, 200, 0.77);
  232. }
  233. /deep/ .el-table--striped .el-table__body tr.el-table__row--striped td {
  234. background: rgba(27, 86, 200, 0.14);
  235. }
  236. /deep/ .has-gutter th {
  237. /*background: rgba(0, 23, 67, 0.8) !important;*/
  238. font-weight: normal;
  239. }
  240. /deep/ .el-table .cell {
  241. padding: 3px;
  242. }
  243. /deep/ .el-table th {
  244. padding: 3px 0;
  245. }
  246. /deep/ .el-table td {
  247. padding: 6px 0;
  248. }
  249. /deep/ .number {
  250. width: 25px;
  251. height: 25px;
  252. line-height: 25px;
  253. min-width: 25px;
  254. }
  255. i.blue {
  256. width: 10px;
  257. height: 10px;
  258. float: left;
  259. background: #6DC1FF;
  260. margin-top: 6px;
  261. margin-right: 5px;
  262. border-radius: 250px;
  263. }
  264. i.yellow {
  265. width: 10px;
  266. height: 10px;
  267. float: left;
  268. margin-top: 6px;
  269. margin-right: 5px;
  270. background: #FFDD00;
  271. border-radius: 250px;
  272. }
  273. /deep/ .el-table .sort-caret {
  274. color: #6DC1FF !important;
  275. }
  276. /deep/ .el-table__empty-text {
  277. color: #015B9E;
  278. }
  279. /deep/ .el-pagination.is-background .btn-next,
  280. /deep/ .el-pagination.is-background .btn-prev {
  281. background: #002540;
  282. }
  283. /deep/ .el-pagination.is-background .el-pager li {
  284. background: #002540;
  285. }
  286. </style>