riskDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div class="main">
  3. <Header/>
  4. <div class="main_t">
  5. <div class="main_t_t">
  6. <i class="main_t_t_l">当前位置:首页 &gt;</i>
  7. <i>危险源统计</i>
  8. </div>
  9. <div class="main_t_b" id="plan_chart"></div>
  10. </div>
  11. <div class="main_b">
  12. <!--查询条件-->
  13. <el-form :model="editForm" ref="queryParams" class="form-box" :inline="true" style="margin:20px;">
  14. <el-form-item label="实验室" prop="dangerId" label-width="98px">
  15. <el-select v-model="editForm.subId" popper-class="select-big-data" placeholder="请选择实验室">
  16. <el-option
  17. v-for="item in labList"
  18. :key="item.id"
  19. :label="item.name"
  20. :value="item.id">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="危险源" prop="dangerId" label-width="98px">
  25. <el-select v-model="editForm.hazardId" popper-class="select-big-data" placeholder="请选择危险源">
  26. <el-option
  27. v-for="item in riskList"
  28. :key="item.id"
  29. :label="item.anotherName"
  30. :value="item.id">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label-width="0">
  35. <el-button type="primary" @click.native.prevent="onSearch" native-type="submit">查询</el-button>
  36. <el-button @click="resetForm('searchForm')">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <!--列表-->
  40. <el-table :data="tableData" style="width: 100%;" height="420" :row-class-name="tableRowClassName">
  41. <el-table-column align="center" header-align='center' type="index" :index="indexMethod" label="序号" width="60"></el-table-column>
  42. <el-table-column align="center" header-align='center' prop="chName" label="危险源"></el-table-column>
  43. <el-table-column align="center" header-align='center' prop="num" label="数量"></el-table-column>
  44. <el-table-column align="center" header-align='center' prop="percentageNum" label="占比" width="420">
  45. <template slot-scope="scope">
  46. <el-progress :percentage="Number(scope.row.percentageNum)" :stroke-width="20"></el-progress>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <el-pagination
  51. style="margin-top: 14px"
  52. background
  53. @current-change="handleCurrentChange"
  54. :page-sizes="[10, 20, 30, 40]"
  55. :current-page.sync="editForm.pageNum"
  56. :page-size="editForm.pageSize"
  57. layout="total,prev, pager, next"
  58. :total="totalNum">
  59. </el-pagination>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import {
  65. departmentsList,
  66. getSubjectDict,
  67. queryHazardColumnarTop,
  68. queryHazardList,
  69. queryHazardOption
  70. } from "../api/http"
  71. import Header from '@/components/header.vue'
  72. export default {
  73. components: {
  74. Header
  75. },
  76. data() {
  77. return {
  78. editForm:{
  79. deptLevel:'',//这个是登陆后,刘波给你的院校的类型
  80. groupDeptId:'',//院系id
  81. subId:'',//实验室
  82. hazardId:'',//危险源
  83. pageNum:1,
  84. pageSize:10
  85. },
  86. subjectOptions:[],//院系
  87. riskList:[],//危险源
  88. totalNum:0,
  89. tableData:[
  90. {
  91. chName:'危化品',
  92. num:'73',
  93. unit:'kg',
  94. percentageNum:'73',
  95. },
  96. {
  97. chName:'气瓶',
  98. num:'62',
  99. unit:'瓶',
  100. percentageNum:'62',
  101. },
  102. {
  103. chName:'冷热设备',
  104. num:'51',
  105. unit:'台',
  106. percentageNum:'51',
  107. },
  108. {
  109. chName:'特种设备',
  110. num:'34',
  111. unit:'台',
  112. percentageNum:'34',
  113. },
  114. ],
  115. labList:[],
  116. }
  117. },
  118. methods: {
  119. back(){
  120. this.$router.push('/')
  121. },
  122. tableRowClassName({ rowIndex}) {
  123. if (rowIndex%2 === 0) {
  124. return 'success-row';
  125. } else{
  126. return 'warning-row';
  127. }
  128. },
  129. indexMethod(index) {
  130. return (this.editForm.pageNum - 1) * this.editForm.pageSize + index + 1;
  131. },
  132. //请求列表
  133. getAjaxList:function (){
  134. let _this=this;
  135. //列表
  136. let obj={
  137. 'groupDeptId':this.editForm.groupDeptId,
  138. 'subjectId':this.editForm.subId,
  139. 'hazardId':this.editForm.hazardId,
  140. 'pageNum':this.editForm.pageNum,
  141. 'pageSize':this.editForm.pageSize,
  142. }
  143. queryHazardList(obj).then((res) =>{
  144. if(res.code==200){
  145. let data = res.rows;
  146. if(data && data.length>0){
  147. _this.tableData = data;
  148. _this.totalNum = parseInt(res.total);
  149. }else{
  150. _this.tableData = [];
  151. _this.totalNum = 0;
  152. }
  153. }
  154. })
  155. },
  156. getAjaxData: function () {
  157. let _this=this;
  158. //图表
  159. let obj={
  160. 'deptLevel':localStorage.getItem('deptLevel'),
  161. }
  162. queryHazardColumnarTop(obj).then((res) =>{
  163. if(res.code==200){
  164. let dataX=[];
  165. let dataValue=[];
  166. let data=res.data;
  167. for (var i = 0; i < data.length; i++) {
  168. dataX.push(data[i].chName)
  169. dataValue.push(data[i].num)
  170. }
  171. _this.riskDetailFun(dataX,dataValue)
  172. }
  173. })
  174. //查询危险源
  175. queryHazardOption({}).then((res) =>{
  176. if(res.code==200){
  177. let data=res.data;
  178. _this.riskList=data
  179. }
  180. })
  181. //查询院系
  182. departmentsList().then((res) =>{
  183. if(res.code==200){
  184. let data=res.data;
  185. _this.subjectOptions=data
  186. }
  187. })
  188. //查询实验室
  189. getSubjectDict().then((res) =>{
  190. if(res.code==200){
  191. let data=res.data;
  192. _this.labList=data
  193. }
  194. })
  195. },
  196. /*查询*/
  197. onSearch() {
  198. this.editForm.pageNum =1;
  199. this.getAjaxList();
  200. },
  201. /*重置*/
  202. resetForm() {
  203. this.editForm.subId = "";
  204. this.editForm.hazardId = "";
  205. this.editForm.groupDeptId = "";
  206. this.onSearch();
  207. },
  208. handleCurrentChange(val) {
  209. this.editForm.pageNum = val;
  210. this.getAjaxList();
  211. },
  212. /*安全隐患详情图表*/
  213. riskDetailFun:function (dataX,dataValue) {
  214. //const sideData = data.map(item => item + 4.5)//侧边主体高度
  215. let planOption = {
  216. color: ['#3398DB'],
  217. tooltip : {
  218. /* trigger: 'axis',
  219. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  220. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  221. }*/
  222. },
  223. grid: {
  224. left: '3%',
  225. right: '4%',
  226. bottom: '3%',
  227. containLabel: true
  228. },
  229. xAxis : [
  230. {
  231. type : 'category',
  232. data : dataX,
  233. axisLabel: {
  234. textStyle: {//改变X轴字体颜色
  235. color: '#fff',
  236. },
  237. },
  238. axisTick:{//去掉X轴刻度
  239. show:false,
  240. },
  241. axisLine:{
  242. show: true,
  243. lineStyle: {
  244. "color": "#486CC2",
  245. width:2,
  246. }
  247. },
  248. }
  249. ],
  250. yAxis : [
  251. {
  252. type : 'value',
  253. splitLine: { // 分隔线
  254. show: false, // 默认显示,属性show控制显示与否
  255. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  256. color: ['#fff'],
  257. width: 1,
  258. type: 'solid',
  259. opacity:0.15
  260. },
  261. },
  262. axisLabel: {
  263. textStyle: {//改变X轴字体颜色
  264. color: '#fff',
  265. },
  266. },
  267. axisTick:{//去掉X轴刻度
  268. show:false,
  269. },
  270. axisLine:{
  271. show:true,
  272. lineStyle: {
  273. "color": "#486CC2",
  274. width:2,
  275. }
  276. },
  277. }
  278. ],
  279. series : [
  280. {
  281. name:'危险源统计',
  282. label: {
  283. normal: {
  284. show: true,
  285. position: 'top',
  286. textStyle: {
  287. color: '#fff',
  288. }
  289. }
  290. },
  291. itemStyle: {
  292. normal: {
  293. borderRadius:4,
  294. color: new this.$echarts.graphic.LinearGradient(
  295. 0, 0, 0, 1,
  296. [
  297. {offset: 0, color: '#007EFF'},
  298. {offset: 1, color: '#3FFFEA'}
  299. ]
  300. )
  301. },
  302. },
  303. type:'bar',
  304. barWidth: '60%',
  305. barMaxWidth: '5%',
  306. data:dataValue
  307. }
  308. ]
  309. };
  310. var plan_chart = this.$echarts.init(document.getElementById('plan_chart'));
  311. plan_chart.setOption(planOption);
  312. }
  313. },
  314. mounted() {
  315. this.getAjaxData()
  316. this.getAjaxList()
  317. },
  318. }
  319. </script>
  320. <!-- Add "scoped" attribute to limit CSS to this component only -->
  321. <style lang="scss" scoped>
  322. @function rw($px){
  323. @return $px*100/1920 *1vw;
  324. }
  325. @function rh($px){
  326. @return $px*100/1080 *1vh;
  327. }
  328. * {
  329. padding: 0;
  330. margin: 0;
  331. box-sizing: border-box;
  332. }
  333. .main {
  334. width: rw(1920);
  335. height: rh(1080);
  336. /* background: url("../img/index_bg.png") no-repeat;
  337. background-size: 100% 100%;*/
  338. position: relative;
  339. left: 0;
  340. top: 0;
  341. z-index: 50;
  342. background: #062338;
  343. .header {
  344. width: 100%;
  345. position: absolute;
  346. left: rw(0);
  347. top: rh(0);
  348. z-index: 100;
  349. display: flex;
  350. justify-content: flex-start;
  351. .header_l {
  352. width: rw(182);
  353. height: rh(44);
  354. margin: rh(10) 0 0 rw(40);
  355. }
  356. .header_c {
  357. width: rw(1180);
  358. height: rh(152);
  359. margin-left: rw(136);
  360. background: url("~@/assets/image/index_icon2.png") no-repeat;
  361. background-size: 100% 100%;
  362. font-size: rh(30);
  363. font-family: Microsoft YaHei;
  364. font-weight: bold;
  365. color: #FFFFFF;
  366. line-height: rh(30);
  367. text-align: center;
  368. padding-top: rh(26);
  369. }
  370. .header_r {
  371. margin-left: rw(264);
  372. width: rw(82);
  373. height: rh(32);
  374. margin-top: rh(18);
  375. }
  376. }
  377. .main_t{
  378. background: rgba(9, 55, 81, 0.6);
  379. width: rw(1852);
  380. height: rh(352);
  381. position: absolute;
  382. left: rw(34);
  383. top: rh(86);
  384. z-index: 200;
  385. .main_t_t{
  386. margin: rh(20) 0 0 rw(18);
  387. >i{
  388. font-size: rh(16);
  389. font-family: Microsoft YaHei;
  390. font-weight: bold;
  391. color: #FFFFFF;
  392. line-height: rh(16);
  393. }
  394. >i:nth-of-type(1){
  395. }
  396. >i:nth-of-type(2){
  397. color: #1ED0F8;
  398. }
  399. }
  400. .main_t_b{
  401. width: rw(1852);
  402. height: rh(302);
  403. }
  404. }
  405. .main_b{
  406. background: rgba(9, 55, 81, 0.6);
  407. padding: 0 rw(32);
  408. width: rw(1852);
  409. height: rh(602);
  410. position: absolute;
  411. left: rw(34);
  412. top: rh(468);
  413. z-index: 200;
  414. }
  415. }
  416. </style>
  417. <style lang="scss">
  418. li{list-style:none}
  419. i,em,b{font-style:normal;font-weight:100;}
  420. body{margin: 0}
  421. </style>