index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <div class="app-container home" >
  3. <div id="main" >
  4. <el-row :gutter="4">
  5. <el-col :span="12">
  6. <div class="card_left">
  7. <el-col :span="24">
  8. <el-card class="box-card card1 " v-loading="loading1">
  9. <span class="title">
  10. <el-image
  11. class="imgTitle"
  12. :src="img"
  13. ></el-image>
  14. <p>{{title}}</p>
  15. </span>
  16. <div class="contain">
  17. <div>
  18. <span>电量</span>
  19. <div>
  20. <p>{{index1Data.dianliang}} %</p>
  21. </div>
  22. </div>
  23. <div>
  24. <span>信号</span>
  25. <div>
  26. <p>{{index1Data.xinhao}}</p>
  27. </div>
  28. </div>
  29. <div>
  30. <span>时间</span>
  31. <div>
  32. <p style="font-size:0.8vw;line-height:4vh">{{index1Data.createTime}}</p>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="contain2" v-if="contain2">
  37. <div class="wrap">
  38. <index3 :resData="index1Data" style="width:100%" alt="饼图" />
  39. <p>设备工况</p>
  40. </div>
  41. </div>
  42. </el-card>
  43. </el-col>
  44. </div>
  45. </el-col>
  46. <el-col :span="12">
  47. <div class="card_right">
  48. <el-card class="box-card card2" v-loading="loading2">
  49. <div class="contain" v-if="contain2">
  50. <index4
  51. :resData="index2Data"
  52. style="width:100%;height:40vh;" alt="折线图" />
  53. </div>
  54. </el-card>
  55. </div>
  56. </el-col>
  57. <el-col :span="24">
  58. <div class="card_bottom">
  59. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
  60. <el-form-item label="单位名称:" prop="companyCode">
  61. <el-select
  62. v-model="queryParams.companyCode"
  63. placeholder="请选择单位名称"
  64. clearable
  65. size="small"
  66. style="width: 160px"
  67. >
  68. <el-option
  69. v-for="dict in companyList"
  70. :key="dict.dictValue"
  71. :label="dict.dictLabel"
  72. :value="dict.dictValue"
  73. />
  74. </el-select>
  75. </el-form-item>
  76. <el-form-item label="时间:" label-width="50px">
  77. <el-date-picker style="vertical-align: middle;width:340px"
  78. v-model="dateRange"
  79. size="small"
  80. value-format="yyyy-MM-dd HH:mm:ss"
  81. type="datetimerange"
  82. range-separator="-"
  83. start-placeholder="开始日期"
  84. end-placeholder="结束日期"
  85. ></el-date-picker>
  86. </el-form-item>
  87. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-top:4px">搜索</el-button>
  88. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  89. </el-form>
  90. </div>
  91. <el-table @row-click="clickData" v-loading="loading3" :data="adminList" height="calc(100vh - 67vh)" :default-sort = "{prop: 'createTime', order: 'descending'}" highlight-current-row>
  92. <el-table-column label="序号" align="center" prop="id" show-overflow-tooltip />
  93. <el-table-column label="单位名称" align="center" prop="companyName" show-overflow-tooltip />
  94. <el-table-column label="剩余电量" align="center" prop="pointData" show-overflow-tooltip />
  95. <el-table-column label="报告时间" align="center" prop="createTime" sortable show-overflow-tooltip />
  96. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
  97. <template slot-scope="scope">
  98. <el-button
  99. size="mini"
  100. type="text"
  101. icon="el-icon-s-promotion"
  102. @click="jump(scope.row)"
  103. v-hasPermi="['system:admin:edit']"
  104. >跳转至工单</el-button>
  105. </template>
  106. </el-table-column> -->
  107. </el-table>
  108. </el-col>
  109. </el-row>
  110. </div>
  111. <pagination
  112. v-show="total>0"
  113. :total="total"
  114. :page.sync="queryParams.current"
  115. :limit.sync="queryParams.size"
  116. @pagination="getList"
  117. />
  118. <!-- 导出-->
  119. <a href="" download="" id="xz" style="position: absolute;z-index: -1;opacity: 0;"></a>
  120. </div>
  121. </template>
  122. <script>
  123. import { tbInfoList,tbInfoCollectIco } from "@/api/business/OM/eventCenter";
  124. import { listChannel } from "@/api/system/product";
  125. import index3 from "@/views/components/fireInternetInfo/index3";
  126. import index4 from "@/views/components/fireInternetInfo/index4";
  127. import { BASEPATH } from "@/assets/js/common.js";
  128. import { getThisDateBeforMonth, YearMonthDate } from "@/assets/js/dataFormate.js";
  129. export default {
  130. name: "index",
  131. components: {
  132. index3,index4
  133. },
  134. data() {
  135. return {
  136. contain2:false,
  137. img:require('@/assets/images/2.png'),
  138. title:"水系统设备工况",
  139. index1Data:{
  140. // dianliang:0.00,
  141. // xinhao:0.00,
  142. // createTime:undefined
  143. },//饼图
  144. index2Data:[],//折线图
  145. index3Data:[],//table
  146. // 遮罩层
  147. loading1: true,
  148. loading2: true,
  149. loading3: true,
  150. // 导出遮罩层
  151. exportLoading: false,
  152. // 显示搜索条件
  153. showSearch: true,
  154. // 总条数
  155. total: 0,
  156. open: false,
  157. t:null,
  158. timeList:[],
  159. queryParams:{
  160. current:1,
  161. size:10,
  162. companyCode:undefined,
  163. pointCodes: [201],
  164. isNew:1,
  165. deviceId:"",
  166. startTime:getThisDateBeforMonth(),
  167. endTime:YearMonthDate(),
  168. },
  169. queryParams2:{
  170. current:1,
  171. size:10,
  172. companyCode:undefined,
  173. pointCodes: [201,202],
  174. deviceId:"",
  175. startTime:getThisDateBeforMonth(),
  176. endTime:YearMonthDate(),
  177. },
  178. dataZ:[],//折线图
  179. // 公司列表
  180. companyList: [],
  181. // 日期范围
  182. dateRange: [],
  183. adminList:[]
  184. };
  185. },
  186. created(){
  187. this.init()
  188. this.getList()
  189. },
  190. /* type=2&bigDeviceType=1&isLine=1
  191. type 1隐患2告警
  192. bigDeviceType1火系统 2 水系统 3rtu 4电气火灾 5 视频监控
  193. isLine 0离线 1在线 */
  194. methods: {
  195. init(){
  196. /* 公司列表 */
  197. this.queryParams.status = undefined
  198. listChannel(this.queryParams).then(response => {
  199. if(response.data.records.length>0){
  200. this.companyList = response.data.records.map(val =>{
  201. return {
  202. dictValue:val.ownerId,
  203. dictLabel:val.ownerName,
  204. address:val.ownerAddress,
  205. }
  206. })
  207. }
  208. });
  209. },
  210. clickData(row){
  211. this.tubiao(row.deviceId)
  212. },
  213. tubiao(id){
  214. if(id){
  215. this.queryParams2.deviceId = id
  216. }
  217. /* 饼图、折线图 */
  218. tbInfoList(this.queryParams2).then(response =>{//pointCode=201 信息 pointCode=202 电量
  219. let data = response.data.records.reverse()
  220. let arr = [[],[],[],[]]
  221. let array = {}
  222. for(let i = 0; i<data.length;i++){
  223. if(i%2>0){
  224. arr[0].push([data[i].createTime,Number(data[i].pointData)])
  225. arr[3].push((data[i].createTime))
  226. }else{
  227. arr[1].push([data[i].createTime,Number(data[i].pointData)])
  228. }
  229. }
  230. this.index1Data = array
  231. this.contain2 = true
  232. this.index2Data = arr
  233. this.index1Data = {
  234. dianliang:this.index2Data[0][this.index2Data[0].length-1][1],
  235. xinhao:this.index2Data[1][this.index2Data[1].length-1][1],
  236. createTime:this.index2Data[0][this.index2Data[0].length-1][0]
  237. }
  238. this.index2Data[2] = {name:"水系统设备工况情况跟踪",color:"#00FFFF"}
  239. this.loading1 = false
  240. this.loading2 = false
  241. })
  242. },
  243. getList(){
  244. this.loading3 = true
  245. tbInfoList(this.queryParams).then(response =>{
  246. //table
  247. this.adminList = response.data.records
  248. this.total = response.data.total;
  249. this.loading3 = false;
  250. this.queryParams2.deviceId = response.data.records[0].deviceId
  251. this.tubiao()
  252. })
  253. },
  254. /** 跳转至工单 */
  255. jump(row){
  256. this.$router.push({
  257. path: '/OM/business/OM/workMange',
  258. query: {
  259. id: row.workId,
  260. type:4
  261. }
  262. })
  263. },
  264. /** 搜索按钮操作 */
  265. handleQuery() {
  266. this.getList();
  267. },
  268. /** 重置按钮操作 */
  269. resetQuery() {
  270. this.queryParams.current = 1;
  271. this.queryParams.startTime = undefined;
  272. this.queryParams.endTime = undefined;
  273. this.queryParams.companyCode = undefined;
  274. this.dateRange = [];
  275. this.resetForm("queryForm");
  276. this.handleQuery();
  277. },
  278. }
  279. }
  280. </script>
  281. <style scoped lang="scss">
  282. ::-webkit-scrollbar-track
  283. {
  284. background: #fff;
  285. border-radius: 0;
  286. }
  287. ::-webkit-scrollbar
  288. {
  289. -webkit-appearance: none;
  290. width: 4px;
  291. height: 4px;
  292. }
  293. ::-webkit-scrollbar-thumb
  294. {
  295. cursor: pointer;
  296. border-radius: 5px;
  297. background: rgba(0,0,0,.25);
  298. transition: color .2s ease;
  299. }
  300. .text {
  301. font-size: 14px;
  302. }
  303. .item {
  304. margin-bottom: 18px;
  305. }
  306. .clearfix:before,
  307. .clearfix:after {
  308. display: table;
  309. content: "";
  310. }
  311. .clearfix:after {
  312. clear: both
  313. }
  314. .box-card {
  315. margin-top:20px;
  316. }
  317. #main{
  318. margin-top:-20px;
  319. .box-card{
  320. .h2{
  321. text-align: center;
  322. margin:0 auto;
  323. display: block;
  324. font-size: 1.2em;
  325. background-image: -webkit-linear-gradient(bottom, #00adce, #000);
  326. -webkit-background-clip: text;
  327. -webkit-text-fill-color: transparent;
  328. }
  329. }
  330. .card_left{
  331. .card1{
  332. height:43vh;
  333. .title{
  334. width:100%;
  335. display: block;
  336. text-align: left !important;
  337. .imgTitle{
  338. width:5%;
  339. display: inline-block;
  340. vertical-align: middle;
  341. }
  342. p{
  343. display: inline-block;
  344. vertical-align: middle;
  345. margin-left:2%;
  346. font-size:1.4vw;
  347. }
  348. }
  349. .contain{
  350. margin-top:3vh;
  351. width:58%;
  352. display: inline-block;
  353. vertical-align: top;
  354. div{
  355. height:7vh;
  356. span{
  357. font-size: 1vw;
  358. vertical-align: middle;
  359. width:4vw;
  360. text-align: left;
  361. display: inline-block;
  362. }
  363. div{
  364. width:212px;
  365. height:6vh;
  366. vertical-align: middle;
  367. background:url("../../../../../../assets/images/operation_item.png") no-repeat right center;
  368. display: inline-block;
  369. p{
  370. font-size: 1.4vw;
  371. vertical-align: top;
  372. margin:1vh 0 0 3vh;
  373. }
  374. }
  375. }
  376. }
  377. .contain2{
  378. margin-top:-3rem;
  379. vertical-align: top;
  380. width:42%;
  381. display: inline-block;
  382. p{
  383. text-align: center;
  384. font-size: 1.4rem;
  385. margin:-2vh 0 0 0%;
  386. }
  387. }
  388. }
  389. }
  390. .card_right{
  391. .card2{
  392. height:43vh;
  393. }
  394. }
  395. .card_bottom{
  396. padding-top:10px;
  397. margin-bottom:-10px
  398. }
  399. }
  400. ::v-deep {
  401. .el-table__body-wrapper::-webkit-scrollbar {
  402. /*width: 0;宽度为0隐藏*/
  403. width: 4px;
  404. }
  405. .el-table__body-wrapper::-webkit-scrollbar-thumb {
  406. border-radius: 6px;
  407. height: 50px;
  408. background: rgba(40, 190, 252, .6);//滚动条颜色
  409. }
  410. .el-table__body-wrapper::-webkit-scrollbar-track {
  411. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  412. border-radius: 6px;
  413. background: #eee;//滚动条背景色
  414. }
  415. }
  416. </style>
  417. <style>
  418. </style>