projects/mesxc-zhp #341

Merged
juzi merged 2 commits from projects/mesxc-zhp into projects/mesxc-test 2024-04-19 11:09:13 +08:00
9 changed files with 2496 additions and 4 deletions
Showing only changes of commit ecf6745c8a - Show all commits

View File

@ -0,0 +1,40 @@
/*
* @Author: zhp
* @Date: 2024-04-18 09:27:54
* @LastEditTime: 2024-04-18 16:00:59
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 更新质量检测类型基础
export function getOriginalData(data) {
return request({
url: 'extend/customized-reports/original',
method: 'post',
data: data
})
}
export function getIngredientData(data) {
return request({
url: 'extend/customized-reports/materialCost',
method: 'post',
data: data
})
}
export function getCuttingtData(data) {
return request({
url: 'extend/customized-reports/cutting',
method: 'post',
data: data
})
}
export function getAutoDailyData(data) {
return request({
url: 'base/report-auto-daily/listAll',
method: 'post',
data: data
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-07-19 15:18:30 * @Date: 2021-07-19 15:18:30
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2024-04-17 16:08:08 * @LastEditTime: 2024-04-18 08:42:00
* @Description: * @Description:
--> -->
<template> <template>
@ -53,10 +53,11 @@
op.planQuantity }}</span> op.planQuantity }}</span>
</span> </span>
<span v-if="op.actualQuantity" class="orderFinish" <span v-if="op.actualQuantity" class="orderFinish"
style="font-size: 14px;opacity: calc(.6);margin-left: 130px;">{{ style="font-size: 14px;margin-left: 130px;">{{
op.actualQuantity op.actualQuantity
}}</span> }}</span>
<el-divider class="split" v-if="op.actualQuantity" direction="vertical"></el-divider> <el-divider class="split" style="background-color: rgba(0, 255, 247, 1)" v-if="op.actualQuantity"
direction="vertical"></el-divider>
<!-- </div> --> <!-- </div> -->
<el-progress style="width: 620px;" text-color="rgba(0, 255, 247, 1)" :stroke-width="10" <el-progress style="width: 620px;" text-color="rgba(0, 255, 247, 1)" :stroke-width="10"
define-back-color="rgba(32, 57, 96, 1)" :percentage="op.progressRate" class="custom-progress-bar" /> define-back-color="rgba(32, 57, 96, 1)" :percentage="op.progressRate" class="custom-progress-bar" />
@ -867,7 +868,7 @@ export default {
margin-left: 8px; margin-left: 8px;
opacity:calc(.6); opacity:calc(.6);
margin-right: 8px; margin-right: 8px;
background-color: rgba(0, 255, 247, 1); background-color: #C8CDD7;
// border: 1px solid #C8CDD7; // border: 1px solid #C8CDD7;
} }
.myLegend { .myLegend {

View File

@ -0,0 +1,237 @@
<!--
* @Author: zhp
* @Date: 2024-01-24 15:15:24
* @LastEditTime: 2024-04-18 16:49:31
* @LastEditors: zhp
* @Description:
-->
<template>
<div class="app-container">
<div>
<!-- <el-alert title="自定义 close-text" type="warning" close-text="知道了">
</el-alert> -->
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="日" prop="time">
<el-date-picker v-model="listQuery.time" value-format="timestamp" type="datetime"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small"
@click="getDataList">查询</el-button>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:export')" type="primary" size="small"
plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
</div>
<inputTable :date="date" :data="tableData" :time="[startTimeStamp]" :sum="all" :type="listQuery.reportType"
@refreshDataList="getDataList" />
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
import { getAutoDailyData } from '@/api/report/qcReport';
import inputTable from './inputTable.vue';
// import { getCorePLList } from '@/api/base/coreProductionLine';
import moment from 'moment'
import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { inputTable },
data() {
return {
urlOptions: {
getDataListURL: getAutoDailyData,
// exportURL: exportGlasscExcel
},
listQuery: {
// pageSize: 10,
// pageNo: 1,
// total: 0,
// reportType: 2,
time: ''
},
date: '许昌安彩新能科技有限公司2024年4月份生产日报',
time: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [],
proLineList: [],
all: {}
};
},
created() {
// this.getDict()
this.getTodayStartTimeAndEndTime()
this.getDataList()
},
methods: {
getTodayStartTimeAndEndTime() {
this.listQuery.time = new Date()
// this.changeTime(this.time)
},
async getDict() {
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if (str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
// const res = await getCorePLList()
// this.proLineList = res.data;
this.dataListLoading = true
if (this.listQuery.time.length == 0) {
this.$message({
message: '请选择时间',
type: 'warning'
})
return false
}
await this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res.data.datas);
let arr = res.data.datas
let obj = res.data.reportAutoYdailyRespVO
obj.lineName = '合计'
arr.push(obj)
// this.tableData.push(res.data.reportAutoYdailyRespVO)
this.tableData = arr
this.listQuery.total = res.data.length;
this.dataListLoading = false;
});
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
// changeTime(val) {
// if (val) {
// // console.log(val)
// // console.log(val.setHours(7, 0, 0))
// // console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// // let time = this.format(val.setHours(7, 0, 0))
// // this.startTimeStamp = this.format(val.setHours(0, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// // this.startTimeStamp = this.format(val.setHours(7, 0, 0) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// // console.log(this.listQuery.reportTime);
// this.listQuery.time = this.format(val.setHours(0, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// // this.listQuery.time[0] = this.format(val.setHours(7, 0, 0) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// // console.log(this.listQuery.reportTime);
// } else {
// this.listQuery.time = ''
// }
// },
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.time = val.time ? val.time : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
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......
})
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
</style>

View File

@ -0,0 +1,273 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 15:49:48
* @LastEditTime: 2024-04-18 16:30:42
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-row style="float: right; margin-bottom: 5px">
<el-button v-if="!edit && this.$auth.hasPermi('base:report-auto-original-glass:update')" :disabled="noData"
size="small" @click="edit = true">编辑</el-button>
<el-button v-if="edit" size="small" @click="handleReturn()">返回</el-button>
<el-button v-if="edit" size="small" @click="updateData">保存</el-button>
</el-row>
<el-table :id="id" :data="data" border style="width: 100%">
<el-table-column v-for="(item, index) in cols" :key="index" :prop="item.prop" :label="item.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(it, index1) in item.children" :key="index1" :prop="it.prop" :label="it.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(y, index2) in it.children" :key="index2" :prop="y.prop" :label="y.label">
<template slot-scope="scope">
<span v-if="!edit">{{ scope.row[y.prop] }}</span>
<el-input type="number" @change="handleChange" :disabled="y.prop == 'dailyOutputTrend' || y.prop === 'originalGlassStatisticsTrend'
|| y.prop === 'actualProductTrend' || y.prop === 'originalGlassPassTrend' || y.prop === 'originalGlassPassNow' || y.prop === 'originalGlassPassHis'
" v-else v-model="scope.row[y.prop]"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
<!-- <el-input type="textarea" v-model="remark" placeholder="备注" :disabled="!edit" :autosize="{ minRows: 2, maxRows: 6}">
</el-input> -->
</div>
</template>
<script>
import { updateGlass, updateGlassRemark } from '@/api/report/glass';
const cols = [
{
prop: 'xc',
label: '许昌安彩新能科技有限公司2024年4月份生产日报',
align: 'center',
children: [
{
prop: 'lineName',
label: '生产线',
},
{
prop: 'm',
label: '尺寸(长、宽、厚)毫米',
align: 'center',
children: [
{
prop: 'length',
label: '长',
},
{
prop: 'width',
label: '宽',
},
{
prop: 'thick',
label: '高',
}
]
},
{
prop: 'm',
label: '良品数',
align: 'center',
children: [
{
prop: 'earlyNum',
label: '早班',
},
{
prop: 'nightNum',
label: '晚班',
},
{
prop: 'num',
label: '合计',
}
]
},
{
prop: 'weight',
label: '良品重量(吨)',
},
{
prop: 'y',
label: '良品玻璃面积(㎡)',
align: 'center',
children: [
{
prop: 'earlyArea',
label: '早班',
},
{
prop: 'nightArea',
label: '晚班',
},
{
prop: 'area',
label: '合计',
}
]
},
{
prop: 'y',
label: '原片良品率',
align: 'center',
children: [
{
prop: 'earlyRate',
label: '早班',
},
{
prop: 'nightRate',
label: '晚班',
},
{
prop: 'rate',
label: '合计',
}
]
},
{
prop: 'monthArea',
label: '月累计面积',
},
{
prop: 'remark',
label: '备注',
}
]
}
]
export default {
props: {
data: {
type: Array,
default: () => [],
},
id: {
type: String,
default:'exportTable'
},
time: {
type: Array,
default: () => [],
},
date: {
type: String,
default:''
},
sum: {
type: Object,
default: () => {},
},
type: {
type: Number,
default: 3,
}
},
data() {
return {
cols,
remark:null,
edit: false,
noData:false,
};
},
watch: {
data: {
handler(newv, oldv) {
if (newv.length != 0) {
this.noData = false
} else {
this.noData = true
}
}
},
time: {
immediate: true,
handler(newv, oldv) {
if (newv[0] !== '') {
this.cols[0].label = this.date + '(' + newv[0] + '-' + newv[1] + ')'
} else {
this.cols[0].label = this.date
}
}
},
// type: {
// immediate: true,
// handler(newv, oldv) {
// let text1 = '', text2 = '', text3 = ''
// if (newv === 3) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else if (newv === 4) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else if (newv === 2) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else {
// text1 = ''
// text2 = ''
// text3 = '/'
// }
// this.cols[0].children[1].children[0].label = text1
// this.cols[0].children[1].children[1].label = text2
// this.cols[0].children[2].children[0].label = text1
// this.cols[0].children[2].children[1].label = text2
// this.cols[0].children[3].children[0].label = text1
// this.cols[0].children[3].children[1].label = text2
// this.cols[0].children[4].children[0].label = text1
// this.cols[0].children[4].children[1].label = text2
// this.cols[0].children[2].label = text3
// }
// }
},
methods: {
handleReturn() {
this.edit = false
console.log(this.$parent.getDataList());
},
handleChange(e) {
},
updateData() {
// let obj = {}
// this.data.forEach((ele, index) => {
// if (ele.det === false) {
// this.data[index].lineId = ''
// this.data[index].remark = this.remark
// obj = ele
// delete this.data[index].dailyOutputTrend
// delete this.data[index].originalGlassStatisticsTrend
// delete this.data[index].actualProductTrend
// delete this.data[index].originalGlassPassTrend
// this.data.splice(index, 1)
// }
// })
// let updateArr = this.data
// updateArr.forEach((ele, index) => {
// delete ele.dailyOutputTrend
// delete ele.originalGlassStatisticsTrend
// delete ele.actualProductTrend
// delete ele.originalGlassPassTrend
// });
// this.data.forEach((ele, index) => {
// delete ele.dailyOutputTrend
// delete ele.originalGlassStatisticsTrend
// delete ele.actualProductTrend
// delete ele.originalGlassPassTrend
// });
updateGlass(updateArr).then(response => {
updateGlassRemark(obj).then(res => {
this.$modal.msgSuccess("修改成功");
this.edit = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>

View File

@ -0,0 +1,220 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 16:32:03
* @LastEditTime: 2024-04-18 16:34:49
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-row style="float: right; margin-bottom: 5px">
<el-button v-if="!edit && this.$auth.hasPermi('base:report-auto-original-glass:update')" :disabled="noData"
size="small" @click="edit = true">编辑</el-button>
<el-button v-if="edit" size="small" @click="handleReturn()">返回</el-button>
<el-button v-if="edit" size="small" @click="updateData">保存</el-button>
</el-row>
<el-table :id="id" :data="data" border style="width: 100%">
<el-table-column v-for="(item, index) in cols" :key="index" :prop="item.prop" :label="item.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(it, index1) in item.children" :key="index1" :prop="it.prop" :label="it.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(y, index2) in it.children" :key="index2" :prop="y.prop" :label="y.label">
<template slot-scope="scope">
<span v-if="!edit">{{ scope.row[y.prop] }}</span>
<el-input type="number" @change="handleChange" :disabled="y.prop == 'dailyOutputTrend' || y.prop === 'originalGlassStatisticsTrend'
|| y.prop === 'actualProductTrend' || y.prop === 'originalGlassPassTrend' || y.prop === 'originalGlassPassNow' || y.prop === 'originalGlassPassHis'
" v-else v-model="scope.row[y.prop]"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
<!-- <el-input type="textarea" v-model="remark" placeholder="备注" :disabled="!edit" :autosize="{ minRows: 2, maxRows: 6}">
</el-input> -->
</div>
</template>
<script>
import { updateGlass, updateGlassRemark } from '@/api/report/glass';
const cols = [
{
prop: 'xc',
label: '许昌安彩新能科技有限公司2024年4月份生产日报',
align: 'center',
children: [
{
prop: 'lineName',
label: '生产线',
},
{
prop: '拉引速度(米/分)',
label: '班次',
},
{
prop: 'width2',
label: '板宽mm',
},
{
prop: 'weight2',
label: '板重(g)',
},
{
prop: 'lineName',
label: '拉引量(吨/班)',
},
{
prop: 'm',
label: '尺寸(长、宽、厚)毫米',
align: 'center',
children: [
{
prop: 'length',
label: '长',
},
{
prop: 'width',
label: '宽',
},
{
prop: 'thick',
label: '高',
}
]
}
]
}
]
export default {
props: {
data: {
type: Array,
default: () => [],
},
id: {
type: String,
default:'exportTable'
},
time: {
type: Array,
default: () => [],
},
date: {
type: String,
default:''
},
sum: {
type: Object,
default: () => {},
},
type: {
type: Number,
default: 3,
}
},
data() {
return {
cols,
remark:null,
edit: false,
noData:false,
};
},
watch: {
data: {
handler(newv, oldv) {
if (newv.length != 0) {
this.noData = false
} else {
this.noData = true
}
}
},
time: {
immediate: true,
handler(newv, oldv) {
if (newv[0] !== '') {
this.cols[0].label = this.date + '(' + newv[0] + '-' + newv[1] + ')'
} else {
this.cols[0].label = this.date
}
}
},
// type: {
// immediate: true,
// handler(newv, oldv) {
// let text1 = '', text2 = '', text3 = ''
// if (newv === 3) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else if (newv === 4) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else if (newv === 2) {
// text1 = ''
// text2 = ''
// text3 = '/'
// } else {
// text1 = ''
// text2 = ''
// text3 = '/'
// }
// this.cols[0].children[1].children[0].label = text1
// this.cols[0].children[1].children[1].label = text2
// this.cols[0].children[2].children[0].label = text1
// this.cols[0].children[2].children[1].label = text2
// this.cols[0].children[3].children[0].label = text1
// this.cols[0].children[3].children[1].label = text2
// this.cols[0].children[4].children[0].label = text1
// this.cols[0].children[4].children[1].label = text2
// this.cols[0].children[2].label = text3
// }
// }
},
methods: {
handleReturn() {
this.edit = false
console.log(this.$parent.getDataList());
},
handleChange(e) {
},
updateData() {
// let obj = {}
// this.data.forEach((ele, index) => {
// if (ele.det === false) {
// this.data[index].lineId = ''
// this.data[index].remark = this.remark
// obj = ele
// delete this.data[index].dailyOutputTrend
// delete this.data[index].originalGlassStatisticsTrend
// delete this.data[index].actualProductTrend
// delete this.data[index].originalGlassPassTrend
// this.data.splice(index, 1)
// }
// })
// let updateArr = this.data
// updateArr.forEach((ele, index) => {
// delete ele.dailyOutputTrend
// delete ele.originalGlassStatisticsTrend
// delete ele.actualProductTrend
// delete ele.originalGlassPassTrend
// });
// this.data.forEach((ele, index) => {
// delete ele.dailyOutputTrend
// delete ele.originalGlassStatisticsTrend
// delete ele.actualProductTrend
// delete ele.originalGlassPassTrend
// });
updateGlass(updateArr).then(response => {
updateGlassRemark(obj).then(res => {
this.$modal.msgSuccess("修改成功");
this.edit = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>

View File

@ -0,0 +1,670 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 14:08:46
* @LastEditTime: 2024-04-19 10:53:21
* @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 :data="alldata" border style="width: 100%">
<el-table-column prop="category" 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 prop="value" label="参考分值">
</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 {
getIngredientData
} 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: getIngredientData,
// deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel,
},
// tableProps,
headers,
// 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: {
startTime: 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: [
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'content',
// },
// {
// type: 'select',
// label: '',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
// param: 'materialId',
// filterable: true
// },
{
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: this.$auth.hasPermi('base:quality-hot-material:create') ? 'separate' : '',
// // type: 'separate',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'success',
plain: true
},
],
};
},
components: {
// AddOrUpdate,
},
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() {
// 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: {
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 }) {
let spanOneArr = [], concatOne = 0;
this.tableData.map((item, index) => {
if (index === 0) {
spanOneArr.push(1);
} else {
//
if (item.code === this.tableData[index - 1].code) {
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);
// this.getSpanArr(this.tableData)
// res.data.forEach((ele) => {
// console.log(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();
// // }
// })
console.log(res.data)
this.tableData = res.data.map((ele) => {
this.mechanism.push(ele.code)
return {
classType: ele.classType == 1 ? '白班' : ele.classType == 2 ? '夜班' : '合计',
code: ele.code,
putNum: ele.putNum,
useNum: ele.useNum,
// num: ele.num,
// size: typeof (ele.size)
// size: ele.size.match(/\[(.+?)\]/g) ? ele.size.substring(1, ele.size.length - 1) : ele.size
}
})
for (let i = 0; i < this.tableData.length - 1; i++) {
console.log(this.tableData[j].code.substr(this.tableData[j].code.length - 2, 1));
//
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;
});
},
// 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) {
switch (val.btnName) {
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.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList();
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':
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>

View File

@ -0,0 +1,261 @@
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :max-height="tableH" v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" /> -->
</base-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 {
getOriginalData
} from '@/api/report/qcReport';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import FileSaver from 'file-saver'
// import { getList, } from "@/api/base/qualityScrapType";
const tableProps = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'lineName',
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: getOriginalData,
// deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel,
},
tableProps,
tableData: [],
listQuery: {
startTime: undefined,
endTime:undefined
},
formConfig: [
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'content',
// },
// {
// type: 'select',
// label: '',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
// param: 'materialId',
// filterable: true
// },
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd HH:mm:ss',
// valueFormat: "yyyy-MM-dd HH:mm:ss",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'checkTime',
defaultSelect: [],
width: 250
},
{
type: this.$auth.hasPermi('base:quality-hot-material:query') ? 'button' : '',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: this.$auth.hasPermi('base:quality-hot-material:create') ? 'separate' : '',
// // type: 'separate',
// },
{
type: this.$auth.hasPermi('base:quality-hot-material:create') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'success',
plain: true
},
],
};
},
components: {
// AddOrUpdate,
},
created() { },
mounted() {
this.getDataList()
// this.getDict();
},
methods: {
handleExport() {
//
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 = '1711095616000';
this.listQuery.endTime = '1711183743000';
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data
// this.listQuery.total = response.data.total;
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) {
switch (val.btnName) {
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.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList();
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':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -0,0 +1,384 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 10:01:33
* @LastEditTime: 2024-04-18 16:26:48
* @LastEditors: zhp
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-table :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>
<!-- <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 {
getOriginalData
} from '@/api/report/qcReport';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import FileSaver from 'file-saver'
// import { getList, } from "@/api/base/qualityScrapType";
const tableProps = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'lineName',
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: getOriginalData,
// deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel,
},
tableProps,
tableData: [],
mergeArr: [],//
pos: 0,
listQuery: {
startTime: undefined,
endTime:undefined
},
formConfig: [
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'content',
// },
// {
// type: 'select',
// label: '',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
// param: 'materialId',
// filterable: true
// },
{
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: this.$auth.hasPermi('base:quality-hot-material:create') ? 'separate' : '',
// // type: 'separate',
// },
{
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: {
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]));
// const data = 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 }) {
let spanOneArr = [], concatOne = 0;
this.tableData.map((item, index) => {
if (index === 0) {
spanOneArr.push(1);
} else {
//
if (item.lineName === this.tableData[index - 1].lineName) {
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 = '1711095616000';
this.listQuery.endTime = '1711183743000';
this.urlOptions.getDataListURL(this.listQuery).then(response => {
// this.getSpanArr(this.tableData)
// response.data.forEach((ele) => {
// console.log(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();
// // }
// })
this.tableData = response.data.map((ele) => {
return {
area:ele.area,
countNum: ele.countNum,
equipmentName: ele.equipmentName,
lineName: ele.lineName,
num: ele.num,
// size: typeof (ele.size)
size: ele.size.match(/\[(.+?)\]/g) ? ele.size.substring(1, ele.size.length - 1) : ele.size
}
})
let obj = {}
response.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 = response.data.total;
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) {
switch (val.btnName) {
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.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList();
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':
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;
}
</style>

View File

@ -0,0 +1,406 @@
<!--
* @Author: zhp
* @Date: 2024-04-18 15:07:53
* @LastEditTime: 2024-04-18 15:26:50
* @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>
<!-- <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 {
getCuttingtData
} from '@/api/report/qcReport';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import FileSaver from 'file-saver'
// import { getList, } from "@/api/base/qualityScrapType";
const tableProps = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'lineName',
label: '产线'
},
{
prop: 'dataType',
label: ''
},
{
prop: 'type',
label: '类别'
},
{
prop: 'pieces',
label: '片数'
},
{
prop: 'area',
label: '面积'
},
{
prop: 'rate',
label: '占比',
// filter: (val) => val == false ? '' : '',
},
// {
// prop: 'checkerName',
// label: ''
// },
// {
// prop: 'checkTime',
// label: '',
// filter: parseTime
// },
];
export default {
mixins: [ tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getCuttingtData,
// deleteURL: deleteQualityHotMaterial,
// exportURL: exportFactoryExcel,
},
tableProps,
tableData: [],
mergeArr: [],//
pos: 0,
listQuery: {
startTime: undefined,
endTime:undefined
},
formConfig: [
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'content',
// },
// {
// type: 'select',
// label: '',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
// param: 'materialId',
// filterable: true
// },
{
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: this.$auth.hasPermi('base:quality-hot-material:create') ? 'separate' : '',
// // type: 'separate',
// },
{
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: {
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 }) {
let spanOneArr = [], concatOne = 0;
let spanTwoArr = [], concatTwo = 0;
this.tableData.map((item, index) => {
// console.log(inde);
if (index === 0) {
spanOneArr.push(1);
spanTwoArr.push(1);
} else {
//
if (item.lineName === this.tableData[index - 1].lineName) {
spanOneArr[concatOne] += 1;
spanOneArr.push(0);
} else {
spanOneArr.push(1);
concatOne = index;
};
if (item.dataType === this.tableData[index - 1].dataType) {
spanTwoArr[concatTwo] += 1;
spanTwoArr.push(0);
} else {
spanTwoArr.push(1);
concatTwo = index;
};
}
});
if (columnIndex === 0) {
const _row = spanOneArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col
}
}
if (columnIndex === 1) {
const _row = spanTwoArr[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 = '1706144404000';
this.listQuery.endTime = '1706230804000';
this.urlOptions.getDataListURL(this.listQuery).then(response => {
// this.getSpanArr(this.tableData)
// response.data.forEach((ele) => {
// console.log(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();
// // }
// })
this.tableData = response.data.map((ele) => {
return {
dataType: ele.dataType == 1 ? '成品' : ele.dataType == 2 ? '取样' : '废版',
code: ele.code,
putNum: ele.putNum,
lineName: ele.lineName,
type: ele.type,
pieces: ele.pieces,
area: ele.area,
rate: ele.rate
// useNum: ele.useNum,
// num: ele.num,
// size: typeof (ele.size)
// size: ele.size.match(/\[(.+?)\]/g) ? ele.size.substring(1, ele.size.length - 1) : ele.size
}
})
// let obj = {}
// response.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 = response.data.total;
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) {
switch (val.btnName) {
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.endTime = val.checkTime ? val.checkTime[1] : undefined;
this.getDataList();
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':
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;
}
</style>