选入阳采,选入阿里

dev_unify
yewj 6 months ago
parent 06366b7bb0
commit c165c4af8c

@ -291,6 +291,7 @@ import selectMsfxOrderDialog from "./selectMsfxOrderDialog"
import A from "@/plugins/KeyScaner" import A from "@/plugins/KeyScaner"
import {findByInvUser, getLocalJoinByUser, getBusTypeList} from '@/api/basic/busType' import {findByInvUser, getLocalJoinByUser, getBusTypeList} from '@/api/basic/busType'
import {deleteRe} from "@/api/auth/register"; import {deleteRe} from "@/api/auth/register";
import store from "@/store";
export default { export default {
name: "ioCreateOrder", name: "ioCreateOrder",
@ -441,12 +442,14 @@ export default {
}, },
handleFileUpload(event) { handleFileUpload(event) {
const file = event.target.files[0]; const file = event.target.files[0];
const billNo = this.orderFormData.billNo; // UUID const billNo = this.orderFormData.billNo;
const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/fileUpload'; // URL const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/fileUpload';
if (this.$isBlank(this.orderFormData.billNo)) { if (this.$isBlank(this.orderFormData.billNo)) {
this.$message.error("单据编号不可以为空!"); this.$message.error("单据编号不可以为空!");
return return;
} }
if (file) { if (file) {
const formData = new FormData(); const formData = new FormData();
formData.append('billNo', billNo); formData.append('billNo', billNo);
@ -454,73 +457,109 @@ export default {
fetch(uploadUrl, { fetch(uploadUrl, {
method: 'POST', method: 'POST',
headers: {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
},
body: formData, body: formData,
}) })
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); throw new Error(`HTTP error! Status: ${response.status}`);
} }
return response.json(); // JSON return response.json();
}) })
.then(data => { .then(data => {
//
if (data.code === 20000) { if (data.code === 20000) {
this.$message.success("上传成功!") //
if (data.data && data.data.billNo) {
this.orderFormData.billNo = data.data.billNo;
}
//
this.isCodeAlive = false;
this.isBizDetailAlive = false;
this.isCodeDetailAlive = false;
this.$nextTick(() => {
this.isCodeAlive = true;
this.isBizDetailAlive = true;
this.isCodeDetailAlive = true;
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
this.$message.success("上传成功!");
});
} else { } else {
this.$message.error(data.message); this.$message.error(data.message);
} }
}) })
.catch(error => { .catch(error => {
//
console.error('File upload failed:', error); console.error('File upload failed:', error);
// this.$message.error('文件上传失败:' + error.message);
}); });
} else {
//
console.error('No file selected for upload!');
} }
//
event.target.value = '';
}, },
handleFileUpload2(event) { handleFileUpload2(event) {
const file = event.target.files[0]; 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';
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) { if (file) {
const formData = new FormData() const formData = new FormData();
this.orderFormData.orderEntity = Object.assign(JSON.parse(JSON.stringify(this.orderFormData))); this.orderFormData.orderEntity = Object.assign(JSON.parse(JSON.stringify(this.orderFormData)));
formData.append('billNoJson', JSON.stringify(this.orderFormData)); formData.append('billNoJson', JSON.stringify(this.orderFormData));
formData.append('file', file); formData.append('file', file);
fetch(uploadUrl, { fetch(uploadUrl, {
method: 'POST', method: 'POST',
headers: {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
},
body: formData body: formData
}) })
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`) throw new Error(`HTTP error! Status: ${response.status}`);
} }
return response.json() // JSON return response.json();
}) })
.then(data => { .then(data => {
//
if (data.code === 20000) { if (data.code === 20000) {
console.log(data.data) //
this.$message.success("上传成功!") if (data.data && data.data.billNo) {
this.orderFormData.billNo = data.data.billNo;
}
//
this.isCodeAlive = false;
this.isBizDetailAlive = false;
this.isCodeDetailAlive = false;
this.$nextTick(() => {
this.isCodeAlive = true;
this.isBizDetailAlive = true;
this.isCodeDetailAlive = true;
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
this.$message.success("上传成功!");
});
} else { } else {
this.$message.error(data.message); this.$message.error(data.message);
} }
}) })
.catch(error => { .catch(error => {
//
console.error('File upload failed:', error); console.error('File upload failed:', error);
// this.$message.error('文件上传失败:' + error.message);
}); });
} else { } else {
// this.$message.warning('请选择要上传的文件');
console.error('No file selected for upload!');
} }
//
event.target.value = '';
}, },
//url //url
selectAuthMenuByMenuKeys() { selectAuthMenuByMenuKeys() {
@ -643,7 +682,7 @@ export default {
actionChange(item) { actionChange(item) {
this.curAction = this.getActionItem(item); this.curAction = this.getActionItem(item);
if ((this.curAction.checkEnable && this.curAction.checkWebNew != 0) || this.viewType == 1) { if ((this.curAction.checkEnable && this.curAction.checkWebNew != 0) || this.viewType == 1) {
// 1 // 1
this.bizShow = true; this.bizShow = true;
} else } else
this.bizShow = false; this.bizShow = false;

Loading…
Cancel
Save