fire-detail-zb.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <!-- 外因火灾 -->
  3. <view class="fire-detail-zb">
  4. <view class="top-area">
  5. <view class="echartBox">
  6. <warnZb
  7. :resetIndex="0"
  8. :widthV="widthV"
  9. :heightV="heightV"
  10. :coordDw="coordDw"
  11. :widthCanvas="widthCanvas"
  12. :heightCanvas="heightCanvas"
  13. :stageList="stageList"
  14. ></warnZb>
  15. </view>
  16. </view>
  17. <view class="bot-area">
  18. <view
  19. class="bot-content"
  20. v-for="(item, index) in botContentList"
  21. :key="index"
  22. >
  23. <view class="content-title">序号:{{ seqNo(index) }}</view>
  24. <view class="content-item-box">
  25. <view
  26. class="content-item"
  27. v-for="(card, cIndex) in cardList"
  28. :key="cIndex"
  29. >
  30. <view class="item-icon">
  31. <image class="icon-img" :src="card.icon" mode="aspectFit"></image>
  32. </view>
  33. <view class="item-info">
  34. <view class="item-value">{{ cellValue(item, card.key) }}</view>
  35. <view class="item-label">{{ card.label }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import api from "@/api/api";
  45. import warnZb from "./warn-zb.vue";
  46. export default {
  47. name: "fireDetailZb",
  48. components: {
  49. warnZb,
  50. },
  51. props: {
  52. detailZb: {
  53. type: Object,
  54. default: () => {
  55. return {};
  56. },
  57. },
  58. },
  59. data() {
  60. return {
  61. widthV: "85%",
  62. heightV: "85%",
  63. coordDw: [16, 42],
  64. widthCanvas: "302px",
  65. heightCanvas: "194px",
  66. botContentList: [],
  67. //底部卡片:名称、取值字段、对应图标
  68. cardList: [
  69. {
  70. label: "预警等级",
  71. key: "level",
  72. icon: "/static/warndata/yujing-dengji.svg",
  73. },
  74. {
  75. label: "煤自燃阶段",
  76. key: "alarmName",
  77. icon: "/static/warndata/meiziran-jieduan.svg",
  78. },
  79. {
  80. label: "指标",
  81. key: "alarmInfo",
  82. icon: "/static/warndata/zhibiao.svg",
  83. },
  84. {
  85. label: "条件",
  86. key: "alarmdes",
  87. icon: "/static/warndata/tiaojian.svg",
  88. },
  89. {
  90. label: "温度",
  91. key: "temperature",
  92. icon: "/static/warndata/wendu.svg",
  93. },
  94. {
  95. label: "参考值",
  96. key: "address",
  97. icon: "/static/warndata/cankaozhi.svg",
  98. },
  99. ],
  100. };
  101. },
  102. watch: {
  103. detailZb: {
  104. handler(newZ, oldZ) {
  105. console.log(newZ, "newZ--------------");
  106. let that = this;
  107. if (JSON.stringify(newZ) != "{}") {
  108. that.botContentList = newZ.info[0].list;
  109. }
  110. },
  111. immediate: true,
  112. deep: true,
  113. },
  114. },
  115. mounted() {},
  116. methods: {
  117. //序号,补零显示:01、02……
  118. seqNo(index) {
  119. const num = index + 1;
  120. return num < 10 ? "0" + num : "" + num;
  121. },
  122. //卡片取值,空值统一显示--
  123. cellValue(item, key) {
  124. const value = item ? item[key] : "";
  125. return value === null || value === undefined || value === ""
  126. ? "--"
  127. : value;
  128. },
  129. },
  130. computed: {
  131. //当前数据中出现的煤自燃阶段(用于曲线图区间高亮)
  132. stageList() {
  133. const list = [];
  134. this.botContentList.forEach((ite) => {
  135. if (ite.alarmName && list.indexOf(ite.alarmName) === -1) {
  136. list.push(ite.alarmName);
  137. }
  138. });
  139. return list;
  140. },
  141. },
  142. };
  143. </script>
  144. <style lang="scss" scoped>
  145. .fire-detail-zb {
  146. width: 100%;
  147. height: 100%;
  148. // box-sizing: border-box;
  149. // overflow-y: auto;
  150. .top-area {
  151. width: 100%;
  152. padding: 10px;
  153. background-color: #f9f9fb;
  154. border: 1px solid #fff;
  155. border-radius: 10px;
  156. margin-bottom: 10px;
  157. box-sizing: border-box;
  158. .echartBox {
  159. width: 100%;
  160. height: 250px;
  161. }
  162. }
  163. .bot-area {
  164. width: 100%;
  165. padding: 10px;
  166. background-color: #f9f9fb;
  167. border: 1px solid #fff;
  168. border-radius: 10px;
  169. box-sizing: border-box;
  170. .bot-content {
  171. margin-bottom: 15px;
  172. &:last-child {
  173. margin-bottom: 0;
  174. }
  175. .content-title {
  176. height: 26px;
  177. line-height: 26px;
  178. padding: 0px 20px;
  179. font-size: 13px;
  180. font-weight: 600;
  181. color: #1f3a68;
  182. background: url("/static/warndata/1-1.png") no-repeat;
  183. background-size: 100% 100%;
  184. }
  185. .content-item-box {
  186. display: flex;
  187. flex-wrap: wrap;
  188. padding: 10px 0px 0px;
  189. .content-item {
  190. width: calc((100% - 12px) / 2);
  191. height: 62px;
  192. margin-right: 6px;
  193. margin-bottom: 8px;
  194. padding: 0px 6px;
  195. box-sizing: border-box;
  196. display: flex;
  197. align-items: center;
  198. background: linear-gradient(
  199. to bottom,
  200. rgba(175, 195, 252, 0.6) 0%,
  201. rgba(175, 195, 252, 0.1) 100%
  202. );
  203. border-radius: 10px;
  204. &:nth-child(2n) {
  205. margin-right: 0px;
  206. }
  207. .item-icon {
  208. flex-shrink: 0;
  209. width: 34px;
  210. height: 34px;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. border-radius: 8px;
  215. background: linear-gradient(135deg, #80b4ff, #347df3);
  216. .icon-img {
  217. width: 18px;
  218. height: 18px;
  219. filter: brightness(0) invert(1);
  220. }
  221. }
  222. .item-info {
  223. flex: 1;
  224. min-width: 0px;
  225. padding-left: 6px;
  226. display: flex;
  227. flex-direction: column;
  228. justify-content: center;
  229. .item-value {
  230. font-size: 12px;
  231. font-weight: bold;
  232. line-height: 16px;
  233. color: #2b7cff;
  234. word-break: break-all;
  235. }
  236. .item-label {
  237. margin-top: 2px;
  238. font-size: 11px;
  239. line-height: 14px;
  240. color: #000;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. </style>