定损、维修列表标记位置回滚

This commit is contained in:
hayu 2026-01-22 10:50:05 +08:00
parent d94835f6c5
commit fcc4e79283
4 changed files with 276 additions and 226 deletions

View File

@ -158,28 +158,36 @@ const options = ref([
]) ])
// //
const onClick = async (e, item) => { const onClick = async (e, item) => {
// //
console.log('驳回') console.log('驳回')
console.log(item) console.log(item)
const parm ={ //
ids:item.ids uni.setStorageSync('fromDetailOperation', true)
}
console.log(parm) const parm = {
const res = await repairRejectAPI(parm) ids:item.ids
if (res.code === 200) { }
await uni.showToast({ console.log(parm)
title: '驳回成功!', const res = await repairRejectAPI(parm)
icon: 'none', if (res.code === 200) {
}) await uni.showToast({
await getRepairDetailsData() title: '驳回成功!',
} icon: 'none',
})
await getRepairDetailsData()
}
} }
const search = () => { const search = () => {
console.log('🚀 ~ search ~ keyWord:', keyWord.value) console.log('🚀 ~ search ~ keyWord:', keyWord.value)
getRepairDetailsData() //
uni.setStorageSync('fromDetailOperation', true)
getRepairDetailsData()
} }
const submit = async () => { const submit = async () => {
//
uni.setStorageSync('fromDetailOperation', true)
// //
const res = await repairSubmitAPI([{taskId: taskId.value}]) const res = await repairSubmitAPI([{taskId: taskId.value}])
if (res.code === 200) { if (res.code === 200) {
@ -195,48 +203,51 @@ const submit = async () => {
// //
const getRepairDetailsData = async () => { const getRepairDetailsData = async () => {
const res = await getLossAssessmentDetailsAPI({ taskId: taskId.value,keyword:keyWord.value }) const res = await getLossAssessmentDetailsAPI({ taskId: taskId.value,keyword:keyWord.value })
console.log("xxxxxxxxxxxxx",res) console.log("xxxxxxxxxxxxx",res)
detailsList.value = res.data detailsList.value = res.data
detailsList.value = detailsList.value.map((e) => { detailsList.value = detailsList.value.map((e) => {
return { ...e, isChecked: false } return { ...e, isChecked: false }
}) })
} }
// //
const onChangeAllChecked = (e) => { const onChangeAllChecked = (e) => {
detailsList.value.forEach((item) => { detailsList.value.forEach((item) => {
if (e.detail.value.length > 0) { if (e.detail.value.length > 0) {
if(Number(item.typeRepairNum)-Number(item.typeRepairedNum)-Number(item.typeScrapNum)==0){ if(Number(item.typeRepairNum)-Number(item.typeRepairedNum)-Number(item.typeScrapNum)==0){
item.isChecked = false item.isChecked = false
}else{ }else{
item.isChecked = true item.isChecked = true
} }
} else { } else {
item.isChecked = false item.isChecked = false
} }
}) })
} }
// //
const onChangeChecked = (val) => { const onChangeChecked = (val) => {
val.isChecked = !val.isChecked val.isChecked = !val.isChecked
} }
// //
const allChecked = computed(() => { const allChecked = computed(() => {
return detailsList.value.every((e) => e.isChecked == true) return detailsList.value.every((e) => e.isChecked == true)
}) })
// //
const onQualified = async () => { const onQualified = async () => {
const isSelect = detailsList.value.some((e) => e.isChecked == true) const isSelect = detailsList.value.some((e) => e.isChecked == true)
if (!isSelect) { if (!isSelect) {
uni.showToast({ uni.showToast({
title: '请选择要驳回的数据!', title: '请选择要驳回的数据!',
icon: 'none', icon: 'none',
}) })
return return
} }
//
uni.setStorageSync('fromDetailOperation', true)
// //
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -274,49 +285,52 @@ const onQualified = async () => {
// //
const onRepairItem = (item) => { const onRepairItem = (item) => {
console.log(item) console.log(item)
let codingUrl = '' //
if (item.manageType === 0) {// uni.setStorageSync('fromDetailOperation', false)
// if(item.status==0){
codingUrl = '/pages/repair/equipAssessment/code-view' let codingUrl = ''
uni.navigateTo({ url: `${codingUrl}?queryParams=${JSON.stringify(item)}` }) if (item.manageType === 0) {//
// }else{ // if(item.status==0){
// uni.showToast({ codingUrl = '/pages/repair/equipAssessment/code-view'
// title: '', uni.navigateTo({ url: `${codingUrl}?queryParams=${JSON.stringify(item)}` })
// icon: 'none', // }else{
// }) // uni.showToast({
// } // title: '',
// icon: 'none',
// })
// }
}
if (item.manageType == 1) {//
if(item.status==0){
codingUrl = '/pages/repair/equipAssessment/num-operate'
uni.navigateTo({ url: `${codingUrl}?queryParams=${JSON.stringify(item)}` })
}else{
uni.showToast({
title: '该规格已完成定损',
icon: 'none',
})
} }
if (item.manageType == 1) {// }
if(item.status==0){
codingUrl = '/pages/repair/equipAssessment/num-operate'
uni.navigateTo({ url: `${codingUrl}?queryParams=${JSON.stringify(item)}` })
}else{
uni.showToast({
title: '该规格已完成定损',
icon: 'none',
})
}
}
} }
onShow(() => { onShow(() => {
getRepairDetailsData() getRepairDetailsData()
}) })
// //
onLoad((options) => { onLoad((options) => {
taskId.value = options.taskId taskId.value = options.taskId
getRepairDetailsData()
//
uni.$on('onUpdate', () => {
//
getRepairDetailsData() getRepairDetailsData()
// })
uni.$on('onUpdate', () => {
//
getRepairDetailsData()
})
}) })
// //
onUnmounted(() => { onUnmounted(() => {
uni.$off('onUpdate') // uni.$off('onUpdate') //
}) })
</script> </script>

View File

@ -136,13 +136,15 @@ const total = ref(0) // 数据总<E68DAE><E680BB>
const active = ref(1) // tap const active = ref(1) // tap
const tableList = ref([]) // const tableList = ref([]) //
const dateArray = ref([ const dateArray = ref([
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0], new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
new Date().toISOString().split('T')[0] new Date().toISOString().split('T')[0]
]) // ]) //
const showCustomModal = ref(false) const showCustomModal = ref(false)
const currentItem = ref(null) const currentItem = ref(null)
const modalTitle = ref('提示') const modalTitle = ref('提示')
const modalContent = ref('是否确认进行定损?') const modalContent = ref('是否确认进行定损?')
//
const shouldRestoreScroll = ref(true)
// //
const queryParams = ref({ const queryParams = ref({
startTime: dateArray.value[0] || '', startTime: dateArray.value[0] || '',
@ -180,15 +182,17 @@ const onClick = async (e, item) => {
if (e.index === 0) { if (e.index === 0) {
// //
const res = await repairSubmitAPI([{ taskId: item.taskId }]) const res = await repairSubmitAPI([{ taskId: item.taskId }])
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '提交成功!', title: '提交成功!',
icon: 'none', icon: 'none',
}) })
queryParams.value.pageNum = 1 shouldRestoreScroll.value = false
tableList.value = [] uni.setStorageSync('fromDetailOperation', true)
getTableList(true) queryParams.value.pageNum = 1
} tableList.value = []
getTableList(true)
}
} else { } else {
// //
console.log('驳回') console.log('驳回')
@ -199,30 +203,34 @@ const onClick = async (e, item) => {
} }
console.log(parm) console.log(parm)
const res = await repairRejectAPI(parm) const res = await repairRejectAPI(parm)
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '驳回成功!', title: '驳回成功!',
icon: 'none', icon: 'none',
}) })
queryParams.value.pageNum = 1 shouldRestoreScroll.value = false
tableList.value = [] uni.setStorageSync('fromDetailOperation', true)
getTableList(true) queryParams.value.pageNum = 1
} tableList.value = []
getTableList(true)
}
} }
} }
// change // change
const onChangeDate = (val) => { const onChangeDate = (val) => {
const [val_1, val_2] = val const [val_1, val_2] = val
queryParams.value.startTime = val_1 queryParams.value.startTime = val_1
queryParams.value.endTime = val_2 queryParams.value.endTime = val_2
} }
// //
const onSearchBtn = () => { const onSearchBtn = () => {
queryParams.value.pageNum = 1 shouldRestoreScroll.value = false
tableList.value = [] uni.setStorageSync('fromDetailOperation', true)
getTableList(true) queryParams.value.pageNum = 1
tableList.value = []
getTableList(true)
} }
// //
@ -234,10 +242,7 @@ const getTableList = async (isTap = false) => {
}) })
console.log('queryParams.value查询参数', queryParams.value) console.log('queryParams.value查询参数', queryParams.value)
const res = await getLossAssessmentListAPI(queryParams.value) const res = await getLossAssessmentListAPI(queryParams.value)
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 400)
total.value = res.data.total total.value = res.data.total
if (isTap) { if (isTap) {
tableList.value = res.data.rows tableList.value = res.data.rows
@ -272,9 +277,32 @@ const getTableList = async (isTap = false) => {
// }) // })
onShow(() => { onShow(() => {
tableList.value = [] //
total.value = 0 const fromDetailOperation = uni.getStorageSync('fromDetailOperation')
getTableList(true)
if (shouldRestoreScroll.value && !fromDetailOperation) {
//
setTimeout(() => {
const cachedScrollTop = uni.getStorageSync('scrollTop')
if (cachedScrollTop) {
scrollTop.value = cachedScrollTop
//
setTimeout(() => {
scrollTop.value = cachedScrollTop + 0.1
}, 50)
}
}, 100)
}
//
uni.removeStorageSync('fromDetailOperation')
//
shouldRestoreScroll.value = true
//
tableList.value = []
total.value = 0
getTableList(true)
}) })
let timers = null let timers = null
@ -288,34 +316,41 @@ const onScroll = (e) => {
// //
const onScrollTolower = debounce(() => { const onScrollTolower = debounce(() => {
console.log('触底事件') console.log('触底事件')
if (total.value > tableList.value.length) { if (total.value > tableList.value.length) {
queryParams.value.pageNum += 1 queryParams.value.pageNum += 1
getTableList() getTableList()
} }
}, 500) }, 500)
// tap // tap
const changeTab = (index) => { const changeTab = (index) => {
active.value = index active.value = index
shouldRestoreScroll.value = false
uni.setStorageSync('fromDetailOperation', true)
uni.setStorageSync('scrollTop', 0) uni.setStorageSync('scrollTop', 0)
uni.setStorageSync('activeTab', index) uni.setStorageSync('activeTab', index)
uni.removeStorageSync('queryParams') uni.removeStorageSync('queryParams')
uni.removeStorageSync('scrollTop') uni.removeStorageSync('scrollTop')
queryParams.value.pageNum = 1 queryParams.value.pageNum = 1
tableList.value = [] tableList.value = []
if (index == 1) { if (index == 1) {
queryParams.value.appTaskStatus = 0 // queryParams.value.appTaskStatus = 0 //
getTableList(true) getTableList(true)
} else if (index == 2) { } else if (index == 2) {
queryParams.value.appTaskStatus = 1 // queryParams.value.appTaskStatus = 1 //
getTableList(true) getTableList(true)
} }
} }
// //
const handleItem = (item) => { const handleItem = (item) => {
console.log(item) console.log(item)
currentItem.value = item currentItem.value = item
//
shouldRestoreScroll.value = true
uni.setStorageSync('fromDetailOperation', false)
if(item.repairStatusCode == "0") { if(item.repairStatusCode == "0") {
// 使 // 使
showCustomModal.value = true showCustomModal.value = true
@ -333,49 +368,15 @@ const handleItem = (item) => {
} else { } else {
uni.navigateTo({ url: `/pages/repair/equipAssessment/view?taskId=${item.taskId}` }) uni.navigateTo({ url: `/pages/repair/equipAssessment/view?taskId=${item.taskId}` })
} }
// if(item.repairStatusCode=="0"){
// //
// uni.showModal({
// title: '',
// content: '',
// confirmText: '',
// cancelText: '',
// success: async (res) => {
// if (res.confirm) {
// //
// uni.navigateTo({ url: `/pages/repair/equipAssessment/details?taskId=${item.taskId}` })
// } else if (res.cancel) {
// //
// const res = await updateRepairStatusAPI({taskId: item.taskId})
// if(res.code==200){
// uni.showToast({
// title: '',
// icon: 'none',
// })
// setTimeout(() => {
// queryParams.value.pageNum = 1
// tableList.value = []
// getTableList(true)
// }, 1000)
//
// }
// }
// }
// })
// // uni.navigateTo({ url: `/pages/repair/equipAssessment/details?taskId=${item.taskId}` })
// }else{
// uni.navigateTo({ url: `/pages/repair/equipAssessment/view?taskId=${item.taskId}` })
// }
} }
// //
const handleConfirm = () => { const handleConfirm = () => {
if (countdown.value > 0) return if (countdown.value > 0) return
showCustomModal.value = false showCustomModal.value = false
//
shouldRestoreScroll.value = true
uni.setStorageSync('fromDetailOperation', false)
uni.navigateTo({ url: `/pages/repair/equipAssessment/details?taskId=${currentItem.value.taskId}` }) uni.navigateTo({ url: `/pages/repair/equipAssessment/details?taskId=${currentItem.value.taskId}` })
} }
@ -383,6 +384,10 @@ const handleConfirm = () => {
const handleCancel = async () => { const handleCancel = async () => {
if (countdown.value > 0) return if (countdown.value > 0) return
showCustomModal.value = false showCustomModal.value = false
//
shouldRestoreScroll.value = false
uni.setStorageSync('fromDetailOperation', true)
const res = await updateRepairStatusAPI({taskId: currentItem.value.taskId}) const res = await updateRepairStatusAPI({taskId: currentItem.value.taskId})
if(res.code == 200) { if(res.code == 200) {
uni.showToast({ uni.showToast({
@ -404,22 +409,22 @@ const handleCloseModal = () => {
// //
const finish = computed(() => { const finish = computed(() => {
if (total.value === tableList.value.length) return true if (total.value === tableList.value.length) return true
}) })
// //
const successStyle = { const successStyle = {
color: '#52c41a', color: '#52c41a',
backgroundColor: 'rgba(82, 196, 26, 0.1)', backgroundColor: 'rgba(82, 196, 26, 0.1)',
border: '2rpx solid rgba(82, 196, 26, 0.2)', border: '2rpx solid rgba(82, 196, 26, 0.2)',
fontWeight: '600' fontWeight: '600'
} }
const warningStyle = { const warningStyle = {
color: '#fa8c16', color: '#fa8c16',
backgroundColor: 'rgba(250, 140, 22, 0.1)', backgroundColor: 'rgba(250, 140, 22, 0.1)',
border: '2rpx solid rgba(250, 140, 22, 0.2)', border: '2rpx solid rgba(250, 140, 22, 0.2)',
fontWeight: '600' fontWeight: '600'
} }
const maskClick = () => {} const maskClick = () => {}

View File

@ -105,8 +105,10 @@ const detailsList = ref([])
const taskId = ref('') const taskId = ref('')
const keyWord = ref('') const keyWord = ref('')
const search = () => { const search = () => {
console.log('🚀 ~ search ~ keyWord:', keyWord.value) console.log('🚀 ~ search ~ keyWord:', keyWord.value)
getRepairDetailsData() //
uni.setStorageSync('fromDetailOperation', true)
getRepairDetailsData()
} }
// //
const getRepairDetailsData = async () => { const getRepairDetailsData = async () => {
@ -158,34 +160,39 @@ const allChecked = computed(() => {
// //
const onQualified = async () => { const onQualified = async () => {
const isSelect = detailsList.value.some((e) => e.isChecked == true) const isSelect = detailsList.value.some((e) => e.isChecked == true)
if (!isSelect) { if (!isSelect) {
uni.showToast({ uni.showToast({
title: '请勾选需要合格的数据!', title: '请勾选需要合格的数据!',
icon: 'none', icon: 'none',
})
return
}
//
uni.setStorageSync('fromDetailOperation', true)
//
const ids = []
detailsList.value.forEach((e) => {
if (e.isChecked) {
if (e.ids.length > 0) {
e.ids.forEach((f) => {
ids.push(f)
}) })
return }
}
//
const ids = []
detailsList.value.forEach((e) => {
if (e.isChecked) {
if (e.ids.length > 0) {
e.ids.forEach((f) => {
ids.push(f)
})
}
}
})
console.log(ids)
const res = await auditRepairPass(ids)
if (res.code === 200) {
uni.showToast({
title: '操作成功!',
icon: 'none',
})
getRepairDetailsData()
} }
})
console.log(ids)
const res = await auditRepairPass(ids)
if (res.code === 200) {
uni.showToast({
title: '操作成功!',
icon: 'none',
})
getRepairDetailsData()
}
} }
// //
@ -225,25 +232,29 @@ const onRepairItem = (item) => {
const isSubmit = ref(false) const isSubmit = ref(false)
const handleSubmit = async () => { const handleSubmit = async () => {
try { try {
if (isSubmit.value) return if (isSubmit.value) return
isSubmit.value = true isSubmit.value = true
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
//
const res = await repairSubmitAPI([{ taskId: taskId.value }]) //
if (res.code === 200) { uni.setStorageSync('fromDetailOperation', true)
uni.showToast({
title: '提交成功!', //
icon: 'none', const res = await repairSubmitAPI([{ taskId: taskId.value }])
}) if (res.code === 200) {
uni.navigateBack() uni.showToast({
} title: '提交成功!',
} catch (error) { icon: 'none',
console.log('🚀 ~ handleSubmit ~ error:', error) })
} finally { uni.navigateBack()
uni.hideLoading()
isSubmit.value = false
} }
} catch (error) {
console.log('🚀 ~ handleSubmit ~ error:', error)
} finally {
uni.hideLoading()
isSubmit.value = false
}
} }

View File

@ -146,6 +146,7 @@ const queryParams = ref({
pageSize: 20, pageSize: 20,
}) })
const scrollTop = ref(0) // const scrollTop = ref(0) //
const shouldRestoreScroll = ref(true)
// //
const options = ref([ const options = ref([
@ -249,9 +250,25 @@ const getTableList = async (isTap = false) => {
onShow(() => { onShow(() => {
tableList.value = [] //
total.value = 0 const cachedScrollTop = uni.getStorageSync('scrollTop')
getTableList(true) const cachedQueryParams = uni.getStorageSync('queryParams')
const cachedActiveTab = uni.getStorageSync('activeTab')
// /
if (shouldRestoreScroll.value && cachedScrollTop) {
scrollTop.value = cachedScrollTop
// DOM
setTimeout(() => {
scrollTop.value = cachedScrollTop
}, 100)
}
//
shouldRestoreScroll.value = true
//
getTableList(true)
}) })
let timer = null let timer = null
@ -260,6 +277,7 @@ const onScroll = (e) => {
timer = setTimeout(() => { timer = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop) uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value)) uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
uni.setStorageSync('activeTab', activeTab.value)
}, 500) }, 500)
} }
@ -291,13 +309,15 @@ const changeTab = (index) => {
} }
// //
const handleItem = (item) => { const handleItem = (item) => {
console.log(item) console.log(item)
if(item.repairStatusCode=="0" || item.repairStatusCode=="4" || item.repairStatusCode=="3"){ shouldRestoreScroll.value = true
uni.navigateTo({ url: `/pages/repair/repairManage/details?taskId=${item.taskId}` }) uni.setStorageSync('fromDetailOperation', false)
}else{
uni.navigateTo({ url: `/pages/repair/repairManage/view?taskId=${item.taskId}` }) if(item.repairStatusCode=="0" || item.repairStatusCode=="4" || item.repairStatusCode=="3"){
} uni.navigateTo({ url: `/pages/repair/repairManage/details?taskId=${item.taskId}` })
}else{
uni.navigateTo({ url: `/pages/repair/repairManage/view?taskId=${item.taskId}` })
}
} }
// //