feat(标签系统): 添加脱脂原料库标签类型并优化透视表功能
新增脱脂原料库标签类型6及相关组件TuoZhiTag 优化透视表功能,增加保存明细选项和导出功能 在标签渲染组件中添加对脱脂原料库类型的判断 更新相关API调用和UI交互逻辑
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 request from '@/utils/request'
|
||||||
|
import { tansParams } from "@/utils/klp";
|
||||||
|
|
||||||
// 查询钢卷物料表列表
|
// 查询钢卷物料表列表
|
||||||
export function listMaterialCoil(query) {
|
export function listMaterialCoil(query) {
|
||||||
@@ -348,12 +349,15 @@ export function categoryWidthStatistics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钢卷被退货,发给客户的钢卷被退货
|
* 导出钢卷的全部字段
|
||||||
*/
|
*/
|
||||||
export function exportCoilWithAll(data) {
|
export function exportCoilWithAll(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/wms/materialCoil/exportAll',
|
url: '/wms/materialCoil/exportAll',
|
||||||
method: 'post',
|
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"
|
:paperWidthMm="180"
|
||||||
:paperHeightMm="100"
|
:paperHeightMm="100"
|
||||||
/>
|
/>
|
||||||
|
<TuoZhiTag
|
||||||
|
v-if="tagType === '6'"
|
||||||
|
:content="content"
|
||||||
|
:paperWidthMm="180"
|
||||||
|
:paperHeightMm="100"
|
||||||
|
/>
|
||||||
<!-- <SampleTagPreview v-if="labelType === '4'" :content="content" />
|
<!-- <SampleTagPreview v-if="labelType === '4'" :content="content" />
|
||||||
<ForgeTagPreview v-if="labelType === '5'" :content="content" />
|
<ForgeTagPreview v-if="labelType === '5'" :content="content" />
|
||||||
<SaltSprayTagPreview v-if="labelType === '6'" :content="content" /> -->
|
<SaltSprayTagPreview v-if="labelType === '6'" :content="content" /> -->
|
||||||
@@ -61,6 +67,8 @@ import GalvanizedTag from './GalvanizedTag.vue';
|
|||||||
import WhereTag from './WhereTag.vue';
|
import WhereTag from './WhereTag.vue';
|
||||||
import ZincRawTag from './ZincRawTag.vue';
|
import ZincRawTag from './ZincRawTag.vue';
|
||||||
import DuGeTag from './DuGeTag.vue';
|
import DuGeTag from './DuGeTag.vue';
|
||||||
|
import TuoZhiTag from './TuoZhiTag.vue';
|
||||||
|
|
||||||
|
|
||||||
// import SampleTagPreview from './SampleTagPreview.vue';
|
// import SampleTagPreview from './SampleTagPreview.vue';
|
||||||
// import ForgeTagPreview from './ForgeTagPreview.vue';
|
// import ForgeTagPreview from './ForgeTagPreview.vue';
|
||||||
@@ -75,6 +83,7 @@ export default {
|
|||||||
WhereTag,
|
WhereTag,
|
||||||
ZincRawTag,
|
ZincRawTag,
|
||||||
DuGeTag,
|
DuGeTag,
|
||||||
|
TuoZhiTag,
|
||||||
// SampleTagPreview,
|
// SampleTagPreview,
|
||||||
// ForgeTagPreview,
|
// ForgeTagPreview,
|
||||||
// SaltSprayTagPreview,
|
// SaltSprayTagPreview,
|
||||||
@@ -107,6 +116,10 @@ export default {
|
|||||||
width: 180,
|
width: 180,
|
||||||
height: 100,
|
height: 100,
|
||||||
},
|
},
|
||||||
|
'6': {
|
||||||
|
width: 180,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -143,6 +156,10 @@ export default {
|
|||||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||||
this.labelType = '5';
|
this.labelType = '5';
|
||||||
|
}
|
||||||
|
// 脱脂原料库
|
||||||
|
else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) {
|
||||||
|
this.labelType = '6';
|
||||||
} else if (itemType == 'raw_material') {
|
} else if (itemType == 'raw_material') {
|
||||||
this.labelType = '2';
|
this.labelType = '2';
|
||||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||||
|
|||||||
@@ -410,7 +410,6 @@ import {
|
|||||||
cancelExportCoil,
|
cancelExportCoil,
|
||||||
checkCoilNo,
|
checkCoilNo,
|
||||||
returnCoil,
|
returnCoil,
|
||||||
exportCoilWithAll
|
|
||||||
} from "@/api/wms/coil";
|
} from "@/api/wms/coil";
|
||||||
import { listBoundCoil } from "@/api/wms/deliveryWaybillDetail";
|
import { listBoundCoil } from "@/api/wms/deliveryWaybillDetail";
|
||||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||||
@@ -807,7 +806,12 @@ export default {
|
|||||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||||
this.labelRender.type = '5';
|
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';
|
this.labelRender.type = '2';
|
||||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||||
this.labelRender.type = '3';
|
this.labelRender.type = '3';
|
||||||
@@ -1060,7 +1064,7 @@ export default {
|
|||||||
const res = await listBoundCoil(query)
|
const res = await listBoundCoil(query)
|
||||||
coilIds = res.rows.map(item => item.coilId).join(',')
|
coilIds = res.rows.map(item => item.coilId).join(',')
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.download('wms/deliveryWaybill/export', {
|
this.download('/wms/materialCoil/exportDelivery', {
|
||||||
coilIds,
|
coilIds,
|
||||||
}, 'coil.xlsx')
|
}, 'coil.xlsx')
|
||||||
} else {
|
} else {
|
||||||
@@ -1071,8 +1075,6 @@ export default {
|
|||||||
coilIds,
|
coilIds,
|
||||||
}, 'coil.xlsx')
|
}, 'coil.xlsx')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleCheck(row) {
|
handleCheck(row) {
|
||||||
this.isCheck = true;
|
this.isCheck = true;
|
||||||
|
|||||||
@@ -577,6 +577,10 @@ export default {
|
|||||||
width: 180,
|
width: 180,
|
||||||
height: 100,
|
height: 100,
|
||||||
},
|
},
|
||||||
|
'6': {
|
||||||
|
width: 180,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
stepSpilt: {
|
stepSpilt: {
|
||||||
list: [],
|
list: [],
|
||||||
@@ -663,7 +667,12 @@ export default {
|
|||||||
// 在镀锌颜料库的卷使用镀锌原料标签
|
// 在镀锌颜料库的卷使用镀锌原料标签
|
||||||
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) {
|
||||||
this.labelRender.type = '5';
|
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';
|
this.labelRender.type = '2';
|
||||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||||
this.labelRender.type = '3';
|
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 type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" class="add-btn">
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="primary" plain icon="el-icon-refresh" size="mini" @click="getList" class="add-btn">
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 自定义列表(替代表格) -->
|
<!-- 自定义列表(替代表格) -->
|
||||||
@@ -32,11 +35,16 @@
|
|||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<el-tag type="info">{{ item.statType }}</el-tag>
|
<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>
|
<div class="value">
|
||||||
<!-- <span class="value">{{ item.createTime }}</span>
|
{{ item.title }}
|
||||||
<span class="value">{{ item.createBy }}</span> -->
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -261,6 +269,7 @@ export default {
|
|||||||
.item-content {
|
.item-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
<LeftList ref="leftList" @add="handleAdd" @select="handleSelect" />
|
<LeftList ref="leftList" @add="handleAdd" @select="handleSelect" />
|
||||||
</el-col>
|
</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 style="height: calc(100vh - 124px); overflow-y: scroll; overflow-x: hidden;">
|
||||||
<div v-if="currentRow.summaryId">
|
<div v-if="currentRow.summaryId">
|
||||||
<Preview :data="currentRow.statJson" :statType="currentRow.statType" />
|
<Preview :data="currentRow.statJson" :statType="currentRow.statType" />
|
||||||
@@ -17,9 +21,21 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-dialog v-loading="previewLoading" title="效果预览" :visible.sync="previewOpen" width="100vw" fullscreen append-to-body>
|
<el-dialog v-loading="previewLoading" title="效果预览" :visible.sync="previewOpen" width="80vw" append-to-body>
|
||||||
<Preview :data="liveData" :statType="form.statType" />
|
<div>
|
||||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
<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="currentRow.summaryId">
|
||||||
|
<Preview :data="liveData" :statType="form.statType" />
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div>钢卷生产统计详情</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -30,7 +46,8 @@ import LeftList from "./components/LeftList.vue";
|
|||||||
import Preview from "@/views/wms/coil/panels/Perspective/index.vue";
|
import Preview from "@/views/wms/coil/panels/Perspective/index.vue";
|
||||||
|
|
||||||
import { listRawMaterialPerspective } from "@/api/wms/rawMaterial";
|
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 {
|
export default {
|
||||||
name: "CoilStatisticsSummary",
|
name: "CoilStatisticsSummary",
|
||||||
@@ -67,6 +84,7 @@ export default {
|
|||||||
title: undefined,
|
title: undefined,
|
||||||
statType: undefined,
|
statType: undefined,
|
||||||
},
|
},
|
||||||
|
saveDetail: false,
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
@@ -171,19 +189,97 @@ export default {
|
|||||||
}
|
}
|
||||||
this.previewLoading = false;
|
this.previewLoading = false;
|
||||||
},
|
},
|
||||||
handleSave() {
|
async handleSave() {
|
||||||
addCoilStatisticsSummary({
|
const loading = this.$loading({
|
||||||
...this.form,
|
lock: true,
|
||||||
statJson: JSON.stringify(this.liveData)
|
text: '保存中...',
|
||||||
}).then(response => {
|
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 listCoilTrimStatistics({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 9999,
|
||||||
|
selectType: 'product',
|
||||||
|
dataType: 1,
|
||||||
|
status: 0,
|
||||||
|
itemName: '冷硬卷',
|
||||||
|
itemType: 'raw_material',
|
||||||
|
})
|
||||||
|
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.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
this.previewOpen = false;
|
||||||
this.liveData = [];
|
this.liveData = [];
|
||||||
this.form = {};
|
this.form = {};
|
||||||
this.$refs.leftList.getList();
|
this.$refs.leftList.getList();
|
||||||
}).finally(() => {
|
} finally {
|
||||||
this.buttonLoading = false;
|
this.buttonLoading = false;
|
||||||
});
|
loading.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDownload(row) {
|
||||||
|
this.$download.oss(row.attachmentInfo)
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
|
|||||||
Reference in New Issue
Block a user