|
|
|
@ -2,18 +2,17 @@ |
|
|
|
<div class="customer-css"> |
|
|
|
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog" @close="handleDialogClose" :show-close="!uploading"> |
|
|
|
<el-form :inline="true" label-position="top" label-width="80px"> |
|
|
|
<el-row> |
|
|
|
<!-- <el-row> |
|
|
|
<el-form-item label=" "> |
|
|
|
<!-- <el-button type="primary" @click="downloadFile()" :disabled="uploading">下载文件模板</el-button>--> |
|
|
|
<a href="/static/downLoad/NotifyUploadModel.xlsx" download="领料申请单导入模板.xlsx"> |
|
|
|
下载 Excel 模板 |
|
|
|
</a> |
|
|
|
</el-form-item> |
|
|
|
</el-row> |
|
|
|
</el-row> --> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls" |
|
|
|
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" :disabled="uploading" style="text-align: left;"> |
|
|
|
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" :disabled="uploading" style="text-align: left;" :file-list="fileList"> |
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
<div class="el-upload__text"> |
|
|
|
{{ uploading ? '正在上传中,请稍候...' : '将文件拖到此处,或点击上传' }} |
|
|
|
@ -53,6 +52,7 @@ export default { |
|
|
|
notifyNo: '', |
|
|
|
}, |
|
|
|
uploading: false, // 上传状态标志 |
|
|
|
returnData: '', // 返回的数据 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -61,6 +61,8 @@ export default { |
|
|
|
init (data) { |
|
|
|
this.fileList = [] |
|
|
|
this.uploading = false // 重置上传状态 |
|
|
|
console.log("init data",this.fileList); |
|
|
|
|
|
|
|
// 打开页面 |
|
|
|
this.visible = true |
|
|
|
this.notifyData=JSON.parse(JSON.stringify(data)) |
|
|
|
@ -106,11 +108,17 @@ export default { |
|
|
|
|
|
|
|
deleteFile(){ |
|
|
|
this.fileList = [] |
|
|
|
this.visible = false |
|
|
|
this.uploading = false // 重置上传状态 |
|
|
|
// 清空文件上传记录 |
|
|
|
this.$refs.uploadFile.clearFiles() |
|
|
|
// 刷新报工的页面 |
|
|
|
this.$emit('refreshTable') |
|
|
|
}, |
|
|
|
successCallback(){ |
|
|
|
this.fileList = [] |
|
|
|
this.visible = false |
|
|
|
this.uploading = false // 重置上传状态 |
|
|
|
this.$emit('refreshTable',this.returnData) |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存当前的数据 |
|
|
|
@ -143,9 +151,10 @@ export default { |
|
|
|
// 调用新的上传接口 |
|
|
|
uploadNoorderNotifyExcel(formData).then(({ data }) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.returnData = data.rows |
|
|
|
this.$message.success(data.msg || 'Excel文件上传成功') |
|
|
|
// 关闭窗口并刷新页面 |
|
|
|
this.closeDialog() |
|
|
|
this.successCallback() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || 'Excel文件上传失败') |
|
|
|
} |
|
|
|
@ -157,28 +166,6 @@ export default { |
|
|
|
this.uploading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 下载模板文件 |
|
|
|
async downloadFile () { |
|
|
|
// 这里可以根据需要实现模板下载功能 |
|
|
|
// 暂时提示用户模板格式 |
|
|
|
this.$alert( |
|
|
|
'模板格式说明:\n' + |
|
|
|
'第1列:工厂编码(site)\n' + |
|
|
|
'第2列:订单号(orderNo)\n' + |
|
|
|
'第3列:发布号(releaseNo)\n' + |
|
|
|
'第4列:序列号(sequenceNo)\n' + |
|
|
|
'第5列:BOM行号(bomLineNo,必须为正整数)\n' + |
|
|
|
'第6列:物料编码(materialPartNo)\n' + |
|
|
|
'第7列:需求日期(needDate,格式:YYYY-MM-DD)\n' + |
|
|
|
'第8列:数量(qty,必须为数字)', |
|
|
|
'模板格式说明', |
|
|
|
{ |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'info' |
|
|
|
} |
|
|
|
) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |