|
@@ -3,7 +3,7 @@
|
|
|
<div class="task">
|
|
<div class="task">
|
|
|
<div class="top">
|
|
<div class="top">
|
|
|
<div class="nav-bar">
|
|
<div class="nav-bar">
|
|
|
- <van-nav-bar title="还库任务" left-arrow @click-left="goBack" @click-right="onClickRight" >
|
|
|
|
|
|
|
+ <van-nav-bar title="还库任务" left-arrow @click-left="goBack" @click-right="onClickRight">
|
|
|
<template #left>
|
|
<template #left>
|
|
|
<van-icon name="arrow-left" size="25" />
|
|
<van-icon name="arrow-left" size="25" />
|
|
|
<div style="color: #fff;height: 46px;padding-right:20px;line-height: 46px" >返回</div>
|
|
<div style="color: #fff;height: 46px;padding-right:20px;line-height: 46px" >返回</div>
|
|
@@ -14,15 +14,15 @@
|
|
|
</van-nav-bar>
|
|
</van-nav-bar>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
- <van-pull-refresh v-model="loading" @refresh="onRefresh" :style="{ 'max-height': computedMaxHeight,'min-height':computedMaxHeight ,'overflow':'auto'}" >
|
|
|
|
|
|
|
+ <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :style="{ 'max-height': computedMaxHeight, 'min-height': computedMaxHeight, 'overflow': 'auto' }">
|
|
|
<van-list
|
|
<van-list
|
|
|
- v-model="loadingMore"
|
|
|
|
|
- :finished="!hasMore"
|
|
|
|
|
|
|
+ v-model:loading="loading"
|
|
|
|
|
+ :finished="finished"
|
|
|
finished-text="没有更多了"
|
|
finished-text="没有更多了"
|
|
|
- @load="loadMore"
|
|
|
|
|
|
|
+ @load="onLoad"
|
|
|
:style="{ 'max-height': computedMaxHeight,'min-height':computedMaxHeight ,'overflow':'auto'}"
|
|
:style="{ 'max-height': computedMaxHeight,'min-height':computedMaxHeight ,'overflow':'auto'}"
|
|
|
>
|
|
>
|
|
|
- <table border="1" style="width: 100%;border-collapse: collapse;text-align: center;table-layout: fixed;" >
|
|
|
|
|
|
|
+ <table border="1" style="width: 100%; border-collapse: collapse; text-align: center; table-layout: fixed;">
|
|
|
<thead>
|
|
<thead>
|
|
|
<tr>
|
|
<tr>
|
|
|
<th>任务号</th>
|
|
<th>任务号</th>
|
|
@@ -33,20 +33,20 @@
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
- <tr v-for="(row, rowIndex) in taskList" :key="rowIndex">
|
|
|
|
|
|
|
+ <tr v-for="(row, rowIndex) in taskList" :key="rowIndex" >
|
|
|
<td style="word-wrap: break-word" >{{ row.containerCode }}</td>
|
|
<td style="word-wrap: break-word" >{{ row.containerCode }}</td>
|
|
|
<td style="word-wrap: break-word" >{{ row.statusDesc }}</td>
|
|
<td style="word-wrap: break-word" >{{ row.statusDesc }}</td>
|
|
|
<td style="word-wrap: break-word;font-size:11px">{{ time(row.createTime) }}</td>
|
|
<td style="word-wrap: break-word;font-size:11px">{{ time(row.createTime) }}</td>
|
|
|
<td style="word-wrap: break-word;">{{ row.remainingQty }}</td>
|
|
<td style="word-wrap: break-word;">{{ row.remainingQty }}</td>
|
|
|
<td>
|
|
<td>
|
|
|
- <van-button type="primary" size="mini" plain @click="linkTask(row)">作业</van-button>
|
|
|
|
|
|
|
+ <van-button type="primary" size="mini" plain @click="onComplete(row)" v-if="row.status=='CREATED'" >作业</van-button>
|
|
|
<van-button type="primary" size="mini" plain @click="linkTask(row)">查看</van-button>
|
|
<van-button type="primary" size="mini" plain @click="linkTask(row)">查看</van-button>
|
|
|
</td>
|
|
</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
- <tr v-if="taskList.length==0 && !loadingMore">
|
|
|
|
|
|
|
+ <tr v-if="taskList.length === 0 && !loading">
|
|
|
<td colspan="5">
|
|
<td colspan="5">
|
|
|
<van-empty :image="nodataUrl" image-size="140" >
|
|
<van-empty :image="nodataUrl" image-size="140" >
|
|
|
- <van-button round type="primary" class="bottom-button" size="small" @click="loadData(true)">刷新</van-button>
|
|
|
|
|
|
|
+ <van-button round type="primary" class="bottom-button" size="small" @click="onRefresh">刷新</van-button>
|
|
|
</van-empty>
|
|
</van-empty>
|
|
|
</td>
|
|
</td>
|
|
|
</tr>
|
|
</tr>
|
|
@@ -58,55 +58,66 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <input-barcode ref="inputBarcodeRef" @setBarcode="setBarcode" />
|
|
|
|
|
|
|
+ <input-barcode ref="inputBarcodeRef" @setBarcode="setBarcode" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { computed, onMounted, ref } from 'vue'
|
|
|
|
|
-import {getHeader, goBack, scanError, scanSuccess} from '@/utils/android'
|
|
|
|
|
|
|
+import { computed, onMounted, ref, nextTick } from 'vue'
|
|
|
|
|
+import { getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
|
|
|
import { useStore } from '@/store/modules/user'
|
|
import { useStore } from '@/store/modules/user'
|
|
|
-import { showToast } from 'vant'
|
|
|
|
|
|
|
+import {showConfirmDialog, showToast} from 'vant'
|
|
|
import nodataUrl from '@/assets/nodata.png'
|
|
import nodataUrl from '@/assets/nodata.png'
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
|
import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
|
|
import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
|
|
|
-import {createReturnTask, getReturnTaskPage} from "@/api/returnTask/index.ts";
|
|
|
|
|
|
|
+import {createReturnTask, getReturnTaskPage, returnTaskFirstStepComplete} from "@/api/returnTask/index.ts"
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
try {
|
|
try {
|
|
|
getHeader()
|
|
getHeader()
|
|
|
}catch (error) {
|
|
}catch (error) {
|
|
|
router.push('/login')
|
|
router.push('/login')
|
|
|
}
|
|
}
|
|
|
-const topHeight=ref(46)
|
|
|
|
|
|
|
+const topHeight = ref(46)
|
|
|
const computedMaxHeight = computed(() => {
|
|
const computedMaxHeight = computed(() => {
|
|
|
return `calc(100vh - ${topHeight.value}px)`;
|
|
return `calc(100vh - ${topHeight.value}px)`;
|
|
|
});
|
|
});
|
|
|
const storeUser = useStore()
|
|
const storeUser = useStore()
|
|
|
const warehouse = storeUser.warehouse
|
|
const warehouse = storeUser.warehouse
|
|
|
-//任务列表
|
|
|
|
|
-const taskList=ref([])
|
|
|
|
|
-const statusMap=ref({
|
|
|
|
|
- 'CREATED':'创建',
|
|
|
|
|
- 'IN_PROGRESS':'进行中',
|
|
|
|
|
- 'FINISHED':'完成'
|
|
|
|
|
|
|
+const taskList = ref([])
|
|
|
|
|
+const statusMap = ref({
|
|
|
|
|
+ 'CREATED': '创建',
|
|
|
|
|
+ 'IN_PROGRESS': '进行中',
|
|
|
|
|
+ 'FINISHED': '完成'
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-// 分页相关状态
|
|
|
|
|
const page = ref(1)
|
|
const page = ref(1)
|
|
|
const size = ref(20)
|
|
const size = ref(20)
|
|
|
-const hasMore = ref(true)
|
|
|
|
|
-const loadingMore = ref(false)
|
|
|
|
|
|
|
+const total = ref(0)
|
|
|
|
|
+const loading = ref(false)
|
|
|
|
|
+const finished = ref(false)
|
|
|
|
|
+const refreshing = ref(false)
|
|
|
|
|
+const isLoading = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const onLoad = async () => {
|
|
|
|
|
+ if (finished.value) {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-const loadData = async (isLoadMore = false) => {
|
|
|
|
|
- if (!isLoadMore) {
|
|
|
|
|
- showLoading()
|
|
|
|
|
|
|
+ if (isLoading.value) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const isRefreshing = refreshing.value
|
|
|
|
|
+ if (isRefreshing) {
|
|
|
page.value = 1
|
|
page.value = 1
|
|
|
taskList.value = []
|
|
taskList.value = []
|
|
|
- } else {
|
|
|
|
|
- loadingMore.value = true
|
|
|
|
|
|
|
+ refreshing.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ isLoading.value = true
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
const params = {
|
|
const params = {
|
|
|
warehouse: warehouse,
|
|
warehouse: warehouse,
|
|
@@ -114,83 +125,99 @@ const loadData = async (isLoadMore = false) => {
|
|
|
size: size.value
|
|
size: size.value
|
|
|
}
|
|
}
|
|
|
const res = await getReturnTaskPage(params)
|
|
const res = await getReturnTaskPage(params)
|
|
|
- if (isLoadMore) {
|
|
|
|
|
- taskList.value = [...taskList.value, ...res.data.records]
|
|
|
|
|
- } else {
|
|
|
|
|
- taskList.value = res.data.records
|
|
|
|
|
|
|
+ const records = res.data.records || []
|
|
|
|
|
+
|
|
|
|
|
+ if (page.value === 1) {
|
|
|
|
|
+ total.value = res.data.total || 0
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 判断是否还有更多数据
|
|
|
|
|
- hasMore.value = res.data.records && res.data.records.length === size.value
|
|
|
|
|
- } finally {
|
|
|
|
|
- if (!isLoadMore) {
|
|
|
|
|
- closeLoading()
|
|
|
|
|
|
|
+ taskList.value = [...taskList.value, ...records]
|
|
|
|
|
+
|
|
|
|
|
+ if (records.length === 0 || taskList.value.length >= total.value) {
|
|
|
|
|
+ finished.value = true
|
|
|
} else {
|
|
} else {
|
|
|
- loadingMore.value = false
|
|
|
|
|
|
|
+ page.value++
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('加载数据失败:', error)
|
|
|
|
|
+ finished.value = true
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ isLoading.value = false
|
|
|
|
|
+ loading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- const time=(createTime)=>{
|
|
|
|
|
- // 创建一个日期对象
|
|
|
|
|
- let date = new Date(createTime);
|
|
|
|
|
-// 获取年月日时分的部分
|
|
|
|
|
- let year = date.getFullYear().toString().slice(2); // 获取年份的后两位
|
|
|
|
|
- let month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份,保证两位
|
|
|
|
|
- let day = String(date.getDate()).padStart(2, '0'); // 获取日期,保证两位
|
|
|
|
|
- let hours = String(date.getHours()).padStart(2, '0'); // 获取小时,保证两位
|
|
|
|
|
- let minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟,保证两位
|
|
|
|
|
-// 组装成目标格式
|
|
|
|
|
- let formattedDate = `${year}${month}${day}${hours}:${minutes}`;
|
|
|
|
|
- return formattedDate
|
|
|
|
|
- }
|
|
|
|
|
-// 上拉加载更多
|
|
|
|
|
-const loadMore = () => {
|
|
|
|
|
- if (hasMore.value && !loadingMore.value) {
|
|
|
|
|
- page.value++
|
|
|
|
|
- loadData(true)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+const time = (createTime) => {
|
|
|
|
|
+ const date = new Date(createTime)
|
|
|
|
|
+ const year = date.getFullYear().toString().slice(2)
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0')
|
|
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
|
|
+ return `${year}${month}${day}${hours}:${minutes}`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onRefresh = () => {
|
|
|
|
|
+ finished.value = false
|
|
|
|
|
+ refreshing.value = true
|
|
|
|
|
+ page.value = 1
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ isLoading.value = false
|
|
|
|
|
+ onLoad()
|
|
|
}
|
|
}
|
|
|
-loadData()
|
|
|
|
|
|
|
|
|
|
-const inputBarcodeRef=ref(null)
|
|
|
|
|
-const onClickRight=()=>{
|
|
|
|
|
- inputBarcodeRef.value?.show(undefined,'请扫描反拣容器','')
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ if (!loading.value && !finished.value && taskList.value.length === 0) {
|
|
|
|
|
+ onLoad()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const inputBarcodeRef = ref(null)
|
|
|
|
|
+const onClickRight = () => {
|
|
|
|
|
+ inputBarcodeRef.value?.show(undefined, '请扫描反拣容器', '')
|
|
|
}
|
|
}
|
|
|
-const setBarcode=(code)=>{
|
|
|
|
|
- createReturnTask({warehouse,containerCode:code}).then(res=>{
|
|
|
|
|
- console.log(res,"res")
|
|
|
|
|
|
|
+
|
|
|
|
|
+const setBarcode = (code) => {
|
|
|
|
|
+ createReturnTask({ warehouse, containerCode: code }).then(res => {
|
|
|
|
|
+ console.log(res, "res")
|
|
|
scanSuccess()
|
|
scanSuccess()
|
|
|
- router.push({ name:'ReturnTask', query: { code: res.data,container:code,status:'CREATING' } });
|
|
|
|
|
- }).catch(err=>{
|
|
|
|
|
|
|
+ router.push({ name: 'ReturnBin', query: { code: res.data, container: code, status: 'CREATING' } })
|
|
|
|
|
+ }).catch(err => {
|
|
|
scanError()
|
|
scanError()
|
|
|
- setTimeout(()=>{
|
|
|
|
|
|
|
+ setTimeout(() => {
|
|
|
inputBarcodeRef.value?.show('', '请扫描反拣容器', err.message)
|
|
inputBarcodeRef.value?.show('', '请扫描反拣容器', err.message)
|
|
|
- },300)
|
|
|
|
|
|
|
+ }, 300)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 进入任务
|
|
|
|
|
-const linkTask = (item) => {
|
|
|
|
|
- let name='ReturnBin'
|
|
|
|
|
- if(item.status=='WORKING'){
|
|
|
|
|
- name='ReturnTask'
|
|
|
|
|
- }
|
|
|
|
|
- router.push({ name, query: { code:item.taskNo,container:item.containerCode,status:item.status } });
|
|
|
|
|
-};
|
|
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * 下拉刷新
|
|
|
|
|
- */
|
|
|
|
|
-const loading = ref(false)
|
|
|
|
|
-const onRefresh = () => {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- loadData(false)
|
|
|
|
|
- showToast('刷新成功')
|
|
|
|
|
- loading.value = false
|
|
|
|
|
- }, 1000)
|
|
|
|
|
|
|
+const linkTask = (item) => {
|
|
|
|
|
+ const name = item.status === 'WORKING' ? 'ReturnTask' : 'ReturnBin'
|
|
|
|
|
+ router.push({ name, query: { code: item.taskNo, container: item.containerCode, status: item.status } })
|
|
|
|
|
+}
|
|
|
|
|
+// 完成任务
|
|
|
|
|
+const onComplete = (item) => {
|
|
|
|
|
+ showConfirmDialog({
|
|
|
|
|
+ title: '温馨提示',
|
|
|
|
|
+ message:
|
|
|
|
|
+ '您正在进行作业操作,是否立即呼叫小车?',
|
|
|
|
|
+ confirmButtonText: '立即呼叫',
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ _returnTaskFirstStepComplete(true,item)
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+const _returnTaskFirstStepComplete=(callHikQuickIn,item)=>{
|
|
|
|
|
+ showLoading()
|
|
|
|
|
+ returnTaskFirstStepComplete({taskNo:item.taskNo,callHikQuickIn}).then(res => {
|
|
|
|
|
+ router.replace({ name: 'ReturnTask', query: { code:item.taskNo,container:item.containerNo } });
|
|
|
|
|
+ }).finally(_ => {
|
|
|
|
|
+ closeLoading()
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-window.onRefresh = loadData
|
|
|
|
|
|
|
+window.onRefresh = onRefresh
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="sass">
|
|
<style scoped lang="sass">
|