乐天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.

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