|
|
@ -150,20 +150,7 @@ |
|
|
<el-col :span="24"> |
|
|
<el-col :span="24"> |
|
|
<div class="search-actions"> |
|
|
<div class="search-actions"> |
|
|
<el-button type="primary" icon="el-icon-search" @click="getData()">{{ buttons.search }}</el-button> |
|
|
<el-button type="primary" icon="el-icon-search" @click="getData()">{{ buttons.search }}</el-button> |
|
|
<download-excel |
|
|
|
|
|
:fields="fields()" |
|
|
|
|
|
:data="exportData" |
|
|
|
|
|
type="xls" |
|
|
|
|
|
:name="exportName" |
|
|
|
|
|
:header="exportHeader" |
|
|
|
|
|
:footer="exportFooter" |
|
|
|
|
|
:fetch="createExportData" |
|
|
|
|
|
:before-generate="startDownload" |
|
|
|
|
|
:before-finish="finishDownload" |
|
|
|
|
|
worksheet="导出信息" |
|
|
|
|
|
class="el-button el-button--primary el-button--medium"> |
|
|
|
|
|
<i class="el-icon-download"></i> {{ buttons.download }} |
|
|
|
|
|
</download-excel> |
|
|
|
|
|
|
|
|
<el-button type="primary" icon="el-icon-download" @click="exportSfdcRollsData">{{ buttons.download }}</el-button> |
|
|
<el-button type="primary" icon="el-icon-printer" @click="printLabelModel()">打印</el-button> |
|
|
<el-button type="primary" icon="el-icon-printer" @click="printLabelModel()">打印</el-button> |
|
|
<el-button type="warning" icon="el-icon-edit" @click="openAttributeChangeDialog()">属性变动</el-button> |
|
|
<el-button type="warning" icon="el-icon-edit" @click="openAttributeChangeDialog()">属性变动</el-button> |
|
|
<div class="summary-bar"> |
|
|
<div class="summary-bar"> |
|
|
@ -509,7 +496,7 @@ import { |
|
|
searchFunctionButtonList, |
|
|
searchFunctionButtonList, |
|
|
|
|
|
|
|
|
} from "@/api/sysLanguage.js" |
|
|
} from "@/api/sysLanguage.js" |
|
|
import {searchSfdcRollsReport, updateSfdcRollsAttribute, executeSfdcRollsReport} from "../../../../api/shopOrder/productionReport"; |
|
|
|
|
|
|
|
|
import {searchSfdcRollsReport, exportSfdcRollsReport, updateSfdcRollsAttribute, executeSfdcRollsReport} from "../../../../api/shopOrder/productionReport"; |
|
|
import {updateInventoryStockAttribute} from "../../../../api/wms/wms"; |
|
|
import {updateInventoryStockAttribute} from "../../../../api/wms/wms"; |
|
|
import getLodop from '@/utils/LodopFuncs.js'; |
|
|
import getLodop from '@/utils/LodopFuncs.js'; |
|
|
import {getPartLabelTemplateList, callUspPartLabelTemplate} from '@/api/wms/wms.js'; |
|
|
import {getPartLabelTemplateList, callUspPartLabelTemplate} from '@/api/wms/wms.js'; |
|
|
@ -581,12 +568,7 @@ import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'; |
|
|
objectType: 'label' |
|
|
objectType: 'label' |
|
|
}, |
|
|
}, |
|
|
tagNo:'', |
|
|
tagNo:'', |
|
|
// 导出 start |
|
|
|
|
|
exportData: [], |
|
|
|
|
|
exportName: "产线产量报告"+this.dayjs().format('YYYYMMDDHHmmss'), |
|
|
|
|
|
exportHeader: ["产线产量报告"], |
|
|
|
|
|
exportFooter: [], |
|
|
|
|
|
// 导出 end |
|
|
|
|
|
|
|
|
exportName: "订单产出标签统计"+this.dayjs().format('YYYYMMDDHHmmss'), |
|
|
tableHeight: 400, |
|
|
tableHeight: 400, |
|
|
modelFlag:false, |
|
|
modelFlag:false, |
|
|
modelInputFlag:true, |
|
|
modelInputFlag:true, |
|
|
@ -1299,20 +1281,46 @@ import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'; |
|
|
this.pageIndex = val; |
|
|
this.pageIndex = val; |
|
|
this.getData(); |
|
|
this.getData(); |
|
|
}, |
|
|
}, |
|
|
//导出excel |
|
|
|
|
|
async createExportData() { |
|
|
|
|
|
|
|
|
async exportSfdcRollsData() { |
|
|
|
|
|
this.startDownload() |
|
|
|
|
|
const params = { |
|
|
|
|
|
...this.searchData |
|
|
|
|
|
} |
|
|
try { |
|
|
try { |
|
|
const params = { |
|
|
|
|
|
...this.searchData, |
|
|
|
|
|
page: 0, |
|
|
|
|
|
limit: 1000000 |
|
|
|
|
|
}; |
|
|
|
|
|
const { data } = await searchSfdcRollsReport(params); |
|
|
|
|
|
return data.rows || []; |
|
|
|
|
|
|
|
|
const response = await exportSfdcRollsReport(params) |
|
|
|
|
|
const fileBlob = response && response.data ? response.data : null |
|
|
|
|
|
if (!fileBlob || fileBlob.size === 0) { |
|
|
|
|
|
throw new Error('导出文件为空') |
|
|
|
|
|
} |
|
|
|
|
|
const contentType = fileBlob.type || '' |
|
|
|
|
|
if (contentType.indexOf('application/json') > -1) { |
|
|
|
|
|
const text = await fileBlob.text() |
|
|
|
|
|
let errMsg = '导出失败' |
|
|
|
|
|
try { |
|
|
|
|
|
const json = JSON.parse(text) |
|
|
|
|
|
errMsg = json.msg || json.message || errMsg |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
errMsg = text || errMsg |
|
|
|
|
|
} |
|
|
|
|
|
throw new Error(errMsg) |
|
|
|
|
|
} |
|
|
|
|
|
const disposition = response.headers && response.headers['content-disposition'] |
|
|
|
|
|
const defaultFileName = `${this.exportName}.xlsx` |
|
|
|
|
|
const fileName = this.parseDownloadFileName(disposition) || defaultFileName |
|
|
|
|
|
const linkNode = document.createElement('a') |
|
|
|
|
|
const url = URL.createObjectURL(fileBlob) |
|
|
|
|
|
linkNode.href = url |
|
|
|
|
|
linkNode.download = fileName |
|
|
|
|
|
linkNode.style.display = 'none' |
|
|
|
|
|
document.body.appendChild(linkNode) |
|
|
|
|
|
linkNode.click() |
|
|
|
|
|
document.body.removeChild(linkNode) |
|
|
|
|
|
URL.revokeObjectURL(url) |
|
|
|
|
|
this.$message.success('导出成功') |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('获取导出数据失败:', error); |
|
|
|
|
|
this.$message.error('获取导出数据失败!'); |
|
|
|
|
|
return []; |
|
|
|
|
|
|
|
|
this.$message.error('导出失败:' + (error.message || '请稍后重试')) |
|
|
|
|
|
} finally { |
|
|
|
|
|
this.finishDownload() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
selectionChangeHandle(val){ |
|
|
selectionChangeHandle(val){ |
|
|
@ -1697,6 +1705,7 @@ import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'; |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
startDownload() { |
|
|
startDownload() { |
|
|
|
|
|
this.exportName = "订单产出标签统计" + this.dayjs().format('YYYYMMDDHHmmss') |
|
|
this._exportLoading = this.$loading({ |
|
|
this._exportLoading = this.$loading({ |
|
|
lock: true, |
|
|
lock: true, |
|
|
text: '正在导出数据,请稍候...', |
|
|
text: '正在导出数据,请稍候...', |
|
|
@ -1710,28 +1719,27 @@ import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'; |
|
|
this._exportLoading = null |
|
|
this._exportLoading = null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
formatExportText(value) { |
|
|
|
|
|
if (value === '' || value === null || value === undefined) { |
|
|
|
|
|
|
|
|
parseDownloadFileName(disposition) { |
|
|
|
|
|
if (!disposition) { |
|
|
return '' |
|
|
return '' |
|
|
} |
|
|
} |
|
|
const safeValue = String(value).replace(/"/g, '""') |
|
|
|
|
|
return `="${safeValue}"` |
|
|
|
|
|
}, |
|
|
|
|
|
fields() { |
|
|
|
|
|
const fieldMap = {} |
|
|
|
|
|
this.columnList.forEach(item => { |
|
|
|
|
|
if (item.columnProp === 'packingList') { |
|
|
|
|
|
fieldMap[item.columnLabel] = { |
|
|
|
|
|
field: item.columnProp, |
|
|
|
|
|
callback: value => this.formatExportText(value) |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
fieldMap[item.columnLabel] = item.columnProp |
|
|
|
|
|
}) |
|
|
|
|
|
return fieldMap |
|
|
|
|
|
|
|
|
let fileName = '' |
|
|
|
|
|
const utf8Match = disposition.match(/filename\*=UTF-8''([^;]+)/i) |
|
|
|
|
|
if (utf8Match && utf8Match[1]) { |
|
|
|
|
|
fileName = utf8Match[1] |
|
|
|
|
|
} else { |
|
|
|
|
|
const normalMatch = disposition.match(/filename="?([^"]+)"?/i) |
|
|
|
|
|
fileName = normalMatch && normalMatch[1] ? normalMatch[1] : '' |
|
|
|
|
|
} |
|
|
|
|
|
if (!fileName) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
return decodeURIComponent(fileName) |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return fileName |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 导出 end |
|
|
|
|
|
//多语言 |
|
|
//多语言 |
|
|
getMultiLanguageList() { |
|
|
getMultiLanguageList() { |
|
|
//首先查询当前按钮的多语言 |
|
|
//首先查询当前按钮的多语言 |
|
|
|