index.vue 14 KB

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