Compare commits
2 Commits
f5310b8724
...
36fd9cc17c
| Author | SHA1 | Date | |
|---|---|---|---|
| 36fd9cc17c | |||
| 76ba1c03c7 |
@ -19,22 +19,32 @@ const routes = [
|
||||
{
|
||||
path: '/materialManage/:data',
|
||||
name: 'MaterialManage',
|
||||
component: () => import('../views//Material/MaterialManagement.vue')
|
||||
component: () => import('../views/Material/MaterialManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/staffManage',
|
||||
name: 'StaffManage',
|
||||
component: () => import('../views//Staff/StaffManagement.vue')
|
||||
component: () => import('../views/Staff/StaffManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/equipDetail/:data',
|
||||
name: 'EquipDetail',
|
||||
component: () => import('../views//Equipment/EquipmentDetails.vue')
|
||||
component: () => import('../views/Equipment/EquipmentDetails.vue')
|
||||
},
|
||||
{
|
||||
path: '/materialDetail/:data',
|
||||
name: 'MaterialDetail',
|
||||
component: () => import('../views//Material/MaterialDetails.vue')
|
||||
component: () => import('../views/Material/MaterialDetails.vue')
|
||||
},
|
||||
{
|
||||
path: '/iceEventManage/:data',
|
||||
name: 'IceEventManage',
|
||||
component: () => import('../views/IceEvent/IceEventManagement.vue')
|
||||
},
|
||||
{
|
||||
path: '/iceEventAdd/:data',
|
||||
name: 'IceEventAdd',
|
||||
component: () => import('../views/IceEvent/IceEventAdd.vue')
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@ -25,7 +25,14 @@
|
||||
}"
|
||||
/>
|
||||
<van-grid-item icon="setting-o" text="人员管理" to="/StaffManage" />
|
||||
<van-grid-item icon="setting-o" text="冰雪灾害" to="/IceHail" />
|
||||
<van-grid-item
|
||||
icon="setting-o"
|
||||
text="冰雪灾害"
|
||||
:to="{
|
||||
name: 'IceEventManage',
|
||||
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||
}"
|
||||
/>
|
||||
</van-grid>
|
||||
</div>
|
||||
|
||||
|
||||
517
packages/mobile/src/views/IceEvent/IceEventAdd.vue
Normal file
517
packages/mobile/src/views/IceEvent/IceEventAdd.vue
Normal file
@ -0,0 +1,517 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<van-nav-bar title="冰雪填报" fixed left-arrow @click-left="onClickLeft">
|
||||
</van-nav-bar>
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<h3>基本信息</h3>
|
||||
<van-form class="IceEventAddForm" label-align="left" colon>
|
||||
<van-field v-model="form.event.occurTime" label="发生时间" center>
|
||||
<template #button>
|
||||
<van-button
|
||||
plain
|
||||
round
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="getCurrentTime"
|
||||
>校准时间</van-button
|
||||
>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.event.occurLocation"
|
||||
label="发生地点"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
<van-field
|
||||
v-model="form.event.routeNo"
|
||||
label="线路编号"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
<van-field
|
||||
v-model="form.event.startStakeNo"
|
||||
label="起点桩号"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
<van-field
|
||||
v-model="form.event.endStakeNo"
|
||||
label="止点桩号"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
<van-field
|
||||
v-model="form.event.disasterMileage"
|
||||
label="受灾里程"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
</van-form>
|
||||
<h3>处置情况</h3>
|
||||
<van-form class="IceEventAddForm" label-align="left" colon>
|
||||
<van-field label="处置措施" center>
|
||||
<template #input>
|
||||
<div class="disposal-buttons">
|
||||
<van-button
|
||||
plain
|
||||
:type="
|
||||
form.event.disposalMeasures === '限速通行'
|
||||
? 'primary'
|
||||
: 'default'
|
||||
"
|
||||
size="small"
|
||||
@click="toggleDisposal('限速通行')"
|
||||
>
|
||||
限速通行
|
||||
</van-button>
|
||||
<van-button
|
||||
plain
|
||||
:type="
|
||||
form.event.disposalMeasures === '封闭交通'
|
||||
? 'primary'
|
||||
: 'default'
|
||||
"
|
||||
size="small"
|
||||
@click="toggleDisposal('封闭交通')"
|
||||
class="last-button"
|
||||
>
|
||||
封闭交通
|
||||
</van-button>
|
||||
</div>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.event.expectRecoverTime"
|
||||
label="预计恢复时间"
|
||||
center
|
||||
placeholder="请选择"
|
||||
readonly
|
||||
clickable
|
||||
@click="showExpectPicker = true"
|
||||
/>
|
||||
<van-popup
|
||||
:show="showExpectPicker"
|
||||
round
|
||||
position="bottom"
|
||||
close-on-click-overlay
|
||||
@close="showExpectPicker = false"
|
||||
>
|
||||
<van-date-picker
|
||||
type="datetime"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
@confirm="handleConfirmExpectTime"
|
||||
@cancel="showExpectPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
</van-form>
|
||||
<h3>实施情况</h3>
|
||||
<van-form class="IceEventAddForm" label-align="left" colon>
|
||||
<van-field
|
||||
v-model="form.material.snowMeltingAgent"
|
||||
type="number"
|
||||
label="融雪剂"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 吨 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.antiSlipSand"
|
||||
type="number"
|
||||
label="防滑沙"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 吨 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.antiSlipChains"
|
||||
type="number"
|
||||
label="防滑链"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 副 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.sandbags"
|
||||
type="number"
|
||||
label="麻袋"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 条 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.inputManpower"
|
||||
type="number"
|
||||
label="投入人力"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 人次 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.inputFunds"
|
||||
type="number"
|
||||
label="投入资金"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 万元 </template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.material.inputEquipment"
|
||||
type="number"
|
||||
label="投入设备"
|
||||
center
|
||||
placeholder="请填写"
|
||||
>
|
||||
<template #extra> 台班 </template>
|
||||
</van-field>
|
||||
<van-field label="当前通行情况" center>
|
||||
<template #input>
|
||||
<div class="disposal-buttons">
|
||||
<van-button
|
||||
plain
|
||||
:type="form.traffic.currentStatus === 1 ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="form.traffic.currentStatus = 1"
|
||||
>
|
||||
正常通行
|
||||
</van-button>
|
||||
<van-button
|
||||
plain
|
||||
:type="form.traffic.currentStatus === 2 ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="form.traffic.currentStatus = 2"
|
||||
>
|
||||
限速通行
|
||||
</van-button>
|
||||
<van-button
|
||||
plain
|
||||
:type="form.traffic.currentStatus === 3 ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="form.traffic.currentStatus = 3"
|
||||
class="last-button"
|
||||
>
|
||||
封闭交通
|
||||
</van-button>
|
||||
</div>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field label="有无车辆滞留" center>
|
||||
<template #input>
|
||||
<div class="disposal-buttons">
|
||||
<van-button
|
||||
plain
|
||||
:type="
|
||||
form.traffic.hasStrandedVehicles === 1 ? 'primary' : 'default'
|
||||
"
|
||||
size="small"
|
||||
@click="form.traffic.hasStrandedVehicles = 1"
|
||||
>
|
||||
有滞留
|
||||
</van-button>
|
||||
<van-button
|
||||
plain
|
||||
:type="
|
||||
form.traffic.hasStrandedVehicles === 0 ? 'primary' : 'default'
|
||||
"
|
||||
size="small"
|
||||
@click="form.traffic.hasStrandedVehicles = 0"
|
||||
class="last-button"
|
||||
>
|
||||
无滞留
|
||||
</van-button>
|
||||
</div>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
v-model="form.traffic.strandedVehicleCount"
|
||||
type="number"
|
||||
label="滞留车辆数"
|
||||
center
|
||||
placeholder="请填写"
|
||||
/>
|
||||
|
||||
<van-field
|
||||
v-model="form.traffic.actualRecoverTime"
|
||||
label="实际恢复时间"
|
||||
center
|
||||
placeholder="请选择"
|
||||
readonly
|
||||
clickable
|
||||
@click="showActualPicker = true"
|
||||
/>
|
||||
<van-popup
|
||||
:show="showActualPicker"
|
||||
round
|
||||
position="bottom"
|
||||
close-on-click-overlay
|
||||
@close="showActualPicker = false"
|
||||
>
|
||||
<van-date-picker
|
||||
type="datetime"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
@confirm="handleConfirmActualTime"
|
||||
@cancel="showActualPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
|
||||
<van-field label="附件" center>
|
||||
<template #input>
|
||||
<van-uploader
|
||||
v-model="fileList"
|
||||
@delete="handleDelete"
|
||||
name="photos"
|
||||
:file-list="fileList"
|
||||
:file-type="['image/jpeg', 'image/png']"
|
||||
:after-read="afterRead"
|
||||
multiple
|
||||
:max-count="6"
|
||||
/>
|
||||
</template>
|
||||
</van-field>
|
||||
</van-form>
|
||||
</div>
|
||||
|
||||
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd">
|
||||
填报
|
||||
</van-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, reactive, toRaw, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
import { request } from "../../../../shared/utils/request";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const yhzDetail = ref({}); // 养护站详情数据
|
||||
const INIT_FORM = reactive({
|
||||
event: {
|
||||
occurLocation: "", // 发生地点
|
||||
routeNo: "", // 线路编号
|
||||
occurTime: "", // 发生时间
|
||||
startStakeNo: "", // 起点桩号
|
||||
endStakeNo: "", // 止点桩号
|
||||
disasterMileage: "", // 受灾里程
|
||||
expectRecoverTime: "", // 预计恢复时间
|
||||
actualRecoverTime: "", // 实际恢复时间
|
||||
serviceStationId: "", // 养护站ID
|
||||
district: "", // 所属区县
|
||||
reportTime: "", // 填报时间
|
||||
reporterPhone: "", // 填报人手机号
|
||||
disposalMeasures: "", // 处置措施
|
||||
createTime: "", // 创建时间
|
||||
updateTime: "", // 更新时间
|
||||
isDeleted: "", // 是否删除 0-未删除 1-已删除
|
||||
},
|
||||
material: {
|
||||
inputManpower: null, // 投入人力
|
||||
inputFunds: null, // 投入资金
|
||||
inputEquipment: null, // 投入设备
|
||||
snowMeltingAgent: null, // 融雪剂
|
||||
sandbags: null, // 麻袋
|
||||
antiSlipSand: null, // 防滑沙
|
||||
antiSlipChains: null, // 防滑链
|
||||
createTime: "", // 创建时间
|
||||
updateTime: "", // 更新时间
|
||||
},
|
||||
traffic: {
|
||||
currentStatus: 0, // 当前通行情况 1-正常通行 2-限速通行 3-封闭交通
|
||||
hasStrandedVehicles: 0, // 是否有车辆滞留 0-无 1-有
|
||||
strandedVehicleCount: null, // 车辆滞留数量
|
||||
actualRecoverTime: "", // 实际恢复时间
|
||||
createTime: "", // 创建时间
|
||||
updateTime: "", // 更新时间
|
||||
},
|
||||
photos: [],
|
||||
});
|
||||
const form = reactive({ ...INIT_FORM });
|
||||
const fileList = ref([]);
|
||||
|
||||
// 日期格式化
|
||||
const formatTime = (date = new Date()) => {
|
||||
const pad = (n) => n.toString().padStart(2, "0");
|
||||
return (
|
||||
`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
|
||||
date.getDate()
|
||||
)} ` +
|
||||
`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(
|
||||
date.getSeconds()
|
||||
)}`
|
||||
);
|
||||
};
|
||||
|
||||
const getCurrentTime = () => {
|
||||
form.event.occurTime = formatTime();
|
||||
};
|
||||
|
||||
const toggleDisposal = (type) => {
|
||||
form.event.disposalMeasures =
|
||||
form.event.disposalMeasures === type ? "" : type;
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data));
|
||||
console.log("yhzDetail", toRaw(yhzDetail.value));
|
||||
form.event.occurTime = formatTime(); // 初始化为当前时间
|
||||
});
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push({
|
||||
name: "IceEventManage",
|
||||
params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) },
|
||||
});
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
console.log("form", toRaw(form));
|
||||
};
|
||||
|
||||
// 预计恢复时间相关
|
||||
const showExpectPicker = ref(false);
|
||||
const minDate = new Date();
|
||||
const maxDate = new Date(2050, 11, 31);
|
||||
const handleConfirmExpectTime = ({ selectedValues }) => {
|
||||
form.event.expectRecoverTime = selectedValues.join("-");
|
||||
showExpectPicker.value = false;
|
||||
};
|
||||
// 实际恢复时间相关
|
||||
const showActualPicker = ref(false);
|
||||
const handleConfirmActualTime = ({ selectedValues }) => {
|
||||
form.traffic.actualRecoverTime = selectedValues.join("-");
|
||||
showActualPicker.value = false;
|
||||
};
|
||||
|
||||
// 文件上传
|
||||
const afterRead = async (file) => {
|
||||
try {
|
||||
const toast = showLoadingToast({
|
||||
message: "上传中...",
|
||||
forbidClick: true,
|
||||
duration: 0, // 设置为0表示不会自动关闭
|
||||
});
|
||||
const formData = new FormData();
|
||||
formData.append("file", file.file);
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/file/upload",
|
||||
method: "post",
|
||||
data: formData,
|
||||
});
|
||||
toast.close();
|
||||
if (res.code === "00000") {
|
||||
form.photos.push({ photoUrl: res.data });
|
||||
const index = fileList.value.findIndex((f) => f.file === file.file);
|
||||
if (index !== -1) {
|
||||
fileList.value[index].serverUrl = res.data;
|
||||
}
|
||||
|
||||
console.log("form.photos", toRaw(form.photos));
|
||||
console.log("fileList.value", fileList.value);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
toast.close();
|
||||
showToast({
|
||||
type: "fail",
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 文件删除
|
||||
const handleDelete = (file) => {
|
||||
if (file.serverUrl) {
|
||||
const index = form.photos.findIndex((p) => p.photoUrl === file.serverUrl);
|
||||
if (index !== -1) {
|
||||
form.photos.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px 16px 80px 16px;
|
||||
}
|
||||
|
||||
.content .van-cell-group .van-cell {
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
|
||||
.IceEventAddForm {
|
||||
padding: 16px 16px 16px 16px;
|
||||
}
|
||||
|
||||
.disposal-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.disposal-buttons .van-button {
|
||||
flex: 1;
|
||||
}
|
||||
.last-button {
|
||||
margin-right: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
116
packages/mobile/src/views/IceEvent/IceEventDetails.vue
Normal file
116
packages/mobile/src/views/IceEvent/IceEventDetails.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<van-nav-bar title="物资管理" fixed left-arrow @click-left="onClickLeft" />
|
||||
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
title="物资信息"
|
||||
style="font-size: 18px; font-weight: bold; line-height: inherit"
|
||||
>
|
||||
</van-cell>
|
||||
<van-cell :title="'物资名称: ' + wzDetailData.wzmc"> </van-cell>
|
||||
<van-cell :title="'数量: ' + wzDetailData.sl"> </van-cell>
|
||||
<van-cell :title="'余量: ' + wzDetailData.ye"> </van-cell>
|
||||
<van-cell :title="'单位: ' + wzDetailData.dw"> </van-cell>
|
||||
<van-cell :title="'存放地点: ' + wzDetailData.cfdd"> </van-cell>
|
||||
<van-cell :title="'区县名称: ' + wzDetailData.qxmc"> </van-cell>
|
||||
<van-cell :title="'负责人: ' + wzDetailData.fzr"> </van-cell>
|
||||
<van-cell :title="'联系电话: ' + wzDetailData.lxdh"> </van-cell>
|
||||
<van-cell :title="'入库日期: ' + wzDetailData.rkrq"> </van-cell>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, toRaw, reactive } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
import { request } from "../../../../shared/utils/request";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const yhzDetail = ref({});
|
||||
const wzData = ref([]);
|
||||
const wzDetailData = ref({}); // 物资详情数据
|
||||
|
||||
onMounted(() => {
|
||||
const data = JSON.parse(decodeURIComponent(route.params.data));
|
||||
yhzDetail.value = data.yhzDetail;
|
||||
wzData.value = data.material;
|
||||
console.log("传递过来的参数:", data);
|
||||
getwzDetail();
|
||||
});
|
||||
|
||||
// 获取物资详情
|
||||
const getwzDetail = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yjwz/getById?rid=${wzData.value.rid}`,
|
||||
method: "GET",
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
wzDetailData.value = res.data;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({
|
||||
message: error.message,
|
||||
type: "error",
|
||||
});
|
||||
console.log("error", error);
|
||||
}
|
||||
};
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push({
|
||||
name: "MaterialManage",
|
||||
params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) },
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
</style>
|
||||
|
||||
176
packages/mobile/src/views/IceEvent/IceEventManagement.vue
Normal file
176
packages/mobile/src/views/IceEvent/IceEventManagement.vue
Normal file
@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<van-nav-bar title="冰雪灾害" fixed left-arrow @click-left="onClickLeft">
|
||||
</van-nav-bar>
|
||||
<van-search
|
||||
shape="round"
|
||||
v-model="searchValue"
|
||||
:show-action="false"
|
||||
placeholder="请输入地点关键词"
|
||||
/>
|
||||
<van-cell-group>
|
||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="content">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
v-for="(item, index) in eventList"
|
||||
:key="index"
|
||||
:title="item.wzmc"
|
||||
is-link
|
||||
:label="`填报时间:${item.sl} (${item.dw})`"
|
||||
:to="{
|
||||
name: 'MaterialDetail',
|
||||
params: {
|
||||
data: encodeURIComponent(
|
||||
JSON.stringify({
|
||||
yhzDetail: yhzDetail,
|
||||
material: item,
|
||||
})
|
||||
),
|
||||
},
|
||||
}"
|
||||
>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
|
||||
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd">
|
||||
冰雪填报
|
||||
</van-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vant/es/toast/style";
|
||||
import "vant/es/popup/style";
|
||||
import { ref, onMounted, reactive, toRaw, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { showToast, showLoadingToast } from "vant";
|
||||
import { request } from "../../../../shared/utils/request";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const searchValue = ref(""); // 搜索框输入值
|
||||
const yhzDetail = ref({}); // 养护站详情数据
|
||||
const eventList = ref([]); // 冰雪灾害列表
|
||||
|
||||
|
||||
// 根据养护站rid获取冰雪事件列表
|
||||
const getIceEventList = async (occurLocation) => {
|
||||
try {
|
||||
const yhzid = yhzDetail.value.id;
|
||||
if (!yhzid) {
|
||||
return;
|
||||
}
|
||||
const data = {
|
||||
yhzid,
|
||||
occurLocation,
|
||||
paageNum: 1,
|
||||
paageSize: 9999,
|
||||
};
|
||||
const res = await request({
|
||||
url: "/snow-ops-platform/event/list",
|
||||
method: "GET",
|
||||
params: data,
|
||||
});
|
||||
if (res.code && res.code === "00000") {
|
||||
eventList.value = res.data.records;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
showToast({
|
||||
type: "error",
|
||||
message: error.message || "获取物资列表失败",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data));
|
||||
console.log("yhzDetail", toRaw(yhzDetail.value));
|
||||
getIceEventList();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => searchValue.value,
|
||||
(newVal, oldVal) => {
|
||||
if (newVal !== oldVal) {
|
||||
getIceEventList(newVal);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
name: "IceEventAdd",
|
||||
params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) },
|
||||
})
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px 16px 80px 16px;
|
||||
}
|
||||
|
||||
.content .van-cell-group .van-cell {
|
||||
margin-bottom: 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.grid {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
.status-good {
|
||||
background-color: #07c160;
|
||||
}
|
||||
.status-warning {
|
||||
background-color: #ff976a;
|
||||
}
|
||||
.status-danger {
|
||||
background-color: #ee0a24;
|
||||
}
|
||||
|
||||
.materialAddForm {
|
||||
padding: 16px 16px 80px 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view />
|
||||
<Index></Index>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
<script setup>
|
||||
import Index from "./views/index.vue";
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
|
||||
BIN
packages/screen/src/assets/imgs/header.png
Normal file
BIN
packages/screen/src/assets/imgs/header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
packages/screen/src/assets/imgs/logo.png
Normal file
BIN
packages/screen/src/assets/imgs/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
packages/screen/src/assets/imgs/menu.png
Normal file
BIN
packages/screen/src/assets/imgs/menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 187 KiB |
52
packages/screen/src/component/MenuBar/index.js
Normal file
52
packages/screen/src/component/MenuBar/index.js
Normal file
@ -0,0 +1,52 @@
|
||||
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
import { Search } from "@element-plus/icons-vue";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
const menuList = ref([])
|
||||
|
||||
// 获取菜单列表
|
||||
const getMenuList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/menu/getMenus',
|
||||
method: 'GET'
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
menuList.value = res.data
|
||||
} else {
|
||||
throw new Error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export default () => {
|
||||
|
||||
// 点击菜单处理
|
||||
const router = useRouter();
|
||||
const handleMenuClick = (menu) => {
|
||||
console.log('menu', menu)
|
||||
if (menu.path) {
|
||||
router.push({
|
||||
path: menu.path,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getMenuList()
|
||||
})
|
||||
|
||||
return {
|
||||
menuList,
|
||||
handleMenuClick,
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
48
packages/screen/src/component/MenuBar/index.vue
Normal file
48
packages/screen/src/component/MenuBar/index.vue
Normal file
@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<el-menu class="MyMenu" :default-active="`1-${script.menuList.value[0]?.children[0]?.uid}`">
|
||||
<el-sub-menu index="1">
|
||||
<template #title>
|
||||
<span>{{ script.menuList.value[0]?.title }}</span>
|
||||
</template>
|
||||
<el-menu-item
|
||||
:index="`1-${menuItem.uid}`"
|
||||
:key="menuItem.uid"
|
||||
v-for="menuItem in script.menuList.value[0]?.children"
|
||||
@click="script.handleMenuClick(menuItem)"
|
||||
>
|
||||
<img :src="menuItem.icon" class="menu-icon" v-if="menuItem.icon" />
|
||||
<span>{{ menuItem.title }}</span>
|
||||
</el-menu-item>
|
||||
</el-sub-menu>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Menu as IconMenu, HomeFilled } from "@element-plus/icons-vue";
|
||||
import scriptFn from "./index.js";
|
||||
const script = scriptFn();
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.MyMenu {
|
||||
padding: 16px;
|
||||
--el-menu-bg-color: transparent;
|
||||
--el-menu-active-color: #fff;
|
||||
:deep(.el-menu-item) {
|
||||
border-radius: 5px;
|
||||
transition: all 0.3s;
|
||||
&:hover {
|
||||
transform: translateX(5px);
|
||||
}
|
||||
}
|
||||
:deep(.el-menu-item.is-active) {
|
||||
background-color: #34acf7 !important;
|
||||
}
|
||||
.menu-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -5,6 +5,19 @@ const service = axios.create({
|
||||
timeout: 10000
|
||||
})
|
||||
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
// 暂时先写死token 实际项目中再调整token的获取位置
|
||||
const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjE5ODU1OTk2NjUxNDk4NjE4OTAsImFjY291bnQiOiJyZWd1bGFyQWRtaW4iLCJ1dWlkIjoiMDBhYTkyYzItYzFlZi00MmNiLWEzZGMtNzFkNDdjODc0YmI2IiwicmVtZW1iZXJNZSI6dHJ1ZSwiZXhwaXJhdGlvbkRhdGUiOjE3NjI1MzAzNjEzMDIsIm90aGVycyI6bnVsbCwic3ViIjoiMTk4NTU5OTY2NTE0OTg2MTg5MCIsImlhdCI6MTc2MjUwMTU2MSwiZXhwIjoxNzYyNTMwMzYxfQ.z38vXkxdJETfUBXrG45QIMTQcIt3qeshlOo95qyL0y198rMJUq_SF8mmMvMJhInHFJ1_0wX7dmL39acT0w5Ccw'
|
||||
// const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
config.headers.Authorization = `${token}`;
|
||||
}
|
||||
return config;
|
||||
}, error => {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
export async function request(config) {
|
||||
try {
|
||||
const res = await service(config)
|
||||
|
||||
@ -93,19 +93,16 @@ const script = scriptFn();
|
||||
const { treeRef, dialogRef } = script;
|
||||
</script>
|
||||
<style scoped>
|
||||
/* * {
|
||||
border: 1px solid #ccc;
|
||||
} */
|
||||
.root {
|
||||
height: 100%;
|
||||
/* padding: 45px; */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
/* 左侧树形结构区域 */
|
||||
.left-tree {
|
||||
width: 20vw;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 25px 25px 0 25px;
|
||||
display: flex;
|
||||
@ -127,7 +124,7 @@ const { treeRef, dialogRef } = script;
|
||||
|
||||
/* 右侧表单区域 */
|
||||
.right-form {
|
||||
width: 80vw;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Home',
|
||||
|
||||
@ -70,19 +70,16 @@ const script = scriptFn();
|
||||
const { treeRef, dialogRef } = script;
|
||||
</script>
|
||||
<style scoped>
|
||||
/* * {
|
||||
border: 1px solid #ccc;
|
||||
} */
|
||||
.root {
|
||||
height: 100%;
|
||||
/* padding: 45px; */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
/* 左侧树形结构区域 */
|
||||
.left-tree {
|
||||
width: 20vw;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 25px 25px 0 25px;
|
||||
display: flex;
|
||||
@ -104,7 +101,7 @@ const { treeRef, dialogRef } = script;
|
||||
|
||||
/* 右侧表单区域 */
|
||||
.right-form {
|
||||
width: 80vw;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
|
||||
@ -546,6 +546,7 @@ const handleClickWz = (row) => {
|
||||
<style scoped>
|
||||
.root {
|
||||
height: 100%;
|
||||
padding: 25px;
|
||||
}
|
||||
.event-box {
|
||||
margin: 20px 0;
|
||||
|
||||
@ -355,44 +355,6 @@ const getDetailData = async (row) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 打开新增物资弹窗
|
||||
const openAddModel = () => {
|
||||
model.title = `新增物资`;
|
||||
model.content = AddDialog;
|
||||
Object.assign(form, INIT_FORM);
|
||||
model.props = {
|
||||
detailData: {},
|
||||
form: form,
|
||||
};
|
||||
model.onCancel = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = async () => {
|
||||
try {
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yjwz/add',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('新增成功');
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
getyhzeventList(qxmc.value, yhzid.value, filterData);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log('error', error)
|
||||
}
|
||||
};
|
||||
modelVisible.value = true;
|
||||
}
|
||||
|
||||
|
||||
export default () => {
|
||||
|
||||
const treeRef = ref(null);
|
||||
@ -467,6 +429,5 @@ export default () => {
|
||||
modelVisible,
|
||||
dialogRef,
|
||||
model,
|
||||
openAddModel,
|
||||
}
|
||||
}
|
||||
@ -36,9 +36,6 @@
|
||||
</div>
|
||||
<div class="form-box">
|
||||
<div class="event-box">
|
||||
<el-button type="primary" size="large" @click="script.addEvent"
|
||||
>新增事件</el-button
|
||||
>
|
||||
<el-button type="primary" size="large" @click="script.generateReport"
|
||||
>生成报告</el-button
|
||||
>
|
||||
@ -81,19 +78,16 @@ const script = scriptFn();
|
||||
const { treeRef, dialogRef } = script;
|
||||
</script>
|
||||
<style scoped>
|
||||
/* * {
|
||||
border: 1px solid #ccc;
|
||||
} */
|
||||
.root {
|
||||
height: 100%;
|
||||
/* padding: 45px; */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
/* 左侧树形结构区域 */
|
||||
.left-tree {
|
||||
width: 20vw;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 25px 25px 0 25px;
|
||||
display: flex;
|
||||
@ -115,7 +109,7 @@ const { treeRef, dialogRef } = script;
|
||||
|
||||
/* 右侧表单区域 */
|
||||
.right-form {
|
||||
width: 80vw;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
|
||||
59
packages/screen/src/views/index.vue
Normal file
59
packages/screen/src/views/index.vue
Normal file
@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="root">
|
||||
<div class="header">
|
||||
<img class="logo" src="../assets/imgs/logo.png" alt="logo" />
|
||||
<h2>政务·渝路智管</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content-leftbar">
|
||||
<MenuBar></MenuBar>
|
||||
</div>
|
||||
<div class="content-main">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import MenuBar from "../component/MenuBar/index.vue";
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.root {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.header {
|
||||
height: 64px;
|
||||
width: 100%;
|
||||
background-image: url("../assets/imgs/header.png");
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.logo {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
height: calc(100% - 64px);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.content-leftbar {
|
||||
width: 248px;
|
||||
height: 100%;
|
||||
background-image: url("../assets/imgs/menu.png");
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
.content-main {
|
||||
width: calc(100% - 248px);
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user