diff --git a/src/api/report/index.js b/src/api/report/index.js index 8571ad5..1cde283 100644 --- a/src/api/report/index.js +++ b/src/api/report/index.js @@ -1,7 +1,7 @@ /* * @Author: zhp * @Date: 2024-06-17 09:41:03 - * @LastEditTime: 2024-06-18 13:47:36 + * @LastEditTime: 2024-06-20 15:39:21 * @LastEditors: zhp * @Description: */ @@ -9,11 +9,21 @@ import request from '@/utils/request' export function getComprehensiveDataPage(data) { return request({ url: 'ip/comprehensive/data/get/comprehensive/data', - method: 'get', - params: data + method: 'post', + data: data }) } +export function exportComprehensiveDataPage(data) { + return request({ + url: 'ip/comprehensive/data/export/comprehensive/data', + method: 'post', + data: data, + responseType: 'blob', + }) +} + + export function getProduceTransData(data) { return request({ url: 'ip/prod-output/queryYCEReportByDateRange', @@ -21,3 +31,65 @@ export function getProduceTransData(data) { data: data }) } + +export function exportProduceTransData(data) { + return request({ + url: 'ip/prod-output/queryYCEReportByDateRangeExcel', + method: 'post', + data: data, + responseType: 'blob', + }) +} + + +export function getProduceSituationData(data) { + return request({ + url: 'ip/production/situation/get/production/situation', + method: 'post', + data: data + }) +} + +export function exportProduceSituationData(data) { + return request({ + url: 'ip/production/situation/export/production/situation', + method: 'post', + data: data, + responseType: 'blob', + }) +} + +export function getProductionSituationMWData(data) { + return request({ + url: 'ip/production/situation/power/get/production/situation', + method: 'post', + data: data + }) +} + +export function exportProductionSituationMWData(data) { + return request({ + url: 'ip/production/situation/power/export/production/situation', + method: 'post', + data: data, + responseType: 'blob', + }) +} + + +export function getProductionYieldSituationMWData(data) { + return request({ + url: 'ip/product/yield/get/production/situation', + method: 'post', + data: data + }) +} + +export function exportProductionYieldSituationMWData(data) { + return request({ + url: 'ip/product/yield/export/production/situation', + method: 'post', + data: data, + responseType: 'blob', + }) +} diff --git a/src/views/report/components/produceLineBar.vue b/src/views/report/components/produceLineBar.vue new file mode 100644 index 0000000..4b63baa --- /dev/null +++ b/src/views/report/components/produceLineBar.vue @@ -0,0 +1,245 @@ + + + + diff --git a/src/views/report/components/produceLineBarTarget.vue b/src/views/report/components/produceLineBarTarget.vue new file mode 100644 index 0000000..434f875 --- /dev/null +++ b/src/views/report/components/produceLineBarTarget.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/src/views/report/components/produceLineBarYearTarget.vue b/src/views/report/components/produceLineBarYearTarget.vue new file mode 100644 index 0000000..b0e9d86 --- /dev/null +++ b/src/views/report/components/produceLineBarYearTarget.vue @@ -0,0 +1,245 @@ + + + + diff --git a/src/views/report/comprehensiveData.vue b/src/views/report/comprehensiveData.vue index 73a9f68..e3529a6 100644 --- a/src/views/report/comprehensiveData.vue +++ b/src/views/report/comprehensiveData.vue @@ -1,7 +1,7 @@ @@ -13,59 +13,48 @@
- + - + - + 至 - + + - - + - - + ~ - - - 查询 - - 导出 - // import { parseTime } from '../../core/mixins/code-filter'; -import { getComprehensiveDataPage } from '@/api/report'; +import { getComprehensiveDataPage, exportComprehensiveDataPage } from '@/api/report'; // import { getWorkOrderPage, exportExcel, getOverView } from '@/components/buttonNav' // import inputTable from './inputTable.vue'; // import lineChart from './lineChart'; @@ -97,16 +86,19 @@ export default { return { factoryList, factoryArray, - start: undefined, - end: undefined, + listQuery: { + pageNo: 1, + pageSize: 999, // size: 10, // current: 1, - factory: null, + factory: undefined, // total: 0, type: 2, startDate: undefined, endDate: undefined, + start: undefined, + end: undefined, reportTime: [] }, timeList: [ @@ -152,68 +144,7 @@ export default { id: 2, }, ], - tableProps: [ - { - prop: 'factory', - label: '玻璃类型', - fixed:true, - // filter: (val) => factoryList[val], - // minWidth: 200, - // showOverflowtooltip: true - }, - { - prop: 'workOrderNumber', - label: '科目/日期', - fixed: true, - // filter: (val) => ['玻璃芯片', '标准组件', 'BIPV', '定制组件'][val] - }, - { - prop: 'workOrderType', - label: '单位', - fixed: true, - // filter: publicFormatter('workorder_status') - // filter: (val) => ['', '芯片工单', '组件类型', 'bipv类型'][val], - }, - // { - // prop: 'plannedInvestment', - // label: '计划投入', - // }, - // { - // prop: 'actualInvestment', - // label: '实际投入', - // }, - // { - // prop: 'targetProduction', - // label: '目标产量', - // }, - // { - // prop: 'actualProduction', - // label: '实际产量', - // }, - // { - // prop: 'productionProgress', - // label: '生产进度', - // filter: (val) => (val * 100) + '%' - // }, - // { - // prop: 'orderStatus', - // label: '工单状态', - // filter: publicFormatter('workorder_status') - // // filter: (val) => ['未开始', '生产中', '已完成'][val], - // }, - // { - // prop: 'startTime', - // label: '开始时间', - // minWidth: 100, - // showOverflowtooltip: true - // }, - // { - // prop: 'endTime', - // label: '完成时间', - // minWidth: 100, - // showOverflowtooltip: true - // } - ], + otherProps:[], tableData: [], xAxis: [], currentMenu:null, @@ -227,6 +158,32 @@ export default { weekNum() { return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1 }, + tableProps() { + return [ + { + prop: 'type', + label: '玻璃类型', + fixed: true, + // filter: (val) => factoryList[val], + // minWidth: 200, + // showOverflowtooltip: true + }, + { + prop: 'item', + label: '科目/日期', + fixed: true, + // filter: (val) => ['玻璃芯片', '标准组件', 'BIPV', '定制组件'][val] + }, + { + prop: 'unit', + label: '单位', + fixed: true, + // filter: publicFormatter('workorder_status') + // filter: (val) => ['', '芯片工单', '组件类型', 'bipv类型'][val], + }, + ...this.otherProps + ] + }, }, // created() { // const currentMonth = new Date() @@ -235,67 +192,40 @@ export default { // }, mounted() { // this.getOverView() - const currentMonth = new Date() - this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')] - this.changeTime() + const today = new Date() + const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000)) + this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD') + this.listQuery.endDate = moment(today).format('yyyy-MM-DD') + this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate] this.getDataList() }, methods: { getYear(e) { - if (this.end && Number(this.end) - Number(this.start) > 10) { + if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) { this.$message({ message: '年份起止时间不能超过十年', type: 'warning' }); - this.start = undefined - this.end = undefined + this.listQuery.reportTime = [] + this.listQuery.start = undefined + this.listQuery.end = undefined // console.log(); } else { - if (Number(this.end) < Number(this.start)) { - this.$message({ - message: '结束年份不能小于开始年份', - type: 'warning' - }); - this.start = undefined - this.end = undefined - } else { - this.listQuery.startDate = Number(this.start) - this.listQuery.endDate = Number(this.end) - } + this.listQuery.startDate = this.listQuery.start + this.listQuery.endDate = this.listQuery.end } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } // console.log(e); }, - changeTime() { - if (this.listQuery.reportTime) { - console.log(this.listQuery.reportTime) - let start = new Date(this.listQuery.reportTime[0]) - let end = new Date(this.listQuery.reportTime[1]) - // const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4)) - // const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4)) - // console.log(years); - if ((end - start) > 31104000000) { - this.$message({ - message: '时间范围不能超过24个月', - type: 'warning' - }); - this.listQuery.reportTime = []; - } else { - this.listQuery.startDate = this.listQuery.reportTime[0] - this.listQuery.endDate = this.listQuery.reportTime[1] - } - } else { - this.listQuery.startDate = undefined - this.listQuery.endDate = undefined - } - }, onValueChange(picker, k) { // 选中近k周后触发的操作 - if (this.start && this.end) { - this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') - this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1]) + if (this.listQuery.start && this.listQuery.end) { + console.log(this.listQuery.reportTime) + this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') + this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss') const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); if (numDays > 168) { console.log(numDays) @@ -304,20 +234,21 @@ export default { type: 'warning' }); } else { - this.listQuery.startDate = this.date1 - this.listQuery.endDate = this.date2 - // this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW')) - // this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW')) + this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') + this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') } } - if (!this.start && !this.end) { + if (!this.listQuery.start && !this.listQuery.end) { this.listQuery.startDate = undefined this.listQuery.endDate = undefined } }, changeDayTime() { if (this.listQuery.reportTime) { - const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) + // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss'); + // this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss'); + console.log(this.listQuery.reportTime[1]) + const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000); if (numDays > 30) { this.$message({ message: '时间范围不能超过30天', @@ -333,30 +264,209 @@ export default { this.listQuery.endDate = undefined } }, - getOverView() { - // getOverView().then(res => { - // this.data = res.data - // console.log('aa', res.data) - // }) - }, - otherMethods(val) { - this.detailOrUpdateVisible = true; - // this.addOrEditTitle = "详情"; - this.$nextTick(() => { - // this.$refs.detailOrUpdate.init(val.data.id); - }); + changeTime(value) { + if (this.listQuery.reportTime) { + const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0]; + if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) { + this.$message({ + message: '时间范围不能超过24个月', + type: 'warning' + }); + this.listQuery.reportTime = []; + } else { + this.listQuery.startDate = this.listQuery.reportTime[0] + this.listQuery.endDate = this.listQuery.reportTime[1] + } + } else { + this.listQuery.startDate = undefined + this.listQuery.endDate = undefined + } }, async getDataList() { - console.log(this.listQuery); - if (this.listQuery.type == 3) { - this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00' - this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59' - } + this.otherProps = [] let arr = [] this.currentMenu === '邯郸' ? arr.push(1) : arr.push(2) this.listQuery.factory = arr const res = await getComprehensiveDataPage(this.listQuery) this.tableData = res.data.list + let dataArr = [{ + type: '芯片', + item: 'FTO投入', + unit: '片' + }, + { + type: '芯片', + item: '芯片产量', + unit: '片' + }, { + type: '芯片', + item: '芯片平均功率', + unit: 'W' + }, + { + type: '芯片', + item: '芯片良率', + unit: '%' + }, { + type: '芯片', + item: '芯片产量', + unit: '片' + }, { + type: '芯片', + item: '芯片总功率', + unit: 'MW' + }, { + type: '芯片', + item: 'CSS稼动率', + unit: '%' + }, { + type: '芯片', + item: '芯片段OEE', + unit: '%' + }, { + type: '芯片', + item: '芯片产能利用率', + unit: '%' + }, { + type: '芯片', + item: '芯片人均产量', + unit: '片/人' + }, { + type: '芯片', + item: '芯片BOM', + unit: '元/片' + }, { + type: '标准组件', + item: '标准组件产量', + unit: '片' + }, { + type: '标准组件', + item: '标准组件平均功率', + unit: 'W' + }, { + type: '标准组件', + item: '标准组件良率', + unit: '%' + }, { + type: '标准组件', + item: '标准组件总功率', + unit: 'MW' + }, { + type: '标准组件', + item: '封装线OEE', + unit: '%' + }, + { + type: '标准组件', + item: '封装线产能利用率', + unit: '%' + }, + { + type: '标准组件', + item: '标准组件人均产量', + unit: '片/人' + }, + { + type: '标准组件', + item: '封装BOM', + unit: '元/片' + }, + { + type: 'BIPV', + item: '芯片使用量', + unit: '%' + }, + { + type: 'BIPV', + item: 'BIPV产量', + unit: 'm2' + }, + { + type: 'BIPV', + item: '芯片使用率', + unit: '%' + }, + { + type: 'BIPV', + item: '人均产量', + unit: 'm2/人' + }, + { + type: 'BIPV', + item: 'OEM及委外材料成本', + unit: '元/片' + }, + { + type: 'BIPV', + item: '内部材料成本', + unit: '元/片' + }, + { + type: 'BIPV', + item: '综合材料成本', + unit: '元/片' + }, + ] + res.data.forEach((ele, index) => { + let i = index + 1 + // this.chartMsg.xData.push(ele.titleValue) + this.otherProps.push({ + label: ele.titleValue, + props: 'value' + i + }) + }) + console.log(this.otherProps) + res.data.forEach((item, index) => { + let i = index + 1 + let m = 'value' + i + // ele.productYieldDataVOList.forEach((item) => { + dataArr[0]['' + m + ''] = item.ftoInput + // dataArr[0].factory = item.factory === 1 ? '邯郸' : '瑞昌' + // dataArr[1].factory = item.factory === 1 ? '邯郸' : '瑞昌' + // dataArr[2].factory = item.factory === 1 ? '邯郸' : '瑞昌' + // dataArr[3].factory = item.factory === 1 ? '邯郸' : '瑞昌' + dataArr[1]['' + m + ''] = item.chipYield + dataArr[2]['' + m + ''] = item.chipAveragePower + dataArr[4]['' + m + ''] = item.chipTotalPower + dataArr[5]['' + m + ''] = item.chipCssMarriageRate + dataArr[6]['' + m + ''] = item.chipOee + dataArr[7]['' + m + ''] = item.chipCapacityUtilizationRate + dataArr[8]['' + m + ''] = item.chipAnnualAverageProduction + dataArr[9]['' + m + ''] = item.chipBom + dataArr[10]['' + m + ''] = item.componentYield + dataArr[11]['' + m + ''] = item.componentAveragePower + dataArr[12]['' + m + ''] = item.componentYieldRate + dataArr[13]['' + m + ''] = item.componentTotalPower + dataArr[14]['' + m + ''] = item.componentOee + dataArr[15]['' + m + ''] = item.componentCapacityUtilizationRate + dataArr[16]['' + m + ''] = item.componentAnnualAverageProduction + dataArr[17]['' + m + ''] = item.componentBom + dataArr[18]['' + m + ''] = item.bipvChipUsage + dataArr[19]['' + m + ''] = item.bipvProductOutput + dataArr[20]['' + m + ''] = item.bipvChipUtilizationRate + dataArr[21]['' + m + ''] = item.bipvAnnualAverageProduction + dataArr[22]['' + m + ''] = item.bipvOeeMaterialCost + dataArr[23]['' + m + ''] = item.bipvInsideMaterialCost + dataArr[24]['' + m + ''] = item.bipvComprehensiveMaterialCost + + // }) + // ele.titleValue + // .push({ + // label: ele.titleValue, + // props: 'value' + index + 1, + // }) + }) + if (res.data.length === 0) { + this.tableData = [] + } else { + if (this.currentMenu !== '瑞昌') { + this.tableData = dataArr + } else { + this.tableData = dataArr.filter(function (item) { + return item.type !== "BIPV" + }); + } + } this.listQuery.total = res.data.total if (this.listQuery.total > 0) { this.tableData.forEach(item => { @@ -392,6 +502,14 @@ export default { }, /** 导出按钮操作 */ handleExport() { + + let fileName = "综合数据.xls"; + exportComprehensiveDataPage(this.listQuery) + .then((response) => { + this.$download.excel(response, fileName); + this.$message.success("导出成功"); + }) + .catch(() => { }); // this.$modal.confirm('是否确认导出工单数据?').then(() => { // // 处理查询参数 // // let params = {...this.listQuery}; diff --git a/src/views/report/produceConversion.vue b/src/views/report/produceConversion.vue index f8e9637..874d994 100644 --- a/src/views/report/produceConversion.vue +++ b/src/views/report/produceConversion.vue @@ -4,7 +4,7 @@ -
+ +
+ + +
+ 产量转化效率 +
+ +
+ +
+ {{ title }} +
+ +
+
+ + +
+ 产量转化效率 +
+ + + +
@@ -79,58 +107,23 @@