乐天mes前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

493 lines
20 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="container" >
  3. <div style="width:100%;height: 20%;text-align:center;">
  4. <TimeC></TimeC>
  5. <!-- <div style="font-size: 26px;float: right;color: #ffffff;height: 100%" v-html="clock"></div>-->
  6. <div style="float: left;width: 25%;height: 100%;text-align:center;margin-left: 37% ">
  7. <div style="height: 40%;width: 100%;text-align: center;margin-top: 3%;">
  8. <label style="font-size: 30px;color: #ffffff">生产状况</label>
  9. </div>
  10. <div style="height: 40%;width: 100%;text-align: center;margin-top: 0%;">
  11. <label id="resourceIdName" style="font-size: 24px;color: #fff300"></label>
  12. </div>
  13. </div>
  14. </div>
  15. <div style="width:100%;height: 79%;">
  16. <div style="float: left;height: 100%;width: 35%; ">
  17. <div style="height: 12%;width: 100%;margin-top: 1%">
  18. <div
  19. style="width: 12%;height: 40%;float: left;margin-left: 18%;border-radius: 10px; background-color: #ec6566;"></div>
  20. <div style="width: 25%;height: 50%;float: left;margin-left: 3%;">
  21. <label style="font-size: 16px;color:#ffffff; ">未完工</label>
  22. </div>
  23. <div
  24. style="width: 12%;height: 40%;float: left;margin-left: 1%;border-radius: 10px; background-color: #90ca75;"></div>
  25. <div style="width: 25%;height: 50%;float: left;margin-left: 3%;">
  26. <label style="font-size: 16px;color:#ffffff; ">已完工</label>
  27. </div>
  28. </div>
  29. <div style="height: 88%;width: 100%;">
  30. <div id="pie" style="float:left;margin-left: 0px; margin-top: 0%; width: 100%; height:80%;"></div>
  31. </div>
  32. </div>
  33. <div style="float: left;height: 45%;width: 58%;margin-left:3% " class="board">
  34. <table class="table table-bordered" style="width:100%;font-size:16px;color: #ffffff" id="table">
  35. </table>
  36. <el-table
  37. :height="height"
  38. :data="tableList"
  39. style="width: 100%">
  40. <el-table-column
  41. prop="resourceDesc"
  42. header-align="center"
  43. align="left"
  44. min-width="100"
  45. label="机台名称">
  46. </el-table-column>
  47. <el-table-column
  48. prop="qtyRequire"
  49. header-align="center"
  50. align="left"
  51. min-width="100"
  52. label="排产数量">
  53. </el-table-column>
  54. <el-table-column
  55. prop="status"
  56. header-align="center"
  57. align="left"
  58. min-width="100"
  59. label="已入库数量">
  60. </el-table-column>
  61. <el-table-column
  62. prop="area"
  63. header-align="center"
  64. align="left"
  65. min-width="100"
  66. label="未入库数量">
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <div style="float: left;height: 49%;width: 65%; ">
  71. <div id="main" style="width: 100%;height: 100%;margin-top: 0px"></div>
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. <script>
  77. import {getNewScheduledTableData,
  78. getRefreshTime,
  79. getScheduledData
  80. } from '@/api/board.js'
  81. import TimeC from "@/views/newTime.vue"
  82. export default {
  83. name: "newScheduledBoard",
  84. data() {
  85. return {
  86. myChart: null,
  87. number1:0,
  88. number2:0,
  89. option:null,
  90. chartDom:null,
  91. option2:null,
  92. tableList:null,
  93. pieData:null,
  94. barList:null,
  95. resourceId:'',
  96. height:200,
  97. // ip:'',
  98. refreshTime:5,
  99. }
  100. },
  101. components: {
  102. TimeC
  103. },
  104. methods: {
  105. searchData(){
  106. this.getRefresh();
  107. getScheduledData().then(({data}) => {
  108. this.pieData=data.pieData;
  109. this.barList=data.barList;
  110. console.log(data.pieData)
  111. console.log(data.barList)
  112. this.number2=0;
  113. this.draw();
  114. this.draw2()
  115. this.getTableData();
  116. window.setTimeout(() => {
  117. this.getTableData();
  118. }, 1000* Number(this.refreshTime));
  119. window.setTimeout(() => {
  120. this.getTableData();
  121. }, 2000*Number(this.refreshTime));
  122. window.setTimeout(() => {
  123. this.getTableData();
  124. }, 3000*Number(this.refreshTime));
  125. })
  126. },
  127. draw(){
  128. // if (data_temp[i].percentage >= 100) {
  129. if (true) {
  130. var color = '#90ca75';
  131. } else {
  132. var color = '#fff300';
  133. }
  134. if (this.myChart!=null) {
  135. this.myChart.clear()
  136. }
  137. // $("#resourceIdName").html("总完成情况");
  138. this.option = ({
  139. title: [{
  140. text: '总完成情况' ,
  141. // text: '工序:' + data_temp[i + x].itemNo,
  142. // x 设置水平安放位置,默认左对齐,可选值:'center' ¦ 'left' ¦ 'right' ¦ {number}(x坐标,单位px)
  143. x: 'center',
  144. // y 设置垂直安放位置,默认全图顶端,可选值:'top' ¦ 'bottom' ¦ 'center' ¦ {number}(y坐标,单位px)
  145. y: 'bottom',
  146. // itemGap设置主副标题纵向间隔,单位px,默认为10,
  147. backgroundColor: '#EEE',
  148. // 主标题文本样式设置
  149. textStyle: {
  150. fontSize: 20,
  151. fontWeight: 'bolder',
  152. color: '#fff300'
  153. }
  154. },
  155. {
  156. text: this.pieData.qtyPercent + '%',
  157. // text: data_temp[i + x].percentage + '%',
  158. // x 设置水平安放位置,默认左对齐,可选值:'center' ¦ 'left' ¦ 'right' ¦ {number}(x坐标,单位px)
  159. x: 'center',
  160. // y 设置垂直安放位置,默认全图顶端,可选值:'top' ¦ 'bottom' ¦ 'center' ¦ {number}(y坐标,单位px)
  161. y: 'center',
  162. // itemGap设置主副标题纵向间隔,单位px,默认为10,
  163. backgroundColor: 'rgba(0,0,0,0)',
  164. // 主标题文本样式设置
  165. textStyle: {
  166. fontSize: 20,
  167. fontWeight: 'bolder',
  168. color: color
  169. },
  170. }],
  171. series: [
  172. {
  173. name: '完成数量统计',
  174. type: 'pie', // 设置图表类型为饼图
  175. radius: ['45%', '75%'], // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
  176. data: [ // 数据数组,name 为数据项名称,value 为数据项值
  177. // {value: data_temp[i + x].approveQty, name: ''},
  178. // {value: data_temp[i + x].unapproveQty, name: ''}
  179. {value: this.pieData.qtyReported, name: ''},
  180. {value: this.pieData.qtyUnReported, name: ''}
  181. ],
  182. color: ['#90ca75', '#ec6566'],
  183. labelLine: {
  184. normal: {
  185. show: false
  186. }
  187. },
  188. label: {
  189. normal: {
  190. position: 'outer', // 设置标签位置,默认在饼状图外 可选值:'outer' ¦ 'inner(饼状图上)'
  191. // formatter: '{a} {b} : {c}个 ({d}%)' 设置标签显示内容 ,默认显示{b}
  192. // {a}指series.name {b}指series.data的name
  193. // {c}指series.data的value {d}%指这一部分占总数的百分比
  194. formatter: '{b}'
  195. }
  196. }
  197. }
  198. ]
  199. });
  200. this.myChart = echarts.init(document.getElementById('pie'));
  201. this.myChart.setOption(this.option);
  202. },
  203. getTableData() {
  204. getNewScheduledTableData(this.number2).then(({data}) => {
  205. this.tableList=data.rows;
  206. })
  207. },
  208. draw2(){
  209. if (this.myChart2!=null) {
  210. this.myChart2.clear()
  211. }
  212. let barData=[];
  213. let valueData=[];
  214. for (let a = 0; a <this.barList.length ; a++) {
  215. let resourceData={
  216. value: this.barList[a].resourceDesc,
  217. textStyle: {
  218. color: '#EEE'
  219. }
  220. }
  221. barData.push(resourceData);
  222. valueData[a]=this.barList[a].qtyPercent;
  223. }
  224. this.myChart2 = echarts.init(document.getElementById('main'));
  225. // document.getElementById('main').style.height="300px";
  226. // if(this.option2!=null){
  227. // document.getElementById('main').removeAttribute('_echarts_instance_')
  228. // this.option2 = null
  229. // }
  230. this.option2 = {
  231. color:["#90ca75", "#00a7ff","#ec6566"],
  232. legend: {
  233. textStyle: { //图例文字的样式
  234. color: '#fff',
  235. // fontSize: 12
  236. },
  237. },
  238. tooltip: {},
  239. xAxis:[
  240. {
  241. type: 'category',
  242. // data: xAxisData
  243. data:barData,
  244. // [
  245. // {
  246. // value: this.getDate(this.barList[6].strDate),
  247. // textStyle: {
  248. // color: '#EEE'
  249. // }
  250. // },
  251. // {
  252. // value: this.getDate(this.barList[5].strDate),
  253. // textStyle: {
  254. // color: '#EEE'
  255. // }
  256. // },
  257. // {
  258. // value: this.getDate(this.barList[4].strDate),
  259. // textStyle: {
  260. // color: '#EEE'
  261. // }
  262. // },
  263. // {
  264. // value: this.getDate(this.barList[3].strDate),
  265. // textStyle: {
  266. // color: '#EEE'
  267. // }
  268. // },
  269. // {
  270. // value: this.getDate(this.barList[2].strDate),
  271. // textStyle: {
  272. // color: '#EEE'
  273. // }
  274. // },
  275. // {
  276. // value: this.getDate(this.barList[1].strDate),
  277. // textStyle: {
  278. // color: '#EEE'
  279. // }
  280. // },
  281. // {
  282. // value: this.getDate(this.barList[0].strDate),
  283. // textStyle: {
  284. // color: '#EEE'
  285. // }
  286. // },
  287. // ],
  288. axisLine:{
  289. lineStyle: {
  290. color:'#eee'
  291. }
  292. },
  293. axisTick: {
  294. lineStyle: {
  295. color:'#eee'
  296. }
  297. },
  298. },
  299. ],
  300. yAxis:[
  301. {
  302. type: 'value',
  303. min: 0,
  304. max: 100,
  305. axisLabel: {
  306. formatter: '{value} %'
  307. },
  308. axisLine:{
  309. lineStyle: {
  310. color:'#eee'
  311. }
  312. },
  313. axisTick: {
  314. lineStyle: {
  315. color:'#eee'
  316. }
  317. },
  318. // splitLine:{
  319. // show:false,
  320. // }
  321. }
  322. ],
  323. series: [
  324. {
  325. 'name': '当日完成率',
  326. 'type': 'bar',
  327. 'emphasis': {
  328. focus: 'series'
  329. },
  330. // data: seriesData1
  331. 'data': valueData,
  332. // [this.barList[6].num1, this.barList[5].num1, this.barList[4].num1, this.barList[3].num1, this.barList[2].num1, this.barList[1].num1, this.barList[0].num1],
  333. 'label':{
  334. show:true,
  335. position:'top',
  336. textStyle: {
  337. color: '#fff300',
  338. fontSize: 11
  339. }
  340. },
  341. },
  342. ]
  343. };
  344. this.option2 && this.myChart2.setOption(this.option2);
  345. },
  346. getDate(value) {
  347. var date = value.substring(5, 10);
  348. return date;
  349. },
  350. timeDo(){
  351. let that=this;
  352. getRefreshTime('scheduledBoard').then(({data}) => {
  353. if (data.rows != "" && data.rows != null) {
  354. that.refreshTime = Number(data.rows);
  355. if(that.refreshTime ==0){
  356. that.refreshTime =5;
  357. }
  358. }else {
  359. that.refreshTime =5;
  360. }
  361. window.setInterval(() => {
  362. this.searchData();
  363. }, 4000*Number(that.refreshTime));
  364. })
  365. // $.ajax({
  366. // url: "/board/getRefreshTime",
  367. // type: "post",
  368. // data: {"boardName": 'newScheduledBoard'},
  369. // dataType: "json",
  370. // success: (data) => {
  371. // if (data.rows != "" && data.rows != null) {
  372. // that.refreshTime = Number(data.rows);
  373. // if(that.refreshTime ==0){
  374. // that.refreshTime =5;
  375. // }
  376. // }else {
  377. // that.refreshTime =5;
  378. // }
  379. // window.setInterval(() => {
  380. // this.searchData();
  381. // }, 4000*Number(that.refreshTime));
  382. // },
  383. // })
  384. },
  385. // getIp(){
  386. // let that=this;
  387. // if (localStorage.getItem("tvIP")==null||localStorage.getItem("tvIP")==""||localStorage.getItem("tvIP")=="192.168.1.130") {
  388. // $.ajax({
  389. // url: "/board/getIpFirst",
  390. // type: "post",
  391. // data: {},
  392. // dataType: "json",
  393. // success: (data) => {
  394. // localStorage.setItem("tvIP", data.row)
  395. // that.ip=localStorage.getItem("tvIP")
  396. // this.tableInit();
  397. // this.timeDo();
  398. // this.searchData();
  399. // }
  400. // }).fail(() => {
  401. // localStorage.setItem("tvIP", "192.168.1.130")
  402. // that.ip=localStorage.getItem("tvIP")
  403. // this.tableInit();
  404. // this.timeDo();
  405. // this.searchData();
  406. // })
  407. // }else {
  408. // that.ip=localStorage.getItem("tvIP")
  409. // this.tableInit();
  410. // this.timeDo();
  411. // this.searchData();
  412. // }
  413. //
  414. // },
  415. getRefresh(){
  416. getRefreshTime('scheduledBoard').then(({data}) => {
  417. if (data.rows != "" && data.rows != null) {
  418. this.refreshTime = Number(data.rows);
  419. if(this.refreshTime ==0){
  420. this.refreshTime =5;
  421. }
  422. }else {
  423. this.refreshTime =5;
  424. }
  425. })
  426. },
  427. },
  428. created(){
  429. this.getRefresh();
  430. },
  431. mounted() {
  432. this.$nextTick(()=>{
  433. this.height = window.innerHeight *0.36;
  434. })
  435. this.getTableData();
  436. this.timeDo();
  437. this.searchData();
  438. }
  439. }
  440. </script>
  441. <<style >
  442. .container {
  443. height: 109%;
  444. position: fixed;
  445. top: 0;
  446. left: 0;
  447. z-index: -1;
  448. width: 100%;
  449. height: 100%;
  450. content: "";
  451. background-image: url(~@/assets/img/factory.jpg);
  452. background-size: cover;
  453. }
  454. .board .el-table .cell {
  455. line-height: 20px;
  456. font-size: 20px;
  457. height: 20px;
  458. padding: 0px;
  459. color: yellow;
  460. }
  461. /* 表格内背景颜色 */
  462. .board .el-table th, .el-table tr,.el-table td{
  463. border: 0;
  464. background-color: transparent;
  465. }
  466. /* 使表格背景透明 */
  467. .board .el-table th, .el-table tr {
  468. background-color: transparent;
  469. }
  470. /* 删除表格下横线 */
  471. .board .el-table::before {
  472. left: 0;
  473. bottom: 0;
  474. width: 100%;
  475. height: 0px;
  476. }
  477. /* 表格表头字体颜色 */
  478. .board .el-table, .el-table__expanded-cell {
  479. background-color: transparent;
  480. }
  481. </style>