index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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="content-item-head">共有19台设备 <span class="triangle"></span> </div>
  34. <div class="pie-left-content">
  35. <base-pie-chart
  36. :options="pieOptions"
  37. height="300px"
  38. width="100%"
  39. />
  40. </div>
  41. <div class="pie-right-content" style="padding-top:50px;">
  42. <div class="content-item bg-color1" @click="showTable('normal')">有5台设备正常使用 <span class="triangle2"></span> </div>
  43. <div class="content-item bg-color2" @click="showTable('20day')">有6台设备20+天闲置 <span class="triangle3"></span> </div>
  44. <div class="content-item bg-color3" @click="showTable('40day')">有8台设备40+天闲置 <span class="triangle4"></span> </div>
  45. </div>
  46. </template>
  47. </normal-card>
  48. </div>
  49. <div class="datatable">
  50. <div class="table-title">{{tableTitle}}</div>
  51. <el-table :data="tableData" stripe row-key="id" fit border width="100%" >
  52. <el-table-column type="index" width="50" label="序号" align="center"/>
  53. <!-- <el-table-column label="设备类型" prop="type" align="center"/> -->
  54. <el-table-column label="设备名称" prop="name" align="center"/>
  55. <el-table-column label="出厂编号" prop="number" align="center" />
  56. <el-table-column label="上次使用时间" prop="online_time" align="center" />
  57. <el-table-column label="上次使用地址" prop="address" align="center" />
  58. <el-table-column label="未使用天数" prop="unused_days" align="center" />
  59. <el-table-column label="备注" prop="remarks" align="center" />
  60. </el-table>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import NormalCard from '@/components/Card/NormalCard';
  66. import BasePieChart from '@/components/Charts/BasePieChart';
  67. import formOperate from "@/layout/rl-list-operate/rlListOperate";
  68. export default {
  69. mixins: [formOperate],
  70. name:'total_hydraulicCount',
  71. components: { NormalCard, BasePieChart },
  72. data() {
  73. return {
  74. url: "report/hydraulicCount",
  75. data: [],
  76. tableData: [],
  77. tableTitle:'正常使用设备列表',
  78. deviceTypes:[],
  79. pieSeriesData: [],
  80. pieOptions: {},
  81. departments: [],
  82. queryParam:{
  83. depart_id:'',
  84. device_type:'0',
  85. },
  86. departProps: {
  87. label: "department_name",
  88. value: "id",
  89. checkStrictly: true,
  90. expandTrigger: 'hover'
  91. },
  92. };
  93. },
  94. created: function() {
  95. this.$http.post("sysDictData/getOptions", { type: "DeviceType" }).then(resp => {
  96. this.deviceTypes = resp.data
  97. });
  98. // 获取所属单位
  99. // this.getDepartOptions();
  100. },
  101. methods: {
  102. /**
  103. * 监听搜索组件中查出的数据
  104. */
  105. afterGetList() {
  106. this.tableData=this.data.list
  107. this.tableTitle='正常使用设备列表';
  108. this.pieSeriesData=this.data.pie_data
  109. this.pieOptions = this.getPieOptions()
  110. },
  111. showTable(name){
  112. if(name=='40day'){
  113. this.tableData=this.data.list40
  114. this.tableTitle='40+天未使用设备列表';
  115. }else if(name=='20day'){
  116. this.tableData=this.data.list20
  117. this.tableTitle='20+天未使用设备列表';
  118. }else{
  119. this.tableData=this.data.list
  120. this.tableTitle='正常使用设备列表';
  121. }
  122. },
  123. getDepartOptions() {
  124. this.$http.get('departments').then( resp => {
  125. this.departments = resp.data
  126. })
  127. },
  128. /**
  129. * 清除过滤器
  130. */
  131. clearFilter() {
  132. this.queryParam = {
  133. device_type: '',
  134. net_state: '',
  135. citys: [],
  136. depart_id: [],
  137. creator: '',
  138. created_at: [],
  139. };
  140. this.checkedDepart = []
  141. this.handleSearch()
  142. },
  143. getPieOptions(){
  144. return {
  145. color:['#91cc75', '#1890ff', '#94a6b7'],
  146. title: {
  147. text: "设备状态统计",
  148. textStyle: {
  149. color: '#80a0b0',
  150. fontSize: 16,
  151. fontWeight: 600
  152. },
  153. bottom:'10',
  154. left:'center',
  155. },
  156. tooltip: {
  157. formatter: '设备数量<br/>{b0}:{c0}'
  158. },
  159. toolbox: {
  160. show: true,
  161. feature: {
  162. mark: { show: true },
  163. saveAsImage: { show: true }
  164. },
  165. right:200,
  166. },
  167. legend: {
  168. show: false
  169. },
  170. series: [{
  171. type: "pie",
  172. center: 'center',
  173. radius: [0, '50%'],
  174. data: this.pieSeriesData,
  175. labelLine: {
  176. smooth: 0.2,
  177. length: 5,
  178. length2: 5
  179. },
  180. }]
  181. }
  182. },
  183. },
  184. };
  185. </script>
  186. <style lang="scss" scoped>
  187. /** 表格错位问题 */
  188. ::v-deep .el-table th.gutter {
  189. display:table-cell !important;
  190. }
  191. .app-container {
  192. .charts {
  193. padding-bottom: 20px;
  194. min-width: 1024px;
  195. }
  196. .datatable {
  197. .table-title {
  198. background-color: #edebff;
  199. color: #1890ff;
  200. display: flex;
  201. width: 100%;
  202. justify-content: center;
  203. align-items: center;
  204. height: 40px;
  205. font-size: 16px;
  206. font-weight: 600;
  207. margin-top: 10px;
  208. }
  209. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  210. }
  211. }
  212. .filter-container{
  213. margin-bottom: 30px;
  214. }
  215. .pie-left-content{
  216. width:45%;
  217. height:100%;
  218. float: left;
  219. }
  220. .pie-right-content{
  221. width:50%;
  222. height:100%;
  223. float: left;
  224. }
  225. .content-item-head{
  226. // width:40%;
  227. width:240px;
  228. margin-top:5px;
  229. background-color:#1d5d99;
  230. color: #FFF;
  231. height:30px;
  232. padding-left:10px;
  233. line-height:30px;
  234. }
  235. .triangle{
  236. float: right;
  237. margin-right:-30px;
  238. width: 0;
  239. height: 0;
  240. border:15px solid transparent;
  241. border-left-color:#1d5d99;
  242. }
  243. .content-item{
  244. width:240px;
  245. height:26px;
  246. margin-top:30px;
  247. padding:0px 10px;
  248. line-height:26px;
  249. color: #FFF;
  250. }
  251. .bg-color1{
  252. background-color:#91cc75;
  253. }
  254. .bg-color2{
  255. background-color:#1890ff;
  256. }
  257. .bg-color3{
  258. background-color:#94a6b7;
  259. }
  260. .triangle2{
  261. float: right;
  262. margin-right:-36px;
  263. width: 0;
  264. height: 0;
  265. border:13px solid transparent;
  266. border-left-color:#91cc75;
  267. }
  268. .triangle3{
  269. float: right;
  270. margin-right:-36px;
  271. width: 0;
  272. height: 0;
  273. border:13px solid transparent;
  274. border-left-color:#1890ff;
  275. }
  276. .triangle4{
  277. float: right;
  278. margin-right:-36px;
  279. width: 0;
  280. height: 0;
  281. border:13px solid transparent;
  282. border-left-color:#94a6b7;
  283. }
  284. </style>