rightTable.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div>
  3. <div class="left_004">
  4. <div class="left_003" style="font-weight: 800;font-size: 20px;">区域隐患</div>
  5. <div class="left_003">
  6. </div>
  7. </div>
  8. <table width="90%" border="1" class="t1">
  9. <thead>
  10. <th width="20%">隐患名称</th>
  11. <th width="20%">发生时间</th>
  12. <th width="20%">级别</th>
  13. <th width="20%">处理结果</th>
  14. <th width="20%">完成时间</th>
  15. </thead>
  16. <tr v-for="(item,index) in tableData" :key="index">
  17. <td>{{ item.description }}</td>
  18. <td>{{item.addTime}}</td>
  19. <td>{{item.level}}</td>
  20. <td>{{item.handleState?'已处理':'未处理'}}</td>
  21. <td>{{item.handleTime}}</td>
  22. </tr>
  23. </table>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. name: "rightTable",
  29. data() {
  30. return {
  31. viewData: {
  32. areaId: '',// string 区域ID
  33. description: '',// string 隐患描述
  34. level: '',// string 隐患级别
  35. addTime: '',// string 添加时间
  36. addUserName: '',// string 添加人
  37. handleState: '',// boolean 处理状态
  38. handleTime: '',//string 处理时间
  39. handleUserName: '',// string 处理人
  40. handleMethod: '',//string 处理方式
  41. },
  42. tableData: [],
  43. statusValue: 'a',
  44. }
  45. },
  46. mounted() {
  47. // this.getTableData();
  48. },
  49. methods: {
  50. //初始化数据
  51. getTableData() {
  52. let _data = {
  53. areaId: sessionStorage.getItem("areaId"),
  54. handleState: true
  55. };
  56. this.$get("index/areas/"+sessionStorage.getItem('areaId')+"/risks", _data).then(res => {
  57. if (res.code === 200) {
  58. this.tableData = res.data || [];
  59. } else {
  60. console.error(res.msg);
  61. }
  62. });
  63. },
  64. parentHandleclick(areaId){
  65. let _data = {
  66. areaId: areaId,
  67. handleState: true
  68. };
  69. this.$get("index/areas/"+areaId+"/risks", _data).then(res => {
  70. if (res.code === 200) {
  71. this.tableData = res.data || [];
  72. } else {
  73. console.error(res.msg);
  74. }
  75. });
  76. },
  77. changeProduct(event) {
  78. this.statusValue = event.target.value; //获取测点ID,即option对应的ID值
  79. let _data = {
  80. areaId: sessionStorage.getItem("areaId"),
  81. handleState: event.target.value
  82. };
  83. this.$get("index/areas/"+sessionStorage.getItem('areaId')+"/risks", _data).then(res => {
  84. if (res.code === 200) {
  85. this.tableData = res.data || [];
  86. } else {
  87. console.error(res.msg);
  88. }
  89. });
  90. }
  91. }
  92. }
  93. </script>
  94. <style scoped>
  95. .left_003 {
  96. text-align: left;
  97. font-size: 16px;
  98. padding: 10px;
  99. }
  100. .left_004 {
  101. display: grid;
  102. grid-template-columns: 1fr 1fr;
  103. border-bottom: white 1px solid;
  104. margin-bottom: 15px;
  105. }
  106. table {
  107. table-layout: fixed;
  108. empty-cells: show;
  109. border-collapse: collapse;
  110. margin: 0 auto;
  111. }
  112. table.hovertable tr {
  113. background-color: #d4e3e5;
  114. }
  115. td {
  116. border: 0px;
  117. height: 30px;
  118. text-align: center;
  119. font-size: 14px;
  120. }
  121. table.t1 {
  122. border: 1px solid #312D4A;
  123. color: white;
  124. }
  125. table.t1 th {
  126. border: 0px;
  127. height: 30px;
  128. padding: 0 2px 0;
  129. background-color: #312D4A;
  130. font-size: 16px;
  131. font-weight: 500;
  132. }
  133. table.t1 td, table.t1 th {
  134. border: 0px;
  135. padding: 0 1em 0;
  136. text-align: center;
  137. }
  138. table.t1 tr.a1 {
  139. background-color: #f5fafe;
  140. }
  141. table.t1 tr:nth-child(odd) {
  142. background-color: #312D4A;
  143. }
  144. table.t1 tr:nth-child(even) {
  145. background-color: #100C2A;
  146. }
  147. </style>