This commit is contained in:
niedongsheng 2026-05-06 10:59:32 +08:00
commit fa880703b2
3 changed files with 335 additions and 245 deletions

View File

@ -1,40 +1,47 @@
<template>
<PageContainer title="恢复重建" @click-back="handleClickBack">
<SearchInput v-model="searchValue" />
<PageContainer title="恢复重建" @click-back="handleClickBack">
<SearchInput v-model="searchValue" />
<CurrentSite />
<CurrentSite />
<div class="list-panel">
<CardItem v-for="(item, index) in list" :key="index" :title="`${item.projectName}`"
@click="handleClickItem(item)">
<template #headerExtra>
<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 type="warning" plain size="medium">待审批</van-tag>
</template>
<div class="list-panel">
<van-list :loading="loading" :finished="finished" finished-text="没有更多了" @load="handleLoadMore">
<CardItem v-for="(item, index) in list" :key="index" :title="`${item.projectName}`" @click="handleClickItem(item)">
<template #headerExtra>
<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 type="warning" plain size="medium">待审批</van-tag>
</template>
<div class="content">
<div class="left-info">
<div><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 class="right-arrow" @click.stop="handleClickItem(item)">
<van-icon name="arrow" />
</div>
</div>
</CardItem>
<div class="content">
<div class="left-info">
<div>
<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 class="right-arrow" @click.stop="handleClickItem(item)">
<van-icon name="arrow" />
</div>
</div>
</CardItem>
<!-- 空状态提示 -->
<EmptyBox v-if="list.length === 0" placeholder="暂无相关预警信息" />
</div>
<!-- 空状态提示 -->
<!-- <EmptyBox v-if="list.length === 0" placeholder="暂无相关预警信息" /> -->
</van-list>
</div>
<van-button type="primary" class="add-btn" icon="plus" @click="handleAddDevice">
项目填报
</van-button>
</PageContainer>
<van-button type="primary" class="add-btn" icon="plus" @click="handleAddDevice"> 项目填报 </van-button>
</PageContainer>
</template>
<script setup>
@ -45,30 +52,58 @@ import SearchInput from '@/components/SearchInput.vue'
import CurrentSite from '@/components/CurrentSite.vue'
import CardItem from '@/components/CardItem.vue'
import EmptyBox from '@/components/EmptyBox.vue'
import { request } from "../../../../shared/utils/request";
import { request } from '../../../../shared/utils/request'
const router = useRouter()
const loading = ref(false)
const finished = ref(false)
const pageNum = ref(1)
const pageSize = 10
onMounted(() => {
getData()
getData({ reset: true })
})
const getData = async () => {
const getData = async ({ reset = false } = {}) => {
if (loading.value) return
if (reset) {
pageNum.value = 1
finished.value = false
list.value = []
}
if (finished.value) return
loading.value = true
try {
const params = {
pageNum: 1,
pageSize: 999,
pageNum: pageNum.value,
pageSize,
}
if (searchValue.value) {
params.districtName = searchValue.value
params.districtName = searchValue.value.trim()
}
const res = await request({
url: '/snow-ops-platform/recovery/list',
method: 'GET',
params
url: '/snow-ops-platform/recovery/list',
method: 'GET',
params,
})
if (res.code === '00000') {
list.value = res.data.records
if (res.code === '00000' && res.data?.records) {
list.value = reset ? res.data.records : [...list.value, ...res.data.records]
const total = Number(res.data.total || 0)
finished.value = list.value.length >= total || res.data.records.length < pageSize
pageNum.value += 1
}
} catch (error) {
console.error('获取列表失败:', error)
showToast('获取数据失败,请稍后重试')
finished.value = true
} finally {
loading.value = false
}
}
//
@ -77,83 +112,88 @@ const searchValue = ref('')
//
const list = ref([])
const handleClickBack = () => {
router.push('/')
router.push('/')
}
const handleClickItem = (item) => {
router.push({
name: 'RebuildDetails',
params: {
data: encodeURIComponent(JSON.stringify(item.id))
}
})
router.push({
name: 'RebuildDetails',
params: {
data: encodeURIComponent(JSON.stringify(item.id)),
},
})
}
const handleAddDevice = () => {
router.push('/rebuild-add')
// router.push({
// name: "RebuildAdd",
// params: {
// data: encodeURIComponent(JSON.stringify(11)),
// },
// });
router.push('/rebuild-add')
// router.push({
// name: "RebuildAdd",
// params: {
// data: encodeURIComponent(JSON.stringify(11)),
// },
// });
}
watch(() => searchValue.value, () => {
getData()
})
const handleLoadMore = () => {
if (loading.value) return
getData()
}
watch(
() => searchValue.value,
() => {
getData({ reset: true })
},
)
</script>
<style scoped lang="scss">
.list-panel {
display: flex;
flex-direction: column;
gap: 8px;
display: flex;
flex-direction: column;
gap: 8px;
}
.content {
display: flex;
justify-content: space-between;
align-items: center;
display: flex;
justify-content: space-between;
align-items: center;
}
.left-info {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 14px;
display: flex;
flex-direction: column;
gap: 4px;
font-size: 14px;
.label {
color: #666;
}
.label {
color: #666;
}
.value {
color: #aaa;
}
.value {
color: #aaa;
}
}
.right-arrow {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
cursor: pointer;
}
.add-btn {
position: fixed;
bottom: 20px;
left: 16px;
right: 16px;
width: calc(100% - 32px);
margin: 0 auto;
border-radius: 24px;
font-size: 16px;
height: 44px;
z-index: 999;
position: fixed;
bottom: 20px;
left: 16px;
right: 16px;
width: calc(100% - 32px);
margin: 0 auto;
border-radius: 24px;
font-size: 16px;
height: 44px;
z-index: 999;
}
</style>

View File

@ -1,59 +1,109 @@
<template>
<PageContainer title="项目填报" @click-back="handleClickBack">
<div class="content">
<PanelItem>
<van-form ref="formRef" label-align="left" colon>
<van-field v-model="form.project.districtName" label="区县名称" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写区县名称' }]" />
<RoadRoutesPicker v-model="form.project.routeNo" label="线路编号" center placeholder="请选择" required
:rules="[{ required: true, message: '请选择线路编号' }]" @change="handleRouteNoChange" />
<van-field v-model="form.project.startStakeNo" label="起点桩号" disabled center placeholder="请选择线路编号"
required :rules="[{ required: true, message: '请填写起点桩号' }]" />
<van-field v-model="form.project.endStakeNo" label="止点桩号" disabled center placeholder="请选择线路编号"
required :rules="[{ required: true, message: '请填写止点桩号' }]" />
<van-field v-model="form.project.implementMileage" label="实施里程" center placeholder="单位:公里" required
type="number" :rules="[{ required: true, message: '请填写实施里程' }]">
<template #extra>
公里
</template>
</van-field>
<van-field v-model="form.project.earthworkLoss" label="塌方及损失" center placeholder="(方/万元)" required
:rules="[{ required: true, message: '请填写塌方及损失' }]" />
<van-field v-model="form.project.disasterType" label="灾害类型" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写灾害类型' }]" />
<van-field v-model="form.project.locationRoute" label="地点路线" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写地点路线' }]" />
<van-field v-model="form.project.roadLocation" label="路况位置" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写路况位置' }]" />
<van-field v-model="form.project.blockedPointName" label="阻断点小地名" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写阻断点小地名' }]" />
<van-field v-model="form.project.estimatedCost" label="恢复重建预估费用" center placeholder="请填写" required
:rules="[{ required: true, message: '请填写恢复重建预估费用' }]">
<template #extra>
万元
</template>
</van-field>
<DisasterFileUpload label="附件上传" v-model="form.fileList"></DisasterFileUpload>
</van-form>
</PanelItem>
</div>
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd">
提交
</van-button>
</PageContainer>
<PageContainer title="项目填报" @click-back="handleClickBack">
<div class="content">
<PanelItem>
<van-form ref="formRef" label-align="left" colon>
<van-field
v-model="form.project.districtName"
label="区县名称"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写区县名称' }]"
/>
<RoadRoutesPicker
v-model="form.project.routeNo"
label="线路编号"
center
placeholder="请选择"
:rules="[{ required: true, message: '请选择线路编号' }]"
@change="handleRouteNoChange"
/>
<van-field
v-model="form.project.startStakeNo"
label="起点桩号"
disabled
center
placeholder="请选择线路编号"
:rules="[{ required: true, message: '请填写起点桩号' }]"
/>
<van-field
v-model="form.project.endStakeNo"
label="止点桩号"
disabled
center
placeholder="请选择线路编号"
:rules="[{ required: true, message: '请填写止点桩号' }]"
/>
<van-field
v-model="form.project.implementMileage"
label="实施里程"
center
placeholder="单位:公里"
type="number"
:rules="[{ required: true, message: '请填写实施里程' }]"
>
<template #extra> 公里 </template>
</van-field>
<van-field
v-model="form.project.earthworkLoss"
label="塌方及损失"
center
placeholder="(方/万元)"
:rules="[{ required: true, message: '请填写塌方及损失' }]"
/>
<van-field
v-model="form.project.disasterType"
label="灾害类型"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写灾害类型' }]"
/>
<van-field
v-model="form.project.locationRoute"
label="地点路线"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写地点路线' }]"
/>
<van-field
v-model="form.project.roadLocation"
label="路况位置"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写路况位置' }]"
/>
<van-field
v-model="form.project.blockedPointName"
label="阻断点小地名"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写阻断点小地名' }]"
/>
<van-field
v-model="form.project.estimatedCost"
label="恢复重建预估费用"
center
placeholder="请填写"
:rules="[{ required: true, message: '请填写恢复重建预估费用' }]"
>
<template #extra> 万元 </template>
</van-field>
<DisasterFileUpload label="附件上传" v-model="form.fileList"></DisasterFileUpload>
</van-form>
</PanelItem>
</div>
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd"> 提交 </van-button>
</PageContainer>
</template>
<script setup>
import { ref, onMounted, watch, reactive, toRaw } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import PageContainer from '@/components/PageContainer.vue'
import { showToast, showLoadingToast } from "vant";
import { showToast, showLoadingToast } from 'vant'
import PanelItem from '@/components/PanelItem.vue'
import { request } from "../../../../shared/utils/request";
import { request } from '../../../../shared/utils/request'
import RoadRoutesPicker from '../DisasterManagement/components/RoadRoutesPicker.vue'
import DisasterFileUpload from '../DisasterManagement/components/DisasterFileUpload.vue'
@ -61,136 +111,132 @@ const router = useRouter()
const route = useRoute()
const form = reactive({
project: {
districtName: null,
routeNo: null,
startStakeNo: null,
endStakeNo: null,
implementMileage: null,
earthworkLoss: null,
disasterType: null,
locationRoute: null,
roadLocation: null,
blockedPointName: null,
estimatedCost: null,
},
fileList: []
project: {
districtName: null,
routeNo: null,
startStakeNo: null,
endStakeNo: null,
implementMileage: null,
earthworkLoss: null,
disasterType: null,
locationRoute: null,
roadLocation: null,
blockedPointName: null,
estimatedCost: null,
},
fileList: [],
})
const formRef = ref();
const formRef = ref()
//
const getDetail = async (id) => {
try {
const res = await request({
url: '/snow-ops-platform/water-damage/getById',
method: 'GET',
params: {
id
}
})
if (res.code === '00000') {
form.project.districtName = res.data.event.district
form.project.routeNo = res.data.routeNo
form.project.startStakeNo = res.data.event.startStakeNo
form.project.endStakeNo = res.data.event.endStakeNo
form.project.implementMileage = res.data.event.blockedMileage
form.project.earthworkLoss = Array.isArray(res.data.lossList) ? res.data.lossList.reduce((sum, item) => sum + (item.totalAmount || 0), 0) : 0
form.project.disasterType = res.data.roadConditionType
form.project.locationRoute = res.data.occurLocation
form.project.roadLocation = res.data.event.blockedPointName
form.project.blockedPointName = res.data.event.blockedPointName
form.project.estimatedCost = res.data.event.estimatedRecoveryCost
form.fileList = res.data.fileList || []
} else {
throw new Error(res.message)
}
} catch (error) {
showToast({
type: "fail",
message: error.message,
});
try {
const res = await request({
url: '/snow-ops-platform/water-damage/getById',
method: 'GET',
params: {
id,
},
})
if (res.code === '00000') {
form.project.districtName = res.data.event.district
form.project.routeNo = res.data.routeNo
form.project.startStakeNo = res.data.event.startStakeNo
form.project.endStakeNo = res.data.event.endStakeNo
form.project.implementMileage = res.data.event.blockedMileage
form.project.earthworkLoss = Array.isArray(res.data.lossList) ? res.data.lossList.reduce((sum, item) => sum + (item.totalAmount || 0), 0) : 0
form.project.disasterType = res.data.roadConditionType
form.project.locationRoute = res.data.occurLocation
form.project.roadLocation = res.data.event.blockedPointName
form.project.blockedPointName = res.data.event.blockedPointName
form.project.estimatedCost = res.data.event.estimatedRecoveryCost
form.fileList = res.data.fileList || []
} else {
throw new Error(res.message)
}
} catch (error) {
showToast({
type: 'fail',
message: error.message,
})
}
}
onMounted(() => {
if (route.params.data) {
const data = JSON.parse(decodeURIComponent(route.params.data));
// console.log('@@@@data', data);
//
getDetail(data);
} else {
// console.log('');
}
if (route.params.data) {
const data = JSON.parse(decodeURIComponent(route.params.data))
// console.log('@@@@data', data);
//
getDetail(data)
} else {
// console.log('');
}
})
const handleClickBack = () => {
if (route.params.data) {
router.push('/')
} else {
router.push('/rebuild')
}
if (route.params.data) {
router.push('/')
} else {
router.push('/rebuild')
}
}
const handleAdd = async () => {
//
if (!formRef.value) {
showToast('表单初始化失败');
return;
}
//
if (!formRef.value) {
showToast('表单初始化失败')
return
}
try {
const isValid = await formRef.value.validate();
//
const toast = showLoadingToast({
message: "上报中...",
forbidClick: true,
duration: 0, // 0
});
console.log('表单校验通过,提交数据:', form);
try {
const isValid = await formRef.value.validate()
//
const toast = showLoadingToast({
message: '上报中...',
forbidClick: true,
duration: 0, // 0
})
console.log('表单校验通过,提交数据:', form)
const res = await request({
url: '/snow-ops-platform/recovery/add',
method: 'POST',
data: form
})
toast.close();
if (res.code === '00000') {
showToast('提交成功');
handleClickBack();
} else {
showToast('提交失败, 请稍后重试或联系管理员');
}
} catch (error) {
// console.log(':', error);
showToast('请检查并完善表单信息');
const res = await request({
url: '/snow-ops-platform/recovery/add',
method: 'POST',
data: form,
})
toast.close()
if (res.code === '00000') {
showToast('提交成功')
handleClickBack()
} else {
showToast('提交失败, 请稍后重试或联系管理员')
}
} catch (error) {
// console.log(':', error);
showToast('请检查并完善表单信息')
}
}
const handleRouteNoChange = (item) => {
form.project.startStakeNo = item.startStakeNo
form.project.endStakeNo = item.endStakeNo
form.project.startStakeNo = item.startStakeNo
form.project.endStakeNo = item.endStakeNo
}
</script>
<style scoped lang="scss">
.content {
padding: 20px 0px 80px 0px;
padding: 20px 0px 80px 0px;
}
.add-btn {
position: fixed;
bottom: 20px;
left: 16px;
right: 16px;
width: calc(100% - 32px);
margin: 0 auto;
border-radius: 24px;
font-size: 16px;
height: 44px;
z-index: 999;
position: fixed;
bottom: 20px;
left: 16px;
right: 16px;
width: calc(100% - 32px);
margin: 0 auto;
border-radius: 24px;
font-size: 16px;
height: 44px;
z-index: 999;
}
</style>

View File

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