diff --git a/src/assets/js/getData1.js b/src/assets/js/getData1.js index 8380e16..efe0a69 100644 --- a/src/assets/js/getData1.js +++ b/src/assets/js/getData1.js @@ -21,261 +21,53 @@ export const deviceStatusList = (id) => post('api/deviceScreen/deviceStatusList' /** 1.10近30天设备故障统计 */ export const errCensus = (id) => post('api/deviceScreen/errCensus', {}) -export const productionStatistics = () => { - let res = { - 'code': 200, - 'desc': '操作成功', - 'result': { - 'planRes': [ - { - 'workorder_procedure': '压制', - 'label': '2', - 'plan_qty': 20000, - 'real_qty': 480 - }, - { - 'workorder_procedure': '原料', - 'label': '1', - 'plan_qty': 0, - 'real_qty': 0 - }, - { - 'workorder_procedure': '干燥', - 'label': '3', - 'plan_qty': 0, - 'real_qty': 0 - }, - { - 'workorder_procedure': '包装', - 'label': '4', - 'plan_qty': 0, - 'real_qty': 0 - } - ], - 'materialTask': [ - { - 'plan_qty': '0', - 'real_qty': '0', - 'label': '1', - 'workorder_procedure': '原料' - } - ], - 'finishedRes': [ - { - 'workorder_procedure': '压制', - 'label': '2', - 'plan_qty': 20000, - 'real_qty': 480 - }, - { - 'workorder_procedure': '原料', - 'label': '1', - 'plan_qty': 0, - 'real_qty': 0 - }, - { - 'workorder_procedure': '干燥', - 'label': '3', - 'plan_qty': 0, - 'real_qty': 0 - }, - { - 'workorder_procedure': '包装', - 'label': '4', - 'plan_qty': 0, - 'real_qty': 0 - } - ], - 'productionTask': [ - { - 'workorder_id': '1650768844706480128', - 'label': null, - 'device_name': '压机5', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 1000000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-25 15:51:44', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1650404416467193856', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 1000000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-24 15:42:59', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1649612373595746304', - 'label': null, - 'device_name': '压机7', - 'material_code': 'ZLMCZ1001C122211GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-22 11:29:10', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1648878346865606656', - 'label': null, - 'device_name': '压机4', - 'material_code': 'ZLMCZ1001C122211GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-20 10:43:55', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1648195777525485568', - 'label': null, - 'device_name': '压机2', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 10000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-18 13:34:36', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1647845461961498624', - 'label': null, - 'device_name': '压机1', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 10000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '3', - 'order_status_name': '生产中', - 'shift_type': null, - 'realproducestart_date': '2023-04-17 14:18:58', - 'realproduceend_date': '-' - }, - { - 'workorder_id': '1650040960085835776', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 100004, - 'qualified_qty': 99807, - 'unqualified_qty': 197, - 'order_status': '5', - 'order_status_name': '完成', - 'shift_type': null, - 'realproducestart_date': '2023-04-23 15:38:03', - 'realproduceend_date': '2023-04-24 12:01:03' - }, - { - 'workorder_id': '1649231836326563840', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C122211GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 276285, - 'qualified_qty': 263808, - 'unqualified_qty': 12477, - 'order_status': '5', - 'order_status_name': '完成', - 'shift_type': null, - 'realproducestart_date': '2023-04-21 10:10:40', - 'realproduceend_date': '2023-04-23 14:17:33' - }, - { - 'workorder_id': '1648871924408909824', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 0, - 'qualified_qty': 0, - 'unqualified_qty': 0, - 'order_status': '5', - 'order_status_name': '完成', - 'shift_type': null, - 'realproducestart_date': '2023-04-20 10:11:33', - 'realproduceend_date': '2023-04-21 09:44:15' - }, - { - 'workorder_id': '1648869698739240960', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 100000, - 'real_qty': 1652528, - 'qualified_qty': 1549371, - 'unqualified_qty': 103157, - 'order_status': '5', - 'order_status_name': '完成', - 'shift_type': null, - 'realproducestart_date': '2023-04-20 10:03:54', - 'realproduceend_date': '2023-04-20 10:03:54' - }, - { - 'workorder_id': '1648860718914801664', - 'label': null, - 'device_name': '压机3', - 'material_code': 'ZLMCZ1001C111122GM001BD20-8', - 'material_name': null, - 'cust_name': null, - 'plan_qty': 10000, - 'real_qty': 1652528, - 'qualified_qty': 1549371, - 'unqualified_qty': 103157, - 'order_status': '5', - 'order_status_name': '完成', - 'shift_type': null, - 'realproducestart_date': '-', - 'realproduceend_date': '2023-04-20 09:37:49' - } - ] - } - } - return res -} +/** 生产统计 */ +export const productionStatistics = (id) => post('api/dashboard/productionStatistics', {}) +// export const productionStatistics = () => { +// let res = { +// 'total': { +// 'pressWeight': 0, +// 'dryWeight': 0, +// 'sortWeight': 0 +// }, +// 'mixProduction': [ +// { +// 'value': 0, +// 'name': 'string' +// } +// ], +// 'pressProduction': { +// 'dailyProductionQty': 0, +// 'dailyProductionWeight': 0, +// 'equipmentProduction': [ +// { +// 'name': 'string', +// 'qty': 0, +// 'weight': 0 +// } +// ] +// }, +// 'finishedProductCompletionRate': [ +// { +// 'name': 'string', +// 'completed': 0, +// 'uncompleted': 0 +// } +// ], +// 'workOrder': [ +// { +// 'workOrderCode': 'string', +// 'equipment': 'string', +// 'materialCode': 'string', +// 'customer': 'string', +// 'planned': 0, +// 'completed': 0, +// 'status': 'string', +// 'planStartTime': 'string', +// 'startTime': 'string', +// 'endTime': 'string' +// } +// ] +// } +// return res +// } diff --git a/src/pages/shunhe/ProdCount.vue b/src/pages/shunhe/ProdCount.vue index b210a64..f665e2c 100644 --- a/src/pages/shunhe/ProdCount.vue +++ b/src/pages/shunhe/ProdCount.vue @@ -66,10 +66,10 @@
订单工序设备物料号生产物料厂家计划量生产量生产状态计划开始时间开始时间结束时间
- + @@ -103,9 +103,7 @@ export default { materData: [], deviceData: [], resData: {}, - taskData: [], - realqty: '', - planqty: '' + workOrder: [] } }, computed: { @@ -142,45 +140,50 @@ export default { }, async initData () { let res = await productionStatistics() - this.resData = res.result - this.showNum1 = (res.result.finishedRes[0].real_qty + '').split('') - this.showNum2 = (res.result.finishedRes[1].real_qty + '').split('') - this.showNum3 = (res.result.finishedRes[2].real_qty + '').split('') - this.taskData = [...res.result.productionTask] + this.resData = res + this.showNum1 = (res.total.pressWeight + '').split('') + this.showNum2 = (res.total.dryWeight + '').split('') + this.showNum3 = (res.total.sortWeight + '').split('') + this.showNum4 = res.pressProduction.dailyProductionQty + this.showNum5 = res.pressProduction.dailyProductionWeight + this.workOrder = [...res.workOrder] + this.setEchart01() this.getEchart1() this.getEchart2() - this.realqty = res.result.materialTask[0].real_qty - this.planqty = res.result.materialTask[0].plan_qty - this.setEchart01() // 五种状态:未成产、已下发、生产中、停止、完成 }, setEchart01 () { - let data = [ - { - value: 10, - name: '1号砖' - }, - { - value: 20, - name: '2号砖' - }, - { - value: 30, - name: '3号砖' - }, - { - value: 40, - name: '4号砖' - }, - { - value: 50, - name: '5号砖' - }, - { - value: 60, - name: '6号砖' - } - ] + // let data = [ + // { + // value: 10, + // name: '1号砖' + // }, + // { + // value: 20, + // name: '2号砖' + // }, + // { + // value: 30, + // name: '3号砖' + // }, + // { + // value: 40, + // name: '4号砖' + // }, + // { + // value: 50, + // name: '5号砖' + // }, + // { + // value: 60, + // name: '6号砖' + // } + // ] + let dataName = [] + this.resData.mixProduction.map(el => { + dataName.push(el.name) + }) + let data = this.resData.mixProduction var option = { legend: { orient: 'horizontal', @@ -193,7 +196,8 @@ export default { itemGap: 30.86, itemWidth: 14.16, itemHeight: 7.38, - data: ['1号砖', '2号砖', '3号砖', '4号砖', '5号砖', '6号砖'] + data: dataName + // data: ['1号砖', '2号砖', '3号砖', '4号砖', '5号砖', '6号砖'] }, color: ['#0966E8', '#39E083', '#ffee0e', '#f975aa', '#32c5ff', '#f7b502'], series: [ @@ -228,14 +232,14 @@ export default { getEchart1 () { // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('echart_d1')) - // var finishArr = [] - // var unFinishArr = [] - // var materArr = [] - // this.materData.map(el => { - // finishArr.push(el.finished_qty) - // unFinishArr.push(el.unfinished_qty) - // materArr.push(el.material_code) - // }) + var finishArr = [] + var unFinishArr = [] + var materArr = [] + this.resData.finishedProductCompletionRate.map(el => { + finishArr.push(el.completed) + unFinishArr.push(el.uncompleted) + materArr.push(el.name) + }) // 指定图表的配置项和数据 var option = { legend: { @@ -263,8 +267,8 @@ export default { // trigger: 'axis' // }, xAxis: { - data: ['1号砖', '2号砖', '3号砖', '4号砖'], - // data: materArr, + // data: ['1号砖', '2号砖', '3号砖', '4号砖'], + data: materArr, axisLine: { lineStyle: { color: '#fff' @@ -297,8 +301,8 @@ export default { type: 'bar', barWidth: 14, stack: '完成情况', - data: [15, 20, 36, 10], - // data: unFinishArr, + // data: [15, 20, 36, 10], + data: unFinishArr, itemStyle: { normal: { color: '#32C5FF' @@ -320,8 +324,8 @@ export default { type: 'bar', barWidth: 14, stack: '完成情况', - data: [40, 57, 18, 20], - // data: finishArr, + // data: [40, 57, 18, 20], + data: finishArr, itemStyle: { normal: { color: '#F7B502' @@ -348,18 +352,17 @@ export default { }, getEchart2 () { // 基于准备好的dom,初始化echarts实例 - var lineData = [4, 9, 8, 6, 8, 7, 3, 8] - var barData = [50002, 34120, 48370, 57370, 67582, 90892, 32321, 57370] - var xData = ['1号机', '2号机', '3号机', '4号机', '5号机', '6号机', '7号机', '8号机'] - // var lineData = [] - // var barData = [] - // var xData = [] - // this.deviceData.map(el => { - // console.log(el.produce_qty) - // lineData.push(el.produce_qty) - // barData.push(el.produce_num) - // xData.push(el.device_name) - // }) + // var lineData = [4, 9, 8, 6, 8, 7, 3, 8] + // var barData = [50002, 34120, 48370, 57370, 67582, 90892, 32321, 57370] + // var xData = ['1号机', '2号机', '3号机', '4号机', '5号机', '6号机', '7号机', '8号机'] + var lineData = [] + var barData = [] + var xData = [] + this.resData.pressProduction.equipmentProduction.map(el => { + lineData.push(el.weight) + barData.push(el.qty) + xData.push(el.name) + }) var option = { legend: { top: 20, @@ -611,7 +614,7 @@ export default { .desc1 position absolute top .56rem - left 2rem + left 1.3rem span color #32C5FF font-size .16rem