Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -27,3 +27,16 @@ export function delOss(ossId) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
export function uploadFile(file) {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
return request({
|
||||
url: '/system/oss/upload',
|
||||
method: 'post',
|
||||
data: form,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { tansParams } from "@/utils/klp";
|
||||
|
||||
// 查询钢卷物料表列表
|
||||
export function listMaterialCoil(query) {
|
||||
@@ -348,12 +349,15 @@ export function categoryWidthStatistics() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 钢卷被退货,发给客户的钢卷被退货
|
||||
* 导出钢卷的全部字段
|
||||
*/
|
||||
export function exportCoilWithAll(data) {
|
||||
return request({
|
||||
url: '/wms/materialCoil/exportAll',
|
||||
method: 'post',
|
||||
data
|
||||
data: data,
|
||||
transformRequest: [(params) => { return tansParams(params) }],
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
291
klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue
Normal file
291
klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue
Normal file
@@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<div class="label-container" :style="{ '--print-scale': printScale }">
|
||||
<div class="material-label-grid">
|
||||
<!-- 公司名称行 -->
|
||||
<div class="grid-cell company-cell">嘉祥科伦普重工有限公司</div>
|
||||
|
||||
<!-- 第一行:冷卷号、热卷号 -->
|
||||
<div class="grid-cell label-cell">冷卷号</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.currentCoilNo || '' }}</div>
|
||||
</div>
|
||||
<div class="grid-cell label-cell">热卷号</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.enterCoilNo || '' }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 第二行:规格、钢种 -->
|
||||
<div class="grid-cell label-cell">规格</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.specification || '' }}</div>
|
||||
</div>
|
||||
<div class="grid-cell label-cell">钢种</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.material || '' }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 第三行:净重、下工序 -->
|
||||
<div class="grid-cell label-cell">净重</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.netWeight || '' }}</div>
|
||||
</div>
|
||||
<div class="grid-cell label-cell">下工序</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.nextProcess || '冷轧' }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 第四行:包装要求、切边要求 -->
|
||||
<div class="grid-cell label-cell">包装要求</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.packagingRequirement || '' }}</div>
|
||||
</div>
|
||||
<div class="grid-cell label-cell">切边要求</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.trimmingRequirement || '' }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 第五行:班组、代码(二维码) -->
|
||||
<div class="grid-cell label-cell">班组</div>
|
||||
<div class="grid-cell value-cell">
|
||||
<div class="nob" contenteditable>{{ content.team || '' }}</div>
|
||||
</div>
|
||||
<div class="grid-cell label-cell">代码</div>
|
||||
<div class="grid-cell qrcode-cell">
|
||||
<!-- 二维码容器 -->
|
||||
<QRCode :content="content.qrcodeRecordId" :size="80"/>
|
||||
</div>
|
||||
|
||||
<!-- 第六行:生产日期 -->
|
||||
<div class="grid-cell label-cell">生产日期</div>
|
||||
<div class="grid-cell value-cell date-cell">
|
||||
<div class="nob" contenteditable>{{ content.createTime || '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QRCode from '@/components/QRCode/index.vue';
|
||||
|
||||
export default {
|
||||
name: 'ZincRawTag',
|
||||
components: {
|
||||
QRCode
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
currentCoilNo: '',
|
||||
entryCoilNo: '',
|
||||
specification: '',
|
||||
material: '',
|
||||
netWeight: '',
|
||||
nextProcess: '',
|
||||
packagingRequirements: '',
|
||||
trimmingRequirements: '',
|
||||
team: '',
|
||||
createTime: '',
|
||||
qrcodeRecordId: '',
|
||||
})
|
||||
},
|
||||
paperWidthMm: {
|
||||
type: Number,
|
||||
default: 100
|
||||
},
|
||||
paperHeightMm: {
|
||||
type: Number,
|
||||
default: 80
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
printScale: 1,
|
||||
printMediaQuery: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.printMediaQuery = window.matchMedia('print');
|
||||
this.printMediaQuery.addListener(this.handlePrintMediaChange);
|
||||
window.addEventListener('beforeprint', this.handleBeforePrint);
|
||||
window.addEventListener('afterprint', this.handleAfterPrint);
|
||||
this.$nextTick(() => {
|
||||
this.calculatePrintScale();
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.printMediaQuery) {
|
||||
this.printMediaQuery.removeListener(this.handlePrintMediaChange);
|
||||
}
|
||||
window.removeEventListener('beforeprint', this.handleBeforePrint);
|
||||
window.removeEventListener('afterprint', this.handleAfterPrint);
|
||||
},
|
||||
methods: {
|
||||
handlePrintMediaChange(mq) {
|
||||
mq.matches ? this.calculatePrintScale() : this.resetPrintScale();
|
||||
},
|
||||
handleBeforePrint() {
|
||||
setTimeout(() => this.calculatePrintScale(), 100);
|
||||
},
|
||||
handleAfterPrint() {
|
||||
this.resetPrintScale();
|
||||
},
|
||||
calculatePrintScale() {
|
||||
this.$nextTick(() => {
|
||||
const container = this.$el;
|
||||
if (!container) return;
|
||||
|
||||
const dpi = 96;
|
||||
const mmToPx = dpi / 25.4;
|
||||
const paperWidthPx = this.paperWidthMm * mmToPx;
|
||||
const paperHeightPx = this.paperHeightMm * mmToPx;
|
||||
const marginPx = 2 * mmToPx;
|
||||
|
||||
const rect = container.getBoundingClientRect();
|
||||
const contentWidth = rect.width || container.scrollWidth;
|
||||
const contentHeight = rect.height || container.scrollHeight;
|
||||
|
||||
const availableWidth = paperWidthPx - marginPx * 2;
|
||||
const availableHeight = paperHeightPx - marginPx * 2;
|
||||
|
||||
const scaleX = contentWidth > 0 ? availableWidth / contentWidth : 1;
|
||||
const scaleY = contentHeight > 0 ? availableHeight / contentHeight : 1;
|
||||
|
||||
this.printScale = Math.min(scaleX, scaleY, 1);
|
||||
container.style.setProperty('--print-scale', this.printScale);
|
||||
container.style.setProperty('--paper-width', `${this.paperWidthMm}mm`);
|
||||
container.style.setProperty('--paper-height', `${this.paperHeightMm}mm`);
|
||||
});
|
||||
},
|
||||
resetPrintScale() {
|
||||
this.printScale = 1;
|
||||
if (this.$el) {
|
||||
this.$el.style.setProperty('--print-scale', 1);
|
||||
this.$el.style.removeProperty('--paper-width');
|
||||
this.$el.style.removeProperty('--paper-height');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.label-container {
|
||||
width: 45em;
|
||||
height: 25em;
|
||||
padding: 16px;
|
||||
font-family: "SimSun", serif;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 核心Grid布局 */
|
||||
.material-label-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr); /* 4列等宽 */
|
||||
grid-auto-rows: 1fr; /* 行高自适应 */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid #333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.grid-cell {
|
||||
border: 1px solid #333;
|
||||
padding: 4px;
|
||||
font-size: 20px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
overflow-wrap: break-word;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* 公司名称单元格 */
|
||||
.company-cell {
|
||||
grid-column: span 4; /* 跨4列 */
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
/* background-color: #f5f5f5; */
|
||||
}
|
||||
|
||||
/* 标签单元格(左) */
|
||||
.label-cell {
|
||||
/* background-color: #f5f5f5; */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 值单元格 */
|
||||
.value-cell {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.date-cell {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
/* 二维码单元格(跨2列+2行) */
|
||||
.qrcode-cell {
|
||||
grid-row: span 2; /* 跨2行 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.qrcode-container {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
border: 1px dashed #999; /* 占位虚线 */
|
||||
}
|
||||
|
||||
/* 内容可编辑区域 */
|
||||
.nob {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
font-size: inherit;
|
||||
word-break: break-all;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* 打印样式 */
|
||||
@media print {
|
||||
@page {
|
||||
size: 100mm 80mm;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
* {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
print-color-adjust: exact !important;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
body>*:not(.label-container) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.label-container {
|
||||
page-break-inside: avoid !important;
|
||||
break-inside: avoid !important;
|
||||
transform: scale(var(--print-scale, 1)) !important;
|
||||
transform-origin: top left !important;
|
||||
max-width: var(--paper-width, 100mm) !important;
|
||||
max-height: var(--paper-height, 80mm) !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -38,6 +38,12 @@
|
||||
:paperWidthMm="180"
|
||||
:paperHeightMm="100"
|
||||
/>
|
||||
<TuoZhiTag
|
||||
v-if="tagType === '6'"
|
||||
:content="content"
|
||||
:paperWidthMm="180"
|
||||
:paperHeightMm="100"
|
||||
/>
|
||||
<!-- <SampleTagPreview v-if="labelType === '4'" :content="content" />
|
||||
<ForgeTagPreview v-if="labelType === '5'" :content="content" />
|
||||
<SaltSprayTagPreview v-if="labelType === '6'" :content="content" /> -->
|
||||
@@ -61,6 +67,8 @@ import GalvanizedTag from './GalvanizedTag.vue';
|
||||
import WhereTag from './WhereTag.vue';
|
||||
import ZincRawTag from './ZincRawTag.vue';
|
||||
import DuGeTag from './DuGeTag.vue';
|
||||
import TuoZhiTag from './TuoZhiTag.vue';
|
||||
|
||||
|
||||
// import SampleTagPreview from './SampleTagPreview.vue';
|
||||
// import ForgeTagPreview from './ForgeTagPreview.vue';
|
||||
@@ -75,6 +83,7 @@ export default {
|
||||
WhereTag,
|
||||
ZincRawTag,
|
||||
DuGeTag,
|
||||
TuoZhiTag,
|
||||
// SampleTagPreview,
|
||||
// ForgeTagPreview,
|
||||
// SaltSprayTagPreview,
|
||||
@@ -107,6 +116,10 @@ export default {
|
||||
width: 180,
|
||||
height: 100,
|
||||
},
|
||||
'6': {
|
||||
width: 180,
|
||||
height: 100,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -143,6 +156,10 @@ export default {
|
||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||
this.labelType = '5';
|
||||
}
|
||||
// 脱脂原料库
|
||||
else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) {
|
||||
this.labelType = '6';
|
||||
} else if (itemType == 'raw_material') {
|
||||
this.labelType = '2';
|
||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||
|
||||
@@ -92,8 +92,8 @@ export default {
|
||||
// 提取净边料所有原始宽度
|
||||
rawTrimmedWidths() {
|
||||
const widthSet = new Set();
|
||||
this.data.forEach(item => {
|
||||
item.trimmedList.forEach(trimmed => {
|
||||
this.data?.forEach(item => {
|
||||
item.trimmedList?.forEach(trimmed => {
|
||||
if (trimmed.width) widthSet.add(trimmed.width);
|
||||
});
|
||||
});
|
||||
@@ -108,8 +108,8 @@ export default {
|
||||
// 提取毛边料所有原始宽度
|
||||
rawUntrimmedWidths() {
|
||||
const widthSet = new Set();
|
||||
this.data.forEach(item => {
|
||||
item.untrimmedList.forEach(untrimmed => {
|
||||
this.data?.forEach(item => {
|
||||
item.untrimmedList?.forEach(untrimmed => {
|
||||
if (untrimmed.width) widthSet.add(untrimmed.width);
|
||||
});
|
||||
});
|
||||
@@ -132,25 +132,25 @@ export default {
|
||||
};
|
||||
|
||||
// 初始化净边料分组数据
|
||||
this.trimmedWidthGroups.forEach(group => {
|
||||
this.trimmedWidthGroups?.forEach(group => {
|
||||
row[`trimmed_${group.key}_count`] = 0;
|
||||
row[`trimmed_${group.key}_weight`] = 0;
|
||||
});
|
||||
|
||||
// 初始化毛边料分组数据
|
||||
this.untrimmedWidthGroups.forEach(group => {
|
||||
this.untrimmedWidthGroups?.forEach(group => {
|
||||
row[`untrimmed_${group.key}_count`] = 0;
|
||||
row[`untrimmed_${group.key}_weight`] = 0;
|
||||
});
|
||||
|
||||
// 处理净边料数据(按分组求和)
|
||||
item.trimmedList.forEach(trimmed => {
|
||||
item.trimmedList?.forEach(trimmed => {
|
||||
const width = trimmed.width;
|
||||
const count = Number(trimmed.coilCount) || 0;
|
||||
const weight = Number(trimmed.totalWeight) || 0;
|
||||
|
||||
// 找到宽度所属的分组并累加
|
||||
this.trimmedWidthGroups.forEach(group => {
|
||||
this.trimmedWidthGroups?.forEach(group => {
|
||||
if (group.includesWidth(width)) {
|
||||
row[`trimmed_${group.key}_count`] += count;
|
||||
row[`trimmed_${group.key}_weight`] = (row[`trimmed_${group.key}_weight`] + weight).toFixed(3);
|
||||
@@ -163,13 +163,13 @@ export default {
|
||||
});
|
||||
|
||||
// 处理毛边料数据(按分组求和)
|
||||
item.untrimmedList.forEach(untrimmed => {
|
||||
item.untrimmedList?.forEach(untrimmed => {
|
||||
const width = untrimmed.width;
|
||||
const count = Number(untrimmed.coilCount) || 0;
|
||||
const weight = Number(untrimmed.totalWeight) || 0;
|
||||
|
||||
// 找到宽度所属的分组并累加
|
||||
this.untrimmedWidthGroups.forEach(group => {
|
||||
this.untrimmedWidthGroups?.forEach(group => {
|
||||
if (group.includesWidth(width)) {
|
||||
row[`untrimmed_${group.key}_count`] += count;
|
||||
row[`untrimmed_${group.key}_weight`] = (row[`untrimmed_${group.key}_weight`] + weight).toFixed(3);
|
||||
@@ -202,7 +202,7 @@ export default {
|
||||
|
||||
// 检查净边料分组列
|
||||
if (!hasNonZeroData) {
|
||||
this.trimmedWidthGroups.forEach(group => {
|
||||
this.trimmedWidthGroups?.forEach(group => {
|
||||
if (Number(row[`trimmed_${group.key}_count`]) > 0 || Number(row[`trimmed_${group.key}_weight`]) > 0) {
|
||||
hasNonZeroData = true;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ export default {
|
||||
|
||||
// 检查毛边料分组列
|
||||
if (!hasNonZeroData) {
|
||||
this.untrimmedWidthGroups.forEach(group => {
|
||||
this.untrimmedWidthGroups?.forEach(group => {
|
||||
if (Number(row[`untrimmed_${group.key}_count`]) > 0 || Number(row[`untrimmed_${group.key}_weight`]) > 0) {
|
||||
hasNonZeroData = true;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ export default {
|
||||
const usedWidths = new Set();
|
||||
|
||||
// 遍历分组规则,匹配原始宽度
|
||||
Object.entries(this.widthGroupRules).forEach(([groupLabel, widthList]) => {
|
||||
Object.entries(this.widthGroupRules)?.forEach(([groupLabel, widthList]) => {
|
||||
// 筛选出当前分组包含的原始宽度
|
||||
const matchedWidths = rawWidths.filter(width => widthList.includes(width));
|
||||
if (matchedWidths.length === 0) return;
|
||||
@@ -246,11 +246,11 @@ export default {
|
||||
});
|
||||
|
||||
// 标记已使用的宽度
|
||||
matchedWidths.forEach(width => usedWidths.add(width));
|
||||
matchedWidths?.forEach(width => usedWidths.add(width));
|
||||
});
|
||||
|
||||
// 处理未匹配到分组的宽度(单独成组)
|
||||
rawWidths.forEach(width => {
|
||||
rawWidths?.forEach(width => {
|
||||
if (!usedWidths.has(width)) {
|
||||
const groupKey = width.replace(/[^a-zA-Z0-9]/g, '_');
|
||||
groups.push({
|
||||
|
||||
@@ -410,7 +410,6 @@ import {
|
||||
cancelExportCoil,
|
||||
checkCoilNo,
|
||||
returnCoil,
|
||||
exportCoilWithAll
|
||||
} from "@/api/wms/coil";
|
||||
import { listBoundCoil } from "@/api/wms/deliveryWaybillDetail";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
@@ -807,7 +806,12 @@ export default {
|
||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||
this.labelRender.type = '5';
|
||||
} else if (itemType == 'raw_material') {
|
||||
}
|
||||
// 脱脂原料库
|
||||
else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) {
|
||||
this.labelRender.type = '6';
|
||||
}
|
||||
else if (itemType == 'raw_material') {
|
||||
this.labelRender.type = '2';
|
||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||
this.labelRender.type = '3';
|
||||
@@ -1060,7 +1064,7 @@ export default {
|
||||
const res = await listBoundCoil(query)
|
||||
coilIds = res.rows.map(item => item.coilId).join(',')
|
||||
this.loading = false
|
||||
this.download('wms/deliveryWaybill/export', {
|
||||
this.download('/wms/materialCoil/exportDelivery', {
|
||||
coilIds,
|
||||
}, 'coil.xlsx')
|
||||
} else {
|
||||
@@ -1071,8 +1075,6 @@ export default {
|
||||
coilIds,
|
||||
}, 'coil.xlsx')
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
handleCheck(row) {
|
||||
this.isCheck = true;
|
||||
|
||||
@@ -577,6 +577,10 @@ export default {
|
||||
width: 180,
|
||||
height: 100,
|
||||
},
|
||||
'6': {
|
||||
width: 180,
|
||||
height: 100,
|
||||
},
|
||||
},
|
||||
stepSpilt: {
|
||||
list: [],
|
||||
@@ -663,7 +667,12 @@ export default {
|
||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||
this.labelRender.type = '5';
|
||||
} else if (itemType == 'raw_material') {
|
||||
}
|
||||
// 脱脂原料库
|
||||
else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) {
|
||||
this.labelRender.type = '6';
|
||||
}
|
||||
else if (itemType == 'raw_material') {
|
||||
this.labelRender.type = '2';
|
||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||
this.labelRender.type = '3';
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" class="add-btn">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-refresh" size="mini" @click="getList" class="add-btn">
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 自定义列表(替代表格) -->
|
||||
@@ -32,11 +35,16 @@
|
||||
<!-- 内容区域 -->
|
||||
<div class="item-content">
|
||||
<el-tag type="info">{{ item.statType }}</el-tag>
|
||||
<div style="display: flex;">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<!-- 双击后变成输入框,输入框失去焦点触发更新 -->
|
||||
<div class="value">{{ item.title }}</div>
|
||||
<!-- <span class="value">{{ item.createTime }}</span>
|
||||
<span class="value">{{ item.createBy }}</span> -->
|
||||
<div class="value">
|
||||
{{ item.title }}
|
||||
<el-icons title="本次汇总保存了汇总时使用的钢卷明细" v-if="item.attachmentInfo" class="el-icon-link"></el-icons>
|
||||
</div>
|
||||
<div>
|
||||
<span class="value" style="margin-right: 5px;">{{ item.createBy }}</span>
|
||||
<span class="value">{{ item.createTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -261,6 +269,7 @@ export default {
|
||||
.item-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
<LeftList ref="leftList" @add="handleAdd" @select="handleSelect" />
|
||||
</el-col>
|
||||
|
||||
<el-col :span="18">
|
||||
<el-col :span="18" style="position: relative;">
|
||||
<ul style="float: right; position: absolute; right: 0; top: 0; z-index: 100;">
|
||||
<li v-show="currentRow.attachmentInfo" @click="handleDownload(currentRow)"><el-button
|
||||
icon="el-icon-download">下载明细</el-button></li>
|
||||
</ul>
|
||||
<div style="height: calc(100vh - 124px); overflow-y: scroll; overflow-x: hidden;">
|
||||
<div v-if="currentRow.summaryId">
|
||||
<Preview :data="currentRow.statJson" :statType="currentRow.statType" />
|
||||
@@ -17,9 +21,21 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-loading="previewLoading" title="效果预览" :visible.sync="previewOpen" width="100vw" fullscreen append-to-body>
|
||||
<Preview :data="liveData" :statType="form.statType" />
|
||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
||||
<el-dialog v-loading="previewLoading" title="效果预览" :visible.sync="previewOpen" width="80vw" append-to-body>
|
||||
<div>
|
||||
<el-button type="primary" @click="handleSave" :loading="buttonLoading">保存</el-button>
|
||||
<!-- <el-button type="primary" @click="handleDetail" :loading="buttonLoading">查看明细</el-button> -->
|
||||
<el-checkbox style="margin-left: 10px;" v-model="saveDetail"
|
||||
label="orderBy">保存透视表时保存明细,勾选后在保存时会消耗更长的时间且会占用更多内存和存储</el-checkbox>
|
||||
</div>
|
||||
<div style="height: calc(100vh - 300px); overflow-y: scroll; overflow-x: hidden;">
|
||||
<div v-if="liveData">
|
||||
<Preview :data="liveData" :statType="form.statType" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>钢卷生产统计详情</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -30,7 +46,8 @@ import LeftList from "./components/LeftList.vue";
|
||||
import Preview from "@/views/wms/coil/panels/Perspective/index.vue";
|
||||
|
||||
import { listRawMaterialPerspective } from "@/api/wms/rawMaterial";
|
||||
import { listCoilTrimStatistics, categoryWidthStatistics } from "@/api/wms/coil";
|
||||
import { uploadFile } from "@/api/system/oss";
|
||||
import { listCoilTrimStatistics, categoryWidthStatistics, listMaterialCoil, exportCoilWithAll } from "@/api/wms/coil";
|
||||
|
||||
export default {
|
||||
name: "CoilStatisticsSummary",
|
||||
@@ -67,6 +84,7 @@ export default {
|
||||
title: undefined,
|
||||
statType: undefined,
|
||||
},
|
||||
saveDetail: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
@@ -171,19 +189,97 @@ export default {
|
||||
}
|
||||
this.previewLoading = false;
|
||||
},
|
||||
handleSave() {
|
||||
addCoilStatisticsSummary({
|
||||
...this.form,
|
||||
statJson: JSON.stringify(this.liveData)
|
||||
}).then(response => {
|
||||
async handleSave() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
try {
|
||||
this.buttonLoading = true;
|
||||
|
||||
const { data: summary } = await addCoilStatisticsSummary({
|
||||
...this.form,
|
||||
statJson: JSON.stringify(this.liveData)
|
||||
})
|
||||
|
||||
if (this.saveDetail) {
|
||||
// 获取原始数据,组装coilIds,
|
||||
let coilIds = ''
|
||||
if (this.form.statType == '热轧原料') {
|
||||
const { rows: coils } = await listMaterialCoil({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
selectType: 'raw_material',
|
||||
dataType: 1,
|
||||
status: 0,
|
||||
itemName: '热轧卷板',
|
||||
itemType: 'raw_material',
|
||||
})
|
||||
coilIds = coils.map(item => item.coilId).join(',')
|
||||
} else if (this.form.statType == '冷硬卷板') {
|
||||
const { rows: coils1 } = await listMaterialCoil({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
selectType: 'raw_material',
|
||||
dataType: 1,
|
||||
status: 0,
|
||||
itemName: '冷硬卷',
|
||||
itemType: 'raw_material',
|
||||
})
|
||||
const { rows: coils2 } = await listMaterialCoil({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
selectType: 'product',
|
||||
dataType: 1,
|
||||
status: 0,
|
||||
itemName: '冷硬卷',
|
||||
itemType: 'product',
|
||||
})
|
||||
coilIds = coils1.concat(coils2).map(item => item.coilId).join(',')
|
||||
} else if (this.form.statType == '汇总') {
|
||||
const { rows: coils } = await listMaterialCoil({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
dataType: 1,
|
||||
status: 0,
|
||||
})
|
||||
coilIds = coils.map(item => item.coilId).join(',')
|
||||
}
|
||||
|
||||
// 使用exportCoilWithAll接口传入coilIds获取二进制文件数据
|
||||
const response = await exportCoilWithAll({
|
||||
coilIds: coilIds,
|
||||
})
|
||||
const file = new Blob([response], { type: 'application/vnd.ms-excel' })
|
||||
const fileName = this.form.statType + '明细.xlsx'
|
||||
// 通过new File构建出excel文件
|
||||
const excelFile = new File([file], fileName, { type: 'application/vnd.ms-excel' })
|
||||
|
||||
console.log(excelFile)
|
||||
// 上传文件到minio
|
||||
const uploadResponse = await uploadFile(excelFile)
|
||||
console.log(uploadResponse)
|
||||
|
||||
// 关联附件信息
|
||||
await updateCoilStatisticsSummary({
|
||||
...summary,
|
||||
attachmentInfo: uploadResponse.data.ossId,
|
||||
});
|
||||
}
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.previewOpen = false;
|
||||
this.liveData = [];
|
||||
this.form = {};
|
||||
this.$refs.leftList.getList();
|
||||
}).finally(() => {
|
||||
} finally {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
loading.close();
|
||||
}
|
||||
},
|
||||
handleDownload(row) {
|
||||
this.$download.oss(row.attachmentInfo)
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
|
||||
Reference in New Issue
Block a user