dy #42

Merged
hellody merged 2 commits from dy into test 2023-10-12 17:06:05 +08:00
7 changed files with 79 additions and 37 deletions
Showing only changes of commit 2b76ef7d23 - Show all commits

View File

@ -144,11 +144,6 @@ export default {
// this.listQuery.lineId = '1672847052717821953' // this.listQuery.lineId = '1672847052717821953'
// this.listQuery.startTime = '1693497600000'; // this.listQuery.startTime = '1693497600000';
// this.listQuery.endTime = '1693843200000'; // this.listQuery.endTime = '1693843200000';
this.tableData.splice(0)
this.xData.splice(0)
this.yData.splice(0)
this.tableProps.splice(0)
this.spanArr.splice(0)
this.urlOptions.getDataListURL(this.listQuery).then(res => { this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res) console.log(res)
let arr = [ let arr = [
@ -228,11 +223,17 @@ export default {
this.listQuery.lineId = val.lineIds this.listQuery.lineId = val.lineIds
this.listQuery.startTime = val.time ? String(new Date(val.time[0]).getTime()) : undefined; this.listQuery.startTime = val.time ? String(new Date(val.time[0]).getTime()) : undefined;
this.listQuery.endTime = val.time ? String(new Date(val.time[1]).getTime()) : undefined; this.listQuery.endTime = val.time ? String(new Date(val.time[1]).getTime()) : undefined;
if (val.time) { if (val.time && val.lineIds) {
this.tableData = []
this.xData = []
this.yData = []
this.tableProps = []
this.spanArr = []
this.timeList = []
this.getData() this.getData()
} else { } else {
this.$message({ this.$message({
message: '请选择时间', message: '请选择产线和时间',
type: 'warning' type: 'warning'
}); });
} }

View File

@ -72,7 +72,7 @@ export default {
{ {
type: 'datePicker', type: 'datePicker',
label: '时间', label: '时间',
dateType: 'datetime', dateType: 'month',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
@ -220,7 +220,6 @@ export default {
}); });
}, },
buttonClick(val) { buttonClick(val) {
// console.log(val)
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.lineIds = val.lineIds ? val.lineIds :undefined this.listQuery.lineIds = val.lineIds ? val.lineIds :undefined

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-03 14:09:18 * @Date: 2023-08-03 14:09:18
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-10-10 16:54:09 * @LastEditTime: 2023-10-11 11:20:51
* @Description: * @Description:
--> -->
<template> <template>
@ -61,6 +61,7 @@ export default {
switchLineBindProduct(data).then((response) => { switchLineBindProduct(data).then((response) => {
this.$modal.msgSuccess('修改成功'); this.$modal.msgSuccess('修改成功');
this.visible = false; this.visible = false;
this.list.productName = this.list.string.split('+')[1]
this.$emit('emitData'); this.$emit('emitData');
}); });
}, },

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-09 09:08:08 * @LastEditTime: 2023-10-12 16:54:15
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -117,6 +117,7 @@ export default {
pageNo: 1, pageNo: 1,
total: 1, total: 1,
}, },
fileName: '',
exportLoading: false, exportLoading: false,
dataListLoading: false, dataListLoading: false,
dialogVisible: false, dialogVisible: false,
@ -207,6 +208,7 @@ export default {
test() { test() {
var target = document.getElementsByClassName("right-aside")[0] var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF' target.style.background = '#FFFFFF'
var that = this
setTimeout(() => { setTimeout(() => {
html2canvas(target).then(function(canvas) { html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width var contentWidth = canvas.width
@ -242,7 +244,7 @@ export default {
} }
} }
pdf.save('产线统计自动报表.pdf') pdf.save(that.fileName + '产线产量.pdf')
}) })
}, 300) }, 300)
}, },
@ -285,7 +287,7 @@ export default {
try { try {
FileSaver.saveAs(new Blob([exportTableOut], { FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream' type: 'application/octet-stream'
}), '产线统计自动报表.xlsx') }), this.fileName + '产线产量.xlsx')
} catch (e) { } catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut) if (typeof console !== 'undefined') console.log(e, exportTableOut)
} }
@ -310,6 +312,9 @@ export default {
this.listQuery.reportType = val.reportType ? val.reportType : undefined; this.listQuery.reportType = val.reportType ? val.reportType : undefined;
this.listQuery.reportStartTime = val.timeVal ? [new Date(val.timeVal[0]).getTime()] : undefined; this.listQuery.reportStartTime = val.timeVal ? [new Date(val.timeVal[0]).getTime()] : undefined;
this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined; this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
if (val.timeVal && val.timeVal.length > 0) {
this.fileName = val.timeVal[0].slice(0, 10) + '-' + val.timeVal[1].slice(0, 10) + '_'
}
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-09 15:14:42 * @LastEditTime: 2023-10-12 16:51:54
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -110,7 +110,7 @@ export default {
showData: [], showData: [],
tableData: [], tableData: [],
selectedList: [], selectedList: [],
fileName: [], fileName: '',
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
@ -156,7 +156,7 @@ export default {
} }
// const time = new Date() // const time = new Date()
// this.formConfig[1].defaultSelect = [time, time] // this.formConfig[1].defaultSelect = [time, time]
// this.getDataList() this.getDataList()
this.getPdLineList() this.getPdLineList()
}, },
methods: { methods: {
@ -199,7 +199,7 @@ export default {
} }
} }
pdf.save(that.fileName[0] + '-' + that.fileName[1] + '_产线产量.pdf') pdf.save(that.fileName + '产线产量.pdf')
}) })
}, 300) }, 300)
}, },
@ -222,7 +222,7 @@ export default {
try { try {
FileSaver.saveAs(new Blob([exportTableOut], { FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream' type: 'application/octet-stream'
}), this.fileName[0] + '-' + this.fileName[1] + '_产线产量.xlsx') }), this.fileName + '产线产量.xlsx')
} catch (e) { } catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut) if (typeof console !== 'undefined') console.log(e, exportTableOut)
} }
@ -265,17 +265,10 @@ export default {
this.listQuery.proLineId = val.line ? val.line : undefined; this.listQuery.proLineId = val.line ? val.line : undefined;
this.listQuery.startTime = val.timeVal ? new Date(val.timeVal[0]).getTime() : undefined; this.listQuery.startTime = val.timeVal ? new Date(val.timeVal[0]).getTime() : undefined;
this.listQuery.endTime = val.timeVal ? new Date(val.timeVal[1]).getTime() : undefined; this.listQuery.endTime = val.timeVal ? new Date(val.timeVal[1]).getTime() : undefined;
console.log('nihc 你好', val.timeVal)
if (val.timeVal && val.timeVal.length > 0) { if (val.timeVal && val.timeVal.length > 0) {
this.fileName[0] = val.timeVal[0].slice(0, 10) this.fileName = val.timeVal[0].slice(0, 10) + '-' + val.timeVal[1].slice(0, 10) + '_'
this.fileName[1] = val.timeVal[1].slice(0, 10)
this.getDataList();
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
} }
this.getDataList();
break; break;
case 'export': case 'export':
this.handleExport(); this.handleExport();

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-08 10:51:49 * @LastEditTime: 2023-10-12 16:35:49
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -129,6 +129,7 @@ export default {
tableBtn: [], tableBtn: [],
tableData: [], tableData: [],
showData: [], showData: [],
fileName: '',
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
@ -200,6 +201,7 @@ export default {
test() { test() {
var target = document.getElementsByClassName("right-aside")[0] var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF' target.style.background = '#FFFFFF'
var that = this
setTimeout(() => { setTimeout(() => {
html2canvas(target).then(function(canvas) { html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width var contentWidth = canvas.width
@ -235,7 +237,7 @@ export default {
} }
} }
pdf.save('工段统计自动报表.pdf') pdf.save(that.fileName + '工段统计.pdf')
}) })
}, 300) }, 300)
}, },
@ -258,7 +260,7 @@ export default {
try { try {
FileSaver.saveAs(new Blob([exportTableOut], { FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream' type: 'application/octet-stream'
}), '工段统计自动报表.xlsx') }), this.fileName + '工段统计.xlsx')
} catch (e) { } catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut) if (typeof console !== 'undefined') console.log(e, exportTableOut)
} }
@ -307,6 +309,9 @@ export default {
this.listQuery.reportType = val.reportType ? val.reportType : undefined; this.listQuery.reportType = val.reportType ? val.reportType : undefined;
this.listQuery.reportStartTime = val.timeVal ? [new Date(val.timeVal[0]).getTime()] : undefined; this.listQuery.reportStartTime = val.timeVal ? [new Date(val.timeVal[0]).getTime()] : undefined;
this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined; this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
if (val.timeVal && val.timeVal.length > 0) {
this.fileName = val.timeVal[0].slice(0, 10) + '-' + val.timeVal[1].slice(0, 10) + '_'
}
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':

View File

@ -3,6 +3,7 @@
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
class="right-aside" class="right-aside"
@ -110,6 +111,7 @@ export default {
param: 'proLineId', param: 'proLineId',
defaultSelect: '', defaultSelect: '',
filterable: true, filterable: true,
onchange: true,
}, },
{ {
type: 'select', type: 'select',
@ -151,9 +153,39 @@ export default {
// this.getDataList() // this.getDataList()
}, },
methods: { methods: {
/** 根据产线获取工段 */
async getWorksectionById(lineId) {
const { code, data } = await this.$axios({
url: '/base/workshop-section/listByParentId',
method: 'get',
params: {
id: lineId,
},
});
if (code == 0) {
this.formConfig[1].selectOptions = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
},
handleSearchBarChanged({ param, value }) {
if (!value) {
this.formConfig[1].selectOptions = [];
return;
}
switch (param) {
case 'proLineId':
this.getWorksectionById(value);
break;
}
},
test() { test() {
var target = document.getElementsByClassName("right-aside")[0] var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF' target.style.background = '#FFFFFF'
var that = this
setTimeout(() => { setTimeout(() => {
html2canvas(target).then(function(canvas) { html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width var contentWidth = canvas.width
@ -189,7 +221,7 @@ export default {
} }
} }
pdf.save('工段统计数据查询报表.pdf') pdf.save(that.fileName[0] + '-' + that.fileName[1] + '_工段统计.pdf')
}) })
}, 300) }, 300)
}, },
@ -212,7 +244,7 @@ export default {
try { try {
FileSaver.saveAs(new Blob([exportTableOut], { FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream' type: 'application/octet-stream'
}), '工段统计数据查询报表.xlsx') }), this.fileName[0] + '-' + this.fileName[1] + '_工段统计.xlsx')
} catch (e) { } catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut) if (typeof console !== 'undefined') console.log(e, exportTableOut)
} }
@ -293,10 +325,9 @@ export default {
this.listQuery.sectionId = val.sectionId ? val.sectionId : undefined this.listQuery.sectionId = val.sectionId ? val.sectionId : undefined
this.listQuery.startTime = val.timeSlot ? new Date(val.timeSlot[0]).getTime() : undefined this.listQuery.startTime = val.timeSlot ? new Date(val.timeSlot[0]).getTime() : undefined
this.listQuery.endTime = val.timeSlot ? new Date(val.timeSlot[1]).getTime() : undefined this.listQuery.endTime = val.timeSlot ? new Date(val.timeSlot[1]).getTime() : undefined
this.fileName[0] = val.timeSlot[0] if (val.timeSlot && val.timeSlot.length > 0) {
this.fileName[1] = val.timeSlot[1] this.fileName[0] = val.timeSlot[0].slice(0, 10)
console.log('wfjmmki文件名称', this.fileName) this.fileName[1] = val.timeSlot[1].slice(0, 10)
if (val.timeSlot) {
this.getDataList() this.getDataList()
} else { } else {
this.$message({ this.$message({
@ -315,7 +346,14 @@ export default {
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
if (val.timeSlot && val.timeSlot.length > 0) {
this.handleExport(); this.handleExport();
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
}
break; break;
default: default:
console.log(val); console.log(val);