|
|
|
@ -5,6 +5,13 @@
|
|
|
|
|
style="margin-bottom: -15px">
|
|
|
|
|
<el-button-group
|
|
|
|
|
style="display: flex; margin: 0px 0 15px 75%; height: 35px">
|
|
|
|
|
<el-button size="mini" type="primary" @click="triggerFileUpload"
|
|
|
|
|
v-if="(curAction.checkWebNew !== 2 || viewType !== 1) && orderFormData.billNo">
|
|
|
|
|
导入阳采追溯码
|
|
|
|
|
</el-button>
|
|
|
|
|
<!-- 隐藏的文件输入元素 -->
|
|
|
|
|
<input type="file" ref="fileInput" accept=".xlsx,.xls" style="display: none;" @change="handleFileUpload" />
|
|
|
|
|
|
|
|
|
|
<el-button size="mini" type="primary" @click.native="selectOrder()"
|
|
|
|
|
v-if="curAction.checkWebNew != 2 || viewType !=1"
|
|
|
|
|
>选入码上放心单据
|
|
|
|
@ -419,6 +426,50 @@ export default {
|
|
|
|
|
codesPanel, codeDetailPanel, bizDetailPanel, editCodeDialog,selectMsfxOrderDialog
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
triggerFileUpload() {
|
|
|
|
|
this.$refs.fileInput.click();
|
|
|
|
|
},
|
|
|
|
|
handleFileUpload(event) {
|
|
|
|
|
const file = event.target.files[0];
|
|
|
|
|
const billNo = this.orderFormData.billNo; // 这里应该是你实际的UUID,可以从其他地方获取
|
|
|
|
|
const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/fileUpload'; // 后端接收文件的URL
|
|
|
|
|
if (this.$isBlank(this.orderFormData.billNo)){
|
|
|
|
|
this.$message.error("单据编号不可以为空!");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (file) {
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('billNo', billNo);
|
|
|
|
|
formData.append('file', file);
|
|
|
|
|
|
|
|
|
|
fetch(uploadUrl, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: formData,
|
|
|
|
|
})
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
|
|
|
}
|
|
|
|
|
return response.json(); // 假设后端返回JSON格式的数据
|
|
|
|
|
})
|
|
|
|
|
.then(data => {
|
|
|
|
|
// 处理后端返回的数据
|
|
|
|
|
if (data.code === 20000) {
|
|
|
|
|
this.$message.success("上传成功!")
|
|
|
|
|
}else {
|
|
|
|
|
this.$message.error(data.message);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
// 处理错误
|
|
|
|
|
console.error('File upload failed:', error);
|
|
|
|
|
// 你可以在这里添加代码来显示错误消息或进行其他操作
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 如果没有选择文件,则显示错误消息或进行其他操作
|
|
|
|
|
console.error('No file selected for upload!');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//获取查看帮助url
|
|
|
|
|
selectAuthMenuByMenuKeys() {
|
|
|
|
|
selectAuthMenuByMenuKeys(this.helpMenuKeys).then((res) => {
|
|
|
|
|