plane.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div id="pages">
  3. <mu-appbar style="width: 100%;" color="primary" :title="$t('Plane details')">
  4. <router-link to="/map" slot="left">
  5. <mu-icon value="arrow_back"></mu-icon>
  6. </router-link>
  7. </mu-appbar>
  8. <mu-tabs :value.sync="active" inverse color="warning" full-width>
  9. <mu-tab :id="Region.RegionId" v-for="(Region,index) in RegionList" :key="Region.RegionId">
  10. {{Region.Region}}
  11. </mu-tab>
  12. </mu-tabs>
  13. <div class="planeContainer">
  14. <ul>
  15. <li v-if="!lists.length">
  16. <h4>{{$t("no use data")}}</h4>
  17. </li>
  18. <li v-for="(list,index) in lists" v-if="lists">
  19. <div class="basic">
  20. <h5>{{list.Region}}</h5>
  21. <span>
  22. {{$t("Detection")}} :{{list.DetectorCount}}台|
  23. {{$t("Dangerous equipment found")}} :{{list.DangerCamCount}}台|
  24. {{$t("phone")}}:{{list.Signalstr == ' '? $t("No mobile signal detected"):list.Signalstr}}
  25. </span>
  26. <div v-if="imgSrc[index]" class="imgSrcContainer">
  27. <img :src="imgSrc[index]" alt="">
  28. <span class="imgContainer">
  29. <em :class="[{'green':pointStates[index].DetectorType == 0},{'red':pointStates[index].DetectorType != 0}]"
  30. v-for="(point,index) in points[index]"
  31. :style="{left:point.Width*0.30+'px',top:point.Height * -0.4+'px'}"
  32. ></em>
  33. </span>
  34. </div>
  35. <div v-else>
  36. <p class="tips">{{$t("No records found")}}</p>
  37. </div>
  38. </div>
  39. </li>
  40. </ul>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import axios from 'axios';
  46. let qs = require('qs');
  47. import Global from '../Global.js'
  48. export default {
  49. data() {
  50. return {
  51. active: 0,
  52. selected: 0,
  53. RegionList: [],
  54. lists: [],
  55. imgSrc: [],
  56. points: [],
  57. pointStates: [],
  58. }
  59. },
  60. mounted() {
  61. this.RegionDetectList();
  62. },
  63. watch: {
  64. active(val) {
  65. this.readList(this.RegionList[val]['RegionId']);
  66. }
  67. },
  68. methods: {
  69. // 读取楼栋信息
  70. RegionDetectList() {
  71. const that = this;
  72. let url = headapi + 'v1/Company/ComRegionDetectList';
  73. let comId = this.$route.query.ComId;
  74. let param = {
  75. token: localStorage.token,
  76. comId: comId
  77. };
  78. that.RegionList = [];
  79. let postdata = qs.stringify(param);
  80. axios.post(url, postdata).then(function (data) {
  81. let json = data.data;
  82. if (json.Code == 0) {
  83. that.RegionList = json.Rs;
  84. if (json.Rs) {
  85. // that.selected = json.Rs[0].RegionId;
  86. that.selected = parseInt(that.$route.query.Regionid);
  87. that.readList( that.selected);
  88. }
  89. } else {
  90. that.Toast(that.TransMemo(json.Memo));
  91. }
  92. }, function (response) {
  93. console.info(response);
  94. })
  95. },
  96. readList(regionId) {
  97. const that = this;
  98. let url = headapi + 'v1/Company/RegionDetectList';
  99. let param = {
  100. token: localStorage.token,
  101. regionId: regionId // regionId
  102. };
  103. that.lists = [];
  104. let postdata = qs.stringify(param);
  105. axios.post(url, postdata).then(function (data) {
  106. let json = data.data;
  107. if (json.Code == 0) {
  108. that.lists = json.Rs;
  109. that.imgFileter(json.Rs);
  110. that.DetectListByRegionID(json.Rs)
  111. } else {
  112. that.Toast(that.TransMemo(json.Memo));
  113. }
  114. }, function (response) {
  115. console.info(response);
  116. })
  117. },
  118. imgFileter(Rs) {
  119. const that = this;
  120. let url = headapi + 'v1/Company/RegionPictureGetByRegionId';
  121. that.imgSrc = [];
  122. for (var i = 0; i < Rs.length; i++) {
  123. let param = {
  124. token: localStorage.token,
  125. regionID: Rs[i].RegionId// regionId
  126. };
  127. let postdata = qs.stringify(param);
  128. axios.post(url, postdata).then(function (data) {
  129. let json = data.data;
  130. if (json.Code == 0) {
  131. that.imgSrc.push(json.EncodeString);
  132. }
  133. }, function (response) {
  134. console.info(response);
  135. })
  136. }
  137. },
  138. DetectListByRegionID(Rs) {
  139. const that = this;
  140. let url = headapi + 'v1/Company/DetectListByRegionID';
  141. let comId = this.$route.query.ComId;
  142. for (var i = 0; i < Rs.length; i++) {
  143. let param = {
  144. token: localStorage.token,
  145. comId: comId, // regionId
  146. regionId: Rs[i].RegionId// regionId
  147. };
  148. let postdata = qs.stringify(param);
  149. axios.post(url, postdata).then(function (data) {
  150. let json = data.data;
  151. if (json.Code == 0) {
  152. if (json.Rs) {
  153. that.points.push(json.Rs);
  154. console.log(that.points);
  155. } else {
  156. that.points = [];
  157. }
  158. if (json.DetectorType != undefined && json.DetectorType != null) {
  159. that.pointStates = json.DetectorType;
  160. } else {
  161. that.pointStates = [];
  162. return false
  163. }
  164. }
  165. }, function (response) {
  166. console.info(response);
  167. })
  168. }
  169. },
  170. },
  171. }
  172. </script>
  173. <style scoped>
  174. /*mu-header*/
  175. .mu-primary-color {
  176. line-height: 60px;
  177. height: 60px;
  178. background: url("../static/images/comm/headerBg.png") top center no-repeat;
  179. background-size: 100%;
  180. }
  181. /deep/ .mu-appbar-left {
  182. padding-top: 15px;
  183. }
  184. /deep/ .material-icons {
  185. color: #fff;
  186. }
  187. /deep/ .mu-appbar-title {
  188. text-align: center;
  189. }
  190. .mu-warning-text-color {
  191. color: #FFA200;
  192. }
  193. /deep/ .mu-tab-link-highlight {
  194. background-color: #FFA200 !important;
  195. }
  196. #pages {
  197. position: absolute;
  198. width: 100%;
  199. height: 100%;
  200. overflow-y: scroll;
  201. display: block;
  202. margin: 0 auto;
  203. background-color: #f2f2f2;
  204. top: 0;
  205. bottom: 0;
  206. }
  207. .info {
  208. width: 100%;
  209. overflow: hidden;
  210. display: block;
  211. margin: 0 auto;
  212. background: #fff;
  213. margin-bottom: 10px;
  214. padding-left: 20px;
  215. }
  216. .planeContainer li {
  217. width: 100%;
  218. height: 360px;
  219. overflow: hidden;
  220. display: block;
  221. margin: 0 auto;
  222. }
  223. .basic {
  224. width: 100%;
  225. height: 360px;
  226. overflow: hidden;
  227. display: block;
  228. margin: 0 auto;
  229. border-bottom: 1px solid #f2f2f2;
  230. background: #fff;
  231. padding: 5px 0px;
  232. }
  233. .basic h5 {
  234. border: 2px solid #f2f2f2;
  235. border-left: 0;
  236. border-right: 0;
  237. padding: 10px 0;
  238. padding-left: 20px;
  239. font-size: 14px;
  240. }
  241. .basic > span {
  242. width: 88%;
  243. overflow: hidden;
  244. display: block;
  245. margin: 0 auto;
  246. font-size: 12px;
  247. }
  248. .basic img {
  249. width: 96%;
  250. height: 200px;
  251. overflow: hidden;
  252. display: block;
  253. margin: 0 auto;
  254. margin-top: 15px;
  255. margin-bottom: 5px;
  256. }
  257. .red {
  258. width: 20px;
  259. height: 20px;
  260. border-radius: 250px !important;
  261. float: left;
  262. margin: 0;
  263. padding: 0;
  264. background-color: red;
  265. color: red;
  266. }
  267. .green {
  268. width: 20px;
  269. height: 20px;
  270. border-radius: 250px !important;
  271. float: left;
  272. margin: 0;
  273. padding: 0;
  274. background-color: yellowgreen;
  275. color: yellowgreen;
  276. }
  277. .imgSrcContainer {
  278. width: 100%;
  279. height: 220px;
  280. overflow: hidden;
  281. display: block;
  282. margin: 0 auto;
  283. }
  284. .imgContainer {
  285. position: relative;
  286. bottom: 200px;
  287. width: 96%;
  288. height: 200px;
  289. display: block;
  290. margin: 0 auto;
  291. }
  292. .imgContainer em {
  293. position: relative;
  294. }
  295. .tips {
  296. width: 100%;
  297. overflow: hidden;
  298. display: block;
  299. margin: 0 auto;
  300. text-align: center;
  301. margin-top: 10px;
  302. margin-bottom: 10px;
  303. }
  304. ul li h4 {
  305. width: 100%;
  306. overflow: hidden;
  307. display: block;
  308. margin: 0 auto;
  309. text-align: center;
  310. }
  311. </style>