HistoryRecord.vue 9.5 KB

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