新增报表
This commit is contained in:
@@ -1,13 +1,35 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-18 14:08:46
|
||||
* @LastEditTime: 2024-04-22 17:10:49
|
||||
* @LastEditTime: 2024-04-23 13:51:05
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
|
||||
<el-form-item label="日" prop="startTime">
|
||||
<el-date-picker v-model="listQuery.startTime" value-format="timestamp" type="date" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线" prop="productionLineId">
|
||||
<el-select v-model="listQuery.productionLineId" placeholder="请选择">
|
||||
<el-option v-for="item in lineList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="">
|
||||
<el-radio-group v-model="radio" @input="handleGetClass">
|
||||
<el-radio-button label="早班查询"></el-radio-button>
|
||||
<el-radio-button label="晚班查询"></el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
|
||||
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table show-summary :header-cell-style="{
|
||||
background: '#F2F4F9',
|
||||
color: '#606266'
|
||||
@@ -24,19 +46,29 @@
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
|
||||
<el-table class="baseTable" :span-method="objectSpanMethod" :data="tableData" style="width: 100%">
|
||||
<el-table-column label="原料样式" align="right" width="150">
|
||||
<el-table-column prop="className" label="时间" width="120">
|
||||
<el-table class="baseTable" :data="tableData" style="width: 100%">
|
||||
<el-table-column label="时间" align="right" width="150">
|
||||
<el-table-column prop="name" label="缺陷" width="120">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column prop="putType" label="" width="180">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="putType" label="" width="180">
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column prop label="参考标准及评价方法">
|
||||
<el-table-column prop="activityName"></el-table-column>
|
||||
<el-table-column prop="message"></el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column v-for="(item, index) in codeList " :prop="item" :label="item">
|
||||
<el-table-column v-for="(item, index) in codeList " :prop="item.prop" :label="item.label">
|
||||
</el-table-column>
|
||||
<div slot="append" v-if="this.tableData.length != 0" style="text-align: center">
|
||||
<!--在此处添加你想要插入在表格最后一行的内容-->
|
||||
|
||||
<el-col :span="8">
|
||||
合计
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
{{ sum }}
|
||||
</el-col>
|
||||
</div>
|
||||
</el-table>
|
||||
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
||||
@pagination="getDataList" /> -->
|
||||
@@ -57,7 +89,8 @@
|
||||
// import basicPage from '../../../core/mixins/basic-page';
|
||||
// import { parseTime } from '../../../core/mixins/code-filter';
|
||||
import {
|
||||
getQualityRecordReport
|
||||
getQualityRecordReport,
|
||||
getCWSectionList
|
||||
} from '@/api/report/qcReport';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
import FileSaver from 'file-saver'
|
||||
@@ -114,7 +147,68 @@ export default {
|
||||
// deleteURL: deleteQualityHotMaterial,
|
||||
// exportURL: exportFactoryExcel,
|
||||
},
|
||||
codeList: ['sj1', 'sj2', 'sj3', 'sj4', 'sj5', 'sj7', 'sj8', 'sj10', 'sj11', 'sj12', 'sj13', 'sj14'],
|
||||
listQuery: {
|
||||
startTime: null,
|
||||
productionLineId:null,
|
||||
},
|
||||
sum:null,
|
||||
radio:'晚班查询',
|
||||
lineList:[],
|
||||
codeList: [
|
||||
{
|
||||
label: '19:00',
|
||||
prop: 'num0'
|
||||
|
||||
},
|
||||
{
|
||||
label: '20:00',
|
||||
prop: 'num1'
|
||||
},
|
||||
{
|
||||
label: '21:00',
|
||||
prop: 'num2'
|
||||
},
|
||||
{
|
||||
label: '22:00',
|
||||
prop: 'num3'
|
||||
},
|
||||
{
|
||||
label: '23:00',
|
||||
prop: 'num4'
|
||||
},
|
||||
{
|
||||
label: '00:00',
|
||||
prop: 'num5'
|
||||
},
|
||||
{
|
||||
label: '01:00',
|
||||
prop: 'num6'
|
||||
},
|
||||
{
|
||||
label: '02:00',
|
||||
prop: 'num7'
|
||||
},
|
||||
{
|
||||
label: '03:00',
|
||||
prop: 'num8'
|
||||
},
|
||||
{
|
||||
label: '04:00',
|
||||
prop: 'num9'
|
||||
},
|
||||
{
|
||||
label: '05:00',
|
||||
prop: 'num10'
|
||||
},
|
||||
{
|
||||
label: '06:00',
|
||||
prop: 'num11'
|
||||
},
|
||||
{
|
||||
label: '合计',
|
||||
prop: 'sum'
|
||||
}
|
||||
],
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
{
|
||||
@@ -156,35 +250,186 @@ export default {
|
||||
// this.listQuery.startTime = this.formConfig[0].defaultSelect[0]
|
||||
// this.listQuery.endTime = this.formConfig[0].defaultSelect[1]
|
||||
// this.formConfig[0].defaultSelect[0] = Date.now()-24*60*60-1000
|
||||
this.listQuery.startTime = new Date(new Date().setHours(1, 9, 0, 0)).getTime()
|
||||
this.getDataList()
|
||||
this.getDict()
|
||||
// this.getSpanArr(this.tableData)
|
||||
// this.getDict();
|
||||
},
|
||||
methods: {
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
let spanOneArr = [], concatOne = 0;
|
||||
this.tableData.map((item, index) => {
|
||||
if (index === 0) {
|
||||
spanOneArr.push(1);
|
||||
} else {
|
||||
//第一列需合并相同内容的判断条件
|
||||
if (item.className === this.tableData[index - 1].className) {
|
||||
spanOneArr[concatOne] += 1;
|
||||
spanOneArr.push(0);
|
||||
} else {
|
||||
spanOneArr.push(1);
|
||||
concatOne = index;
|
||||
};
|
||||
}
|
||||
});
|
||||
async getDict() {
|
||||
const res = await getCWSectionList()
|
||||
console.log(res)
|
||||
this.lineList = res.data
|
||||
},
|
||||
// objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
// let spanOneArr = [], concatOne = 0;
|
||||
// this.tableData.map((item, index) => {
|
||||
// if (index === 0) {
|
||||
// spanOneArr.push(1);
|
||||
// } else {
|
||||
// //第一列需合并相同内容的判断条件
|
||||
// if (item.className === this.tableData[index - 1].className) {
|
||||
// spanOneArr[concatOne] += 1;
|
||||
// spanOneArr.push(0);
|
||||
// } else {
|
||||
// spanOneArr.push(1);
|
||||
// concatOne = index;
|
||||
// };
|
||||
// }
|
||||
// });
|
||||
|
||||
if (columnIndex === 0) {
|
||||
const _row = spanOneArr[rowIndex];
|
||||
const _col = _row > 0 ? 1 : 0;
|
||||
return {
|
||||
rowspan: _row,
|
||||
colspan: _col
|
||||
}
|
||||
// if (columnIndex === 0) {
|
||||
// const _row = spanOneArr[rowIndex];
|
||||
// const _col = _row > 0 ? 1 : 0;
|
||||
// return {
|
||||
// rowspan: _row,
|
||||
// colspan: _col
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
formatDateTime(time) {
|
||||
var date = new Date(time);
|
||||
var y = date.getFullYear();
|
||||
var m = date.getMonth() + 1;
|
||||
m = m < 10 ? ('0' + m) : m;
|
||||
var d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
var h = date.getHours();
|
||||
h = h < 10 ? ('0' + h) : h;
|
||||
var minute = date.getMinutes();
|
||||
var second = date.getSeconds();
|
||||
minute = minute < 10 ? ('0' + minute) : minute;
|
||||
second = second < 10 ? ('0' + second) : second;
|
||||
|
||||
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
|
||||
},
|
||||
handleGetClass(e) {
|
||||
|
||||
this.listQuery.startTime = new Date(new Date().setHours(0, 7, 0, 0)).getTime()
|
||||
// console.log(startTime1)
|
||||
this.codeList = []
|
||||
if (e === '早班查询') {
|
||||
let arr = [
|
||||
{
|
||||
label: '07:00',
|
||||
prop:'num0'
|
||||
},
|
||||
{
|
||||
label: '08:00',
|
||||
prop: 'num1'
|
||||
},
|
||||
{
|
||||
label: '09:00',
|
||||
prop: 'num2'
|
||||
},
|
||||
{
|
||||
label: '10:00',
|
||||
prop: 'num3'
|
||||
},
|
||||
{
|
||||
label: '11:00',
|
||||
prop: 'num4'
|
||||
},
|
||||
{
|
||||
label: '12:00',
|
||||
prop: 'num5'
|
||||
},
|
||||
{
|
||||
label: '13:00',
|
||||
prop: 'num6'
|
||||
},
|
||||
{
|
||||
label: '14:00',
|
||||
prop: 'num7'
|
||||
},
|
||||
{
|
||||
label: '15:00',
|
||||
prop: 'num8'
|
||||
},
|
||||
{
|
||||
label: '16:00',
|
||||
prop: 'num9'
|
||||
},
|
||||
{
|
||||
label: '17:00',
|
||||
prop: 'num10'
|
||||
},
|
||||
{
|
||||
label: '18:00',
|
||||
prop: 'num11'
|
||||
},
|
||||
{
|
||||
label: '合计',
|
||||
prop: 'sum'
|
||||
}
|
||||
]
|
||||
arr.forEach((ele,index) => [
|
||||
this.codeList.push(ele)
|
||||
])
|
||||
this.getDataList()
|
||||
} else {
|
||||
// this.codeList = []
|
||||
this.listQuery.startTime = new Date(new Date().setHours(1, 9, 0, 0)).getTime()
|
||||
let arr = [
|
||||
{
|
||||
label: '19:00',
|
||||
prop: 'num0'
|
||||
|
||||
},
|
||||
{
|
||||
label: '20:00',
|
||||
prop: 'num1'
|
||||
},
|
||||
{
|
||||
label: '21:00',
|
||||
prop: 'num2'
|
||||
},
|
||||
{
|
||||
label: '22:00',
|
||||
prop: 'num3'
|
||||
},
|
||||
{
|
||||
label: '23:00',
|
||||
prop: 'num4'
|
||||
},
|
||||
{
|
||||
label: '00:00',
|
||||
prop: 'num5'
|
||||
},
|
||||
{
|
||||
label: '01:00',
|
||||
prop: 'num6'
|
||||
},
|
||||
{
|
||||
label: '02:00',
|
||||
prop: 'num7'
|
||||
},
|
||||
{
|
||||
label: '03:00',
|
||||
prop: 'num8'
|
||||
},
|
||||
{
|
||||
label: '04:00',
|
||||
prop: 'num9'
|
||||
},
|
||||
{
|
||||
label: '05:00',
|
||||
prop: 'num10'
|
||||
},
|
||||
{
|
||||
label: '06:00',
|
||||
prop: 'num11'
|
||||
},
|
||||
{
|
||||
label: '合计',
|
||||
prop: 'sum'
|
||||
}
|
||||
]
|
||||
arr.forEach((ele, index) => [
|
||||
this.codeList.push(ele)
|
||||
])
|
||||
this.getDataList()
|
||||
}
|
||||
},
|
||||
handleExport() {
|
||||
@@ -236,10 +481,35 @@ export default {
|
||||
// this.listQuery.startTime = '1713197388000';
|
||||
// this.listQuery.endTime = '1713254961000';
|
||||
this.urlOptions.getDataListURL({
|
||||
productionLineId: '1696716506443354114',
|
||||
startTime: '1705618800000'
|
||||
// productionLineId: '1696716506443354114',
|
||||
// startTime: '1705618800000'
|
||||
productionLineId: this.listQuery.productionLineId,
|
||||
startTime:this.listQuery.startTime
|
||||
},).then(res => {
|
||||
console.log(res.data);
|
||||
let count = 0
|
||||
let arr = []
|
||||
console.log(res.data)
|
||||
this.sum = res.data.allSum
|
||||
for (let i in res.data.qualityInspectionRecordReportLineVOMap) {
|
||||
count ++,
|
||||
console.log(res.data.qualityInspectionRecordReportLineVOMap[i])
|
||||
// arr.push({
|
||||
|
||||
// })
|
||||
// console.log(arr)
|
||||
let obj = {
|
||||
name: res.data.qualityInspectionRecordReportLineVOMap[i].content,
|
||||
sum: res.data.qualityInspectionRecordReportLineVOMap[i].sum,
|
||||
}
|
||||
res.data.qualityInspectionRecordReportLineVOMap[i].nums.forEach((ele, index) => {
|
||||
obj['num' +index] = ele
|
||||
// console.log(arr[count])
|
||||
// arr[count]['num'+index] = ele
|
||||
})
|
||||
arr.push(obj)
|
||||
}
|
||||
console.log(arr);
|
||||
this.tableData = arr
|
||||
// console.log(res)
|
||||
// console.log(res.data)
|
||||
// let arr = [
|
||||
|
||||
Reference in New Issue
Block a user