feat: 恢复重建H5 添加加载状态

This commit is contained in:
huangchenhao 2026-05-06 09:31:28 +08:00
parent db10d94b16
commit ea1dc1afc4
2 changed files with 116 additions and 101 deletions

View File

@ -5,8 +5,8 @@
<CurrentSite /> <CurrentSite />
<div class="list-panel"> <div class="list-panel">
<CardItem v-for="(item, index) in list" :key="index" :title="`${item.projectName}`" <van-list :loading="loading" :finished="finished" finished-text="没有更多了">
@click="handleClickItem(item)"> <CardItem v-for="(item, index) in list" :key="index" :title="`${item.projectName}`" @click="handleClickItem(item)">
<template #headerExtra> <template #headerExtra>
<van-tag v-if="item.approvalStatus === 3 || item.approvalStatus === 1" type="success" plain size="medium">审批通过</van-tag> <van-tag v-if="item.approvalStatus === 3 || item.approvalStatus === 1" type="success" plain size="medium">审批通过</van-tag>
<van-tag v-else-if="item.approvalStatus === 2 || item.approvalStatus === 4" type="danger" plain size="medium">审批驳回</van-tag> <van-tag v-else-if="item.approvalStatus === 2 || item.approvalStatus === 4" type="danger" plain size="medium">审批驳回</van-tag>
@ -15,11 +15,19 @@
<div class="content"> <div class="content">
<div class="left-info"> <div class="left-info">
<div><span class="label">起止桩号</span><span class="value">{{ `${item.startStakeNo} - <div>
${item.endStakeNo}`}}</span> <span class="label">起止桩号</span
><span class="value">{{
`${item.startStakeNo} -
${item.endStakeNo}`
}}</span>
</div>
<div>
<span class="label">路况位置</span><span class="value">{{ item.roadLocation }}</span>
</div>
<div>
<span class="label">提交日期</span><span class="value">{{ item.submitTime }}</span>
</div> </div>
<div><span class="label">路况位置</span><span class="value">{{ item.roadLocation }}</span></div>
<div><span class="label">提交日期</span><span class="value">{{ item.submitTime }}</span></div>
</div> </div>
<div class="right-arrow" @click.stop="handleClickItem(item)"> <div class="right-arrow" @click.stop="handleClickItem(item)">
<van-icon name="arrow" /> <van-icon name="arrow" />
@ -28,12 +36,11 @@
</CardItem> </CardItem>
<!-- 空状态提示 --> <!-- 空状态提示 -->
<EmptyBox v-if="list.length === 0" placeholder="暂无相关预警信息" /> <!-- <EmptyBox v-if="list.length === 0" placeholder="暂无相关预警信息" /> -->
</van-list>
</div> </div>
<van-button type="primary" class="add-btn" icon="plus" @click="handleAddDevice"> <van-button type="primary" class="add-btn" icon="plus" @click="handleAddDevice"> 项目填报 </van-button>
项目填报
</van-button>
</PageContainer> </PageContainer>
</template> </template>
@ -45,9 +52,11 @@ import SearchInput from '@/components/SearchInput.vue'
import CurrentSite from '@/components/CurrentSite.vue' import CurrentSite from '@/components/CurrentSite.vue'
import CardItem from '@/components/CardItem.vue' import CardItem from '@/components/CardItem.vue'
import EmptyBox from '@/components/EmptyBox.vue' import EmptyBox from '@/components/EmptyBox.vue'
import { request } from "../../../../shared/utils/request"; import { request } from '../../../../shared/utils/request'
const router = useRouter() const router = useRouter()
const loading = ref(false)
const finished = ref(false)
onMounted(() => { onMounted(() => {
getData() getData()
@ -61,14 +70,16 @@ const getData = async () => {
if (searchValue.value) { if (searchValue.value) {
params.districtName = searchValue.value params.districtName = searchValue.value
} }
loading.value = true
const res = await request({ const res = await request({
url: '/snow-ops-platform/recovery/list', url: '/snow-ops-platform/recovery/list',
method: 'GET', method: 'GET',
params params,
}) })
if (res.code === '00000') { if (res.code === '00000') {
list.value = res.data.records list.value = res.data.records
} }
loading.value = false
} }
// //
@ -77,7 +88,6 @@ const searchValue = ref('')
// //
const list = ref([]) const list = ref([])
const handleClickBack = () => { const handleClickBack = () => {
router.push('/') router.push('/')
} }
@ -86,8 +96,8 @@ const handleClickItem = (item) => {
router.push({ router.push({
name: 'RebuildDetails', name: 'RebuildDetails',
params: { params: {
data: encodeURIComponent(JSON.stringify(item.id)) data: encodeURIComponent(JSON.stringify(item.id)),
} },
}) })
} }
@ -101,11 +111,12 @@ const handleAddDevice = () => {
// }); // });
} }
watch(() => searchValue.value, () => { watch(
() => searchValue.value,
() => {
getData() getData()
}) },
)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,7 +1,7 @@
<template> <template>
<PageContainer title="项目填报" @click-back="handleClickBack"> <PageContainer title="项目填报" @click-back="handleClickBack">
<div class="content"> <div class="content">
<PanelItem> <PanelItem v-if="!loading">
<div class="detail"> <div class="detail">
<div class="header"> <div class="header">
<div class="header-title">{{ data.projectName }}</div> <div class="header-title">{{ data.projectName }}</div>
@ -26,7 +26,7 @@
<div class="item">恢复重建预估费用 {{ data.estimatedCost }}</div> <div class="item">恢复重建预估费用 {{ data.estimatedCost }}</div>
</div> </div>
</PanelItem> </PanelItem>
<PanelItem title="附件"> <PanelItem v-if="!loading" title="附件">
<div class="fileArea"> <div class="fileArea">
<van-image v-for="(item, index) in data?.fileList" :key="index" :src="item.fileUrl" fit="cover" <van-image v-for="(item, index) in data?.fileList" :key="index" :src="item.fileUrl" fit="cover"
width="100px" height="100px" style="margin: 10px" @click="showImage(item.fileUrl)"></van-image> width="100px" height="100px" style="margin: 10px" @click="showImage(item.fileUrl)"></van-image>
@ -56,6 +56,7 @@ const router = useRouter()
const route = useRoute() const route = useRoute()
const data = ref({}) const data = ref({})
const loading = ref(false)
onMounted(() => { onMounted(() => {
if (route.params.data) { if (route.params.data) {
@ -69,6 +70,7 @@ onMounted(() => {
const getDetaillData = async (id) => { const getDetaillData = async (id) => {
try { try {
loading.value = true
const res = await request({ const res = await request({
url: '/snow-ops-platform/recovery/getById', url: '/snow-ops-platform/recovery/getById',
method: 'GET', method: 'GET',
@ -82,6 +84,8 @@ const getDetaillData = async (id) => {
} catch (error) { } catch (error) {
showToast('获取详情失败,请稍后重试') showToast('获取详情失败,请稍后重试')
console.log('error', error); console.log('error', error);
} finally {
loading.value = false
} }
} }