feat: 阳采追溯码导出

dev_unify
chenhc 6 months ago
parent 067d2deb74
commit e1f89798d1

@ -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) => {

Loading…
Cancel
Save