This commit is contained in:
hongchao 2025-09-02 22:52:46 +08:00
commit 7b3bd9f619
9 changed files with 109 additions and 46 deletions

View File

@ -211,7 +211,7 @@
{
"path": "pages/back/index",
"style": {
"navigationBarTitleText": "退料任务"
"navigationStyle": "custom"
}
},
{

View File

@ -1,12 +1,12 @@
<template>
<uni-nav-bar
status-bar
leftIcon="left"
title="退料任务"
backgroundColor="#dcf4ff"
:border="false"
fixed
@clickLeft="leftClick"
status-bar
leftIcon="left"
title="退料任务"
backgroundColor="#dcf4ff"
:border="false"
fixed
@clickLeft="leftClick"
/>
<!-- 退料任务 -->
<view class="page-container">
@ -58,7 +58,13 @@
<view class="addBtn" @click="goAdd()">新增</view>
</uni-col>
</uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<scroll-view
scroll-y
:scroll-top="scrollTop"
@scroll="onScroll"
@scrolltolower="onScrollTolower"
class="scroll-container"
>
<div
class="table-list-item"
v-for="(item, index) in tableList"
@ -178,6 +184,8 @@ import { ref, computed } from 'vue'
import { getBackList, submitBackApply, backApplyRemove } from '../../services/back.js'
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
const scrollTop = ref(0)
const total = ref(0) //
const active = ref(1) // tap
const tableList = ref([]) //
@ -335,6 +343,10 @@ const getTableList = async (isTap = false) => {
console.log('queryParams.value查询参数', queryParams.value)
const res = await getBackList(queryParams.value)
console.log('res列表数据', res)
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 400)
total.value = res.data.total
if (isTap) {
tableList.value = res.data.rows
@ -348,10 +360,10 @@ const getTableList = async (isTap = false) => {
const unique = []
const seen = new Set()
for (const item of merged) {
if (!seen.has(item.taskId)) {
seen.add(item.taskId)
unique.push(item)
}
if (!seen.has(item.taskId)) {
seen.add(item.taskId)
unique.push(item)
}
}
console.log('🚀 ~ getTableList ~ unique:', unique)
tableList.value = unique
@ -371,9 +383,20 @@ const onScrollTolower = debounce(() => {
getTableList()
}
})
let timer = null
const onScroll = (e) => {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
}, 500)
}
//tab
const changeTab = (index) => {
active.value = index
uni.setStorageSync('scrollTop', 0)
uni.setStorageSync('activeTab', index)
if (index == 1) {
queryParams.value.appTaskStatus = 0
} else if (index == 2) {
@ -413,6 +436,10 @@ const leftClick = () => {
onShow(() => {
tableList.value = []
total.value = 0
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
active.value = uni.getStorageSync('activeTab') || 1
getTableList(true)
})

View File

@ -154,10 +154,10 @@
</uni-table>
<button v-if="opts.isOut" style="width: 100%; margin: 50px 0" type="primary" @click="submit(1)">
</button>
<button v-else style="width: 100%; margin: 50px 0" type="primary" @click="submit(0)">
</button>
</div>
@ -262,6 +262,7 @@ const getDetailsById = async () => {
Object.assign(formData, res.data.leaseApplyInfo)
formData.projectId = res.data.leaseApplyInfo.proId
formData.proId = res.data.leaseApplyInfo.proId
formData.relPhone = res.data.leaseApplyInfo.phone || res.data.leaseApplyInfo.relPhone || ''
getAgreementInfoById()
} catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error)
@ -527,6 +528,7 @@ const submit = (isOut) => {
.validate()
.then(async (valid) => {
formData.isOut = isOut
formData.phone = formData.relPhone
formData.createBy = uni.getStorageSync('username') || ''
console.log('🚀 ~ form.value.validate.then ~ valid:', valid)
if (tableData.value.length === 0) {
@ -561,15 +563,17 @@ const submit = (isOut) => {
leaseApplyInfo: formData,
}
console.log('🚀 ~ .then ~ params:', params)
//
const res = await uni.showModal({
title: '提示',
content: '是否确认提交?',
confirmText: isOut == 0 ? '暂存' : '出库',
cancelText: '取消',
})
console.log('🚀 ~ .then ~ res:', res)
if (!res.confirm) return
if (isOut != 0) {
//
const resp = await uni.showModal({
title: '提示',
content: '是否确认提交?',
confirmText: '提交',
cancelText: '取消',
})
console.log('🚀 ~ .confirm ~ resp:', resp)
if (!resp.confirm) return
}
uni.showLoading({
title: '提交中...',
mask: true, //

View File

@ -214,7 +214,7 @@ const getTableList = async (isTap = false, isSearch = false) => {
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 300)
}, 400)
console.log('res列表数据', res)
total.value = res.data.total
if (isTap) {
@ -255,6 +255,7 @@ onShow(() => {
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
active.value = uni.getStorageSync('activeTab') || 0
getTableList()
})
@ -285,8 +286,8 @@ const onScroll = (e) => {
// tap
const changeTab = (index) => {
uni.removeStorageSync('scrollTop')
uni.removeStorageSync('queryParams')
uni.setStorageSync('scrollTop', 0)
uni.setStorageSync('activeTab', index)
active.value = index
console.log('index', index)
if (index == 2) {

View File

@ -104,7 +104,7 @@
</view>
</scroll-view>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container" v-else>
<scroll-view scroll-y :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="onScrollTolower" class="scroll-container" v-else>
<view
class="table-list-item"
:key="index"
@ -192,6 +192,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
import { onBackPress } from '@dcloudio/uni-app'
const scrollTop = ref(0)
const opts = ref(null)
const total = ref(0) //
const active = ref(1) // tap
@ -270,6 +271,10 @@ const getTableList = async (isTap = false, isSearch = false) => {
} else {
res = await getPickingOutboundListAPI(queryParams.value)
}
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 400)
console.log('res列表数据', res)
total.value = res.data.total
if (isTap) {
@ -311,6 +316,9 @@ onShow(() => {
queryParams.value.pageNum = 1
tableList.value = []
total.value = 0
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
if (opts.value) {
getTableList()
} else {
@ -327,6 +335,15 @@ const onScrollTolower = debounce(() => {
}
}, 500)
let timer = null
const onScroll = (e) => {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
}, 500)
}
// tap
const changeTab = (index) => {
active.value = index

View File

@ -11,11 +11,11 @@
<uni-forms-item label="规格型号:" name=" typeName">
<span style="height: 100%;display: flex;align-items: center;">{{ formData.typeName||"" }}</span>
</uni-forms-item>
<uni-forms-item label="入库人:" name="createBy">
<span style="height: 100%;display: flex;align-items: center;">{{ formData.createBy||"" }}</span>
<uni-forms-item label="入库人:" name="auditBy">
<span style="height: 100%;display: flex;align-items: center;">{{ formData.auditBy||"" }}</span>
</uni-forms-item>
<uni-forms-item label="入库时间:" name="createTime">
<span style="height: 100%;display: flex;align-items: center;">{{ formData.createTime||"" }}</span>
<uni-forms-item label="入库时间:" name="auditTime">
<span style="height: 100%;display: flex;align-items: center;">{{ formData.auditTime||"" }}</span>
</uni-forms-item>
</uni-forms>
</view>
@ -84,8 +84,8 @@ onLoad((options) => {
if(queryParams.value.manageType==1){
formData.value.maTypeName = queryParams.value.typeName
formData.value.typeName = queryParams.value.typeModelName
formData.value.createBy = queryParams.value.createBy
formData.value.createTime = queryParams.value.createTime
formData.value.auditBy = queryParams.value.auditBy
formData.value.auditTime = queryParams.value.auditTime
}
})

View File

@ -292,7 +292,7 @@ onLoad((options) => {
console.log(taskInfo.value)
taskId.value = taskInfo.value.taskId
console.log(taskId.value)
getDetailsData()
// getDetailsData()
//
uni.$on('onUpdate', () => {
// console.log('')

View File

@ -57,7 +57,7 @@
</uni-col>
</uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<scroll-view scroll-y :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="onScrollTolower" class="scroll-container">
<view
class="table-list-item"
:key="index"
@ -157,6 +157,7 @@ import { getRepairedList } from '@/services/repair/testedInBound.js'
import { onShow, onLoad } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
const scrollTop = ref(0)
const total = ref(0) //
const active = ref(1) // tap
const tableList = ref([]) //
@ -242,6 +243,10 @@ const getTableList = async (isTap = false) => {
mask: true
})
const res = await getRepairedList(queryParams.value)
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 400)
total.value = res.data.total
if (isTap) {
tableList.value = res.data.rows
@ -271,30 +276,38 @@ const getTableList = async (isTap = false) => {
}
//
onLoad(() => {
// tableList.value = []
// total.value = 0
onShow(() => {
tableList.value = []
total.value = 0
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
active.value = uni.getStorageSync('activeTab') || 1
getTableList()
})
// onShow(() => {
// tableList.value = []
// total.value = 0
// getTableList()
// })
//
const onScrollTolower = debounce(() => {
console.log('触底事件')
if (total.value > tableList.value.length) {
queryParams.value.pageSize += 5
queryParams.value.pageSize += 10
getTableList()
}
}, 500)
let timer = null
const onScroll = (e) => {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
}, 500)
}
// tap
const changeTab = (index) => {
active.value = index
uni.setStorageSync('scrollTop', 0)
uni.setStorageSync('activeTab', index)
if (index == 1) {
queryParams.value.appTaskStatus = 0 //
queryParams.value.pageNum = 1

View File

@ -153,6 +153,7 @@ import { onShow,onLoad } from '@dcloudio/uni-app'
const urlPermissions = ref([])
onShow((options) => {
urlPermissions.value = uni.getStorageSync('urlPermissions')
uni.removeStorageSync('activeTab')
uni.removeStorageSync('scrollTop')
uni.removeStorageSync('queryParams')
})