fire-detail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view class="fire-detail">
  3. <u-tabs
  4. class="devic-box-tab"
  5. :current="PageCur"
  6. :list="tabList"
  7. @click="NavChange"
  8. ></u-tabs>
  9. <view class="fire-content-box">
  10. <view class="search-area" v-if="PageCur != 2">
  11. <view class="search-l">
  12. <view class="search-label">监测点:</view>
  13. <view class="search-select" @click="changeSelect">
  14. <view class="select-val">{{ searchText }}</view>
  15. <view class="select-icon">
  16. <u-icon
  17. v-if="isShowSelect"
  18. name="arrow-down"
  19. color="#0eb4fc"
  20. size="14"
  21. ></u-icon>
  22. <u-icon v-else name="arrow-up" color="#0eb4fc" size="14"></u-icon>
  23. </view>
  24. </view>
  25. <view class="select-item" v-if="!isShowSelect">
  26. <view
  27. class="item-box"
  28. v-for="(ite, ind) in selectList"
  29. :key="ind"
  30. @click="choiceSelect(ite)"
  31. >{{ ite.name }}
  32. </view>
  33. </view>
  34. </view>
  35. <view class="search-r">
  36. <!-- <image src="/static/model/alarmTrue.svg" alt="" class="icon-style" /> -->
  37. <u-icon name="warning-fill" color="#0eb4fc" size="18"></u-icon>
  38. <text class="icon-text">低风险</text>
  39. </view>
  40. </view>
  41. <!-- 内因火灾-密闭监测 -->
  42. <view class="fire-content" v-if="PageCur == 0 && isShow">
  43. <fireDetailMb :detailMb="detailData"></fireDetailMb>
  44. </view>
  45. <!-- 内因火灾-采空区 -->
  46. <view class="fire-content" v-if="PageCur == 0 && !isShow">
  47. <fireDetailCkq :detailCkq="detailData"></fireDetailCkq>
  48. </view>
  49. <!-- 外因火灾 -->
  50. <view class="fire-content" v-if="PageCur == 1">
  51. <fireDetailOut :detailWy="detailData"></fireDetailOut>
  52. </view>
  53. <!-- 火灾指标 -->
  54. <view class="fire-content-zb" v-if="PageCur == 2">
  55. <fireDetailZb :detailZb="menuList"></fireDetailZb>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import api from "@/api/api";
  62. import fireDetailMb from "./fire-detail-mb.vue";
  63. import fireDetailCkq from "./fire-detail-ckq.vue";
  64. import fireDetailOut from "./fire-detail-out.vue";
  65. import fireDetailZb from "./fire-detail-zb.vue";
  66. export default {
  67. name: "fireDetail",
  68. components: {
  69. fireDetailMb,
  70. fireDetailCkq,
  71. fireDetailOut,
  72. fireDetailZb,
  73. },
  74. props: {},
  75. watch: {},
  76. data() {
  77. return {
  78. timer: "",
  79. isShow: false,
  80. PageCur: "0",
  81. tabList: [
  82. { name: "内因火灾" },
  83. { name: "外因火灾" },
  84. { name: "火灾指标" },
  85. ],
  86. searchText: "",
  87. isShowSelect: true,
  88. selectList: [],
  89. menuList: [],
  90. detailData: {},
  91. };
  92. },
  93. beforeDestroy() {
  94. this.timer = null;
  95. clearTimeout(this.timer);
  96. },
  97. mounted() {
  98. this.getTabList();
  99. },
  100. methods: {
  101. NavChange: function (item) {
  102. clearTimeout(this.timer);
  103. this.PageCur = item.index;
  104. if (this.PageCur == 1) {
  105. this.selectList = this.menuList.external.map((el) => {
  106. return {
  107. name: el.systemname,
  108. warn: "低风险",
  109. deviceID: el.id,
  110. strtype: el.strtype,
  111. };
  112. });
  113. this.searchText = this.selectList[0].name;
  114. this.getMonitor(this.selectList[0].deviceID, true);
  115. } else if (this.PageCur == 0) {
  116. this.selectList = this.menuList.internal.map((el) => {
  117. return {
  118. name: el.systemname,
  119. warn: "低风险",
  120. deviceID: el.id,
  121. strtype: el.strtype,
  122. };
  123. });
  124. this.searchText = this.selectList[0].name;
  125. this.getMonitor(this.selectList[0].deviceID, true);
  126. } else {
  127. this.selectList = [];
  128. }
  129. },
  130. changeSelect() {
  131. this.isShowSelect = !this.isShowSelect;
  132. },
  133. choiceSelect(val) {
  134. clearTimeout(this.timer);
  135. this.searchText = val.name;
  136. this.isShowSelect = true;
  137. if (this.searchText.indexOf("采空") != -1) {
  138. this.isShow = false;
  139. } else {
  140. this.isShow = true;
  141. }
  142. this.getMonitor(val.deviceID, true);
  143. },
  144. getMonitor(deviceID, flag) {
  145. let than = this;
  146. than.timer = setTimeout(
  147. async () => {
  148. await than.getSysWarnList(deviceID, "fire");
  149. if (than.timer) {
  150. than.timer = null;
  151. }
  152. than.getMonitor(deviceID);
  153. },
  154. flag ? 0 : 3000
  155. );
  156. },
  157. //获取内因火灾下拉选项数据
  158. getTabList() {
  159. new Promise((resolve, reject) => {
  160. api
  161. .sysTypeWarn({ type: "fire" })
  162. .then((response) => {
  163. if (response.data.code == 200 && response.data.result.length != 0) {
  164. let result = response.data.result;
  165. console.log(result, "result-------");
  166. this.menuList = result;
  167. this.selectList = result.internal.map((el) => {
  168. return {
  169. name: el.systemname,
  170. warn: "低风险",
  171. deviceID: el.id,
  172. strtype: el.strtype,
  173. };
  174. });
  175. this.searchText = this.selectList[0].name;
  176. this.getMonitor(this.selectList[0].deviceID, true);
  177. } else {
  178. reject(response);
  179. }
  180. })
  181. .catch((error) => {
  182. console.log("catch===>response", response);
  183. reject(error);
  184. });
  185. });
  186. },
  187. //获取选项详情数据
  188. getSysWarnList(id, type) {
  189. new Promise((resolve, reject) => {
  190. api
  191. .sysWarn({ sysid: id, type: type })
  192. .then((response) => {
  193. if (response.data.code == 200) {
  194. let data = response.data.result;
  195. this.detailData = data;
  196. console.log(this.detailData, "火灾详情数据----------");
  197. } else {
  198. reject(response);
  199. }
  200. })
  201. .catch((error) => {
  202. console.log("catch===>response", response);
  203. reject(error);
  204. });
  205. });
  206. },
  207. },
  208. computed: {},
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. .fire-detail {
  213. position: relative;
  214. box-sizing: border-box;
  215. .devic-box-tab {
  216. padding: 0px 10px !important;
  217. }
  218. .fire-content-box {
  219. box-sizing: border-box;
  220. overflow-y: auto;
  221. .search-area {
  222. width: 100%;
  223. padding: 10px 0px;
  224. display: flex;
  225. justify-content: center;
  226. align-items: center;
  227. box-sizing: border-box;
  228. background-color: #fff;
  229. margin-bottom: 2px;
  230. .search-l {
  231. position: relative;
  232. display: flex;
  233. align-items: center;
  234. margin-right: 10px;
  235. .search-label {
  236. font-size: 12px;
  237. }
  238. .search-select {
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. width: 150px;
  243. height: 26px;
  244. border-radius: 5px;
  245. border: 1px solid #0eb4fc;
  246. padding: 5px;
  247. box-sizing: border-box;
  248. }
  249. .select-item {
  250. position: absolute;
  251. bottom: -85px;
  252. left: 55px;
  253. width: 150px;
  254. height: 80px;
  255. background-color: #fff;
  256. border: 1px solid #eee;
  257. padding: 5px 10px;
  258. border-radius: 5px;
  259. overflow-y: auto;
  260. .item-box {
  261. height: 20px;
  262. line-height: 20px;
  263. font-size: 14px;
  264. }
  265. }
  266. }
  267. .search-r {
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: center;
  271. width: 80px;
  272. padding: 4px 10px;
  273. border-radius: 5px;
  274. background: #d4ecff;
  275. .icon-style {
  276. width: 14px;
  277. height: 14px;
  278. }
  279. .icon-text {
  280. font-size: 12px;
  281. font-weight: bold;
  282. color: #0eb4fc;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. </style>