WarnLeftTop.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!-- 报警信息左侧顶部组件:包含报警搜索、报警列表展示及详情查看功能 -->
  2. <template>
  3. <div class="search-table">
  4. <!-- 搜索区域:包含搜索输入框和筛选按钮 -->
  5. <div class="search-area">
  6. <a-input v-model:value="searchWarn" placeholder="搜索报警" size="small" />
  7. <div class="search-btn">
  8. <div class="btn-item">筛选</div>
  9. </div>
  10. </div>
  11. <!-- 内容区域:包含表头和表格数据 -->
  12. <div class="content-area">
  13. <!-- 表头:根据 warnTitle 配置动态渲染列标题 -->
  14. <div class="content-title">
  15. <div class="title-item" v-for="(item, index) in warnTitle" :key="index">{{ item.label }}</div>
  16. </div>
  17. <!-- 表格数据列表:遍历 tableData 渲染每行报警信息 -->
  18. <div class="table-content">
  19. <div class="content-item" v-for="(item, index) in tableData" :key="index">
  20. <div class="item-text" v-for="(ite, ind) in warnTitle" :key="ind">
  21. <!-- 报警时间列 -->
  22. <div v-if="ite.value == 'starttime'">{{ item[ite.value] }}</div>
  23. <!-- 报警名称列 -->
  24. <div v-if="ite.value == 'alarmName'">{{ item[ite.value] }}</div>
  25. <!-- 报警等级列:根据不同等级码显示对应颜色和文字 -->
  26. <!-- 101-低风险(蓝色) 102-一般风险(黄色) 103-较大风险(橙色) 104-重大风险(红色) 201-报警(深红色) -->
  27. <div v-if="ite.value == 'alarmLevel'"
  28. :style="{ color: item[ite.value] == 101 ? '#00d8ff' : item[ite.value] == 102 ? '#fcfc22' : item[ite.value] == 103 ? '#ff7010' : item[ite.value] == 104 ? '#df4e43' : item[ite.value] == 201 ? '#ff0000' : '' }">
  29. {{ item[ite.value] == 101 ? '低风险' : item[ite.value] ==
  30. 102 ? '一般风险' :
  31. item[ite.value] == 103 ? '较大风险' : item[ite.value] == 104 ? '重大风险' : item[ite.value] == 201 ? '报警' :
  32. '低风险' }}</div>
  33. <!-- 处理状态列:0-未处理(红色) 其他-已处理(绿色) -->
  34. <div v-if="ite.value == 'isok'" :style="{ color: item[ite.value] === 0 ? '#fd0404' : '#0eca74' }">{{
  35. item[ite.value] === 0 ? '未处理' : '已处理' }}</div>
  36. <!-- 操作列:点击"详情"触发详情查看 -->
  37. <div v-if="ite.value == 'operation'">
  38. <span class="text-look" @click="handlerDetail(item)">详情</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script setup lang="ts">
  47. import { ref, type PropType } from 'vue'
  48. import { warnTitle } from '../hsqHome.data'
  49. // 接收父组件传入的报警数据列表
  50. let props = defineProps({
  51. tableData: {
  52. type: Array as PropType<any[]>,
  53. default: () => [],
  54. },
  55. })
  56. // 报警搜索关键词
  57. let searchWarn = ref('')
  58. // 定义事件:detail - 查看报警详情
  59. let $emit = defineEmits(['detail'])
  60. // 点击"详情"按钮,向父组件派发 detail 事件并传递当前行数据
  61. function handlerDetail(item: any) {
  62. $emit('detail', item)
  63. }
  64. </script>
  65. <style lang="less" scoped>
  66. @import '/@/design/theme.less';
  67. @{theme-deepblue} {
  68. .search-table {}
  69. }
  70. /* 整体容器:定义背景图片变量及基础布局 */
  71. .search-table {
  72. --image-box-bg1: url('@/assets/images/home-container/configurable/hsq/2-6.png');
  73. --image-box-bg2: url('@/assets/images/home-container/configurable/hsq/2-24.png');
  74. position: relative;
  75. width: 100%;
  76. height: 100%;
  77. padding: 15px;
  78. box-sizing: border-box;
  79. }
  80. /* 搜索区域:输入框与筛选按钮水平排列 */
  81. .search-area {
  82. height: 42px;
  83. display: flex;
  84. justify-content: space-between;
  85. align-items: center;
  86. margin-bottom: 5px;
  87. }
  88. /* 筛选按钮外框 */
  89. .search-btn {
  90. width: 85px;
  91. height: 30px;
  92. border: 1px solid #01fefc;
  93. border-radius: 4px;
  94. padding: 3px;
  95. cursor: pointer;
  96. }
  97. /* 筛选按钮内部填充 */
  98. .btn-item {
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. width: 100%;
  103. height: 100%;
  104. background-color: rgba(32, 166, 169);
  105. }
  106. /* 内容区域:占据搜索区域以下的所有空间 */
  107. .content-area {
  108. height: calc(100% - 47px);
  109. }
  110. /* 表头行:使用背景图片装饰 */
  111. .content-title {
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. height: 34px;
  116. background: var(--image-box-bg2) no-repeat;
  117. background-size: 100% 100%;
  118. margin-bottom: 6px;
  119. }
  120. /* 表头列项:统一居中,青色文字,按列分配 flex 比例 */
  121. .title-item {
  122. display: flex;
  123. justify-content: center;
  124. align-items: center;
  125. color: #01fefc;
  126. &:nth-child(1) {
  127. flex: 2;
  128. }
  129. &:nth-child(2) {
  130. flex: 2;
  131. }
  132. &:nth-child(3) {
  133. flex: 1;
  134. }
  135. &:nth-child(4) {
  136. flex: 1;
  137. }
  138. &:nth-child(5) {
  139. flex: 1;
  140. }
  141. }
  142. /* 表格内容区:可纵向滚动 */
  143. .table-content {
  144. height: calc(100% - 40px);
  145. overflow-y: auto;
  146. }
  147. /* 数据行:奇偶行交替背景色 */
  148. .content-item {
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. height: 36px;
  153. &:nth-child(odd) {
  154. background-color: #0e3455;
  155. }
  156. &:nth-child(even) {
  157. background-color: #114268;
  158. }
  159. }
  160. /* 数据单元格:居中对齐,按列分配 flex 比例(与表头一致) */
  161. .item-text {
  162. display: flex;
  163. justify-content: center;
  164. align-items: center;
  165. text-align: center;
  166. &:nth-child(1) {
  167. flex: 2;
  168. }
  169. &:nth-child(2) {
  170. flex: 2;
  171. }
  172. &:nth-child(3) {
  173. flex: 1;
  174. }
  175. &:nth-child(4) {
  176. flex: 1;
  177. }
  178. &:nth-child(5) {
  179. flex: 1;
  180. }
  181. }
  182. /* "详情"操作按钮样式 */
  183. .text-look {
  184. padding: 0px 3px;
  185. margin: 0px 2px;
  186. border-radius: 2px;
  187. background-color: #2484bc;
  188. cursor: pointer;
  189. }
  190. /* 搜索输入框:自定义背景图片,去除默认边框 */
  191. .zxm-input {
  192. height: 42px;
  193. color: #fff;
  194. background-color: transparent;
  195. border: none;
  196. background: var(--image-box-bg1) no-repeat;
  197. background-size: 100% 100%;
  198. }
  199. /* 小尺寸输入框内边距 */
  200. .zxm-input-sm {
  201. padding: 0px 20px;
  202. }
  203. /* 隐藏滚动条 */
  204. ::-webkit-scrollbar {
  205. display: none;
  206. }
  207. </style>