index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <div class="ele-body">
  3. <el-row :gutter="5">
  4. <el-col :span="24" style="height: 46px; margin-bottom: 5px">
  5. <el-card class="box-card">
  6. <el-radio-group v-model="form.timeType">
  7. <el-radio-button label="1">企业</el-radio-button>
  8. <el-radio-button label="2">工厂</el-radio-button>
  9. <el-radio-button label="3">班组</el-radio-button>
  10. <el-radio-button label="4">产线</el-radio-button>
  11. </el-radio-group>
  12. </el-card>
  13. </el-col>
  14. <el-col :span="10" style="height: 33%">
  15. <el-card class="box-card">
  16. <div slot="header" class="clearfix">
  17. <span>年度计划达成情况</span>
  18. </div>
  19. <v-chart ref="barRef1" style="height: 100%" :option="barOption" />
  20. </el-card>
  21. </el-col>
  22. <el-col :span="3" style="height: 33%">
  23. <div class="item">
  24. <div class="header"> 7日内需要交付订单 </div>
  25. <div class="content">
  26. <p><span>订单数</span><span>3/10</span></p>
  27. <p><span>产品量</span><span>558/1860</span></p>
  28. </div>
  29. </div>
  30. </el-col>
  31. <el-col :span="3" style="height: 33%">
  32. <div class="item">
  33. <div class="header"> 本月需要完成订单 </div>
  34. <div class="content">
  35. <p><span>订单数</span><span>3/10</span></p>
  36. <p><span>产品量</span><span>558/1860</span></p>
  37. </div>
  38. </div>
  39. </el-col>
  40. <el-col :span="8" style="height: 33%">
  41. <el-card class="box-card" style="height: 100%">
  42. <div slot="header" class="clearfix">
  43. <span>本月异常类型分布</span>
  44. </div>
  45. <v-chart ref="pieRef" style="height: 100%" :option="pieOption" />
  46. </el-card>
  47. </el-col>
  48. <el-col :span="8" style="height: 33%; margin-top: 5px">
  49. <el-card class="box-card">
  50. <div slot="header" class="clearfix">
  51. <span>近7天良率趋势</span>
  52. </div>
  53. <v-chart ref="lineRef" style="height: 100%" :option="lineOption" />
  54. </el-card>
  55. </el-col>
  56. <el-col :span="16" style="height: 33%; margin-top: 5px">
  57. <el-card class="box-card">
  58. <div slot="header" class="clearfix">
  59. <span>准时交付率</span>
  60. </div>
  61. <v-chart ref="barRef3" style="height: 100%" :option="barOption1" />
  62. </el-card>
  63. </el-col>
  64. <el-col :span="24" style="height: calc(34% - 15px); margin-top: 5px">
  65. <el-card class="box-card">
  66. <div slot="header" class="clearfix">
  67. <span>计划进度看板</span>
  68. </div>
  69. <ele-pro-table
  70. ref="table"
  71. :columns="columns"
  72. :datasource="datasource"
  73. :needPage="false"
  74. :toolbar="false"
  75. >
  76. </ele-pro-table>
  77. </el-card>
  78. </el-col>
  79. </el-row>
  80. </div>
  81. </template>
  82. <script>
  83. // import {
  84. // queryHomePage,
  85. // queryFactory,
  86. // queryTeam,
  87. // queryProductionLine
  88. // } from '@/api/qms';
  89. import { pieOption, barOption, lineOption, columns } from './data';
  90. import { use } from 'echarts/core';
  91. import { CanvasRenderer } from 'echarts/renderers';
  92. import { BarChart, PieChart, LineChart } from 'echarts/charts';
  93. import {
  94. GridComponent,
  95. TooltipComponent,
  96. LegendComponent
  97. } from 'echarts/components';
  98. import VChart from 'vue-echarts';
  99. import { echartsMixin } from '@/utils/echarts-mixin';
  100. // 按需加载 echarts
  101. use([
  102. CanvasRenderer,
  103. BarChart,
  104. PieChart,
  105. GridComponent,
  106. TooltipComponent,
  107. LegendComponent,
  108. LineChart
  109. ]);
  110. export default {
  111. mixins: [echartsMixin(['pieRef', 'barRef1', 'lineRef', 'barRef3'])],
  112. components: { VChart },
  113. data() {
  114. return {
  115. columns,
  116. arr: [
  117. {
  118. name: '在制工单数',
  119. num: '188',
  120. // imgUrl: require('../../assets/Group1.png'),
  121. unit: '个'
  122. },
  123. {
  124. name: '在制工单计划生产数',
  125. num: '188',
  126. // imgUrl: require('../../assets/Group2.png'),
  127. unit: 'pcs'
  128. },
  129. {
  130. name: '在制工单已入库数',
  131. num: '188',
  132. // imgUrl: require('../../assets/Group3.png'),
  133. unit: 'pcs'
  134. },
  135. {
  136. name: '在制工单延期生产数',
  137. num: '188',
  138. // imgUrl: require('../../assets/Group4.png'),
  139. unit: 'pcs',
  140. color: '#f97876'
  141. }
  142. ],
  143. pieOption: {},
  144. barOption: {},
  145. barOption1: {},
  146. lineOption: {},
  147. form: {
  148. finishTime: '',
  149. timeType: '1'
  150. }
  151. };
  152. },
  153. created() {},
  154. mounted() {
  155. this.pieOption = pieOption([
  156. { value: 60, name: '人员异常' },
  157. { value: 60, name: '物料异常' },
  158. { value: 60, name: '设备异常' },
  159. { value: 60, name: '工装异常' },
  160. { value: 60, name: '工装异常' },
  161. { value: 60, name: '设计异常' },
  162. { value: 60, name: '交期异常' }
  163. ]);
  164. this.barOption = barOption(
  165. [
  166. '一月',
  167. '二月',
  168. '三月',
  169. '四月',
  170. '五月',
  171. '六月',
  172. '七月',
  173. '八月',
  174. '九月',
  175. '十月',
  176. '十一月',
  177. '十二月'
  178. ],
  179. [
  180. {
  181. name: '任务量',
  182. barWidth: '25%',
  183. data: [50, 78, 88, 76, 75, 91, 50, 78, 88, 76, 75, 91],
  184. type: 'bar',
  185. yAxisIndex: 0, // 使用第一个Y轴
  186. itemStyle: {
  187. color: '#f9cd5d'
  188. }
  189. },
  190. {
  191. name: '完成量',
  192. barWidth: '25%',
  193. data: [50, 78, 88, 76, 75, 91, 50, 78, 88, 76, 75, 91],
  194. type: 'bar',
  195. yAxisIndex: 0, // 使用第一个Y轴
  196. itemStyle: {
  197. color: '#5893eb'
  198. }
  199. },
  200. {
  201. name: '达成率',
  202. symbolSize: 10,
  203. data: [50, 78, 88, 76, 75, 91, 50, 78, 88, 76, 75, 91],
  204. type: 'line',
  205. smooth: true,
  206. yAxisIndex: 1, // 使用第一个Y轴
  207. itemStyle: {
  208. color: '#59b9fe'
  209. }
  210. }
  211. ]
  212. );
  213. this.barOption1 = barOption(
  214. [
  215. '一月',
  216. '二月',
  217. '三月',
  218. '四月',
  219. '五月',
  220. '六月',
  221. '七月',
  222. '八月',
  223. '九月',
  224. '十月',
  225. '十一月',
  226. '十二月'
  227. ],
  228. [
  229. {
  230. name: '应完成订单',
  231. barWidth: '25%',
  232. data: [50, 78, 88, 76, 75, 91, 78, 87, 81, 67, 95, 73],
  233. type: 'bar',
  234. yAxisIndex: 0 // 使用第一个Y轴
  235. },
  236. {
  237. name: '实际完成订单',
  238. barWidth: '25%',
  239. data: [50, 78, 88, 76, 75, 91, 78, 87, 81, 67, 95, 73],
  240. type: 'bar',
  241. yAxisIndex: 0 // 使用第一个Y轴
  242. },
  243. {
  244. name: '准时交付率',
  245. symbolSize: 10,
  246. data: [50, 78, 88, 76, 75, 91, 78, 87, 81, 67, 95, 73],
  247. type: 'line',
  248. smooth: true,
  249. yAxisIndex: 1, // 使用第一个Y轴
  250. itemStyle: {
  251. color: '#ff8856'
  252. }
  253. }
  254. ]
  255. );
  256. this.lineOption = lineOption([
  257. [30, 58, 68, 36, 55, 41, 73],
  258. [55, 81, 90, 80, 78, 95, 80]
  259. ]);
  260. setTimeout(() => {
  261. this.$refs.pieRef.resize();
  262. this.$refs.barRef1.resize();
  263. this.$refs.lineRef.resize();
  264. this.$refs.barRef3.resize();
  265. }, 300);
  266. },
  267. methods: {
  268. datasource({ page, where, limit }) {
  269. return [];
  270. return getList({
  271. ...where,
  272. pageNum: page,
  273. size: limit
  274. });
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. .clearfix {
  281. font-size: 0.7vw;
  282. > span {
  283. font-weight: bold;
  284. }
  285. :deep(.el-radio-button__inner) {
  286. font-size: 0.7vw;
  287. }
  288. }
  289. .ele-body {
  290. height: calc(100vh - 136px);
  291. > .el-row {
  292. height: 100%;
  293. }
  294. .el-card {
  295. height: 100%;
  296. :deep(.el-card__body) {
  297. padding: 0.3vw;
  298. }
  299. :deep(.el-card__header) {
  300. padding: 0.6vw;
  301. }
  302. :deep(.el-card__body) {
  303. height: calc(100% - 2.3vw);
  304. }
  305. :deep(.ele-pro-table) {
  306. height: 99%;
  307. }
  308. :deep(.el-table) {
  309. font-size: 0.65vw;
  310. }
  311. }
  312. }
  313. .item {
  314. width: 100%;
  315. height: 100%;
  316. background: url(../../assets/main_item.png);
  317. background-size: cover;
  318. border-radius: 6px;
  319. padding: 1vw;
  320. color: #333;
  321. > .header {
  322. font-size: 0.9vw;
  323. font-weight: 600;
  324. width: 100%;
  325. padding-bottom: 0.7vw;
  326. border-bottom: 1px solid #f3f3f3;
  327. text-align: center;
  328. color: #3a92edd1;
  329. }
  330. > .content {
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. flex-direction: column;
  335. font-size: 0.9vw;
  336. font-weight: 500;
  337. height: calc(100% - 1.5vw);
  338. p {
  339. display: flex;
  340. align-items: center;
  341. justify-content: space-between;
  342. width: 100%;
  343. height: 33%;
  344. }
  345. }
  346. }
  347. </style>