You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

201 lines
5.5 KiB

  1. <template>
  2. <div class="pages">
  3. <div class="container">
  4. <div class="tableBox">
  5. <div class="header">
  6. <div class="h-left">
  7. <div class="label">
  8. <span>设备编号:</span>
  9. <span>{{ paramsObj.imei }}</span>
  10. </div>
  11. <div class="label">
  12. <span>领用人:</span>
  13. <span>{{ paramsObj.name }}</span>
  14. </div>
  15. </div>
  16. <div class="h-right">
  17. <el-button type="primary" @click="exportMethodPost">导出</el-button>
  18. <el-button type="primary" @click="back">返回</el-button>
  19. </div>
  20. </div>
  21. <div class="tabs">
  22. <el-table :data="tableData" height="100%">
  23. <el-table-column type="index" label="序号"> </el-table-column>
  24. <el-table-column prop="imei" label="设备编号"> </el-table-column>
  25. <el-table-column prop="receptionTime" label="更新时间">
  26. </el-table-column>
  27. <el-table-column prop="electricity" label="设备电量">
  28. </el-table-column>
  29. <el-table-column prop="signalDevice" label="设备信号">
  30. </el-table-column>
  31. <el-table-column prop="fileCount" label="待上传文件数">
  32. </el-table-column>
  33. <el-table-column prop="stateInterval" label="更新间隔时长">
  34. <template slot-scope="{ row }">
  35. <span v-if="row.timeInterval > 60*11*1000" style="color: red;font-weight: bold;">{{ row.stateInterval }}</span>
  36. <span v-else >{{ row.stateInterval }}</span>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. </div>
  41. </div>
  42. <div class="btmpagiation">
  43. <el-pagination
  44. @size-change="handleSizeChange"
  45. @current-change="handleCurrentChange"
  46. :current-page="paramsObj.current"
  47. :page-sizes="[10, 50, 100]"
  48. :page-size="paramsObj.size"
  49. layout="total, sizes, prev, pager, next, jumper"
  50. :total="total"
  51. >
  52. </el-pagination>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. id: "", // 设备号
  62. total: 0, // 总条数
  63. paramsObj: {
  64. imei: "",
  65. // 当前页面的参数
  66. current: 1,
  67. size: 10,
  68. },
  69. tableData: [], // 数据列表数据
  70. };
  71. },
  72. mounted() {
  73. if (this.$route.query.id) this.paramsObj.imei = this.$route.query.id;
  74. if (this.$route.query.names) this.paramsObj.name = this.$route.query.names;
  75. this.getMessageList();
  76. },
  77. methods: {
  78. // 导出.Excel公用方法
  79. exportMethodPost() {
  80. axios({
  81. method: "get",
  82. url: `/autoSR/zk/equipment/findByImeiExport?imei=${this.paramsObj.imei}`,
  83. responseType: "blob",
  84. })
  85. .then((res) => {
  86. let blob = new Blob([res], { type: "application/vnd.ms-excel" });
  87. let date = new Date();
  88. let time = date.toLocaleDateString();
  89. // console.log(time, "时间");
  90. if ("download" in document.createElement("a")) {
  91. const link = document.createElement("a");
  92. link.style.display = "none";
  93. link.href = URL.createObjectURL(blob);
  94. // link.download = res.headers['content-disposition'] //下载后文件名
  95. link.download = (name || "导出文件") + time + ".xlsx"; //下载的文件名
  96. document.body.appendChild(link);
  97. link.click();
  98. document.body.removeChild(link);
  99. } else {
  100. // console.log("--------------------jingla")
  101. let fileName = (name || "导出文件") + time + ".xlsx"; //下载的文件名
  102. navigator.msSaveBlob(blob, fileName);
  103. }
  104. })
  105. .catch((error) => {
  106. // Message.error({
  107. // message: '网络连接错误'
  108. // })
  109. console.log(error);
  110. });
  111. },
  112. back() {
  113. this.$router.go(-1);
  114. },
  115. // 获取设备日志
  116. getMessageList() {
  117. this.$api.api.findByImeiAndHours(this.paramsObj).then((res) => {
  118. console.log(res);
  119. if (res.code == 10000) {
  120. this.total = res.data.total;
  121. this.tableData = res.data.records;
  122. }
  123. });
  124. },
  125. // 改变当前分页条数
  126. handleSizeChange(val) {
  127. console.log(`每页 ${val} 条`);
  128. this.paramsObj.size = val;
  129. this.getMessageList();
  130. },
  131. handleCurrentChange(val) {
  132. this.paramsObj.current = val;
  133. this.getMessageList();
  134. },
  135. },
  136. };
  137. </script>
  138. <style lang="scss" scoped>
  139. .pages {
  140. padding: 10px 20px;
  141. width: 100%;
  142. height: 100%;
  143. .container {
  144. padding: 10px 20px;
  145. width: 100%;
  146. height: 100%;
  147. background: #fff;
  148. border-radius: 8px;
  149. overflow: hidden;
  150. display: flex;
  151. flex-direction: column;
  152. .tableBox {
  153. width: 100%;
  154. height: calc(100% - 72px);
  155. .header {
  156. padding: 20px 0;
  157. display: flex;
  158. align-items: center;
  159. .h-left {
  160. flex-grow: 1;
  161. display: flex;
  162. align-items: center;
  163. .label {
  164. margin-left: 20px;
  165. display: flex;
  166. align-items: baseline;
  167. }
  168. }
  169. .h-right {
  170. flex-shrink: 0;
  171. }
  172. }
  173. .tabs {
  174. height: calc(100% - 72px);
  175. }
  176. }
  177. .btmpagiation {
  178. flex-shrink: 0;
  179. margin: 20px 0;
  180. padding: 0 20px;
  181. display: flex;
  182. justify-content: flex-end;
  183. }
  184. }
  185. }
  186. </style>