index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="communicate">
  3. <div class="comTop">
  4. <div class="comTopLeft">
  5. <el-input
  6. placeholder="搜索设备或编号"
  7. v-model="filterText"
  8. class="comTopLeftInput"
  9. >
  10. <template #suffix>
  11. <i class="el-icon-search el-input__icon"></i>
  12. </template>
  13. </el-input>
  14. <el-button
  15. class="search-button"
  16. icon="el-icon-plus"
  17. type="success"
  18. @click="Insert()"
  19. >
  20. 新增
  21. </el-button>
  22. </div>
  23. <div class="comRight">
  24. <el-button type="primary">导入</el-button>
  25. <el-button type="primary">导出</el-button>
  26. </div>
  27. </div>
  28. <div class="comContent">
  29. <el-table
  30. :data="
  31. tableData.filter(
  32. (data) =>
  33. !filterText ||
  34. data.deviceName
  35. .toLowerCase()
  36. .includes(filterText.toLowerCase()) ||
  37. data.deviceCode.toLowerCase().includes(filterText.toLowerCase())
  38. )
  39. "
  40. border
  41. stripe
  42. :header-cell-style="headClass"
  43. :height="Height"
  44. >
  45. <el-table-column prop="stationStatus" label="状态" width="50">
  46. <template #default="scope">
  47. <el-avatar
  48. class="status"
  49. :style="
  50. scope.row.stationStatus == 0
  51. ? 'background-color:red'
  52. : 'background-color:#04F21C'
  53. "
  54. ></el-avatar>
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. prop="deviceName"
  59. label="通信设备名称"
  60. width="150"
  61. ></el-table-column>
  62. <el-table-column
  63. prop="deviceCode"
  64. label="设备编号"
  65. width=""
  66. ></el-table-column>
  67. <el-table-column
  68. prop="deviceSite"
  69. label="所属站点"
  70. width=""
  71. ></el-table-column>
  72. <el-table-column
  73. prop="offlineTime"
  74. label="上次离线时间"
  75. width=""
  76. ></el-table-column>
  77. <el-table-column
  78. prop="onlineTime"
  79. label="上次在线时间"
  80. width=""
  81. ></el-table-column>
  82. <el-table-column
  83. prop="offlineDuration"
  84. label="离线时长"
  85. width=""
  86. ></el-table-column>
  87. <el-table-column
  88. prop="onlineDuration"
  89. label="在线时长"
  90. width=""
  91. ></el-table-column>
  92. <el-table-column
  93. prop="deviceAdd"
  94. label="设备地址"
  95. width=""
  96. ></el-table-column>
  97. <el-table-column label="操作" width="150">
  98. <template #default="scope">
  99. <el-button
  100. type="text"
  101. size="small"
  102. style="color: #409eff"
  103. @click.prevent="Update(scope.row)"
  104. >
  105. 编辑
  106. </el-button>
  107. <el-button
  108. @click="Delete(scope.$index, scope.row)"
  109. type="text"
  110. size="small"
  111. style="color: red"
  112. >
  113. 删除
  114. </el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <div class="listPagination">
  119. <el-pagination
  120. v-model:currentPage="currentPage"
  121. :page-sizes="[15, 20, 25, 30]"
  122. :page-size="15"
  123. layout="total, sizes, prev, pager, next, jumper"
  124. :total="tableData.length"
  125. @size-change="handleSizeChange"
  126. @current-change="handleCurrentChange"
  127. background
  128. ></el-pagination>
  129. </div>
  130. </div>
  131. <div></div>
  132. </div>
  133. </template>
  134. <script>
  135. import { defineComponent, ref } from 'vue'
  136. export default defineComponent({
  137. name: 'powerEquip',
  138. components: {},
  139. props: {
  140. Height: String,
  141. },
  142. data() {
  143. return {
  144. deviceNumData: [],
  145. tableData: [
  146. {
  147. stationStatus: 0,
  148. deviceName: '测试设备',
  149. deviceCode: 'cssb1',
  150. deviceSite: '站点1',
  151. offlineTime: '2021-1-1 00:00:00',
  152. onlineTime: '2021-2-1 00:00:00',
  153. offlineDuration: '180天',
  154. onlineDuration: '180天',
  155. deviceAdd: '徐乐路208号',
  156. },
  157. {
  158. stationStatus: 1,
  159. deviceName: '测试设备',
  160. deviceCode: 'cssb1',
  161. deviceSite: '站点1',
  162. offlineTime: '2021-1-1 00:00:00',
  163. onlineTime: '2021-2-1 00:00:00',
  164. offlineDuration: '180天',
  165. onlineDuration: '180天',
  166. deviceAdd: '徐乐路208号',
  167. },
  168. ],
  169. activeName: 'powerEquip',
  170. filterText: '',
  171. currentPage: ref(15),
  172. }
  173. },
  174. methods: {
  175. //新增
  176. Insert() {
  177. console.log('')
  178. },
  179. // 表头样式设置
  180. headClass() {
  181. return 'background:#FAFAFA !important;color: black;'
  182. },
  183. //修改
  184. Update(row) {
  185. console.log(row)
  186. },
  187. //删除
  188. Delete(ind, row) {
  189. console.log(ind, row)
  190. },
  191. handleSizeChange(val) {
  192. console.log(`${val} items per page`)
  193. },
  194. handleCurrentChange(val) {
  195. console.log(`current page: ${val}`)
  196. },
  197. },
  198. })
  199. </script>
  200. <style lang="scss" scoped>
  201. //first样式
  202. .communicate {
  203. margin: 15px;
  204. //顶部左侧样式
  205. .comTop {
  206. display: flex;
  207. height: 32px;
  208. line-height: 32px;
  209. .comTopLeft {
  210. width: 70%;
  211. .goBack {
  212. margin-right: 15px;
  213. }
  214. .comTopLeftTitle {
  215. font-size: 14px;
  216. margin-right: 10px;
  217. }
  218. .comTopLeftInput {
  219. width: 15rem;
  220. }
  221. .el-input__icon {
  222. color: #409eff;
  223. }
  224. .el-input__inner:hover {
  225. border-color: #409eff;
  226. }
  227. .el-input__inner:focus {
  228. border-color: #409eff;
  229. }
  230. .search-button {
  231. margin-left: 1rem;
  232. }
  233. }
  234. //顶部右侧样式
  235. .comRight {
  236. width: 30%;
  237. button {
  238. margin-left: 1rem;
  239. float: right;
  240. }
  241. }
  242. }
  243. .comContent {
  244. margin-top: 15px;
  245. }
  246. }
  247. .listPagination {
  248. margin-top: 15px;
  249. float: right;
  250. }
  251. </style>