You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
346 lines
9.0 KiB
346 lines
9.0 KiB
<template>
|
|
<view class="">
|
|
<com-empty-view v-if="jobList.length == 0"></com-empty-view>
|
|
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter>
|
|
|
|
<view v-if="jobList.length > 0" class="u-m-20">
|
|
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in jobList" :key="index" :options="item.status == '2' ? detailGiveupOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="swipeClick">
|
|
<com-putaway-job-card :dataContent="item" @click="openJobDetail(item)"></com-putaway-job-card>
|
|
</u-swipe-action>
|
|
<putaway-info-popup ref="jobInfoPopup"></putaway-info-popup>
|
|
<putaway-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></putaway-job-list-popup>
|
|
<u-loadmore :status="loadingType" v-if="jobList.length > 0" />
|
|
</view>
|
|
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
|
|
<winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob>
|
|
<jobListCom ref="jobListRef" @selectItem="selectItem"></jobListCom>
|
|
<com-message ref="comMessageRef" />
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, getCurrentInstance, nextTick } from 'vue'
|
|
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
|
import { getPutawayJobList, cancleTakePutawayJob } from '@/api/request2.js'
|
|
|
|
import { goHome, updateTitle } from '@/common/basic.js'
|
|
|
|
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
|
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
|
|
import jobFilter from '@/mycomponents/job/jobFilter.vue'
|
|
import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue'
|
|
import putawayJobListPopup from '@/pages/putaway/coms/putawayJobListPopup.vue'
|
|
import putawayInfoPopup from '@/pages/putaway/coms/putawayInfoPopup.vue'
|
|
import jobListCom from '@/mycomponents/jobList/jobList.vue'
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
|
|
import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue'
|
|
import { useCountStore } from '@/store'
|
|
// 获取自定义的store
|
|
const store = useCountStore()
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
const jobList = ref([])
|
|
const pageNo = ref(1)
|
|
const pageSize = ref(10)
|
|
const totalCount = ref(0)
|
|
const loadingType = ref('nomore')
|
|
const checkedToday = ref(false)
|
|
const todayTime = ref('')
|
|
const status = ref('1,2') // 待处理 、进行中
|
|
const detailOptions = ref([])
|
|
const detailGiveupOptions = ref([])
|
|
const title = ref('')
|
|
const filter = ref()
|
|
const comMessageRef = ref()
|
|
const scanPopup = ref()
|
|
const jobListRef = ref()
|
|
const jobInfoPopup = ref()
|
|
onShow(() => {
|
|
nextTick(() => {
|
|
getList('refresh')
|
|
})
|
|
})
|
|
onLoad((option) => {
|
|
title.value = option.title
|
|
})
|
|
onReady(() => {
|
|
detailOptions.value = getDetailOption()
|
|
detailGiveupOptions.value = getDetailGiveupOption()
|
|
})
|
|
|
|
// 后退按钮
|
|
onBackPress((options) => {
|
|
if (options.from === 'navigateBack') {
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
return false
|
|
}
|
|
})
|
|
|
|
// 返回首页
|
|
onNavigationBarButtonTap((e) => {
|
|
if (e.index === 0) {
|
|
goHome()
|
|
} else if (e.index == 1) {
|
|
filter.value.openFilter()
|
|
}
|
|
})
|
|
onReachBottom(() => {
|
|
// 避免多次触发
|
|
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
|
|
return
|
|
}
|
|
getList('more')
|
|
})
|
|
onPullDownRefresh(() => {
|
|
getList('refresh')
|
|
})
|
|
const getList = (type) => {
|
|
proxy.$modal.loading('加载中....')
|
|
loadingType.value = 'loading'
|
|
if (type === 'refresh') {
|
|
pageNo.value = 1
|
|
jobList.value = []
|
|
}
|
|
|
|
const filters = []
|
|
if (checkedToday.value) {
|
|
filters.push({
|
|
column: 'create_time',
|
|
action: 'betweeen',
|
|
value: todayTime.value
|
|
})
|
|
}
|
|
|
|
filters.push({
|
|
column: 'status',
|
|
action: 'in',
|
|
value: status.value
|
|
})
|
|
|
|
filters.push({
|
|
column: 'accept_user_id',
|
|
action: '==',
|
|
value: store.id
|
|
})
|
|
|
|
const params = {
|
|
filters,
|
|
pageNo: pageNo.value,
|
|
pageSize: pageSize.value
|
|
}
|
|
|
|
getPutawayJobList(params)
|
|
.then((res) => {
|
|
uni.hideLoading()
|
|
if (type === 'refresh') {
|
|
uni.stopPullDownRefresh()
|
|
openScanPopup()
|
|
}
|
|
|
|
const { list } = res.data
|
|
totalCount.value = res.data.total
|
|
updateTitle(`${title.value}(${totalCount.value})`)
|
|
loadingType.value = 'loadmore'
|
|
if (list == null || list.length == 0) {
|
|
loadingType.value = 'nomore'
|
|
return
|
|
}
|
|
jobList.value = type === 'refresh' ? list : jobList.value.concat(list)
|
|
pageNo.value++
|
|
})
|
|
.catch((error) => {
|
|
if (type === 'refresh') {
|
|
uni.stopPullDownRefresh()
|
|
}
|
|
loadingType.value = ''
|
|
updateTitle(title.value)
|
|
uni.hideLoading()
|
|
showErrorMessage(error)
|
|
})
|
|
}
|
|
const openJobDetail = (item) => {
|
|
proxy.$tab.navigateTo(`./putawayDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`)
|
|
}
|
|
|
|
const selectedItem = (item) => {
|
|
openJobDetail(item)
|
|
}
|
|
|
|
const swipeClick = (index, index1) => {
|
|
// var text = clearTirmAndWrap(requestList.value[index].options[index].text)
|
|
let text = ''
|
|
const dataContent = jobList.value[index]
|
|
if (dataContent.status == '2') {
|
|
text = detailGiveupOptions.value[index1].text
|
|
} else {
|
|
text = detailOptions.value[index1].text
|
|
}
|
|
if (text == '详情') {
|
|
openjobInfoPopup(dataContent)
|
|
} else if (text == '放弃') {
|
|
comMessageRef.value.showQuestionMessage('确定要放弃当前任务?', (res) => {
|
|
if (res) {
|
|
cancleJob(dataContent.masterId)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
const openjobInfoPopup = (item) => {
|
|
jobInfoPopup.value.openPopup(item)
|
|
}
|
|
|
|
const cancleJob = (id) => {
|
|
cancleTakePutawayJob(id)
|
|
.then((res) => {
|
|
if (res.data) {
|
|
getList('refresh')
|
|
uni.showToast({
|
|
title: '放弃任务成功'
|
|
})
|
|
} else {
|
|
showMessage('放弃任务失败')
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
showMessage(error)
|
|
})
|
|
}
|
|
const switchChangeToday = (state, creationTime) => {
|
|
checkedToday.value = state
|
|
todayTime.value = creationTime
|
|
getList('refresh')
|
|
}
|
|
const switchChangeWait = (state, jobStatus) => {
|
|
checkedWaitTask.value = state
|
|
status.value = jobStatus
|
|
getList('refresh')
|
|
}
|
|
|
|
const getScanNumber = (code) => {
|
|
getDataListByType(code)
|
|
}
|
|
const getDataListByType = (code) => {
|
|
proxy.$modal.loading('加载中....')
|
|
const filters = []
|
|
filters.push({
|
|
column: 'status',
|
|
action: 'in',
|
|
value: '1,2'
|
|
})
|
|
filters.push({
|
|
column: 'number',
|
|
action: '==',
|
|
value: code
|
|
})
|
|
|
|
const params = {
|
|
filters,
|
|
pageNo: 1,
|
|
pageSize: 100
|
|
}
|
|
getPutawayJobList(params)
|
|
.then((res) => {
|
|
uni.hideLoading()
|
|
if (res.data.list.length == 0) {
|
|
showMessage('未查找到' + `【${code}】的收货任务`)
|
|
} else if (res.data.list.length == 1) {
|
|
openJobDetail(res.data.list[0])
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
uni.hideLoading()
|
|
showMessage(error)
|
|
})
|
|
}
|
|
|
|
const showMessage = (message) => {
|
|
comMessageRef.value.showErrorMessage(message, (res) => {
|
|
if (res) {
|
|
}
|
|
})
|
|
}
|
|
const openScanPopup = () => {
|
|
scanPopup.value.openScanPopup()
|
|
}
|
|
const selectItem = (item) => {
|
|
scanPopup.value.closeScanPopup()
|
|
uni.navigateTo({
|
|
url: `./putawayDetail?id=${item.masterId}&status=${item.status}&scaned=${item.packingNumber}`
|
|
})
|
|
}
|
|
|
|
const getScanResult = (result) => {
|
|
try {
|
|
const filters = [
|
|
{
|
|
column: 'packingNumber',
|
|
action: '==',
|
|
value: result.label.packingNumber
|
|
},
|
|
{
|
|
column: 'batch',
|
|
action: '==',
|
|
value: result.label.batch
|
|
},
|
|
// {
|
|
// column: 'qty',
|
|
// action: '==',
|
|
// value: result.label.qty
|
|
// },
|
|
{
|
|
column: 'itemCode',
|
|
action: '==',
|
|
value: result.label.itemCode
|
|
},
|
|
{
|
|
column: 'status',
|
|
action: 'in',
|
|
value: '1,2'
|
|
}
|
|
// {
|
|
// column: 'fromLocationCode',
|
|
// action: '==',
|
|
// value: result.label.fromLocationCode
|
|
// }
|
|
]
|
|
getPutawayJobList({
|
|
filters,
|
|
pageNo: 1,
|
|
pageSize: 100
|
|
})
|
|
.then((res) => {
|
|
const resultList = res.data.list
|
|
if (resultList.length > 0) {
|
|
resultList.forEach((item) => {
|
|
item.title = item.number
|
|
item.selected = false
|
|
})
|
|
const list = []
|
|
resultList.forEach((item) => {
|
|
if (!list.find((subItem) => subItem.title == item.title)) {
|
|
list.push(item)
|
|
}
|
|
})
|
|
if (list.length > 1) {
|
|
jobListRef.value.openList(list)
|
|
} else {
|
|
selectItem(list[0])
|
|
}
|
|
} else {
|
|
showMessage('未查找到任务')
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
showMessage(error)
|
|
})
|
|
} catch (e) {
|
|
showMessage(e.message)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss"></style>
|
|
|