index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="12">
  4. <el-col :span="24">
  5. <div class="filter-container">
  6. <!-- <el-cascader
  7. class="filter-item fl form-search-input"
  8. @change="handleSearch"
  9. placeholder="请选择所属部门"
  10. :options="departments"
  11. v-model="queryParam.depart_id"
  12. :props="departProps"
  13. filterable
  14. clearable>
  15. </el-cascader> -->
  16. <el-select v-model="queryParam.device_type" class="filter-item form-search-input fl" placeholder="请选择设备类型" >
  17. <el-option
  18. v-for="item in deviceTypes"
  19. :key="item.value"
  20. :label="item.text"
  21. :value="item.value">
  22. </el-option>
  23. </el-select>
  24. <el-button class="filter-item fl" icon="el-icon-search" @click="handleSearch">
  25. 搜索
  26. </el-button>
  27. </div>
  28. </el-col>
  29. </el-row>
  30. <div class="charts">
  31. <normal-card shadow="always" >
  32. <template slot="content">
  33. <div class="content-item1-head">共有19台设备 <span class="triangle"></span> </div>
  34. <div class="pie-left-content">
  35. <base-pie-chart
  36. :options="pieOptionsA"
  37. height="100%"
  38. width="100%"
  39. />
  40. </div>
  41. <div class="pie-right-content" style="padding-top:50px;">
  42. <!-- <div class="content-item1 " @click="showTable('A',0)">有15 <span class="triangle1"></span> </div> -->
  43. <div v-for="(item,index) in pie_dataA" :key="index" class="content-item1" :style="'background-color:'+pieColorA[index]+';'" @click="showTable('A',index)"> 有{{item.value}}台{{item.name}}<span class="triangle2" :style="'border-left-color:'+pieColorA[index]+';'"></span> </div>
  44. </div>
  45. </template>
  46. </normal-card>
  47. </div>
  48. <div class="charts">
  49. <normal-card shadow="always" bodyStyle="{height:'360px'}">
  50. <template slot="content">
  51. <div class="pie-left-content">
  52. <div class="pie-left-content-search">
  53. <el-date-picker
  54. v-model="value1"
  55. type="daterange"
  56. align="right"
  57. class="pie-time-picker"
  58. unlink-panels
  59. range-separator="至"
  60. start-placeholder="开始日期"
  61. end-placeholder="结束日期"
  62. :picker-options="pickerOptions">
  63. </el-date-picker>
  64. <div class="content-item-head">共计36次故障 <span class="triangle"></span> </div>
  65. </div>
  66. <div class="pie-left-content-pie">
  67. <base-pie-chart
  68. :options="pieOptionsB"
  69. height="300px"
  70. width="100%"
  71. />
  72. </div>
  73. </div>
  74. <div class="pie-right-content" style="padding-top:80px;">
  75. <div v-for="(item,index) in pie_dataB" :key="index" class="content-item" :style="'background-color:'+pieColor[index]+';'" @click="showTable('B',index)"> {{item.name}}故障{{item.value}}次 <span class="triangle2" :style="'border-left-color:'+pieColor[index]+';'"></span> </div>
  76. </div>
  77. <div class="pie-left-content">
  78. <div class="pie-left-content-search">
  79. <el-date-picker
  80. v-model="value2"
  81. type="daterange"
  82. align="right"
  83. class="pie-time-picker"
  84. unlink-panels
  85. range-separator="至"
  86. start-placeholder="开始日期"
  87. end-placeholder="结束日期"
  88. :picker-options="pickerOptions">
  89. </el-date-picker>
  90. <div class="content-item-head">共计36次故障 <span class="triangle"></span> </div>
  91. </div>
  92. <div class="pie-left-content-pie">
  93. <base-pie-chart
  94. :options="pieOptionsC"
  95. height="300px"
  96. width="100%"
  97. />
  98. </div>
  99. </div>
  100. <div class="pie-right-content" style="padding-top:80px;">
  101. <div v-for="(item,index) in pie_dataC" :key="index" class="content-item" :style="'background-color:'+pieColor[index]+';'" @click="showTable('C',index)"> {{item.name}}故障{{item.value}}次 <span class="triangle2" :style="'border-left-color:'+pieColor[index]+';'"></span> </div>
  102. </div>
  103. </template>
  104. </normal-card>
  105. </div>
  106. <div class="datatable">
  107. <div class="table-title">{{tableTitle}}</div>
  108. <el-table :data="tableData" stripe row-key="id" fit border width="100%" >
  109. <el-table-column type="index" width="50" label="序号" align="center"/>
  110. <el-table-column label="设备名称" prop="name" align="center"/>
  111. <el-table-column label="出厂编号" prop="number" align="center" />
  112. <el-table-column label="上次所在位置" prop="address" align="center" />
  113. <el-table-column label="故障时间" prop="online_time" align="center" />
  114. <el-table-column label="故障代码" prop="code" align="center" />
  115. <el-table-column label="故障描述" prop="comment" align="center" />
  116. <el-table-column label="备注" prop="remarks" align="center" />
  117. </el-table>
  118. </div>
  119. </div>
  120. </template>
  121. <script>
  122. import NormalCard from '@/components/Card/NormalCard';
  123. import BasePieChart from '@/components/Charts/BasePieChart';
  124. import formOperate from "@/layout/rl-list-operate/rlListOperate";
  125. export default {
  126. mixins: [formOperate],
  127. name:'total_alarmDeviceCount',
  128. components: { NormalCard, BasePieChart },
  129. data() {
  130. return {
  131. // url: "report/hydraulicCount",
  132. url: "report/alarmDeviceCount",
  133. data: [],
  134. tableA:true,
  135. tableC:false,
  136. tableData: [],
  137. tableTitle:'有效期内设备列表(A)',
  138. deviceTypes:[],
  139. daysOptions:[
  140. {
  141. value:"7",
  142. text:'7天内',
  143. },
  144. {
  145. value:"30",
  146. text:'30天内',
  147. },
  148. {
  149. value:"90",
  150. text:'90天内',
  151. },
  152. {
  153. value:"180",
  154. text:'半年内',
  155. },
  156. ],
  157. pie_dataA: [],
  158. pie_dataB: [],
  159. pie_dataC: [],
  160. pieOptionsA: {},
  161. pieOptionsB: {},
  162. pieOptionsC: {},
  163. departments: [],
  164. queryParam:{
  165. depart_id:'',
  166. device_type:'0',
  167. days:'90',
  168. },
  169. departProps: {
  170. label: "department_name",
  171. value: "id",
  172. checkStrictly: true,
  173. expandTrigger: 'hover'
  174. },
  175. pickerOptions: {
  176. shortcuts: [{
  177. text: '最近一周',
  178. onClick(picker) {
  179. const end = new Date();
  180. const start = new Date();
  181. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  182. picker.$emit('pick', [start, end]);
  183. }
  184. }, {
  185. text: '最近一个月',
  186. onClick(picker) {
  187. const end = new Date();
  188. const start = new Date();
  189. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  190. picker.$emit('pick', [start, end]);
  191. }
  192. }, {
  193. text: '最近三个月',
  194. onClick(picker) {
  195. const end = new Date();
  196. const start = new Date();
  197. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  198. picker.$emit('pick', [start, end]);
  199. }
  200. }]
  201. },
  202. value1: '',
  203. value2: '',
  204. pieColorA:['#d7511e', '#1890ff'],
  205. pieColor:['#fc8452', '#91cc75','#fac858','#ee6666','#73c0de','#9a60b4']
  206. };
  207. },
  208. created: function() {
  209. this.$http.post("sysDictData/getOptions", { type: "DeviceType" }).then(resp => {
  210. this.deviceTypes = resp.data
  211. });
  212. // 获取所属单位
  213. // this.getDepartOptions();
  214. },
  215. methods: {
  216. /**
  217. * 监听搜索组件中查出的数据
  218. */
  219. afterGetList() {
  220. this.tableData=this.data.list
  221. this.tableTitle='故障设备列表';
  222. this.pie_dataA=this.data.pie_dataA
  223. this.pieOptionsA = this.getPieOptions()
  224. this.pie_dataB=this.data.pie_dataB
  225. this.pieOptionsB = this.getPieBOptions()
  226. this.pie_dataC=this.data.pie_dataC
  227. this.pieOptionsC = this.getPieCOptions()
  228. },
  229. showTable(name,index){
  230. switch (name) {
  231. case 'A':
  232. let item=this.pie_dataA[index];
  233. this.tableTitle=item.name+'列表';
  234. break
  235. case 'B':
  236. let itemB=this.pie_dataB[index];
  237. this.tableTitle=itemB.name+'故障列表';
  238. break
  239. case 'C':
  240. let itemC=this.pie_dataC[index];
  241. this.tableTitle=itemC.name+'故障列表';
  242. break
  243. default:
  244. break
  245. }
  246. },
  247. getDepartOptions() {
  248. this.$http.get('departments').then( resp => {
  249. this.departments = resp.data
  250. })
  251. },
  252. /**
  253. * 清除过滤器
  254. */
  255. clearFilter() {
  256. this.queryParam = {
  257. device_type: '',
  258. net_state: '',
  259. citys: [],
  260. depart_id: [],
  261. creator: '',
  262. created_at: [],
  263. };
  264. this.checkedDepart = []
  265. this.handleSearch()
  266. },
  267. getPieOptions(){
  268. return {
  269. color:this.pieColorA,
  270. title: {
  271. text: "故障总表",
  272. textStyle: {
  273. color: '#80a0b0',
  274. fontSize: 16,
  275. fontWeight: 600
  276. },
  277. bottom:'10',
  278. left:'center',
  279. },
  280. tooltip: {
  281. formatter: '数量<br/>{b0}:{c0}'
  282. },
  283. legend: {
  284. show: false
  285. },
  286. series: [{
  287. type: "pie",
  288. center: 'center',
  289. radius: [0, '50%'],
  290. data: this.pie_dataA,
  291. labelLine: {
  292. show: false
  293. },
  294. label: {
  295. show: false,
  296. position: 'center'
  297. },
  298. }]
  299. }
  300. },
  301. getPieBOptions(){
  302. return {
  303. color:this.pieColor,
  304. title: {
  305. text: "TOP5故障频次",
  306. textStyle: {
  307. color: '#80a0b0',
  308. fontSize: 16,
  309. fontWeight: 600
  310. },
  311. bottom:'10',
  312. left:'center',
  313. },
  314. tooltip: {
  315. formatter: '设备数量<br/>{b0}:{c0}'
  316. },
  317. legend: {
  318. show: false
  319. },
  320. series: [{
  321. type: "pie",
  322. center: 'center',
  323. radius: [0, '50%'],
  324. data: this.pie_dataB,
  325. labelLine: {
  326. show: false
  327. },
  328. label: {
  329. show: false,
  330. position: 'center'
  331. },
  332. }]
  333. }
  334. },
  335. getPieCOptions(){
  336. return {
  337. color:this.pieColor,
  338. title: {
  339. text: "TOP5故障设备",
  340. textStyle: {
  341. color: '#80a0b0',
  342. fontSize: 16,
  343. fontWeight: 600
  344. },
  345. bottom:'10',
  346. left:'center',
  347. },
  348. tooltip: {
  349. formatter: '数量<br/>{b0}:{c0}'
  350. },
  351. legend: {
  352. show: false
  353. },
  354. series: [{
  355. type: "pie",
  356. center: 'center',
  357. radius: [0, '50%'],
  358. data: this.pie_dataC,
  359. labelLine: {
  360. show: false
  361. },
  362. label: {
  363. show: false,
  364. position: 'center'
  365. },
  366. }]
  367. }
  368. },
  369. },
  370. };
  371. </script>
  372. <style lang="scss" scoped>
  373. /** 表格错位问题 */
  374. ::v-deep .el-table th.gutter {
  375. display:table-cell !important;
  376. }
  377. .app-container {
  378. .charts {
  379. padding-bottom: 20px;
  380. min-width: 1024px;
  381. }
  382. .datatable {
  383. .table-title {
  384. background-color: #edebff;
  385. color: #1890ff;
  386. display: flex;
  387. width: 100%;
  388. justify-content: center;
  389. align-items: center;
  390. height: 40px;
  391. font-size: 16px;
  392. font-weight: 600;
  393. margin-top: 10px;
  394. }
  395. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  396. }
  397. }
  398. .filter-container{
  399. margin-bottom: 30px;
  400. }
  401. .pie-left-content{
  402. width:25%;
  403. height:100%;
  404. float: left;
  405. margin-bottom: 20px;
  406. // border:1px solid #1d5d99;
  407. border-right:0px;
  408. }
  409. .pie-right-content{
  410. width:20%;
  411. height:100%;
  412. float: left;
  413. margin-bottom: 20px;
  414. // border:1px solid #1d5d99;
  415. margin-right: 20px;
  416. border-left:0px;
  417. }
  418. .pie-left-content-search{
  419. width:100%;
  420. height:10%;
  421. float: left;
  422. margin-bottom: 20px;
  423. // border:1px solid #1d5d99;
  424. margin-right: 20px;
  425. border-left:0px;
  426. }
  427. .pie-left-content-pie{
  428. width:100%;
  429. height:90%;
  430. float: left;
  431. margin-bottom: 20px;
  432. // border:1px solid #1d5d99;
  433. margin-right: 20px;
  434. margin-top: -22px;
  435. border-left:0px;
  436. }
  437. .pie-time-picker{
  438. width:95%;
  439. }
  440. .content-item1-head{
  441. width:90%;
  442. max-width:260px;
  443. min-width:200px;
  444. margin-top:5px;
  445. background-color:#1d5d99;
  446. color: #FFF;
  447. height:30px;
  448. padding-left:10px;
  449. line-height:30px;
  450. }
  451. .content-item-head{
  452. width:90%;
  453. max-width:260px;
  454. min-width:200px;
  455. background-color:#1d5d99;
  456. color: #FFF;
  457. height:30px;
  458. padding-left:10px;
  459. margin-top:5px;
  460. line-height:30px;
  461. }
  462. .triangle{
  463. float: right;
  464. margin-right:-30px;
  465. width: 0;
  466. height: 0;
  467. border:15px solid transparent;
  468. border-left-color:#1d5d99;
  469. }
  470. .content-item1{
  471. width:90%;
  472. max-width:260px;
  473. min-width:200px;
  474. height:26px;
  475. margin-top:30px;
  476. padding:0px 10px;
  477. line-height:26px;
  478. background-color:#d7511e;
  479. color: #FFF;
  480. }
  481. .triangle1{
  482. float: right;
  483. margin-right:-36px;
  484. width: 0;
  485. height: 0;
  486. border:13px solid transparent;
  487. border-left-color:#d7511e;
  488. }
  489. .content-item{
  490. width:90%;
  491. max-width:260px;
  492. min-width:200px;
  493. height:26px;
  494. margin-top:15px;
  495. padding:0px 10px;
  496. line-height:26px;
  497. color: #FFF;
  498. }
  499. .bg-color1{
  500. background-color:#d7511e;
  501. }
  502. .bg-color2{
  503. background-color:#1890ff;
  504. }
  505. .bg-color3{
  506. background-color:#94a6b7;
  507. }
  508. .triangle2{
  509. float: right;
  510. margin-right:-36px;
  511. width: 0;
  512. height: 0;
  513. border:13px solid transparent;
  514. }
  515. </style>