|
|
@ -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;
|
|
|
|