siteList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="app-container">
  3. <!-- 返回start -->
  4. <div class="siteTitle">
  5. <el-button class="goBack" @click="goBack">返回</el-button>
  6. 台区1-站点列表
  7. </div>
  8. <!-- 返回end -->
  9. <!-- 表格start -->
  10. <el-table
  11. :data="tableData"
  12. border
  13. stripe
  14. :header-cell-style="headClass"
  15. :cell-style="cellStyle"
  16. >
  17. <el-table-column
  18. fixed
  19. prop="siteName"
  20. label="站点名称"
  21. width=""
  22. ></el-table-column>
  23. <el-table-column prop="stationStatus" label="状态" width="">
  24. <template #default="scope">
  25. <el-avatar class="status" :class="[scope.row.deviceStatusr=='离线'? 'offline':'online']"></el-avatar>
  26. </template>
  27. </el-table-column>
  28. <el-table-column
  29. prop="deviceName"
  30. label="设备名称"
  31. width=""
  32. ></el-table-column>
  33. <el-table-column prop="monitoringEquipmentNo" label="监控设备编号" width="">
  34. <template #default="scope">
  35. <span>{{scope.row.monitoringEquipmentNo?scope.row.monitoringEquipmentNo:'--'}}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="ratedVoltage" label="额定电压" width=""></el-table-column>
  39. <el-table-column prop="ratedCurrent" label="额定电流" width=""></el-table-column>
  40. <el-table-column
  41. prop="currentLoadRate"
  42. label="电流负载率门限"
  43. width=""
  44. ></el-table-column>
  45. <el-table-column fixed="right" label="操作" width="250">
  46. <template #default="scope">
  47. <el-button @click="handleClick(scope.row)" type="text" size="small">
  48. 查看
  49. </el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <!-- 表格end -->
  54. </div>
  55. </template>
  56. <script>
  57. import { defineComponent, ref,onMounted } from 'vue'
  58. import * as api from '@/api/stationManage/index.js'
  59. import { ElMessage } from 'element-plus'
  60. export default defineComponent({
  61. name: 'SiteList',
  62. props: ['pageShow', 'goSiteListParam'],
  63. setup(props, context) {
  64. const showDialog = ref(false)
  65. const input = ref('请输入台区名称')
  66. const tableData = ref([])
  67. const goBack = () => {
  68. context.emit('func')
  69. }
  70. // 表头样式设置
  71. const headClass = () => {
  72. return 'background:#FAFAFA;'
  73. }
  74. //自定义列样式
  75. const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  76. row, column, rowIndex
  77. if (columnIndex === 1) {
  78. return `color:#04F21C`
  79. } else {
  80. return ''
  81. }
  82. }
  83. //查看
  84. const handleClick = (row) => {
  85. alert('查看对应站点(页面跳转)')
  86. console.log(row)
  87. }
  88. //站点设备列表
  89. function siteDeviceList() {
  90. api
  91. .siteDeviceList({"stationAreaId":props.goSiteListParam})
  92. .then((requset) => {
  93. if (requset.status === 'SUCCESS') {
  94. // console.log(requset.data)
  95. tableData.value = requset.data
  96. } else {
  97. ElMessage.error(requset.msg)
  98. }
  99. })
  100. }
  101. onMounted(() => {
  102. siteDeviceList()
  103. })
  104. return {
  105. tableData,
  106. input,
  107. showDialog,
  108. headClass,
  109. cellStyle,
  110. goBack,
  111. handleClick,
  112. }
  113. },
  114. })
  115. </script>
  116. <style lang='scss' scoped>
  117. </style>