fire-detail.vue 9.0 KB

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