lb #39

Merged
g7hoo merged 16 commits from lb into test 2023-10-11 10:33:08 +08:00
14 changed files with 615 additions and 315 deletions
Showing only changes of commit 0162f338ba - Show all commits

View File

@ -20,6 +20,7 @@
<el-select <el-select
v-model="dataForm.productionLineId" v-model="dataForm.productionLineId"
placeholder="请选择产线" placeholder="请选择产线"
filterable
@change="handleProductlineChange"> @change="handleProductlineChange">
<el-option <el-option
v-for="opt in productionLineList" v-for="opt in productionLineList"
@ -37,6 +38,7 @@
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="dataForm.workshopSectionId" v-model="dataForm.workshopSectionId"
filterable
placeholder="请选择工段" placeholder="请选择工段"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
<el-option <el-option
@ -56,6 +58,7 @@
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="dataForm.equipmentId" v-model="dataForm.equipmentId"
filterable
placeholder="请选择设备" placeholder="请选择设备"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
<el-option <el-option
@ -69,8 +72,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工段排序" prop="sort"> <el-form-item label="工段排序" prop="sort">
<el-input <el-input-number
v-model="dataForm.sort" v-model="dataForm.sort"
filterable
min="0"
max="100"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入工段排序" /> placeholder="请输入工段排序" />
</el-form-item> </el-form-item>

View File

@ -134,6 +134,8 @@ export default {
label: '工段', label: '工段',
placeholder: '请选择工段', placeholder: '请选择工段',
param: 'workshopSectionId', param: 'workshopSectionId',
selectOptions: [],
filterable: true
}, },
{ {
type: 'input', type: 'input',
@ -239,8 +241,24 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.initWorksection();
}, },
methods: { methods: {
/** 准备工段数据 */
async initWorksection() {
const { code, data } = await this.$axios({
url: '/base/workshop-section/listAll',
method: 'get',
});
if (code == 0) {
this.searchBarFormConfig[0].selectOptions = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -323,7 +341,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除工段设备绑定编号为"' + id + '"的数据项?') .confirm('是否确认删除工段设备绑定设备名称为"' + row.equipment + '"的数据项?')
.then(function () { .then(function () {
return deleteEquipmentBindSection(id); return deleteEquipmentBindSection(id);
}) })

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-09-13 09:02:25 * @Date: 2023-09-13 09:02:25
* @LastEditTime: 2023-09-13 10:33:20 * @LastEditTime: 2023-10-08 15:39:38
* @LastEditors: zhp * @LastEditors: DY
* @Description: * @Description:
--> -->
<template> <template>
@ -61,11 +61,12 @@ export default {
// }, // },
methods: { methods: {
initChart(xData, yData,lineName) { initChart(xData, yData,lineName) {
console.log(xData,yData); console.log( '打印结果', xData,yData, lineName);
this.chart = echarts.init(this.$el, 'macarons') this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(xData, yData, lineName) this.setOptions(xData, yData, lineName)
}, },
setOptions(xData, yData, lineName) { setOptions(xData, yData, lineName) {
console.log('da', lineName)
let seriesData = [] let seriesData = []
lineName.forEach((item,index) => { lineName.forEach((item,index) => {
seriesData.push({ seriesData.push({
@ -86,7 +87,7 @@ export default {
type: 'value' type: 'value'
}, },
series: seriesData series: seriesData
}) }, true)
} }
} }
} }

View File

@ -228,7 +228,14 @@ 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;
this.getData() if (val.time) {
this.getData()
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
}
break; break;
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();

View File

@ -1,14 +1,14 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-09-13 09:02:25 * @Date: 2023-09-13 09:02:25
* @LastEditTime: 2023-09-20 09:29:40 * @LastEditTime: 2023-10-08 16:36:37
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
<template> <template>
<div> <div>
<div style="margin: 20px"> <div style="margin: 20px">
<el-button v-for="(item, index) in dataArray" :key="index" @click="changeChart(index)">{{ item.name }}</el-button> <el-button v-for="(item, index) in buttonList" :key="index" :class="[item.actived ? 'activeButton': 'normalButton']" @click="changeChart(index)">{{ item.name }}</el-button>
</div> </div>
<div ref="chartDiv" :class="className" :style="{height:height,width:width}" /> <div ref="chartDiv" :class="className" :style="{height:height,width:width}" />
</div> </div>
@ -43,7 +43,8 @@ export default {
return { return {
chart: null, chart: null,
dataArray: [], dataArray: [],
xDatas: [] xDatas: [],
buttonList: []
} }
}, },
mounted() { mounted() {
@ -51,12 +52,34 @@ export default {
methods: { methods: {
changeChart(index) { changeChart(index) {
this.setOptions(this.xDatas, this.dataArray[index]) this.setOptions(this.xDatas, this.dataArray[index])
this.buttonList.forEach((item, s) => {
if (index === s) {
// item.actived = true
this.$nextTick(() =>{
// item.actived = true
this.$set(item, 'actived', true)
})
} else {
// item.actived = false
this.$nextTick(() =>{
// item.actived = false
this.$set(item, 'actived', false)
})
// this.$set(item, 'actived', false)
}
})
console.log('看一下数22222据', this.dataArray)
}, },
initChart(xData, yData, lineName) { initChart(xData, yData, lineName) {
this.dataArray = yData this.dataArray = yData
this.buttonList = this.dataArray.map((item, index) => {
return {
'name': item.name,
'actived': index === 0 ? true : false
}
})
console.log('看一下数据', this.dataArray)
this.xDatas = xData this.xDatas = xData
console.log(xData,yData);
console.log('zale', yData[0].eqData)
this.chart = echarts.init(this.$refs.chartDiv, 'macarons') this.chart = echarts.init(this.$refs.chartDiv, 'macarons')
this.setOptions(xData, yData[0], lineName) this.setOptions(xData, yData[0], lineName)
}, },
@ -100,3 +123,12 @@ export default {
} }
} }
</script> </script>
<style scoped>
.activeButton {
background-color: rgb(93,159,255);
}
.normalButton {
background-color: none;
}
</style>

View File

@ -57,8 +57,7 @@ export default {
lineIds: [], lineIds: [],
time: '' time: ''
}, },
xData: [], dateLabelList: [],
yData:[],
optionArrUrl: [getProductionLinePage ], optionArrUrl: [getProductionLinePage ],
formConfig: [ formConfig: [
{ {
@ -113,75 +112,101 @@ export default {
let arr = [ let arr = [
{ {
prop: 'lineName', prop: 'lineName',
label: '产线', label: '产线'
align: 'center',
}, },
{ {
prop: 'sum', prop: 'sum',
label: '合计', label: '合计'
align: 'center',
}, },
{ {
prop: res.data.nameData[0].name, prop: res.data ? res.data.nameData[0].name : undefined,
label: res.data.nameData[0].name, label: res.data ? res.data.nameData[0].name : undefined,
align: 'center', align: 'center',
children:[ children:[
] ]
} }
] ]
console.log(res.data.nameData.slice(1)) // console.log(res.data.nameData.slice(1))
res.data.nameData.slice(1).forEach(item => {
const props = {
'prop': item.name,
'label': item.name,
'align': 'center'
}
arr[2].children.push(props)
})
let tableDataArr =[]
res.data.data.forEach(item => {
let obj = {}
obj.lineName= item.lineName,
obj.sum= item.sum,
item.data.forEach((ele, index) => {
// console.log(ele)
ele.children.forEach((e) => {
console.log(e.dynamicName)
obj['' + e.dynamicName + ''] = e.dynamicValue
console.log(obj['' + e.dynamicName + '']);
})
})
tableDataArr.push(obj)
});
this.tableData = tableDataArr
console.log(this.tableData)
console.log(arr)
this.tableProps = arr
let xData = [] let xData = []
res.data.nameData.slice(1).forEach(item => {
xData.push(item.name)
// arr[2].children.push(props)
})
let yAllData = [] let yAllData = []
let lineName = [] let lineName = []
res.data.data.forEach(item => { if (res.data) {
let yData = [] let tempDateList = []
lineName.push(item.lineName) res.data.nameData.forEach(date => {
// let obj = {} tempDateList.push(date.name)
// obj.lineName = item.lineName, })
// obj.sum = item.sum, this.dateLabelList = Array.from(new Set(tempDateList))
item.data.forEach((ele, index) => {
this.dateLabelList.forEach(item => {
if (item.indexOf('年') === -1) {
//
const props = {
'prop': item,
'label': item
}
arr[2].children.push(props)
// echarts
xData.push(item)
}
})
// res.data.nameData.slice(1).forEach(item => {
// const props = {
// 'prop': item.name,
// 'label': item.name,
// 'align': 'center'
// }
// arr[2].children.push(props)
// })
let tableDataArr =[]
res.data.data.forEach(item => {
let obj = {}
obj.lineName= item.lineName,
obj.sum= item.sum,
item.data.forEach((ele, index) => {
// console.log(ele) // console.log(ele)
ele.children.forEach((e) => { ele.children.forEach((e) => {
// let yData = [] console.log(e.dynamicName)
yData.push(e.dynamicValue) obj['' + e.dynamicName + ''] = e.dynamicValue
console.log(obj['' + e.dynamicName + '']);
}) })
}) })
yAllData.push(yData) tableDataArr.push(obj)
}); });
console.log(lineName) this.tableData = tableDataArr
this.tableProps = arr
// let tempList = []
// res.data.nameData.slice(1).forEach(item => {
// tempList.push(item.name)
// // arr[2].children.push(props)
// })
// xData = Array.from(new Set(tempList))
res.data.data.forEach(item => {
let yData = []
lineName.push(item.lineName)
// let obj = {}
// obj.lineName = item.lineName,
// obj.sum = item.sum,
item.data.forEach((ele, index) => {
// console.log(ele)
ele.children.forEach((e) => {
// let yData = []
yData.push(e.dynamicValue)
})
})
yAllData.push(yData)
});
console.log(lineName)
} else {
this.tableProps = arr
this.tableData = []
xData = []
yAllData = []
lineName = []
}
// res.data.data[0].data[0].children.forEach((item, index) => { // res.data.data[0].data[0].children.forEach((item, index) => {
// // console.log(item) // // console.log(item)
// yData.push(item.dynamicValue) // yData.push(item.dynamicValue)
@ -203,7 +228,14 @@ export default {
this.listQuery.time = val.time ? new Date(val.time).getTime() : undefined this.listQuery.time = val.time ? new Date(val.time).getTime() : undefined
// this.listQuery.pageNo = 1; // this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10; // this.listQuery.pageSize = 10;
this.getData() if (val.time) {
this.getData()
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
}
break; break;
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();

View File

@ -50,29 +50,24 @@ import {
const tableProps = [ const tableProps = [
{ {
prop: 'code', prop: 'code',
label: '工厂编码', label: '工厂编码'
align: 'center',
}, },
{ {
prop: 'name', prop: 'name',
label: '工厂名称', label: '工厂名称'
align: 'center',
}, },
{ {
prop: 'address', prop: 'address',
label: '地址', label: '地址'
align: 'center',
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注', label: '备注'
align: 'center',
}, },
{ {
prop: 'createTime', prop: 'createTime',
label: '创建时间', label: '创建时间',
align: 'center', filter: parseTime
filter: parseTime,
}, },
]; ];
@ -120,14 +115,14 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ // {
type: 'separate', // type: 'separate',
}, // },
{ // {
type: 'button', // type: 'button',
btnName: '重置', // btnName: '',
name: 'reset', // name: 'reset',
}, // },
{ {
type: 'separate', type: 'separate',
}, },

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2023-08-02 15:12:42 * @Date: 2023-08-02 15:12:42
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2023-08-03 14:24:36 * @LastEditTime: 2023-10-10 16:49:03
* @Description: * @Description:
--> -->
<template> <template>
@ -81,6 +81,7 @@ export default {
}; };
getProductPage(params).then((response) => { getProductPage(params).then((response) => {
this.tableProps[1].list = response.data.list; this.tableProps[1].list = response.data.list;
console.log('打印', this.tableProps[1].list)
}); });
}, },
methods: { methods: {

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2023-08-03 14:09:18 * @Date: 2023-08-03 14:09:18
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2023-08-03 14:51:16 * @LastEditTime: 2023-10-10 16:54:09
* @Description: * @Description:
--> -->
<template> <template>
@ -48,6 +48,9 @@ export default {
visible: false, visible: false,
}; };
}, },
mounted() {
console.log('hello', this.list)
},
methods: { methods: {
changeInput() { changeInput() {
const data = { const data = {

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-09-16 17:34:17 * @LastEditTime: 2023-10-09 09:08:08
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -12,21 +12,15 @@
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
class="right-aside"
v-loading="dataListLoading" v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:selectWidth="55" :selectWidth="55"
:table-data="tableData" :table-data="showData"
@selection-change="selectChange" @selection-change="selectChange"
> >
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table> </base-table>
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
@ -43,19 +37,6 @@
:table-data="selectedList" :table-data="selectedList"
/> />
</div> --> </div> -->
<div ref="pdf" v-show="false">
<el-table :data="selectedList" stripe border style="width: 100%">
<el-table-column prop="reportType" label="报表类型" />
<el-table-column prop="reportStartTime" label="统计开始时间" />
<el-table-column prop="reportEndTime" label="统计结束时间" />
<el-table-column prop="proLineName" label="产线名称" />
<el-table-column prop="inputNum" label="投入数量/片" />
<el-table-column prop="outputNum" label="产出数量/片" />
<el-table-column prop="outputArea" label="产出面积/㎡" />
<el-table-column prop="lossArea" label="损耗面积/㎡" />
<el-table-column prop="lossRatio" label="损耗比例%" />
</el-table>
</div>
<el-dialog <el-dialog
title="提示" title="提示"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@ -74,8 +55,8 @@
<script> <script>
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getPdlAutoReport, getPdList } from '@/api/core/monitoring/auto' import { getPdlAutoReport, getPdList } from '@/api/core/monitoring/auto'
// import jsPDF from 'jspdf' import jsPDF from 'jspdf'
// import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
// import codeFilter from '../../mixins/code-filter' // import codeFilter from '../../mixins/code-filter'
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
@ -83,55 +64,45 @@ import FileSaver from 'file-saver'
const tableProps = [ const tableProps = [
{ {
prop: 'reportType', prop: 'reportType',
label: '报表类型', label: '报表类型'
align: 'center'
}, },
{ {
prop: 'reportStartTime', prop: 'reportStartTime',
label: '统计开始时间', label: '统计开始时间',
align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'reportEndTime', prop: 'reportEndTime',
label: '统计结束时间', label: '统计结束时间',
align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'proLineName', prop: 'proLineName',
label: '产线名称', label: '产线名称'
align: 'center',
}, },
{ {
prop: 'inputNum', prop: 'inputNum',
label: '投入数量/片', label: '投入数量/片'
align: 'center',
}, },
{ {
prop: 'outputNum', prop: 'outputNum',
label: '产出数量/片', label: '产出数量/片'
align: 'center',
}, },
{ {
prop: 'outputArea', prop: 'outputArea',
label: '产出面积/㎡', label: '产出面积/㎡'
align: 'center',
}, },
{ {
prop: 'lossNum', prop: 'lossNum',
label: '损耗数量/片', label: '损耗数量/片'
align: 'center',
}, },
{ {
prop: 'lossArea', prop: 'lossArea',
label: '损耗面积/㎡', label: '损耗面积/㎡'
align: 'center',
}, },
{ {
prop: 'lossRatio', prop: 'lossRatio',
label: '损耗比例%', label: '损耗比例%'
align: 'center',
} }
]; ];
@ -153,6 +124,7 @@ export default {
addOrUpdateVisible: false, addOrUpdateVisible: false,
tableProps, tableProps,
tableBtn: [], tableBtn: [],
showData: [],
selectedList: [], selectedList: [],
// tableBtn: [ // tableBtn: [
// this.$auth.hasPermi(`base:factory:update`) // this.$auth.hasPermi(`base:factory:update`)
@ -232,44 +204,60 @@ export default {
this.getPdLineList() this.getPdLineList()
}, },
methods: { methods: {
test() {
var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF'
setTimeout(() => {
html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width
var contentHeight = canvas.height
// pdfhtmlcanvas
var pageHeight = contentHeight / 592.28 * 841.89
// pdfhtml
var leftHeight = contentHeight
//
var position = 0
// a4[595.28,841.89]htmlcanvaspdf
var imgWidth = 595.28
var imgHeight = 592.28 / contentWidth * contentHeight
var pageData = canvas.toDataURL('image/jpeg', 1.0)
console.log('nihc URL', leftHeight, pageHeight)
var pdf = new jsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
} else {
while(leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
//
if (leftHeight > 0) {
pdf.addPage()
}
}
}
pdf.save('产线统计自动报表.pdf')
})
}, 300)
},
exportPdf() { exportPdf() {
this.pdf() this.test()
this.dialogVisible = false setTimeout(() =>{
this.dialogVisible = false
this.showData = this.tableData
}, 600)
}, },
exportXlsx() { exportXlsx() {
this.down() this.exportECL()
this.dialogVisible = false this.dialogVisible = false
}, this.showData = this.tableData
// imgDownload() {
// let that = this
// let img = this.$refs['pdf']
// //
// var w = parseInt(window.getComputedStyle(img).width)
// //
// var h = parseInt(window.getComputedStyle(img).height)
// //
// window.pageYOffset = 0
// html2canvas(img).then(function(canvas) {
// })
// },
pdf() {
// console.log('[df]')
// const pdf = new jsPDF()
// const content = this.$refs.pdf.innerHTML
// console.log('', content)
// pdf.text(content, 15, 15)
// // pdf.text('Hello world!', 10, 10)
// pdf.save('test.pdf')
// console.log('', pdf)
const printWindow = window.open('', '_blank')
const temp = this.$refs.pdf.innerHTML
console.log(temp)
printWindow.document.body.innerHTML = temp
printWindow.focus()
// printWindow.document.writeln(this.$refs.pdf.innerHTML)
printWindow.document.close()
printWindow.print()
}, },
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
@ -278,23 +266,30 @@ export default {
}) })
.catch(_ => {}); .catch(_ => {});
}, },
down() { exportECL() {
// let tables = document.querySelector('.el-table').cloneNode(true)
// const fix = tables.querySelector('.el-table__fixed')
const exportData = [ const fixRight = tables.querySelector('.el-table__fixed-right')
{reportType: '报表类型', reportStartTime: '统计开始时间', reportEndTime: '统计结束时间', proLineName: '产线名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' }, if (fix) {
...this.selectedList tables.removeChild(tables.querySelector('.el-table__fixed'))
]
//id dom
const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
try {
FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '产线统计自动报表.xlsx')
} catch (e) {
console.log(e)
} }
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
}
let exportTable = XLSX.utils.table_to_book(tables)
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx', bookSST: true, type: 'array'
})
// sheetjs.xlsx
try {
FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream'
}), '产线统计自动报表.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut)
}
return exportTableOut
}, },
selectChange(val) { selectChange(val) {
console.log(val) console.log(val)
@ -313,8 +308,8 @@ export default {
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.lineId = val.line ? val.line : undefined; this.listQuery.lineId = val.line ? val.line : undefined;
this.listQuery.reportType = val.reportType ? val.reportType : undefined; this.listQuery.reportType = val.reportType ? val.reportType : undefined;
this.listQuery.reportStartTime = [new Date(val.timeVal[0]).getTime()]; this.listQuery.reportStartTime = val.timeVal ? [new Date(val.timeVal[0]).getTime()] : undefined;
this.listQuery.reportEndTime = [new Date(val.timeVal[1]).getTime()]; this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
@ -328,12 +323,13 @@ export default {
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list.map(item => { this.tableData = response.data.list.map((item, index) => {
item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月' item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
return item return item
}); });
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
this.showData = this.tableData
}); });
}, },
// //
@ -348,15 +344,10 @@ export default {
this.getDataList(); this.getDataList();
}, },
handleExport() { handleExport() {
if (this.selectedList.length === 0) { if (this.selectedList.length > 0) {
this.selectedList = this.tableData this.showData = this.selectedList
} }
this.dialogVisible = true this.dialogVisible = true
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// // this.down()
// this.pdf()
// }).catch(() => { });
} }
}, },
}; };

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-09-20 10:55:23 * @LastEditTime: 2023-10-09 15:14:42
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -12,12 +12,13 @@
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
class="right-aside"
v-loading="dataListLoading" v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:selectWidth="55" :selectWidth="55"
:table-data="tableData" :table-data="showData"
@selection-change="selectChange" @selection-change="selectChange"
> >
<method-btn <method-btn
@ -33,17 +34,6 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getDataList" />
<div ref="pdf" v-show="false">
<el-table :data="selectedList" stripe border style="width: 100%">
<el-table-column prop="proLineName" label="产线名称" />
<el-table-column prop="inputNum" label="投入数量/片" />
<el-table-column prop="outputNum" label="产出数量/片" />
<el-table-column prop="outputArea" label="产出面积/㎡" />
<el-table-column prop="lossNum" label="损耗数量/片" />
<el-table-column prop="lossArea" label="损耗面积/㎡" />
<el-table-column prop="lossRatio" label="损耗比例%" />
</el-table>
</div>
<el-dialog <el-dialog
title="提示" title="提示"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@ -63,6 +53,8 @@
import { getPdlDataSearch, getPdList } from '@/api/core/monitoring/data' import { getPdlDataSearch, getPdList } from '@/api/core/monitoring/data'
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
const tableProps = [ const tableProps = [
{ {
@ -115,8 +107,10 @@ export default {
addOrUpdateVisible: false, addOrUpdateVisible: false,
tableProps, tableProps,
tableBtn: [], tableBtn: [],
showData: [],
tableData: [], tableData: [],
selectedList: [], selectedList: [],
fileName: [],
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
@ -162,44 +156,91 @@ 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: {
test() {
var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF'
var that = this
setTimeout(() => {
html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width
var contentHeight = canvas.height
// pdfhtmlcanvas
var pageHeight = contentHeight / 592.28 * 841.89
// pdfhtml
var leftHeight = contentHeight
//
var position = 0
// a4[595.28,841.89]htmlcanvaspdf
var imgWidth = 595.28
var imgHeight = 592.28 / contentWidth * contentHeight
var pageData = canvas.toDataURL('image/jpeg', 1.0)
console.log('nihc URL', leftHeight, pageHeight)
var pdf = new jsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
} else {
while(leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
//
if (leftHeight > 0) {
pdf.addPage()
}
}
}
pdf.save(that.fileName[0] + '-' + that.fileName[1] + '_产线产量.pdf')
})
}, 300)
},
exportECL() {
let tables = document.querySelector('.el-table').cloneNode(true)
const fix = tables.querySelector('.el-table__fixed')
const fixRight = tables.querySelector('.el-table__fixed-right')
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'))
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
}
let exportTable = XLSX.utils.table_to_book(tables)
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx', bookSST: true, type: 'array'
})
// sheetjs.xlsx
try {
FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream'
}), this.fileName[0] + '-' + this.fileName[1] + '_产线产量.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut)
}
return exportTableOut
},
exportPdf() { exportPdf() {
this.pdf() this.test()
this.dialogVisible = false setTimeout(() =>{
this.dialogVisible = false
this.showData = this.tableData
}, 600)
}, },
exportXlsx() { exportXlsx() {
this.down() this.exportECL()
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData
}, },
pdf() {
const printWindow = window.open('', '_blank')
const temp = this.$refs.pdf.innerHTML
console.log(temp)
printWindow.document.body.innerHTML = temp
printWindow.document.close()
printWindow.print()
},
down() {
//
//
const exportData = [
{proLineName: '产线名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
...this.selectedList
]
//id dom
const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
try {
FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '产线统计数据查询.xlsx')
} catch (e) {
console.log(e)
}
},
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
.then(_ => { .then(_ => {
@ -224,7 +265,17 @@ 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;
this.getDataList(); console.log('nihc 你好', val.timeVal)
if (val.timeVal && val.timeVal.length > 0) {
this.fileName[0] = val.timeVal[0].slice(0, 10)
this.fileName[1] = val.timeVal[1].slice(0, 10)
this.getDataList();
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
}
break; break;
case 'export': case 'export':
this.handleExport(); this.handleExport();
@ -240,6 +291,7 @@ export default {
this.tableData = response.data; this.tableData = response.data;
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
this.showData = this.tableData
}); });
}, },
// //
@ -254,21 +306,10 @@ export default {
this.getDataList(); this.getDataList();
}, },
handleExport() { handleExport() {
if (this.selectedList.length === 0) { if (this.selectedList.length > 0) {
this.selectedList = this.tableData this.showData = this.selectedList
} }
this.dialogVisible = true this.dialogVisible = true
//
// let params = { ...this.queryParams };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return this.urlOptions.exportURL(params);
// }).then(response => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// }).catch(() => { });
} }
}, },
}; };

View File

@ -7,7 +7,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<SearchBar <SearchBar
:formConfigs="[{ label: '设备近24小时产线生产数据', type: 'title' }]" :formConfigs="[{ label: '近24小时产线生产数据', type: 'title' }]"
ref="search-bar" /> ref="search-bar" />
<el-skeleton v-if="initing" :rows="6" animated /> <el-skeleton v-if="initing" :rows="6" animated />
<!-- :span-method="mergeColumnHandler" --> <!-- :span-method="mergeColumnHandler" -->
@ -150,11 +150,13 @@ export default {
prop: 'proLineName', prop: 'proLineName',
label: '生产线', label: '生产线',
align: 'center', align: 'center',
fixed: 'left'
}, },
{ {
prop: 'spec', prop: 'spec',
label: '产品规格', label: '产品规格',
align: 'center', align: 'center',
fixed: 'left'
} }
] ]
this.buildProps(res.data.nameData); this.buildProps(res.data.nameData);

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-09-22 15:13:48 * @LastEditTime: 2023-10-08 10:51:49
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -13,12 +13,13 @@
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
class="right-aside"
v-loading="dataListLoading" v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:selectWidth="55" :selectWidth="55"
:table-data="tableData" :table-data="showData"
@selection-change="selectChange" @selection-change="selectChange"
> >
<method-btn <method-btn
@ -34,21 +35,6 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getDataList" />
<div ref="pdf" v-show="false">
<el-table :data="selectedList" stripe border style="width: 100%">
<el-table-column prop="reportType" label="报表类型" />
<el-table-column prop="reportStartTime" label="统计开始时间" />
<el-table-column prop="reportEndTime" label="统计结束时间" />
<el-table-column prop="proLineName" label="产线名称" />
<el-table-column prop="sectionName" label="工段名称" />
<el-table-column prop="inputNum" label="投入数量/片" />
<el-table-column prop="outputNum" label="产出数量/片" />
<el-table-column prop="outputArea" label="产出面积/㎡" />
<el-table-column prop="lossNum" label="损耗数量/片" />
<el-table-column prop="lossArea" label="损耗面积/㎡" />
<el-table-column prop="lossRatio" label="损耗比例%" />
</el-table>
</div>
<el-dialog <el-dialog
title="提示" title="提示"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@ -69,6 +55,8 @@ import { parseTime } from '../../mixins/code-filter';
import { getWorkshopSectionList, getPdList, getSectionAutoReport } from '@/api/core/monitoring/sectionStatistics' import { getWorkshopSectionList, getPdList, getSectionAutoReport } from '@/api/core/monitoring/sectionStatistics'
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
const tableProps = [ const tableProps = [
{ {
@ -140,6 +128,7 @@ export default {
tableProps, tableProps,
tableBtn: [], tableBtn: [],
tableData: [], tableData: [],
showData: [],
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
@ -208,40 +197,86 @@ export default {
this.getPdLineList() this.getPdLineList()
}, },
methods: { methods: {
test() {
var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF'
setTimeout(() => {
html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width
var contentHeight = canvas.height
// pdfhtmlcanvas
var pageHeight = contentHeight / 592.28 * 841.89
// pdfhtml
var leftHeight = contentHeight
//
var position = 0
// a4[595.28,841.89]htmlcanvaspdf
var imgWidth = 595.28
var imgHeight = 592.28 / contentWidth * contentHeight
var pageData = canvas.toDataURL('image/jpeg', 1.0)
console.log('nihc URL', leftHeight, pageHeight)
var pdf = new jsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
} else {
while(leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
//
if (leftHeight > 0) {
pdf.addPage()
}
}
}
pdf.save('工段统计自动报表.pdf')
})
}, 300)
},
exportECL() {
let tables = document.querySelector('.el-table').cloneNode(true)
const fix = tables.querySelector('.el-table__fixed')
const fixRight = tables.querySelector('.el-table__fixed-right')
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'))
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
}
let exportTable = XLSX.utils.table_to_book(tables)
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx', bookSST: true, type: 'array'
})
// sheetjs.xlsx
try {
FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream'
}), '工段统计自动报表.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut)
}
return exportTableOut
},
exportPdf() { exportPdf() {
this.pdf() this.test()
this.dialogVisible = false setTimeout(() =>{
this.dialogVisible = false
this.showData = this.tableData
}, 600)
}, },
exportXlsx() { exportXlsx() {
this.down() this.exportECL()
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData
}, },
pdf() {
const printWindow = window.open('', '_blank')
const temp = this.$refs.pdf.innerHTML
console.log(temp)
printWindow.document.body.innerHTML = temp
printWindow.document.close()
printWindow.print()
},
down() {
//
//
const exportData = [
{reportType: '产线类型', reportStartTime: '统计开始时间', reportEndTime: '统计结束时间', lineName: '产线名称', sectionName: '工段名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
...this.selectedList
]
//id dom
const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
try {
FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '工段统计自动报表.xlsx')
} catch (e) {
console.log(e)
}
},
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
.then(_ => { .then(_ => {
@ -289,6 +324,7 @@ export default {
item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月' item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
return item return item
}); });
this.showData = this.tableData
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
@ -305,21 +341,10 @@ export default {
this.getDataList(); this.getDataList();
}, },
handleExport() { handleExport() {
if (this.selectedList.length === 0) { if (this.selectedList.length > 0) {
this.selectedList = this.tableData this.showData = this.selectedList
} }
this.dialogVisible = true this.dialogVisible = true
//
// let params = { ...this.queryParams };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return this.urlOptions.exportURL(params);
// }).then(response => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// }).catch(() => { });
} }
}, },
}; };

View File

@ -5,23 +5,42 @@
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
class="right-aside"
v-loading="dataListLoading" v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
:table-data="tableData" /> :table-data="showData"
<!-- <pagination :selectWidth="55"
@selection-change="selectChange"
/>
<pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> --> @pagination="getDataList" />
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose">
<el-button type="primary" @click="exportXlsx">xlsx</el-button>
<el-button type="success" @click="exportPdf">pdf</el-button>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
// import basicPage from '../../mixins/basic-page'; // import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getSectionDataSearch } from '@/api/core/monitoring'; import { getSectionDataSearch } from '@/api/core/monitoring';
import { getProductionLinePage } from '@/api/core/base/productionLine'; import { getProductionLinePage } from '@/api/core/base/productionLine';
import { getWorkshopSectionPage } from '@/api/core/base/workshopSection'; import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
import * as XLSX from 'xlsx'
import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
const tableProps = [ const tableProps = [
{ {
@ -70,13 +89,18 @@ export default {
}, },
tableProps, tableProps,
tableData: [], tableData: [],
showData: [],
selectedList: [],
listQuery: { listQuery: {
proLineId:undefined, proLineId:undefined,
sectionId: undefined, sectionId: undefined,
startTime: undefined, startTime: undefined,
endTime: undefined, endTime: undefined,
total: 0
}, },
dataListLoading: false, dataListLoading: false,
dialogVisible: false,
fileName: [],
optionArrUrl: [getProductionLinePage, getWorkshopSectionPage], optionArrUrl: [getProductionLinePage, getWorkshopSectionPage],
formConfig: [ formConfig: [
{ {
@ -124,9 +148,96 @@ export default {
}, },
created() { created() {
this.getArr(); this.getArr();
this.getDataList() // this.getDataList()
}, },
methods: { methods: {
test() {
var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF'
setTimeout(() => {
html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width
var contentHeight = canvas.height
// pdfhtmlcanvas
var pageHeight = contentHeight / 592.28 * 841.89
// pdfhtml
var leftHeight = contentHeight
//
var position = 0
// a4[595.28,841.89]htmlcanvaspdf
var imgWidth = 595.28
var imgHeight = 592.28 / contentWidth * contentHeight
var pageData = canvas.toDataURL('image/jpeg', 1.0)
console.log('nihc URL', leftHeight, pageHeight)
var pdf = new jsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
} else {
while(leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
//
if (leftHeight > 0) {
pdf.addPage()
}
}
}
pdf.save('工段统计数据查询报表.pdf')
})
}, 300)
},
exportECL() {
let tables = document.querySelector('.el-table').cloneNode(true)
const fix = tables.querySelector('.el-table__fixed')
const fixRight = tables.querySelector('.el-table__fixed-right')
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'))
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
}
let exportTable = XLSX.utils.table_to_book(tables)
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx', bookSST: true, type: 'array'
})
// sheetjs.xlsx
try {
FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream'
}), '工段统计数据查询报表.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut)
}
return exportTableOut
},
exportPdf() {
this.test()
setTimeout(() =>{
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() {
this.exportECL()
this.dialogVisible = false
this.showData = this.tableData
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
getArr() { getArr() {
const params = { const params = {
page: 1, page: 1,
@ -144,9 +255,31 @@ export default {
// this.listQuery.endTime = '1693564257000' // this.listQuery.endTime = '1693564257000'
this.urlOptions.getDataListURL(this.listQuery).then(res => { this.urlOptions.getDataListURL(this.listQuery).then(res => {
this.tableData = res.data this.tableData = res.data
// this.total = response.data.total; this.listQuery.total = this.tableData.length;
this.dataListLoading = false; this.dataListLoading = false;
this.showData = this.tableData;
}); });
},
//
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
handleExport() {
if (this.selectedList.length > 0) {
this.showData = this.selectedList
}
this.dialogVisible = true
},
selectChange(val) {
console.log(val)
this.selectedList = val
}, },
buttonClick(val) { buttonClick(val) {
console.log(val) console.log(val)
@ -160,7 +293,17 @@ 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.getDataList(); this.fileName[0] = val.timeSlot[0]
this.fileName[1] = val.timeSlot[1]
console.log('wfjmmki文件名称', this.fileName)
if (val.timeSlot) {
this.getDataList()
} else {
this.$message({
message: '请选择时间',
type: 'warning'
});
}
break; break;
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
@ -171,6 +314,9 @@ export default {
}; };
this.getDataList(); this.getDataList();
break; break;
case 'export':
this.handleExport();
break;
default: default:
console.log(val); console.log(val);
} }