|
|
|
@ -5,16 +5,22 @@
|
|
|
|
|
style="margin-bottom: -15px">
|
|
|
|
|
<el-button-group
|
|
|
|
|
style="display: flex; margin: 0px 0 15px 75%; height: 35px">
|
|
|
|
|
<el-button size="mini" type="primary" @click="triggerFileUpload2"
|
|
|
|
|
>
|
|
|
|
|
同步阳采单据
|
|
|
|
|
</el-button>
|
|
|
|
|
<!-- 隐藏的文件输入元素 -->
|
|
|
|
|
<input type="file" ref="fileInput2" accept=".xlsx,.xls" style="display: none;" @change="handleFileUpload2" />
|
|
|
|
|
<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"
|
|
|
|
|
>选入码上放心单据
|
|
|
|
|
>同步码上放心单据
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
@ -343,7 +349,8 @@ export default {
|
|
|
|
|
fromInvCode: null,
|
|
|
|
|
remark: null,
|
|
|
|
|
fromType: 2,
|
|
|
|
|
errMsg: null
|
|
|
|
|
errMsg: null,
|
|
|
|
|
orderEntity: { }
|
|
|
|
|
},
|
|
|
|
|
errView: 0,
|
|
|
|
|
|
|
|
|
@ -429,6 +436,9 @@ export default {
|
|
|
|
|
triggerFileUpload() {
|
|
|
|
|
this.$refs.fileInput.click();
|
|
|
|
|
},
|
|
|
|
|
triggerFileUpload2() {
|
|
|
|
|
this.$refs.fileInput2.click();
|
|
|
|
|
},
|
|
|
|
|
handleFileUpload(event) {
|
|
|
|
|
const file = event.target.files[0];
|
|
|
|
|
const billNo = this.orderFormData.billNo; // 这里应该是你实际的UUID,可以从其他地方获取
|
|
|
|
@ -470,6 +480,48 @@ export default {
|
|
|
|
|
console.error('No file selected for upload!');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleFileUpload2(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/orderFileUpload'; // 后端接收文件的URL
|
|
|
|
|
// if (this.$isBlank(this.orderFormData.billNo)){
|
|
|
|
|
// this.$message.error("单据编号不可以为空!");
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
if (file) {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
this.orderFormData.orderEntity = JSON.parse(JSON.stringify(this.orderFormData));
|
|
|
|
|
formData.append('billNoJson', JSON.stringify(this.orderFormData));
|
|
|
|
|
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) {
|
|
|
|
|
console.log(data.data)
|
|
|
|
|
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) => {
|
|
|
|
|