index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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="pie-left-content">
  34. <base-pie-chart
  35. :options="pieOptionsA"
  36. height="300px"
  37. width="100%"
  38. />
  39. </div>
  40. <div class="pie-right-content" style="padding-top:40px;">
  41. <div class="content-item-head">共有19台设备 <span class="triangle"></span> </div>
  42. <div class="content-item bg-color1" @click="showTable(1)">有效期内15台 <span class="triangle2"></span> </div>
  43. <div class="content-item bg-color3" @click="showTable(2)">已失效4台 (小于15天)<span class="triangle4"></span> </div>
  44. </div>
  45. <div class="pie-left-content">
  46. <base-pie-chart
  47. :options="pieOptionsC"
  48. height="300px"
  49. width="100%"
  50. />
  51. </div>
  52. <div class="pie-right-content">
  53. <div class="content-item" >
  54. <el-select v-model="queryParam.days" class="filter-item form-search-input fl" placeholder="时间段" >
  55. <el-option
  56. v-for="item in daysOptions"
  57. :key="item.value"
  58. :label="item.text"
  59. :value="item.value">
  60. </el-option>
  61. </el-select>
  62. </div>
  63. <div class="content-item-head">共有19台设备 <span class="triangle"></span> </div>
  64. <div class="content-item bg-color1" @click="showTable(3)">已维护14台<span class="triangle2"></span> </div>
  65. <div class="content-item bg-color3" @click="showTable(4)">未维护5台<span class="triangle4"></span> </div>
  66. </div>
  67. <div class="pie-left-content">
  68. <base-pie-chart
  69. :options="pieOptionsB"
  70. height="300px"
  71. width="100%"
  72. />
  73. </div>
  74. <div class="pie-right-content">
  75. <div class="content-item-head">有效期内30台 <span class="triangle"></span> </div>
  76. <div class="content-item bg-color1" @click="showTable(5)"> 有效使用20台(大于45天) <span class="triangle2"></span> </div>
  77. <div class="content-item bg-color2" @click="showTable(6)"> 警告失效4台(15天~45天) <span class="triangle3"></span> </div>
  78. <div class="content-item bg-color3" @click="showTable(7)"> 失效6台(0~15天) <span class="triangle4"></span> </div>
  79. </div>
  80. </template>
  81. </normal-card>
  82. </div>
  83. <div class="datatable" v-if="tableA">
  84. <div class="table-title">{{tableTitle}}</div>
  85. <el-table :data="tableData" row-key="id" fit border width="100%" >
  86. <el-table-column type="index" width="50" label="序号" align="center"/>
  87. <el-table-column label="设备名称" prop="name" align="center"/>
  88. <el-table-column label="出厂编号" prop="number" align="center" />
  89. <el-table-column label="上次所在位置" prop="address" align="center" />
  90. <el-table-column label="有效截止时间" prop="online_time" align="center" />
  91. <el-table-column label="未使用天数" prop="unused_days" align="center" />
  92. <el-table-column label="备注" prop="remarks" align="center" />
  93. </el-table>
  94. </div>
  95. <div class="datatable" v-if="tableC">
  96. <div class="table-title">{{tableTitle}}</div>
  97. <el-table :data="tableData" row-key="id" fit border width="100%" >
  98. <el-table-column type="index" width="50" label="序号" align="center"/>
  99. <el-table-column label="设备名称" prop="name" align="center"/>
  100. <el-table-column label="出厂编号" prop="number" align="center" />
  101. <el-table-column label="上次所在位置" prop="address" align="center" />
  102. <el-table-column label="上次维护时间" prop="online_time" align="center" />
  103. <el-table-column label="距离下次天数" prop="unused_days" align="center" />
  104. <el-table-column label="备注" prop="remarks" align="center" />
  105. </el-table>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. import NormalCard from '@/components/Card/NormalCard';
  111. import BasePieChart from '@/components/Charts/BasePieChart';
  112. import formOperate from "@/layout/rl-list-operate/rlListOperate";
  113. export default {
  114. mixins: [formOperate],
  115. name:'total_maintainCount',
  116. components: { NormalCard, BasePieChart },
  117. data() {
  118. return {
  119. url: "report/maintainCount",
  120. data: [],
  121. tableA:true,
  122. tableC:false,
  123. tableData: [],
  124. tableTitle:'有效期内设备列表(A)',
  125. deviceTypes:[],
  126. daysOptions:[
  127. {
  128. value:"7",
  129. text:'7天内',
  130. },
  131. {
  132. value:"30",
  133. text:'30天内',
  134. },
  135. {
  136. value:"90",
  137. text:'90天内',
  138. },
  139. {
  140. value:"180",
  141. text:'半年内',
  142. },
  143. ],
  144. pieSeriesData: [],
  145. pieOptionsA: {},
  146. pieOptionsB: {},
  147. pieOptionsC: {},
  148. departments: [],
  149. queryParam:{
  150. depart_id:'',
  151. device_type:'0',
  152. days:'90',
  153. },
  154. departProps: {
  155. label: "department_name",
  156. value: "id",
  157. checkStrictly: true,
  158. expandTrigger: 'hover'
  159. },
  160. };
  161. },
  162. created: function() {
  163. this.$http.post("sysDictData/getOptions", { type: "DeviceType" }).then(resp => {
  164. this.deviceTypes = resp.data
  165. });
  166. // 获取所属单位
  167. // this.getDepartOptions();
  168. },
  169. methods: {
  170. /**
  171. * 监听搜索组件中查出的数据
  172. */
  173. afterGetList() {
  174. this.tableData=this.data.list
  175. this.tableTitle='有效期内设备列表(A)';
  176. this.pieSeriesData=this.data.pie_dataA
  177. this.pieOptionsA = this.getPieOptions()
  178. this.pieSeriesData=this.data.pie_dataB
  179. this.pieOptionsB = this.getPieBOptions()
  180. this.pieSeriesData=this.data.pie_dataC
  181. this.pieOptionsC = this.getPieCOptions()
  182. },
  183. showTable(name){
  184. switch (name) {
  185. case 1:
  186. this.tableTitle='有效期内设备列表';
  187. this.tableA=true;
  188. this.tableC=false;
  189. break
  190. case 2:
  191. this.tableTitle='已失效(小于15天)设备列表';
  192. this.tableA=true;
  193. this.tableC=false;
  194. break
  195. case 3:
  196. this.tableTitle='已维护设备列表';
  197. this.tableA=false;
  198. this.tableC=true;
  199. break
  200. case 4:
  201. this.tableTitle='未维护设备列表';
  202. this.tableA=false;
  203. this.tableC=true;
  204. break
  205. case 5:
  206. this.tableTitle='有效使用(大于45天)设备列表';
  207. this.tableA=true;
  208. this.tableC=false;
  209. break
  210. case 6:
  211. this.tableTitle='警告失效(15天~45天)设备列表';
  212. this.tableA=true;
  213. this.tableC=false;
  214. break
  215. case 7:
  216. this.tableTitle='失效(0~15天)设备列表';
  217. this.tableA=true;
  218. this.tableC=false;
  219. break
  220. default:
  221. break
  222. }
  223. },
  224. getDepartOptions() {
  225. this.$http.get('departments').then( resp => {
  226. this.departments = resp.data
  227. })
  228. },
  229. /**
  230. * 清除过滤器
  231. */
  232. clearFilter() {
  233. this.queryParam = {
  234. device_type: '',
  235. net_state: '',
  236. citys: [],
  237. depart_id: [],
  238. creator: '',
  239. created_at: [],
  240. };
  241. this.checkedDepart = []
  242. this.handleSearch()
  243. },
  244. getPieOptions(){
  245. return {
  246. color:['#91cc75', '#94a6b7'],
  247. title: {
  248. text: "表A",
  249. textStyle: {
  250. color: '#80a0b0',
  251. fontSize: 16,
  252. fontWeight: 600
  253. }
  254. },
  255. tooltip: {
  256. formatter: '数量<br/>{b0}:{c0}'
  257. },
  258. legend: {
  259. show: false
  260. },
  261. series: [{
  262. type: "pie",
  263. center: 'center',
  264. radius: [0, '50%'],
  265. data: this.pieSeriesData,
  266. labelLine: {
  267. show: false
  268. },
  269. label: {
  270. show: false,
  271. position: 'center'
  272. },
  273. }]
  274. }
  275. },
  276. getPieBOptions(){
  277. return {
  278. color:['#91cc75', '#1890ff', '#94a6b7'],
  279. title: {
  280. text: "表B",
  281. textStyle: {
  282. color: '#80a0b0',
  283. fontSize: 16,
  284. fontWeight: 600
  285. }
  286. },
  287. tooltip: {
  288. formatter: '设备数量<br/>{b0}:{c0}'
  289. },
  290. legend: {
  291. show: false
  292. },
  293. series: [{
  294. type: "pie",
  295. center: 'center',
  296. radius: [0, '50%'],
  297. data: this.pieSeriesData,
  298. labelLine: {
  299. show: false
  300. },
  301. label: {
  302. show: false,
  303. position: 'center'
  304. },
  305. }]
  306. }
  307. },
  308. getPieCOptions(){
  309. return {
  310. color:['#91cc75', '#94a6b7'],
  311. title: {
  312. text: "表C",
  313. textStyle: {
  314. color: '#80a0b0',
  315. fontSize: 16,
  316. fontWeight: 600
  317. }
  318. },
  319. tooltip: {
  320. formatter: '数量<br/>{b0}:{c0}'
  321. },
  322. legend: {
  323. show: false
  324. },
  325. series: [{
  326. type: "pie",
  327. center: 'center',
  328. radius: [0, '50%'],
  329. data: this.pieSeriesData,
  330. labelLine: {
  331. show: false
  332. },
  333. label: {
  334. show: false,
  335. position: 'center'
  336. },
  337. }]
  338. }
  339. },
  340. },
  341. };
  342. </script>
  343. <style lang="scss" scoped>
  344. /** 表格错位问题 */
  345. ::v-deep .el-table th.gutter {
  346. display:table-cell !important;
  347. }
  348. .app-container {
  349. .charts {
  350. padding-bottom: 20px;
  351. min-width: 1024px;
  352. }
  353. .datatable {
  354. .table-title {
  355. background-color: #edebff;
  356. color: #1890ff;
  357. display: flex;
  358. width: 100%;
  359. justify-content: center;
  360. align-items: center;
  361. height: 40px;
  362. font-size: 16px;
  363. font-weight: 600;
  364. margin-top: 10px;
  365. }
  366. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  367. }
  368. }
  369. .filter-container{
  370. margin-bottom: 30px;
  371. }
  372. .pie-left-content{
  373. width:25%;
  374. height:100%;
  375. float: left;
  376. margin-bottom: 20px;
  377. // border:1px solid #1d5d99;
  378. border-right:0px;
  379. }
  380. .pie-right-content{
  381. width:20%;
  382. height:100%;
  383. float: left;
  384. margin-bottom: 20px;
  385. // border:1px solid #1d5d99;
  386. margin-right: 20px;
  387. border-left:0px;
  388. }
  389. .content-item-head{
  390. width:90%;
  391. max-width:260px;
  392. min-width:200px;
  393. margin-top:30px;
  394. background-color:#1d5d99;
  395. color: #FFF;
  396. height:30px;
  397. padding-left:10px;
  398. line-height:30px;
  399. }
  400. .triangle{
  401. float: right;
  402. margin-right:-30px;
  403. width: 0;
  404. height: 0;
  405. border:15px solid transparent;
  406. border-left-color:#1d5d99;
  407. }
  408. .content-item{
  409. width:90%;
  410. max-width:260px;
  411. min-width:200px;
  412. height:26px;
  413. margin-top:30px;
  414. padding:0px 10px;
  415. line-height:26px;
  416. color: #FFF;
  417. }
  418. .bg-color1{
  419. background-color:#91cc75;
  420. }
  421. .bg-color2{
  422. background-color:#1890ff;
  423. }
  424. .bg-color3{
  425. background-color:#94a6b7;
  426. }
  427. .triangle2{
  428. float: right;
  429. margin-right:-36px;
  430. width: 0;
  431. height: 0;
  432. border:13px solid transparent;
  433. border-left-color:#91cc75;
  434. }
  435. .triangle3{
  436. float: right;
  437. margin-right:-36px;
  438. width: 0;
  439. height: 0;
  440. border:13px solid transparent;
  441. border-left-color:#1890ff;
  442. }
  443. .triangle4{
  444. float: right;
  445. margin-right:-36px;
  446. width: 0;
  447. height: 0;
  448. border:13px solid transparent;
  449. border-left-color:#94a6b7;
  450. }
  451. </style>