index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div style="padding: 0px 35px; display: flex; justify-content: space-between">
  3. <div>
  4. <border-panel
  5. height="302px"
  6. style="margin-bottom: 6px; cursor: pointer"
  7. title="基础信息"
  8. @click="openBasicModal"
  9. >
  10. <BasicInfo :qy="qy" @showTc="showTc" @UnitType="UnitType" />
  11. </border-panel>
  12. <border-panel height="346px" style="margin-bottom: 6px" title="隐患排查">
  13. <HiddenDangerDetection :qy="qy" />
  14. </border-panel>
  15. <border-panel height="296px" header-cursor="pointer" title="自主管理" @click-header="openAutoManageModal">
  16. <AutonomousManagement @click-item="onClickAutonomousManagementItemHandler" :qy="qy" />
  17. </border-panel>
  18. </div>
  19. <div class="display: flex;">
  20. <div class="map" style="position: relative">
  21. <MapChartsCategory
  22. :mapHeatData="heatMap"
  23. :formatter="showLabel"
  24. :qx="qy"
  25. @selectArea="(area) => (qy = area)"
  26. />
  27. <div style="position: absolute; top: 10px; width: 500px">
  28. <SearchBox :area.sync="qy" />
  29. </div>
  30. </div>
  31. <div>
  32. <border-panel
  33. title="警情动态"
  34. width="938px"
  35. height="321px"
  36. :header-type="1"
  37. >
  38. <AlarmingSituationDynamics :qx="qy" :PoliceList="PoliceList" />
  39. </border-panel>
  40. </div>
  41. </div>
  42. <div>
  43. <border-panel
  44. height="311px"
  45. style="margin-bottom: 6px; cursor: pointer"
  46. header-cursor="pointer"
  47. title="风险预警"
  48. @click-header="openBasicModal"
  49. >
  50. <RiskWarning :riskList="riskList" @showFxyj="showFxyj" :qy="qy" />
  51. <template #ext-header>
  52. <img src="../../assets/images/dd_wh.png" alt="" @click="getShoeInfo('whFxModal')">
  53. </template>
  54. </border-panel>
  55. <border-panel
  56. height="331px"
  57. style="margin-bottom: 6px; cursor: pointer"
  58. title="智慧消防"
  59. >
  60. <WisdomFire :frieList="frieList" :iotList="iotList" :qy="qy" />
  61. </border-panel>
  62. <border-panel height="298px" title="火灾指标">
  63. <FireIndex :type="fireIndexType" :qx="qy" />
  64. <template #ext-header>
  65. <button-block
  66. :items="['月', '年']"
  67. @select-item="selectItemHandler"
  68. />
  69. </template>
  70. </border-panel>
  71. </div>
  72. <basic-modal top="120px" ref="basicInfoModal" name="基础信息">
  73. <BasicInfoModalContent :qy="qy" :default="defaultModel" />
  74. </basic-modal>
  75. <basic-modal top="120px" ref="autoManageModal" name="自主管理">
  76. <zzglModul ref="zzglModul"
  77. :queryParams="queryParams"
  78. :qy="qy" />
  79. </basic-modal>
  80. <!-- 风险问号弹窗 -->
  81. <basic-modal top="30px" ref="whFxModal" name="安全风险分级规则" width="90%">
  82. <div style="display: flex; justify-content: center">
  83. <img src="../../assets/images/dd-exp-fx.png" />
  84. </div>
  85. </basic-modal>
  86. </div>
  87. </template>
  88. <script>
  89. import BasicInfo from "./components/BasicInfo.vue";
  90. import AlarmingSituationDynamics from "./components/AlarmingSituationDynamics/index.vue";
  91. import AutonomousManagement from "./components/AutonomousManagement/index.vue";
  92. import HiddenDangerDetection from "./components/HiddenDangerDetection/index.vue";
  93. import MapChartsCategory from "./components/MapChartsCategory.vue";
  94. import RiskWarning from "./components/RiskWarning.vue";
  95. import WisdomFire from "./components/WisdomFire.vue";
  96. import FireIndex from "./components/FireIndex/index.vue";
  97. import BasicInfoModalContent from "./components/BasicInfoModalContent.vue";
  98. import SearchBox from "@/components/SearchBox.vue";
  99. import zzglModul from "./components/zzglModul.vue";
  100. import { totaldata, getJqdt, getZxgjtj, getJrjzsbs, getDtskgzList } from "@/api/index.js";
  101. import { fxfb } from "@/api/risk";
  102. import { formatCityData, createMapChartWindowInfo } from "@/utils";
  103. export default {
  104. name: "HomePage",
  105. components: {
  106. BasicInfo,
  107. WisdomFire,
  108. AlarmingSituationDynamics,
  109. MapChartsCategory,
  110. RiskWarning,
  111. AutonomousManagement,
  112. HiddenDangerDetection,
  113. FireIndex,
  114. BasicInfoModalContent,
  115. SearchBox,
  116. zzglModul,
  117. },
  118. data() {
  119. return {
  120. riskList: [],
  121. // 传参
  122. qy: "重庆市",
  123. params: {
  124. pageSize: 100,
  125. pageNum: 1,
  126. },
  127. PoliceList: [],
  128. frieList: {},
  129. iotList: {},
  130. fireIndexType: 0,
  131. heatMap: [],
  132. defaultModel: {},
  133. mapType: {
  134. "红色": 90,
  135. "橙色": 70,
  136. "黄色": 50,
  137. "蓝色": 30,
  138. "绿色": 10
  139. },
  140. queryParams: {
  141. glxs: "", //管理形式
  142. wbxs: "", //维保形式
  143. dxjj: "" //大修基金
  144. }
  145. }
  146. },
  147. watch: {
  148. qy() {
  149. this.getList();
  150. this.getFireList();
  151. this.getIotList();
  152. },
  153. },
  154. methods: {
  155. onClickAutonomousManagementItemHandler(data) {
  156. const temp = {
  157. glxs: "",
  158. wbxs: "",
  159. dxjj: "",
  160. }
  161. switch (data.index) {
  162. case 0:
  163. temp.glxs = data.value
  164. break;
  165. case 1:
  166. temp.wbxs = data.value
  167. break;
  168. case 2:
  169. temp.dxjj = data.value
  170. break;
  171. }
  172. this.queryParams = temp
  173. this.showModal("autoManageModal")
  174. },
  175. showLabel(params) {
  176. return createMapChartWindowInfo(
  177. {
  178. title: params.name,
  179. },
  180. () => {
  181. const item = params.data.meta
  182. let res =`
  183. <table>
  184. <tr >
  185. <td style="padding-bottom:8px;">${item.区域} 第<span style="font-size: 24px;color:red;font-weight:bold;">${item.区域排名 || 0}</span>名</td>
  186. <td></td>
  187. </tr>
  188. <tr>
  189. <td>直接财产损失 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${Math.ceil((item.直接财产损失 || 0) / 10000)}</span>万元</td>
  190. <td></td>
  191. </tr>
  192. <tr>
  193. <td>火灾起数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.火灾起数 || 0}</span>起</td>
  194. <td>亡人数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.亡人数 || 0}</span>人</td>
  195. </tr>
  196. <tr>
  197. <td>重大风险栋数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.重大风险 || 0}</span>栋</td>
  198. <td>较大风险栋数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.较大风险 || 0}</span>栋</td>
  199. </tr>
  200. <tr>
  201. <td>一般风险栋数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.一般风险 || 0}</span>栋</td>
  202. <td>低风险风数 <span style="font-size: 24px;color:#ffb800;font-weight:400;">${item.低风险 || 0}</span>栋</td>
  203. </tr>
  204. </table>
  205. `
  206. return res;
  207. }
  208. );
  209. },
  210. showTc(val) {
  211. if (val) {
  212. this.defaultModel = {
  213. qy: this.qy,
  214. dl: val
  215. }
  216. this.showModal("basicInfoModal");
  217. }
  218. },
  219. showFxyj(val){
  220. this.defaultModel = {
  221. qy: this.qy,
  222. fxdjYs: val
  223. }
  224. this.showModal("basicInfoModal");
  225. },
  226. openBasicModal() {
  227. this.showModal("basicInfoModal");
  228. },
  229. UnitType(name){
  230. const params={
  231. qy:this.qy,
  232. }
  233. if (name == "超高层建筑总数(栋)") {
  234. params.gd = "100米以上";
  235. }
  236. if (name == "2000年底前老旧住宅建筑总数(栋)") {
  237. params.jcnd = "2000年前";
  238. params.dl = "住宅建筑";
  239. }
  240. if (name == "2000年底前老旧商业混合体建筑总数(栋)") {
  241. params.jcnd = "2000年前";
  242. params.dl = "公共建筑";
  243. }
  244. this.defaultModel = params
  245. this.showModal("basicInfoModal");
  246. },
  247. getShoeInfo(name){
  248. this.showModal(name);
  249. },
  250. // 风险预警
  251. getList(){
  252. totaldata({...this.params,qy:this.qy==="重庆市"?"":this.qy}).then(res=>{
  253. if(res.data.code==200){
  254. this.riskList=res.data.rows
  255. }
  256. }).catch(error=>{
  257. this.$message({
  258. message: res.data.msg,
  259. type: "error"
  260. });
  261. })
  262. },
  263. selectItemHandler(idx) {
  264. this.fireIndexType = idx;
  265. },
  266. getStaic() {
  267. getJqdt(this.params).then((res) => {
  268. this.PoliceList = res.data.rows;
  269. });
  270. },
  271. //智慧消防
  272. getFireList() {
  273. getZxgjtj({
  274. ...this.params,
  275. name: this.qy === "重庆市" ? "" : this.qy,
  276. }).then((res) => {
  277. this.frieList = res.data.rows[0];
  278. });
  279. },
  280. // 物联网栋数
  281. getIotList() {
  282. getJrjzsbs({
  283. ...this.params,
  284. name: this.qy === "重庆市" ? "" : this.qy,
  285. }).then((res) => {
  286. this.iotList = res.data.rows[0];
  287. });
  288. },
  289. openAutoManageModal() {
  290. this.showModal("autoManageModal");
  291. },
  292. loadMapData() {
  293. getDtskgzList({
  294. pageNum: 1,
  295. pageSize: 42,
  296. }).then((res) => {
  297. let tempData = res.data.rows;
  298. this.heatMap = formatCityData(
  299. tempData.map((item) => ({
  300. name: item.qx,
  301. value: this.mapType[item.分区颜色],
  302. meta: item
  303. }))
  304. );
  305. });
  306. },
  307. },
  308. created() {
  309. this.getList();
  310. this.getStaic();
  311. this.getFireList();
  312. this.getIotList();
  313. this.loadMapData();
  314. },
  315. };
  316. </script>
  317. <style scoped>
  318. .map {
  319. flex: 1;
  320. }
  321. </style>