新增报表

This commit is contained in:
‘937886381’ 2024-04-19 16:59:47 +08:00
parent 4482ce0433
commit 46ce982cfc
6 changed files with 586 additions and 379 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: zhp # @Author: zhp
# @Date: 2024-04-12 14:30:48 # @Date: 2024-04-12 14:30:48
# @LastEditTime: 2024-04-12 14:31:16 # @LastEditTime: 2024-04-19 16:11:56
# @LastEditors: zhp # @LastEditors: zhp
# @Description: # @Description:
### ###
@ -12,8 +12,8 @@ ENV = 'development'
VUE_APP_TITLE = MES系统 VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.0.33:48082'
VUE_APP_BASE_API = 'http://192.168.1.104:48082'
# 积木报表指向地址 # 积木报表指向地址
VUE_APP_JIMU_API = 'http://192.168.0.33:48082' VUE_APP_JIMU_API = 'http://192.168.0.33:48082'

View File

@ -1,7 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-04-18 09:27:54 * @Date: 2024-04-18 09:27:54
* @LastEditTime: 2024-04-18 16:00:59 * @LastEditTime: 2024-04-19 16:12:49
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
@ -38,3 +38,11 @@ export function getAutoDailyData(data) {
data: data data: data
}) })
} }
export function getQualityRecordReport(data) {
return request({
url: 'base/quality-inspection-record/qualityRecordReport',
method: 'get',
data: data
})
}

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-01-29 16:50:26 * @Date: 2024-01-29 16:50:26
* @LastEditTime: 2024-04-16 13:44:14 * @LastEditTime: 2024-04-19 16:06:21
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -625,8 +625,8 @@ export default {
`<span style="color:rgba(255,255,255,0.5)">${this.getSize(item.size) || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.getSize(item.size) || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.productArea) + '㎡' || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.productArea) + '㎡' || ''}</span>`,
`<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.wasteArea) + '㎡' || ''}</span>`, `<span style="color:rgba(255,255,255,0.5)">${this.NumFormat(item.wasteArea) + '㎡' || ''}</span>`,
`<div style = "${(item.product * 100).toFixed(0) > 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</div> `<div style = "${(item.product * 100).toFixed(0) >= 91 ? 'display:block;color:#00FFF7' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</div>
<div style = "${(item.product * 100).toFixed(0) < 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</div>` <div style = "${(item.product * 100).toFixed(0) <= 91 ? 'display:block; color:rgba(255, 209, 96, 1)' : 'display:none;'}">${(item.product * 100).toFixed(0) + '%' || ''}</div>`
]) ])
this.cutConfig.data = cutArr this.cutConfig.data = cutArr
// this.$nextTick(() => { // this.$nextTick(() => {

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-12-27 13:54:52 * @Date: 2023-12-27 13:54:52
* @LastEditTime: 2024-04-16 13:16:34 * @LastEditTime: 2024-04-19 15:43:08
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -170,7 +170,7 @@ export default {
let singleData = series.filter(function (item) { let singleData = series.filter(function (item) {
return item.name == name return item.name == name
}) })
return name + parseFloat((singleData[0].data * 100).toFixed(0)) + '%' return name + parseFloat((singleData[0].data * 100).toFixed(2)) + '%'
}, },
itemWidth: 12, itemWidth: 12,
itemHeight: 12, itemHeight: 12,

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-18 14:08:46 * @Date: 2024-04-18 14:08:46
* @LastEditTime: 2024-04-19 10:53:21 * @LastEditTime: 2024-04-19 15:11:14
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -24,14 +24,18 @@
</el-table-column> </el-table-column>
</el-table> --> </el-table> -->
<el-table :data="alldata" border style="width: 100%"> <el-table class="baseTable" :span-method="objectSpanMethod" :data="tableData" style="width: 100%">
<el-table-column prop="category" label="项目及分值" width="180"> <el-table-column label="原料样式" align="right" width="150">
<el-table-column prop="className" label="时间" width="120">
</el-table-column> </el-table-column>
<el-table-column prop label="参考标准及评价方法"> </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="activityName"></el-table-column>
<el-table-column prop="message"></el-table-column> <el-table-column prop="message"></el-table-column>
</el-table-column> </el-table-column> -->
<el-table-column prop="value" label="参考分值"> <el-table-column v-for="(item,index) in codeList " :prop="item" :label="item">
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" <!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@ -110,70 +114,13 @@ export default {
// deleteURL: deleteQualityHotMaterial, // deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel, // exportURL: exportFactoryExcel,
}, },
// tableProps, codeList: ['sj1', 'sj2', 'sj3', 'sj4', 'sj5', 'sj7', 'sj8', 'sj10', 'sj11', 'sj12', 'sj13', 'sj14' ],
headers, tableData: [],
// tableData: [
// {
// date: '2016-05-02',
// name: '',
// address: ' 1518 '
// },
// {
// date: '2016-05-04',
// name: '',
// address: ' 1517 '
// },
// {
// date: '2016-05-01',
// name: '',
// address: ' 1519 '
// },
// {
// date: '2016-05-03',
// name: '',
// address: ' 1516 '
// }
// ],
// tableData: [],
listQuery: { listQuery: {
startTime: undefined, startTime: undefined,
endTime:undefined endTime:undefined
}, },
originData: [{
type: '选择题',
num: '5题',
average: '3分/题',
},
{
type: '填空题',
num: '5题',
average: '3分/题',
},
{
type: '选择题',
num: '2题',
average: '10分/题',
}
],
originTitle: ['题型', '数量', '均分'], // originTitle ,
transTitle: ['', '学生1', '学生2', '学生3'], // transTitle , , , ,
transData: [],
formConfig: [ formConfig: [
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'content',
// },
// {
// type: 'select',
// label: '',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
// param: 'materialId',
// filterable: true
// },
{ {
type: 'datePicker', type: 'datePicker',
label: '时间段', label: '时间段',
@ -193,10 +140,6 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// {
// type: this.$auth.hasPermi('base:quality-hot-material:create') ? 'separate' : '',
// // type: 'separate',
// },
{ {
type:'button', type:'button',
btnName: '导出', btnName: '导出',
@ -211,144 +154,6 @@ export default {
// AddOrUpdate, // AddOrUpdate,
}, },
created() { created() {
var list = [
{
"id": "16EE8A54E6917F6479905CDC5B031F22",
"activityPointsDOS": [
{
"id": "16EE8A54E0C17F647404A2DC7783EE88",
"activityPointsDOS": [
{
"id": "1",
"value": "6",
"activityName": "坚定政治立场。",
"message": " 1牢固树立“四个意识”巴拉巴拉",
"period": "19上半年"
},
{
"id": "2",
"value": "8",
"activityName": "坚定政治立场。",
"message": "2严格遵守政治纪律和政治规矩.巴拉啦",
"period": "19上半年"
}
],
"activityName": "1. 坚定政治立场。(10分)"
},
{
"id": "16EE8A54E4817F64779EF35CC6671C10",
"activityPointsDOS": [
{
"id": "3",
"value": "7",
"activityName": "坚持学习提高。",
"message": "1及时认真参加支部集体学习....",
"period": "19上半年"
},
{
"id": "4",
"value": "3",
"activityName": "坚持学习提高。",
"message": "2每年集中学习培训....",
"period": "19上半年"
},
{
"id": "5",
"value": "5",
"activityName": "坚持学习提高。",
"message": "3有取得更高....位",
"period": "19上半年"
}
],
"activityName": "2.坚持学习提高。(6分)"
},
{
"id": "16EE8A54E4817F64779EF35CC6671C10",
"activityPointsDOS": [
{
"id": "6",
"value": "7",
"activityName": "严格组织生活。",
"message": "1按季度.....",
"period": "19上半年"
},
{
"id": "7",
"value": "3",
"activityName": "严格组织生活。",
"message": "2按时上党课.......。",
"period": "19上半年"
},
{
"id": "8",
"value": "5",
"activityName": "坚持学习提高。",
"message": "3积极参加",
"period": "19上半年"
}
],
"activityName": "3.严格组织生活。(13分)"
}
],
"category": "合格积分\r\n(40分)"
},
{
"id": "16EE8A54FF617F6491391BD04A0D4E7F",
"activityPointsDOS": [
{
"id": "16EE8A54EA517F647D257760897C805F",
"activityPointsDOS": [
{
"id": "8",
"value": "10",
"activityName": "1.所在基层党组织情况。10分",
"message": " (1) 根据所在.....",
"period": "19上半年"
}
],
"activityName": "1.所在基层党组织情况。10分"
},
{
"id": "16EE8A54E8517F647B3DE374CF0D6D93",
"activityPointsDOS": [
{
"id": "10",
"value": "3",
"activityName": "2.年度评议、考核情况。10分",
"message": " (1) 在党建....",
"period": "19上半年"
},
{
"id": "9",
"value": "10",
"activityName": "2.年度评议、考核情况。10分",
"message": " (2在年度.........................................................................",
"period": "19上半年"
}
],
"activityName": "2.年度评议、考核情况。10分"
}
],
"category": "综合积分\r\n20分"
}
];
this.alldata = this.handleTableArr(list);
let matrixData = this.originData.map((row) => {
let arr = []
for (let key in row) {
console.log(row[key])
arr.push(row[key])
}
return arr
})
console.log(matrixData)
//
this.transData = matrixData[0].map((col, i) => {
return [this.originTitle[i], ...matrixData.map((row) => {
return row[i]
})]
})
console.log(this.transData)
}, },
mounted() { mounted() {
// this.formConfig[1].defaultSelect[] // this.formConfig[1].defaultSelect[]
@ -360,68 +165,6 @@ export default {
// this.getDict(); // this.getDict();
}, },
methods: { methods: {
handleTableArr(data) {
let arr = [];
for (let i = 0; i < data.length; i++) {
let category_info = data[i];
let activityPointsDOS = category_info["activityPointsDOS"];
let count = 0;
for (let j = 0; j < activityPointsDOS.length; j++) {
let activityTwo_info = activityPointsDOS[j];
let activityTwo_activityPointsDOS = activityPointsDOS[j]["activityPointsDOS"];
for (let k = 0; k < activityTwo_activityPointsDOS.length; k++) {
count++;
let info = {
//
span_num: k === 0 ? activityTwo_activityPointsDOS.length : 0,
value: activityTwo_activityPointsDOS[k]["value"],
message: activityTwo_activityPointsDOS[k]["message"],
activityName: activityTwo_info["activityName"],
category: category_info["category"],
};
arr.push(info);
}
}
// , . 8 .
arr[arr.length - count]["count"] = count;
}
return arr;
},
renderHeader(h, { column }) {
//
column.realLabel = column.label;
column.label = '';
//
return h('el-table-column', { props: { width: '50' } }, column.realLabel);
},
getSummaries(param) {
console.log(columns)
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += ' ';
} else {
sums[index] = '-';
}
});
return sums;
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {
let spanOneArr = [], concatOne = 0; let spanOneArr = [], concatOne = 0;
this.tableData.map((item, index) => { this.tableData.map((item, index) => {
@ -429,7 +172,7 @@ export default {
spanOneArr.push(1); spanOneArr.push(1);
} else { } else {
// //
if (item.code === this.tableData[index - 1].code) { if (item.className === this.tableData[index - 1].className) {
spanOneArr[concatOne] += 1; spanOneArr[concatOne] += 1;
spanOneArr.push(0); spanOneArr.push(0);
} else { } else {
@ -497,118 +240,139 @@ export default {
this.listQuery.startTime = '1713197388000'; this.listQuery.startTime = '1713197388000';
this.listQuery.endTime = '1713254961000'; this.listQuery.endTime = '1713254961000';
this.urlOptions.getDataListURL(this.listQuery).then(res => { this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res); // console.log(res)
// this.getSpanArr(this.tableData) // console.log(res.data)
// res.data.forEach((ele) => { let arr = [
// console.log(ele.size.substring(2, ele.size.length - 2)) {
// // console.log(Object.prototype.toString.call(ele.size)) classType: 1,
// // // if (Object.prototype.toString.call(ele.size) === Array) { className:'白班(8:00-20:00)',
// // console.log(11111) 'sj1': null,
// // console.log(); 'sj2': null,
// // } 'sj3': null,
// }) 'sj4': null,
'sj5': null,
console.log(res.data) 'sj7': null,
this.tableData = res.data.map((ele) => { 'sj8': null,
this.mechanism.push(ele.code) 'sj10': null,
return { 'sj11': null,
classType: ele.classType == 1 ? '白班' : ele.classType == 2 ? '夜班' : '合计', 'sj12': null,
code: ele.code, 'sj13': null,
putNum: ele.putNum, 'sj14': null,
useNum: ele.useNum, putType: '投入数量'
// num: ele.num, },
// size: typeof (ele.size) {
// size: ele.size.match(/\[(.+?)\]/g) ? ele.size.substring(1, ele.size.length - 1) : ele.size classType: 1,
className: '白班(8:00-20:00)',
'sj1': null,
'sj2': null,
'sj3': null,
'sj4': null,
'sj5': null,
'sj7': null,
'sj8': null,
'sj10': null,
'sj11': null,
'sj12': null,
'sj13': null,
'sj14': null,
putType: '投入次数'
},
{
classType: 2,
className: '夜班(20:00-8:00)',
'sj1': null,
'sj2': null,
'sj3': null,
'sj4': null,
'sj5': null,
'sj7': null,
'sj8': null,
'sj10': null,
'sj11': null,
'sj12': null,
'sj13': null,
'sj14': null,
putType: '投入数量',
},
{
classType:2,
className: '夜班(20:00-8:00)',
'sj1': null,
'sj2': null,
'sj3': null,
'sj4': null,
'sj5': null,
'sj7': null,
'sj8': null,
'sj10': null,
'sj11': null,
'sj12': null,
'sj13': null,
'sj14': null,
putType: '投入次数',
},
{
classType: 1,
className: '全天',
'sj1': null,
'sj2': null,
'sj3': null,
'sj4': null,
'sj5': null,
'sj7': null,
'sj8': null,
'sj10': null,
'sj11': null,
'sj12': null,
'sj13': null,
'sj14': null,
putType: '投入数量',
},
{
classType: 2,
className: '全天',
'sj1': null,
'sj2': null,
'sj3': null,
'sj4': null,
'sj5': null,
'sj7': null,
'sj8': null,
'sj10': null,
'sj11': null,
'sj12': null,
'sj13': null,
'sj14': null,
putType: '投入次数',
}
]
res.data.forEach((ele) => {
this.codeList.forEach((item) => {
if (ele.classType === 1 && ele.code == item) {
// console.log(arr[0][item])
arr[0][item] = ele.putNum
arr[1][item] = ele.useNum
} else if (ele.classType === 2 && ele.code == item) {
arr[2][item] = ele.putNum
arr[3][item] = ele.useNum
} else if (ele.classType === 3 && ele.code == item) {
arr[4][item] = ele.putNum
arr[5][item] = ele.useNum
} }
}) })
for (let i = 0; i < this.tableData.length - 1; i++) { })
console.log(this.tableData[j].code.substr(this.tableData[j].code.length - 2, 1)); // console.log(arr)
// this.tableData = arr
for (let j = 0; j < this.tableData.length - i - 1; j++) {
//
if (this.tableData[j].code.substr(this.tableData[j].code.length - 2, 1) > this.tableData[j + 1].code.substr(this.tableData[j + 1].code.length - 2, 1)) {
//
let temp = this.tableData[j];
this.tableData[j] = this.tableData[j + 1];
this.tableData[j + 1] = temp;
}
}
}
// let obj = {}
// res.data.reduce((prev, curr) => {
// console.log(prev, curr)
// })
// this.tableData.forEach((ele) => {
// ele.size.substring(2, ele.size.length - 2)
// // console.log(Object.prototype.toString.call(ele.size))
// // // if (Object.prototype.toString.call(ele.size) === Array) {
// // console.log(11111)
// // console.log();
// // }
// })
// let obj = {}
// this.tableData.forEach(ele => {
// obj.num += ele.num
// obj.area += ele.num
// obj.count += ele.num
// })
// console.log(obj);
// this.listQuery.total = res.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
// deleteHandle(id, name, index, data) {
// this.$confirm(`${index}?`, "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(() => {
// this.urlOptions.deleteURL(id).then(({ data }) => {
// this.$message({
// message: "",
// type: "success",
// duration: 1500,
// onClose: () => {
// this.getDataList();
// },
// });
// });
// })
// .catch(() => { });
// },
// async getDict() {
// //
// const res = await getHotMaterialAllList();
// this.formConfig[0].selectOptions = res.data;
// },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 20;
// this.listQuery.materialId = val.materialId ? val.materialId : undefined;
// this.listQuery.startTime = '1706144404000';
// this.listQuery.endTime = '1706230804000';
this.listQuery.startTime = val.checkTime ? val.checkTime[0] : undefined; this.listQuery.startTime = val.checkTime ? val.checkTime[0] : undefined;
this.listQuery.endTime = val.checkTime ? val.checkTime[1] : undefined; this.listQuery.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList(); this.getDataList();
break; break;
// case 'reset':
// this.$refs.searchBarForm.resetForm();
// this.listQuery = {
// pageSize: 20,
// pageNo: 1,
// total: 1,
// };
// this.getDataList();
// break;
// case 'add':
// this.addOrEditTitle = '';
// this.addOrUpdateVisible = true;
// this.addOrUpdateHandle();
// break;
case 'export': case 'export':
this.handleExport(); this.handleExport();
break; break;

View File

@ -0,0 +1,435 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 14:08:46
* @LastEditTime: 2024-04-19 15:48:59
* @LastEditors: zhp
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<!-- <el-table show-summary :header-cell-style="{
background: '#F2F4F9',
color: '#606266'
}" class="baseTable" :max-height="tableH" id="exportTable" :data="tableData" style="width: 100%"
:span-method="objectSpanMethod">
<el-table-column v-for="item in tableProps" :prop="item.prop" :label="item.label" align="center">
</el-table-column>
</el-table> -->
<!-- <el-table border style="margin-top: 50px;" :data="transData">
<el-table-column v-for="(item, index) in transTitle" :label="item" :key="index" align="center">
<template slot-scope="scope">
{{scope.row[index]}}
</template>
</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-column>
</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>
</el-table>
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" /> -->
<!-- <base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="30%"> -->
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
<!-- </base-dialog> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import basicPage from '../../../core/mixins/basic-page';
// import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityRecordReport
} from '@/api/report/qcReport';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import FileSaver from 'file-saver'
// import { getList, } from "@/api/base/qualityScrapType";
const headers = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'classType',
label: '时间'
},
{
prop: 'equipmentName',
label: ''
},
{
prop: 'num',
label: '片数'
},
{
prop: 'area',
label: '面积'
},
{
prop: 'countNum',
label: '托数',
// filter: (val) => val == false ? '' : '',
},
{
prop: 'size',
label: '规格',
// filter: (val) => val == 1 ? 'A' : val == 2 ? 'B' : 'C',
},
// {
// prop: 'checkerName',
// label: ''
// },
// {
// prop: 'checkTime',
// label: '',
// filter: parseTime
// },
];
export default {
mixins: [tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getQualityRecordReport,
// deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel,
},
codeList: ['sj1', 'sj2', 'sj3', 'sj4', 'sj5', 'sj7', 'sj8', 'sj10', 'sj11', 'sj12', 'sj13', 'sj14'],
tableData: [],
listQuery: {
"productionLineId": 1696716506443354114, "startTime": "2024-01-19 07:00:00"
},
formConfig: [
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'checkTime',
defaultSelect: [Date.now() - 24 * 60 * 60 - 1000, Date.now()],
width: 250
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'success',
plain: true
},
],
};
},
components: {
// AddOrUpdate,
},
created() {
},
mounted() {
// this.formConfig[1].defaultSelect[]
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.getDataList()
// 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;
};
}
});
if (columnIndex === 0) {
const _row = spanOneArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col
}
}
},
handleExport() {
//
console.log(this.$refs);
var xlsxParam = { raw: true };
/* 从表生成工作簿对象 */
import('xlsx').then(excel => {
var wb = excel.utils.table_to_book(
document.querySelector("#exportTable"),
xlsxParam
);
/* 获取二进制字符串作为输出 */
var wbout = excel.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array",
});
try {
FileSaver.saveAs(
//Blob
//Blob JavaScript
//File Blob blob 使
// Blob
new Blob([wbout], { type: "application/octet-stream" }),
//
"原片各线堆垛表.xlsx"
);
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout);
}
return wbout;
//do something......
})
},
// otherMethods(val) {
// if (val.type === 'detail') {
// this.addOrUpdateVisible = true;
// this.addOrEditTitle = "";
// this.$nextTick(() => {
// this.$refs.addOrUpdate.init(val.data.id, true);
// });
// }
// },
//
getDataList() {
this.dataListLoading = true;
// this.listQuery.startTime = '1713197388000';
// this.listQuery.endTime = '1713254961000';
this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res.data);
// console.log(res)
// console.log(res.data)
// let arr = [
// {
// classType: 1,
// className: '(8:00-20:00)',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: ''
// },
// {
// classType: 1,
// className: '(8:00-20:00)',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: ''
// },
// {
// classType: 2,
// className: '(20:00-8:00)',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: '',
// },
// {
// classType: 2,
// className: '(20:00-8:00)',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: '',
// },
// {
// classType: 1,
// className: '',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: '',
// },
// {
// classType: 2,
// className: '',
// 'sj1': null,
// 'sj2': null,
// 'sj3': null,
// 'sj4': null,
// 'sj5': null,
// 'sj7': null,
// 'sj8': null,
// 'sj10': null,
// 'sj11': null,
// 'sj12': null,
// 'sj13': null,
// 'sj14': null,
// putType: '',
// }
// ]
// res.data.forEach((ele) => {
// this.codeList.forEach((item) => {
// if (ele.classType === 1 && ele.code == item) {
// // console.log(arr[0][item])
// arr[0][item] = ele.putNum
// arr[1][item] = ele.useNum
// } else if (ele.classType === 2 && ele.code == item) {
// arr[2][item] = ele.putNum
// arr[3][item] = ele.useNum
// } else if (ele.classType === 3 && ele.code == item) {
// arr[4][item] = ele.putNum
// arr[5][item] = ele.useNum
// }
// })
// })
// // console.log(arr)
// this.tableData = arr
// this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.startTime = val.checkTime ? val.checkTime[0] : undefined;
this.listQuery.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>
<style>
.baseTable .el-table__body tr.current-row>td.el-table__cell {
background-color: #EAF1FC;
}
.baseTable .el-table .el-table__cell {
padding: 0;
height: 35px;
}
.el-table thead.is-group th {
background: none;
}
.el-table thead.is-group tr:first-of-type th:first-of-type {
border-bottom: none;
}
.el-table thead.is-group tr:first-of-type th:first-of-type:before {
content: '';
position: absolute;
width: 1px;
height: 75px;
/*这里需要自己调整根据td的宽度和高度*/
top: 0;
left: 0;
background-color: grey;
opacity: 0.3;
display: block;
transform: rotate(-53deg);
/*这里需要自己调整,根据线的位置*/
transform-origin: top;
}
.el-table thead.is-group tr:last-of-type th:first-of-type:before {
content: '';
position: absolute;
width: 1px;
height: 75px;
/*这里需要自己调整根据td的宽度和高度*/
bottom: 0;
right: 0;
background-color: grey;
opacity: 0.3;
display: block;
transform: rotate(-54deg);
/*这里需要自己调整,根据线的位置*/
transform-origin: bottom;
}
</style>