前端出库页面调整
This commit is contained in:
parent
e74af4da82
commit
2c56587cae
|
|
@ -2,46 +2,46 @@
|
||||||
<el-config-provider :locale="zhCn">
|
<el-config-provider :locale="zhCn">
|
||||||
<el-container class="content">
|
<el-container class="content">
|
||||||
<div class="work-area">
|
<div class="work-area">
|
||||||
<fieldset class="search-area">
|
<!-- <fieldset class="search-area">-->
|
||||||
<el-form ref="outTaskRef" :model="outTaskEntity" :label-position="labelPosition" label-width="158px"
|
<!-- <el-form ref="outTaskRef" :model="outTaskEntity" :label-position="labelPosition" label-width="158px"-->
|
||||||
style="max-width: 100%" :rules="requestRules" status-icon>
|
<!-- style="max-width: 100%" :rules="requestRules" status-icon>-->
|
||||||
<div style="display: flex; justify-content: space-between;">
|
<!-- <div style="display: flex; justify-content: space-between;">-->
|
||||||
<el-row>
|
<!-- <el-row>-->
|
||||||
<!-- <el-form-item label="出库类型" prop="outType">
|
<!-- <!– <el-form-item label="出库类型" prop="outType">-->
|
||||||
<el-select-v2 style="width: 196px" v-model="outTaskEntity.outType" placeholder="请选择入库类型"
|
<!-- <el-select-v2 style="width: 196px" v-model="outTaskEntity.outType" placeholder="请选择入库类型"-->
|
||||||
:options="outTypeOptions"></el-select-v2>
|
<!-- :options="outTypeOptions"></el-select-v2>-->
|
||||||
</el-form-item> -->
|
<!-- </el-form-item> –>-->
|
||||||
<el-form-item label="料号" prop="goodsId">
|
<!-- <el-form-item label="料号" prop="goodsId">-->
|
||||||
<el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>
|
<!-- <el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item label="箱号" prop="vehicleId" v-if="outTaskEntity.outType !== 9">
|
<!-- <el-form-item label="箱号" prop="vehicleId" v-if="outTaskEntity.outType !== 9">-->
|
||||||
<el-input v-model="outTaskEntity.vehicleId" clearable/>
|
<!-- <el-input v-model="outTaskEntity.vehicleId" clearable/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item label="数量" prop="needNum">
|
<!-- <el-form-item label="数量" prop="needNum">-->
|
||||||
<el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum"
|
<!-- <el-input-number style="width: 196px" v-model.number="outTaskEntity.needNum"-->
|
||||||
controls-position="right" :min="1" clearable/>
|
<!-- controls-position="right" :min="1" clearable/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<!-- <el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType === 9">
|
<!-- <!– <el-form-item label="原因" prop="reason" v-if="outTaskEntity.outType === 9">-->
|
||||||
<el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"
|
<!-- <el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"-->
|
||||||
:options="reasonOptions"></el-select-v2>
|
<!-- :options="reasonOptions"></el-select-v2>-->
|
||||||
</el-form-item> -->
|
<!-- </el-form-item> –>-->
|
||||||
<el-form-item label="工单" prop="workOrder" v-if="outTaskEntity.reason === '缺料'">
|
<!-- <el-form-item label="工单" prop="workOrder" v-if="outTaskEntity.reason === '缺料'">-->
|
||||||
<el-input v-model="outTaskEntity.workOrder" @blur="getLackQty()" clearable/>
|
<!-- <el-input v-model="outTaskEntity.workOrder" @blur="getLackQty()" clearable/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</el-row>
|
<!-- </el-row>-->
|
||||||
<el-row>
|
<!-- <el-row>-->
|
||||||
<el-button type="primary"
|
<!-- <el-button type="primary"-->
|
||||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
<!-- style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"-->
|
||||||
@click="confirmOut()">确认出库
|
<!-- @click="confirmOut()">确认出库-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
<el-button type="warning"
|
<!-- <el-button type="warning"-->
|
||||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
<!-- style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"-->
|
||||||
@click="clearInput()">清除输入
|
<!-- @click="clearInput()">清除输入-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</el-row>
|
<!-- </el-row>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</el-form>
|
<!-- </el-form>-->
|
||||||
</fieldset>
|
<!-- </fieldset>-->
|
||||||
<!-- 修改confirm-area为竖直布局,表单项两两一排 -->
|
<!-- 修改confirm-area为竖直布局,表单项两两一排 -->
|
||||||
<!-- 修改confirm-area为竖直布局,表单项两两一排 -->
|
<!-- 修改confirm-area为竖直布局,表单项两两一排 -->
|
||||||
<div style="display: flex; margin-top: 10px;">
|
<div style="display: flex; margin-top: 10px;">
|
||||||
|
|
@ -230,25 +230,30 @@ let confirmEntities = reactive([
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
const confirmRules = reactive({})
|
const confirmRules = reactive({})
|
||||||
let pauseGetPickFlag = ref(false)
|
//let pauseGetPickFlag = ref(false)
|
||||||
|
let hasDataTaskResult = ref(false) // 记录上次请求是否有数据
|
||||||
const route = useRoute()// 路由
|
const route = useRoute()// 路由
|
||||||
// 系统
|
// 系统
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
timer.value = setInterval(() => {
|
startTimer() // 调用启动定时器函数
|
||||||
timerTask_1()
|
|
||||||
}, 1000)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
clearInterval(timer.value)
|
clearInterval(timer.value)
|
||||||
})
|
})
|
||||||
|
// 新增启动定时器的函数
|
||||||
|
const startTimer = () => {
|
||||||
|
clearInterval(timer.value) // 先清除已存在的定时器
|
||||||
|
timer.value = setInterval(() => {
|
||||||
|
timerTask_1()
|
||||||
|
}, 2000) // 默认2秒间隔
|
||||||
|
}
|
||||||
// 监视路由
|
// 监视路由
|
||||||
|
// 修改 watch 中的定时器设置
|
||||||
watch(() => route.path, (newVal, oldVal) => {
|
watch(() => route.path, (newVal, oldVal) => {
|
||||||
if (newVal === '/goodsOut') {
|
if (newVal === '/goodsOut') {
|
||||||
timer.value = setInterval(() => {
|
startTimer() // 调用启动定时器函数
|
||||||
timerTask_1()
|
|
||||||
}, 1000)
|
|
||||||
} else {
|
} else {
|
||||||
clearInterval(timer.value)
|
clearInterval(timer.value)
|
||||||
}
|
}
|
||||||
|
|
@ -259,9 +264,9 @@ const timerTask_1 = () => {
|
||||||
}
|
}
|
||||||
// 获取拣选信息
|
// 获取拣选信息
|
||||||
const getTask = () => {
|
const getTask = () => {
|
||||||
if (pauseGetPickFlag.value) {
|
// if (pauseGetPickFlag.value) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
const request = {
|
const request = {
|
||||||
standId: STAND_ID,
|
standId: STAND_ID,
|
||||||
userName: USER_NAME
|
userName: USER_NAME
|
||||||
|
|
@ -271,6 +276,16 @@ const getTask = () => {
|
||||||
const response = res.data
|
const response = res.data
|
||||||
console.log(response)
|
console.log(response)
|
||||||
if (response.code === 0) {
|
if (response.code === 0) {
|
||||||
|
// 有数据的情况
|
||||||
|
if (!hasDataTaskResult.value) {
|
||||||
|
// 从无数据切换到有数据,更改定时器频率
|
||||||
|
hasDataTaskResult.value = true
|
||||||
|
clearInterval(timer.value)
|
||||||
|
timer.value = setInterval(() => {
|
||||||
|
timerTask_1()
|
||||||
|
}, 10000) // 10秒间隔
|
||||||
|
}
|
||||||
|
|
||||||
const confirmVos = response.data
|
const confirmVos = response.data
|
||||||
// 根据主站台ID确定需要显示的子站台顺序
|
// 根据主站台ID确定需要显示的子站台顺序
|
||||||
let childStandOrder = []
|
let childStandOrder = []
|
||||||
|
|
@ -326,18 +341,28 @@ const getTask = () => {
|
||||||
warningBox(`请注意!${found.childStandId}站台,剩余数量小于预警值,请检查并核对数量。`)
|
warningBox(`请注意!${found.childStandId}站台,剩余数量小于预警值,请检查并核对数量。`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else if (response.code === 400) {
|
||||||
|
// 无数据的情况
|
||||||
|
if (hasDataTaskResult.value) {
|
||||||
pauseGetPickFlag.value = true
|
// 从有数据切换到无数据,更改定时器频率
|
||||||
} else if (response.code === 400) {
|
hasDataTaskResult.value = false
|
||||||
// 警告,弹框
|
clearInterval(timer.value)
|
||||||
pauseGetPickFlag.value = true
|
timer.value = setInterval(() => {
|
||||||
|
timerTask_1()
|
||||||
|
}, 2000) // 2秒间隔
|
||||||
|
}
|
||||||
warningBox(response.message)
|
warningBox(response.message)
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
pauseGetPickFlag.value = true
|
// 请求错误视为无数据情况
|
||||||
|
if (hasDataTaskResult.value) {
|
||||||
|
hasDataTaskResult.value = false
|
||||||
|
clearInterval(timer.value)
|
||||||
|
timer.value = setInterval(() => {
|
||||||
|
timerTask_1()
|
||||||
|
}, 2000) // 2秒间隔
|
||||||
|
}
|
||||||
errorBox('请求错误,请检查完原因后刷新界面。')
|
errorBox('请求错误,请检查完原因后刷新界面。')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -444,12 +469,14 @@ const confirmOrRelease = (index) => {
|
||||||
confirmCurrentTask(request, { timeout: 5000 }).then(res => {
|
confirmCurrentTask(request, { timeout: 5000 }).then(res => {
|
||||||
const response = res.data
|
const response = res.data
|
||||||
if (response.code === 0) {
|
if (response.code === 0) {
|
||||||
clearConfirmEntity(index) // 调用新添加的方法
|
clearConfirmEntity(index)
|
||||||
//清除数据
|
|
||||||
pauseGetPickFlag.value = false
|
|
||||||
ElMessage.success(response.message)
|
ElMessage.success(response.message)
|
||||||
|
// 确认后检查是否还有其他数据,如果没有则切换回2秒间隔
|
||||||
|
setTimeout(() => {
|
||||||
|
// 这里可以触发一次检查,但不强制改变频率
|
||||||
|
getTask()
|
||||||
|
}, 100)
|
||||||
} else if (response.code === 400) {
|
} else if (response.code === 400) {
|
||||||
pauseGetPickFlag.value = false
|
|
||||||
warningBox(response.message)
|
warningBox(response.message)
|
||||||
} else {
|
} else {
|
||||||
// 错误,弹框
|
// 错误,弹框
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user