结算全部打印,未结算报表zip导出,盘点入库编号设置
This commit is contained in:
parent
532a1395af
commit
40ff5283d1
|
|
@ -228,27 +228,49 @@ export function downloadJson(url, params, filename, config) {
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function downloadZip(url, params, filename, config) {
|
export function downloadZip(url, params, filename, config) {
|
||||||
downloadLoadingInstance = Loading.service({
|
const backgroundMode = config && config.background === true
|
||||||
text: '正在下载数据,请稍候',
|
const showLoading = !(config && config.showLoading === false) && !backgroundMode
|
||||||
spinner: 'el-icon-loading',
|
const finalAxiosConfig = {
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
transformRequest: [
|
||||||
})
|
(params) => {
|
||||||
return service
|
return params
|
||||||
.post(url, params, {
|
},
|
||||||
transformRequest: [
|
],
|
||||||
(params) => {
|
headers: { 'Content-Type': 'application/json', encryptResponse: false },
|
||||||
return params
|
responseType: 'blob',
|
||||||
},
|
// if background mode and no explicit timeout, extend to 10 minutes
|
||||||
],
|
timeout: backgroundMode && !(config && typeof config.timeout === 'number') ? 600000 : undefined,
|
||||||
headers: { 'Content-Type': 'application/json',encryptResponse: false },
|
...config,
|
||||||
responseType: 'blob',
|
}
|
||||||
...config,
|
|
||||||
|
if (showLoading) {
|
||||||
|
downloadLoadingInstance = Loading.service({
|
||||||
|
text: '正在下载数据,请稍候',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
})
|
})
|
||||||
|
} else if (backgroundMode) {
|
||||||
|
Notification.info({
|
||||||
|
title: '已开始生成',
|
||||||
|
message: '批量导出任务已在后台执行,准备就绪后将自动下载。',
|
||||||
|
duration: 4000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return service
|
||||||
|
.post(url, params, finalAxiosConfig)
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
const isBlob = blobValidate(data)
|
const isBlob = blobValidate(data)
|
||||||
if (isBlob) {
|
if (isBlob) {
|
||||||
const blob = new Blob([data])
|
const blob = new Blob([data])
|
||||||
saveAs(blob, filename)
|
saveAs(blob, filename)
|
||||||
|
if (backgroundMode) {
|
||||||
|
Notification.success({
|
||||||
|
title: '导出完成',
|
||||||
|
message: 'ZIP 文件已准备好,正在开始下载。',
|
||||||
|
duration: 3000,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const resText = await data.text()
|
const resText = await data.text()
|
||||||
const rspObj = JSON.parse(resText)
|
const rspObj = JSON.parse(resText)
|
||||||
|
|
@ -256,12 +278,20 @@ export function downloadZip(url, params, filename, config) {
|
||||||
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
Message.error(errMsg)
|
Message.error(errMsg)
|
||||||
}
|
}
|
||||||
downloadLoadingInstance.close()
|
if (showLoading && downloadLoadingInstance) {
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((r) => {
|
.catch((r) => {
|
||||||
console.error(r)
|
console.error(r)
|
||||||
Message.error('下载文件出现错误,请联系管理员!')
|
if (r && r.message && r.message.includes('timeout')) {
|
||||||
downloadLoadingInstance.close()
|
Message.error('导出超时,请减少选择数量或稍后重试')
|
||||||
|
} else {
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
}
|
||||||
|
if (showLoading && downloadLoadingInstance) {
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export default service
|
export default service
|
||||||
|
|
|
||||||
|
|
@ -145,10 +145,10 @@
|
||||||
<table border="1" cellspacing="0" cellpadding="6" class="header-table">
|
<table border="1" cellspacing="0" cellpadding="6" class="header-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 60px;">
|
<col style="width: 60px;">
|
||||||
<col style="width: 120px;">
|
<col style="width: 150px;">
|
||||||
<col style="width: 120px;">
|
<col style="width: 150px;">
|
||||||
|
<col style="width: 60px;">
|
||||||
<col style="width: 80px;">
|
<col style="width: 80px;">
|
||||||
<col style="width: 100px;">
|
|
||||||
<col style="width: 80px;">
|
<col style="width: 80px;">
|
||||||
<col style="width: 100px;">
|
<col style="width: 100px;">
|
||||||
<col style="width: 100px;">
|
<col style="width: 100px;">
|
||||||
|
|
@ -178,10 +178,10 @@
|
||||||
<table border="1" cellspacing="0" cellpadding="6" class="data-table">
|
<table border="1" cellspacing="0" cellpadding="6" class="data-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 60px;">
|
<col style="width: 60px;">
|
||||||
<col style="width: 120px;">
|
<col style="width: 150px;">
|
||||||
<col style="width: 120px;">
|
<col style="width: 150px;">
|
||||||
|
<col style="width: 60px;">
|
||||||
<col style="width: 80px;">
|
<col style="width: 80px;">
|
||||||
<col style="width: 100px;">
|
|
||||||
<col style="width: 80px;">
|
<col style="width: 80px;">
|
||||||
<col style="width: 100px;">
|
<col style="width: 100px;">
|
||||||
<col style="width: 100px;">
|
<col style="width: 100px;">
|
||||||
|
|
@ -834,7 +834,25 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handlePrint() {
|
handlePrint() {
|
||||||
this.$refs.remarksPrintRef.print()
|
// 移除滚动容器的样式,确保所有数据显示
|
||||||
|
const tableBodies = document.querySelectorAll('.table-body');
|
||||||
|
tableBodies.forEach(body => {
|
||||||
|
body.style.maxHeight = 'none';
|
||||||
|
body.style.overflow = 'visible';
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行打印
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.remarksPrintRef.print();
|
||||||
|
|
||||||
|
// 打印完成后恢复样式
|
||||||
|
setTimeout(() => {
|
||||||
|
tableBodies.forEach(body => {
|
||||||
|
body.style.maxHeight = '400px';
|
||||||
|
body.style.overflow = 'auto';
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 初始化数据 - 统一处理数据解析和API调用
|
// 初始化数据 - 统一处理数据解析和API调用
|
||||||
initData() {
|
initData() {
|
||||||
|
|
|
||||||
|
|
@ -807,6 +807,7 @@ export default {
|
||||||
'material/slt_agreement_info/exportUnsettled',
|
'material/slt_agreement_info/exportUnsettled',
|
||||||
JSON.stringify(param),
|
JSON.stringify(param),
|
||||||
`未结算批量明细导出_${new Date().getTime()}.zip`,
|
`未结算批量明细导出_${new Date().getTime()}.zip`,
|
||||||
|
{ background: true, showLoading: false, timeout: 600000 }
|
||||||
)
|
)
|
||||||
|
|
||||||
this.$refs.tableRef.clearSelection()
|
this.$refs.tableRef.clearSelection()
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
phone: [
|
phone: [
|
||||||
{ required: false, message: "联系电话不能为空", trigger: "blur" },
|
{ required: true, message: "联系电话不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||||
message: "请输入正确的手机号码",
|
message: "请输入正确的手机号码",
|
||||||
|
|
|
||||||
|
|
@ -991,8 +991,8 @@ export default {
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: /^[1-9][0-9]*$/,
|
pattern: /^[0-9]+[1-9][0-9]*$|^[1-9][0-9]*$|^0+[1-9][0-9]*$/,
|
||||||
message: '请输入大于0且不能以0开头的正整数',
|
message: '请输入有效的数字串(不能只输入0)',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
putInType: [
|
putInType: [
|
||||||
|
|
@ -1137,22 +1137,25 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
||||||
for (let i = 0; i < this.codeForm.num; i++) {
|
for (let i = 0; i < this.codeForm.num; i++) {
|
||||||
// 设备编码: 前缀 拼接 后缀
|
// 保留原始格式的前缀长度
|
||||||
let suffix = parseInt(this.codeForm.codeSuffixStart) + i
|
const prefixLength = this.codeForm.codeSuffixStart?.length || 1
|
||||||
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
|
// 计算当前序号,保留原始数字值
|
||||||
suffix = parseInt(this.codeForm.codeSuffixEnd)
|
const originalNum = parseInt(this.codeForm.codeSuffixStart)
|
||||||
|
const currentNum = originalNum + i
|
||||||
|
|
||||||
|
// 格式化序号,保持用户输入的位数
|
||||||
|
let suffix = currentNum.toString().padStart(prefixLength, '0')
|
||||||
|
|
||||||
|
// 确保不超过结束值
|
||||||
|
if (this.codeForm.codeSuffixEnd) {
|
||||||
|
const endNum = parseInt(this.codeForm.codeSuffixEnd)
|
||||||
|
if (currentNum > endNum) {
|
||||||
|
suffix = endNum.toString().padStart(prefixLength, '0')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
suffix = suffix
|
|
||||||
.toString()
|
// 生成设备编码
|
||||||
.padStart(
|
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
|
||||||
this.codeForm.codeSuffixStart?.length,
|
|
||||||
'0',
|
|
||||||
)
|
|
||||||
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
|
||||||
suffix = isNaN(suffix) ? '' : suffix
|
|
||||||
const maCode = `${
|
|
||||||
this.codeForm.codePrefix || ''
|
|
||||||
}${suffix}`
|
|
||||||
// 出厂编码
|
// 出厂编码
|
||||||
const outFacCode = ''
|
const outFacCode = ''
|
||||||
// 生产厂家
|
// 生产厂家
|
||||||
|
|
@ -1169,7 +1172,7 @@ export default {
|
||||||
// 单价: codeForm.buyPrice
|
// 单价: codeForm.buyPrice
|
||||||
const buyPrice = this.codeForm.buyPrice || 0
|
const buyPrice = this.codeForm.buyPrice || 0
|
||||||
this.codeTableList.push({
|
this.codeTableList.push({
|
||||||
maCode: this.codeForm.codeSuffixStart * 1 + i,
|
maCode: maCode,
|
||||||
outFacCode,
|
outFacCode,
|
||||||
maVender,
|
maVender,
|
||||||
thisCheckTime,
|
thisCheckTime,
|
||||||
|
|
@ -1198,16 +1201,12 @@ export default {
|
||||||
changeSuffixStart(num) {
|
changeSuffixStart(num) {
|
||||||
if (isNaN(num)) {
|
if (isNaN(num)) {
|
||||||
this.$message.error('后缀范围请输入数字类型')
|
this.$message.error('后缀范围请输入数字类型')
|
||||||
this.codeForm.codeSuffixStart =
|
|
||||||
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
isNaN(this.codeForm.codeSuffixStart) ||
|
|
||||||
this.codeForm.codeSuffixStart.includes('.')
|
|
||||||
) {
|
|
||||||
this.$message.error('后缀范围请输入整数类型')
|
|
||||||
this.codeForm.codeSuffixStart = ''
|
this.codeForm.codeSuffixStart = ''
|
||||||
}
|
}
|
||||||
|
// 只保留数字字符,允许前导零
|
||||||
|
if (num) {
|
||||||
|
this.codeForm.codeSuffixStart = num.replace(/[^\d]/g, '')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
changeSuffixEnd() {
|
changeSuffixEnd() {
|
||||||
if (!this.codeForm.codeSuffixStart) {
|
if (!this.codeForm.codeSuffixStart) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue