gasCcb.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="gas-ccb">
  3. <div class="top-box" v-if="typeData.includes('pump_under')">
  4. <div class="box-label">{{ pumpUnder.label }}</div>
  5. <div class="box-values">
  6. <div class="value-b" v-for="(items, ind) in pumpUnder.data" :key="ind">
  7. <span>{{ `${items.name} : ` }}</span>
  8. <span
  9. :class="{
  10. 'box-value': items.val == 0 && items.name == '报警状态',
  11. 'box-value1': items.val == 101 && items.name == '报警状态',
  12. 'box-value2': items.val == 102 && items.name == '报警状态',
  13. 'box-value3': items.val == 103 && items.name == '报警状态',
  14. 'box-value4': items.val == 104 && items.name == '报警状态',
  15. 'box-value5': items.val == 201 && items.name == '报警状态',
  16. }"
  17. >{{
  18. items.val == 0 && items.name == '报警状态'
  19. ? '正常'
  20. : items.val == 101 && items.name == '报警状态'
  21. ? '较低风险'
  22. : items.val == 102 && items.name == '报警状态'
  23. ? '低风险'
  24. : items.val == 103 && items.name == '报警状态'
  25. ? '中风险'
  26. : items.val == 104 && items.name == '报警状态'
  27. ? '高风险'
  28. : items.val == 201 && items.name == '报警状态'
  29. ? '报警'
  30. : items.val == 1001 && items.name == '报警状态'
  31. ? '网络断开'
  32. : items.val
  33. }}</span
  34. >
  35. </div>
  36. </div>
  37. </div>
  38. <div class="top-box" v-if="typeData.includes('pump_under_31')">
  39. <div class="box-label">{{ pumpOver.label }}</div>
  40. <div class="box-values">
  41. <div class="value-b" v-for="(items, ind) in pumpOver.data" :key="ind">
  42. <span>{{ `${items.name} : ` }}</span>
  43. <span
  44. :class="{
  45. 'box-value': items.val == 0 && items.name == '报警状态',
  46. 'box-value1': items.val == 101 && items.name == '报警状态',
  47. 'box-value2': items.val == 102 && items.name == '报警状态',
  48. 'box-value3': items.val == 103 && items.name == '报警状态',
  49. 'box-value4': items.val == 104 && items.name == '报警状态',
  50. 'box-value5': items.val == 201 && items.name == '报警状态',
  51. }"
  52. >{{
  53. items.val == 0 && items.name == '报警状态'
  54. ? '正常'
  55. : items.val == 101 && items.name == '报警状态'
  56. ? '较低风险'
  57. : items.val == 102 && items.name == '报警状态'
  58. ? '低风险'
  59. : items.val == 103 && items.name == '报警状态'
  60. ? '中风险'
  61. : items.val == 104 && items.name == '报警状态'
  62. ? '高风险'
  63. : items.val == 201 && items.name == '报警状态'
  64. ? '报警'
  65. : items.val == 1001 && items.name == '报警状态'
  66. ? '网络断开'
  67. : items.val
  68. }}</span
  69. >
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script setup lang="ts">
  76. import { onMounted, ref, watch, reactive } from 'vue';
  77. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  78. let props = defineProps({
  79. gasData: {
  80. type: Object,
  81. default: () => {
  82. return {};
  83. },
  84. },
  85. });
  86. let typeData = ref<any[]>(['pump_under']);
  87. let pumpUnder = reactive({});
  88. let pumpOver = reactive({});
  89. watch(
  90. () => props.gasData,
  91. (newV, oldV) => {
  92. console.log(newV, 'ccc---');
  93. let data = newV.pump;
  94. if (data && data.length != 0) {
  95. typeData.value = data.map((v) => v.deviceType);
  96. let list = {
  97. label: '',
  98. data: [],
  99. };
  100. if (typeData.value.includes('pump_under')) {
  101. let labelData = getTableHeaderColumns('pump_under_monitor');
  102. let param = labelData.map((el: any) => {
  103. return {
  104. name: el.title,
  105. val: el.dataIndex,
  106. };
  107. });
  108. let filterData = data.filter((v) => v.deviceType == 'pump_under')[0];
  109. list.label = filterData.strinstallpos;
  110. list.data = param.map((item) => {
  111. return {
  112. name: item.name,
  113. val: filterData.readData[item.val] && filterData.readData[item.val] != '0' ? filterData.readData[item.val] : '-',
  114. };
  115. });
  116. pumpUnder = Object.assign({}, list);
  117. } else if (typeData.value.includes('pump_under_31')) {
  118. let labelData = getTableHeaderColumns('pump_under_31_monitor');
  119. let param = labelData.map((el: any) => {
  120. return {
  121. name: el.title,
  122. val: el.dataIndex,
  123. };
  124. });
  125. let filterData = data.filter((v) => v.deviceType == 'pump_under_31')[0];
  126. list.label = filterData.strinstallpos;
  127. list.data = param.map((item) => {
  128. return {
  129. name: item.name,
  130. val: filterData.readData[item.val] && filterData.readData[item.val] != '0' ? filterData.readData[item.val] : '-',
  131. };
  132. });
  133. pumpOver = Object.assign({}, list);
  134. }
  135. }
  136. },
  137. { immediate: true }
  138. );
  139. onMounted(() => {});
  140. </script>
  141. <style lang="less" scoped>
  142. @import '/@/design/theme.less';
  143. @{theme-deepblue} {
  144. .gas-ccb {
  145. --image-no-choice: url('/@/assets/images/themify/deepblue/fire/no-choice.png');
  146. --image-choice: url('/@/assets/images/themify/deepblue/fire/choice.png');
  147. --image-border: url('/@/assets/images/themify/deepblue/fire/border.png');
  148. --image-bj1: url('/@/assets/images/themify/deepblue/fire/bj1.png');
  149. --image-top-area: url('/@/assets/images/themify/deepblue/fire/gas-top.png');
  150. }
  151. }
  152. .gas-ccb {
  153. --image-no-choice: url('/@/assets/images/fire/no-choice.png');
  154. --image-choice: url('/@/assets/images/fire/choice.png');
  155. --image-border: url('/@/assets/images/fire/border.png');
  156. --image-bj1: url('/@/assets/images/fire/bj1.png');
  157. --image-top-area: url('/@/assets/images/fire/gas-top.png');
  158. width: 100%;
  159. height: 100%;
  160. display: flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. padding: 0px 10px;
  164. box-sizing: border-box;
  165. .top-box {
  166. position: relative;
  167. width: 724px;
  168. height: 100%;
  169. background: var(--image-top-area) no-repeat center;
  170. background-size: 100% 100%;
  171. overflow:hidden;
  172. .box-label {
  173. position: absolute;
  174. left: 50%;
  175. top: 28px;
  176. transform: translate(-50%, 0);
  177. width: 80%;
  178. font-family: 'douyuFont';
  179. font-size: 16px;
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. word-wrap: break-word;
  184. color: #fff;
  185. }
  186. .box-values {
  187. position: absolute;
  188. left: 50%;
  189. top: 70px;
  190. transform: translate(-50%, 0);
  191. width: 84%;
  192. height:185px;
  193. display: flex;
  194. justify-content: space-between;
  195. align-items: center;
  196. flex-wrap: wrap;
  197. overflow-y:auto;
  198. .value-b {
  199. width: calc(50% - 10px);
  200. height: 25px;
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. color: #fff;
  205. font-size: 14px;
  206. span {
  207. font-size: 14px;
  208. &:last-child {
  209. font-family: 'douyuFont';
  210. color: var(--vent-table-action-link);
  211. }
  212. }
  213. .box-value {
  214. color: rgb(145, 230, 9) !important;
  215. }
  216. .box-value1 {
  217. color: var(--vent-table-action-link) !important;
  218. }
  219. .box-value2 {
  220. color: #ffff35 !important;
  221. }
  222. .box-value3 {
  223. color: #ffbe69 !important;
  224. }
  225. .box-value4 {
  226. color: #ff6f00 !important;
  227. }
  228. .box-value5 {
  229. color: #ff0000 !important;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>