代码更新:
1.增加文件重复上传的判断 2.备料执行界面信息不刷新
This commit is contained in:
parent
9bd3dad1ee
commit
2a52f91fd1
|
|
@ -5,7 +5,7 @@ const uploadExcelStock = (data) => {
|
|||
url: '/excel/uploadStocks',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ const uploadExcelGoods = (data) => {
|
|||
url: '/excel/uploadGoods',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ const uploadStationConfig = (data) => {
|
|||
url: '/excel/uploadStationConfig',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ const uploadExcelDbs = (data) => {
|
|||
url: '/excel/uploadDbs',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ const uploadExcelOrders = (data) => {
|
|||
url: '/excel/uploadKateOrders',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ const uploadExcelInventoryList = (data) => {
|
|||
url: '/excel/uploadInventoryList',
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 100000
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,17 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadExcelDbs } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
const file = ref()
|
||||
var currentHash = ''
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
fileId: '',
|
||||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadDbs = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadDbs = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelDbs(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadDbs = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadExcelGoods } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
|
|
@ -20,6 +23,7 @@ const uploadForm = reactive({
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadGoods = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadGoods = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelGoods(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadGoods = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadExcelInventoryList } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
|
|
@ -20,6 +23,7 @@ const uploadForm = reactive({
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadInventory = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadInventory = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelInventoryList(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadInventory = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadExcelOrders } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
|
|
@ -20,6 +23,7 @@ const uploadForm = reactive({
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadOrders = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadOrders = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelOrders(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadOrders = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadStationConfig } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
|
|
@ -20,6 +23,7 @@ const uploadForm = reactive({
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadDbs = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadDbs = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadStationConfig(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadDbs = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { ref, reactive } from 'vue';
|
|||
import { uploadExcelStock } from '@/api/excel.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sizeFormatter } from '@/utils/formatter.js'
|
||||
import loading from '@/utils/loading.js'
|
||||
import { getHashString } from '@/utils/hashUtils.js'
|
||||
var currentHash = ''
|
||||
const file = ref()
|
||||
const uploadForm = reactive({
|
||||
data: {
|
||||
|
|
@ -20,6 +23,7 @@ const uploadForm = reactive({
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
})
|
||||
|
|
@ -30,6 +34,7 @@ const changeFile = (uploadFile) => {
|
|||
name: file.value.raw.name,
|
||||
type: file.value.raw.type,
|
||||
size: sizeFormatter(file.value.raw.size),
|
||||
hash: getHashString(uploadFile),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +42,13 @@ const uploadRef = ref()
|
|||
const uploadStock = () => {
|
||||
if (uploadForm == undefined || file.value == undefined) {
|
||||
ElMessage.error('请选择文件之后再上传')
|
||||
return
|
||||
}
|
||||
if (currentHash != '' && currentHash == uploadForm.data.hash) {
|
||||
ElMessage.error('请勿重复上传')
|
||||
return
|
||||
}
|
||||
currentHash = uploadForm.data.hash
|
||||
const jsonStr = JSON.stringify(uploadForm.data);
|
||||
const blob = new Blob([jsonStr], {
|
||||
type: 'application/json'
|
||||
|
|
@ -46,7 +57,10 @@ const uploadStock = () => {
|
|||
// 这里很重要 file.value.raw才是真实的file文件,file.value只是一个Proxy代理对象
|
||||
formData.append("obj", blob);
|
||||
formData.append("file", file.value.raw);
|
||||
loading.open('导入中...')
|
||||
uploadExcelStock(formData).then(res => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '上传成功',
|
||||
|
|
@ -57,6 +71,8 @@ const uploadStock = () => {
|
|||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
loading.close()
|
||||
currentHash = ''
|
||||
console.log(err)
|
||||
ElMessage.error('上传错误')
|
||||
})
|
||||
|
|
@ -69,6 +85,7 @@ const clearFileInfos = () => {
|
|||
name: '',
|
||||
type: '',
|
||||
size: null,
|
||||
hash: '',
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
file.value = undefined
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
baseURL: 'http://10.90.36.70:443/wmsServer/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -253,18 +253,11 @@ export default {
|
|||
},
|
||||
// 重置参数
|
||||
resetForms() {
|
||||
this.workFormEntity = reactive({
|
||||
goodsId: '',
|
||||
planPickNum: 0,
|
||||
remainNumOrigin: null,
|
||||
remainNumReal: null,
|
||||
remark: '',
|
||||
finishedRows: 0,
|
||||
totalRows: 0,
|
||||
finishedCounts: 0,
|
||||
totalCounts: 0,
|
||||
tip: ''
|
||||
})
|
||||
this.workFormEntity.goodsId = ''
|
||||
this.workFormEntity.planPickNum = 0
|
||||
this.workFormEntity.remainNumOrigin = null
|
||||
this.workFormEntity.remainNumReal = null
|
||||
this.workFormEntity.remark = ''
|
||||
this.$refs.goodsId.focus()
|
||||
},
|
||||
// 确认完成工作
|
||||
|
|
|
|||
16
src/utils/hashUtils.js
Normal file
16
src/utils/hashUtils.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import crypto from 'crypto'
|
||||
function base64URLEncode(str) {
|
||||
return str.toString('base64')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
}
|
||||
|
||||
function getHashString(obj) {
|
||||
return base64URLEncode(crypto.createHash('sha256').update(obj).digest())
|
||||
}
|
||||
|
||||
export {
|
||||
base64URLEncode,
|
||||
getHashString
|
||||
}
|
||||
|
|
@ -1,9 +1,15 @@
|
|||
import { ElLoading } from 'element-plus'
|
||||
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
|
||||
const loading = {
|
||||
loadingInstance: null,
|
||||
open: function (text) {
|
||||
this.loadingInstance = ElLoading.service({
|
||||
lock: true,
|
||||
text: text,
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
},
|
||||
close: function () {
|
||||
this.loadingInstance.close()
|
||||
}
|
||||
}
|
||||
export default loading
|
||||
Loading…
Reference in New Issue
Block a user