fire-detail.vue 7.7 KB

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