index.vue 13 KB

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