Merge branch 'dev' of http://222.212.85.86:8222/bdzl2/bxztApp into dev
This commit is contained in:
commit
f60145a5cc
@ -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 |
56
packages/screen/src/component/MenuBar/index.js
Normal file
56
packages/screen/src/component/MenuBar/index.js
Normal file
@ -0,0 +1,56 @@
|
||||
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(async () => {
|
||||
await getMenuList();
|
||||
const firstMenuItem = menuList.value[0]?.children?.[0];
|
||||
if (firstMenuItem) {
|
||||
handleMenuClick(firstMenuItem);
|
||||
}
|
||||
})
|
||||
|
||||
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>
|
||||
@ -7,6 +7,7 @@ import ElementPlus from 'element-plus'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import 'cesium/Build/Cesium/Widgets/widgets.css'
|
||||
import 'virtual:svg-icons-register'
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
|
||||
@ -27,6 +27,11 @@ const routes = [
|
||||
name: 'yhzwz',
|
||||
component: () => import('../views/MaterialManagement/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/yhzry/:data?',
|
||||
name: 'yhzry',
|
||||
component: () => import('../views/PersonManagement/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/yhzevent',
|
||||
name: 'yhzevent',
|
||||
|
||||
@ -5,6 +5,19 @@ const service = axios.create({
|
||||
timeout: 10000
|
||||
})
|
||||
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
// 暂时先写死token 实际项目中再调整token的获取位置
|
||||
const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjE5ODY2ODgzMjY1MjAwNTc4NTcsImFjY291bnQiOiJieHp0IiwidXVpZCI6ImMyY2E5OGU4LTIyYzItNGZmZi1hZWE0LTBiNWNiZmE4YjNlMSIsInJlbWVtYmVyTWUiOnRydWUsImV4cGlyYXRpb25EYXRlIjoxNzYyNzgzOTkwMzUxLCJvdGhlcnMiOm51bGwsInN1YiI6IjE5ODY2ODgzMjY1MjAwNTc4NTciLCJpYXQiOjE3NjI3NTUxOTAsImV4cCI6MTc2Mjc4Mzk5MH0.zqQcAE08fr2jQd7HcQ9Y3i-gWb2TrCWuUxSzl1kXOoJe2rp1Yly0ffrY6_1jY0ybHJwihONChqiSc-8jRTKYKw'
|
||||
// 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)
|
||||
|
||||
@ -8,60 +8,60 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="操作员:">
|
||||
<el-input disabled v-model="detailData.czy" />
|
||||
<el-input disabled v-model="detailData.equipment.czy" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辐射范围:">
|
||||
<el-input disabled v-model="detailData.fsfw" />
|
||||
<el-input disabled v-model="detailData.equipment.fsfw" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理人员:">
|
||||
<el-input disabled v-model="detailData.glry" />
|
||||
<el-input disabled v-model="detailData.equipment.glry" />
|
||||
</el-form-item>
|
||||
<el-form-item label="购买费用(万元):">
|
||||
<el-input disabled v-model="detailData.gmfy" />
|
||||
<el-input disabled v-model="detailData.equipment.gmfy" />
|
||||
</el-form-item>
|
||||
<el-form-item label="购置日期:">
|
||||
<el-input disabled v-model="detailData.gzrq" />
|
||||
<el-input disabled v-model="detailData.equipment.gzrq" />
|
||||
</el-form-item>
|
||||
<el-form-item label="区县名称:">
|
||||
<el-input disabled v-model="detailData.qxmc" />
|
||||
<el-input disabled v-model="detailData.equipment.qxmc" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编号:">
|
||||
<el-input disabled v-model="detailData.sbbh" />
|
||||
<el-input disabled v-model="detailData.equipment.sbbh" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备大类:">
|
||||
<el-input disabled v-model="detailData.sbdl" />
|
||||
<el-input disabled v-model="detailData.equipment.sbdl" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备小类:">
|
||||
<el-input disabled v-model="detailData.sbxl" />
|
||||
<el-input disabled v-model="detailData.equipment.sbxl" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称:">
|
||||
<el-input disabled v-model="detailData.sbmc" />
|
||||
<el-input disabled v-model="detailData.equipment.sbmc" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备位置:">
|
||||
<el-input disabled v-model="detailData.sbwz" />
|
||||
<el-input disabled v-model="detailData.equipment.sbwz" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备经度:">
|
||||
<el-input disabled v-model="detailData.jd" />
|
||||
<el-input disabled v-model="detailData.equipment.jd" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备纬度:">
|
||||
<el-input disabled v-model="detailData.wd" />
|
||||
<el-input disabled v-model="detailData.equipment.wd" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备型号:">
|
||||
<el-input disabled v-model="detailData.sbxh" />
|
||||
<el-input disabled v-model="detailData.equipment.sbxh" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态:">
|
||||
<el-input disabled v-model="detailData.sbzt" />
|
||||
<el-input disabled v-model="detailData.equipmentsbzt" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产厂家:">
|
||||
<el-input disabled v-model="detailData.sccj" />
|
||||
<el-input disabled v-model="detailData.equipment.sccj" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否应急设备:">
|
||||
<el-input disabled v-model="detailData.sfyjsb" />
|
||||
<el-input disabled v-model="detailData.equipment.sfyjsb" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否纳入市级补助范围:">
|
||||
<el-input disabled v-model="detailData.sfnrsjbz" />
|
||||
<el-input disabled v-model="detailData.equipment.sfnrsjbz" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@ -97,21 +97,23 @@ const filterNode = (value, node) => {
|
||||
const getTreeData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup',
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup?dataType=EQUIPMENT',
|
||||
method: 'GET'
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
treeData.value = Object.entries(res.data).map(([areaName, sites]) => ({
|
||||
id: areaName,
|
||||
name: `${areaName}(${sites.length})`,
|
||||
type: 'area',
|
||||
children: sites.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.sbsl})`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: areaName // 原始名称
|
||||
}));
|
||||
treeData.value = res.data.map((qx, index) => (
|
||||
{
|
||||
id: index,
|
||||
name: `${qx.qxmc}(${qx.sbsl})`,
|
||||
type: 'area',
|
||||
children: qx.yhzList.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.sbsl})`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: qx.qxmc, // 原始名称
|
||||
})
|
||||
);
|
||||
console.log('treeData', toRaw(treeData.value))
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -8,41 +8,41 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物资名称:">
|
||||
<el-input disabled v-model="detailData.wzmc" />
|
||||
<el-input disabled v-model="detailData.material.wzmc" />
|
||||
</el-form-item>
|
||||
<el-form-item label="余量:">
|
||||
<el-input disabled v-model="detailData.ye" />
|
||||
<el-input disabled v-model="detailData.material.ye" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库日期:">
|
||||
<el-input disabled v-model="detailData.rkrq" />
|
||||
<el-input disabled v-model="detailData.material.rkrq" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单位:">
|
||||
<el-input disabled v-model="detailData.rkdw" />
|
||||
<el-input disabled v-model="detailData.material.rkdw" />
|
||||
</el-form-item>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数量:">
|
||||
<el-input disabled v-model="detailData.sl"/>
|
||||
<el-input disabled v-model="detailData.material.sl"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位:">
|
||||
<el-input disabled v-model="detailData.dw" /> </el-form-item
|
||||
<el-input disabled v-model="detailData.material.dw" /> </el-form-item
|
||||
></el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="存放地点:">
|
||||
<el-input disabled v-model="detailData.cfdd" />
|
||||
<el-input disabled v-model="detailData.material.cfdd" />
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人:">
|
||||
<el-input disabled v-model="detailData.fzr" />
|
||||
<el-input disabled v-model="detailData.material.fzr" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话:">
|
||||
<el-input disabled v-model="detailData.lxdh" />
|
||||
<el-input disabled v-model="detailData.material.lxdh" />
|
||||
</el-form-item>
|
||||
<el-form-item label="区县名称:">
|
||||
<el-input disabled v-model="detailData.qxmc" />
|
||||
<el-input disabled v-model="detailData.materialqxmc" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@ -84,21 +84,23 @@ const filterNode = (value, node) => {
|
||||
const getTreeData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup',
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup?dataType=MATERIAL',
|
||||
method: 'GET'
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
treeData.value = Object.entries(res.data).map(([areaName, sites]) => ({
|
||||
id: areaName,
|
||||
name: `${areaName}(${sites.length})`,
|
||||
type: 'area',
|
||||
children: sites.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.wzsl})`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: areaName // 原始名称
|
||||
}));
|
||||
treeData.value = res.data.map((qx, index) => (
|
||||
{
|
||||
id: index,
|
||||
name: `${qx.qxmc}(${qx.wzsl})`,
|
||||
type: 'area',
|
||||
children: qx.yhzList.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.wzsl})`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: qx.qxmc, // 原始名称
|
||||
})
|
||||
);
|
||||
console.log('treeData', toRaw(treeData.value))
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
|
||||
@ -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;
|
||||
|
||||
159
packages/screen/src/views/PersonManagement/addDialog.vue
Normal file
159
packages/screen/src/views/PersonManagement/addDialog.vue
Normal file
@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
>
|
||||
<el-form-item label="人员:">
|
||||
<el-select
|
||||
v-model="ryxx"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入人员名称 / 联系方式 查询"
|
||||
:remote-method="remoteMethod"
|
||||
:loading="loading"
|
||||
@change="handleSelect"
|
||||
value-key="userId"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions"
|
||||
:key="item.userId"
|
||||
:label="item.realName"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位:">
|
||||
<el-input v-model="form.gw" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="养护站:">
|
||||
<el-select
|
||||
v-model="yhzmc"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入养护站名称查询"
|
||||
:remote-method="yhzremoteMethod"
|
||||
:loading="loading"
|
||||
@change="handleYhzSelect"
|
||||
value-key="id"
|
||||
:disabled="disabled"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectYhzOptions"
|
||||
:key="item.id"
|
||||
:label="item.mc"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="人员角色:">
|
||||
<el-select v-model="form.ryjs" placeholder="请选择人员角色">
|
||||
<el-option label="负责人" value="1"></el-option>
|
||||
<el-option label="普通工作人员" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
|
||||
const props = defineProps({
|
||||
detailData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
form: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
getUserList: {
|
||||
type: Function,
|
||||
default: () => () => {},
|
||||
},
|
||||
treeData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
yhzid: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
yhzmc: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
getYhzList: {
|
||||
type: Function,
|
||||
default: () => () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const ryxx = ref("");
|
||||
const loading = ref(false);
|
||||
const selectOptions = ref([]);
|
||||
// 选择人员筛选
|
||||
const remoteMethod = async (query) => {
|
||||
loading.value = true;
|
||||
const res = await props.getUserList(query);
|
||||
if (res) {
|
||||
selectOptions.value = res;
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
// 选择人员
|
||||
const handleSelect = (value) => {
|
||||
props.form.xm = value.realName;
|
||||
props.form.sjhm = value.phone;
|
||||
props.form.userId = value.userId;
|
||||
};
|
||||
|
||||
const yhzmc = ref(props.yhzmc);
|
||||
const disabled = ref(false);
|
||||
const selectYhzOptions = ref([]);
|
||||
|
||||
// 选择养护站筛选
|
||||
const yhzremoteMethod = async (query) => {
|
||||
loading.value = true;
|
||||
const res = await props.getYhzList(query);
|
||||
if (res) {
|
||||
selectYhzOptions.value = res;
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
// 选择养护站
|
||||
const handleYhzSelect = (value) => {
|
||||
yhzmc.value = value.mc;
|
||||
props.form.yhzid = value.id;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.yhzid) {
|
||||
disabled.value = true;
|
||||
props.form.yhzid = props.yhzid;
|
||||
} else {
|
||||
const res2 = await props.getYhzList();
|
||||
if (res2) {
|
||||
selectYhzOptions.value = res2;
|
||||
}
|
||||
}
|
||||
|
||||
const res = await props.getUserList();
|
||||
if (res) {
|
||||
selectOptions.value = res;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
37
packages/screen/src/views/PersonManagement/detailDialog.vue
Normal file
37
packages/screen/src/views/PersonManagement/detailDialog.vue
Normal file
@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
>
|
||||
<el-form-item label="人员名称:">
|
||||
<el-input disabled v-model="detailData.xm" />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位:">
|
||||
<el-input disabled v-model="detailData.gw" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码:">
|
||||
<el-input disabled v-model="detailData.sjhm" />
|
||||
</el-form-item>
|
||||
<el-form-item label="人员角色:">
|
||||
<el-input disabled :value="detailData.ryjs === 1 ? '管理员' : '普通用户'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间:">
|
||||
<el-input disabled v-model="detailData.cjsj" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
detailData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
49
packages/screen/src/views/PersonManagement/editDialog.vue
Normal file
49
packages/screen/src/views/PersonManagement/editDialog.vue
Normal file
@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
style="max-height: 60vh; overflow-y: auto; padding-right: 50px"
|
||||
>
|
||||
<el-form-item label="人员名称:">
|
||||
<el-input disabled v-model="form.xm" />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位:">
|
||||
<el-input v-model="form.gw" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码:">
|
||||
<el-input disabled v-model="form.sjhm" />
|
||||
</el-form-item>
|
||||
<el-form-item label="人员角色:" prop="ryjs">
|
||||
<el-select v-model="form.ryjs" placeholder="请选择角色">
|
||||
<el-option label="负责人" :value="1" />
|
||||
<el-option label="普通工作人员" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间:">
|
||||
<el-input disabled v-model="form.cjsj" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
const formRef = ref(null);
|
||||
defineExpose({ formRef });
|
||||
|
||||
const props = defineProps({
|
||||
form: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
form: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
535
packages/screen/src/views/PersonManagement/index.js
Normal file
535
packages/screen/src/views/PersonManagement/index.js
Normal file
@ -0,0 +1,535 @@
|
||||
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
import { Search } from "@element-plus/icons-vue";
|
||||
import DetailDialog from "./detailDialog.vue";
|
||||
import EditDialog from "./editDialog.vue";
|
||||
import AddDialog from "./addDialog.vue";
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const treeData = ref([]);
|
||||
const treeProps = {
|
||||
children: "children",
|
||||
label: "name",
|
||||
key: "id",
|
||||
}
|
||||
const filterText = ref(''); // 树节点过滤条件
|
||||
const tableData = ref([]);
|
||||
const qxmc = ref(''); // 区县名称
|
||||
const yhzid = ref(''); // 养护站id
|
||||
const yhzmc = ref(''); // 养护站名称
|
||||
const filterData = reactive({
|
||||
xm: '',
|
||||
}); // 表格过滤条件
|
||||
const pagination = reactive({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
pageSizes: [10, 20, 50],
|
||||
layout: "prev, pager, next, jumper",
|
||||
onChange: (page, pageSize) => {
|
||||
pagination.current = page;
|
||||
pagination.pageSize = pageSize;
|
||||
getyhzryList(qxmc.value, yhzid.value, filterData);
|
||||
},
|
||||
}); // 表格分页
|
||||
const modelVisible = ref(false); // 弹窗显示状态
|
||||
const model = reactive({
|
||||
title: '',
|
||||
content: null,
|
||||
props: {},
|
||||
onCancel: null,
|
||||
onConfirm: null,
|
||||
width: '60%',
|
||||
}); // 弹窗内容
|
||||
const dialogType = ref(''); // 弹窗类型
|
||||
const dialogRef = ref(null); // 弹窗实例
|
||||
|
||||
const INIT_FORM = {
|
||||
xm: "",
|
||||
sjhm: "",
|
||||
gw: "",
|
||||
cjsj: "",
|
||||
yhzid: "",
|
||||
ryjs: null, // 人员角色 1-负责人 2-普通工作人员
|
||||
userId: "",
|
||||
}; // 表单初始值
|
||||
const form = reactive({ ...INIT_FORM }); // 表单
|
||||
|
||||
|
||||
|
||||
// 节点过滤函数
|
||||
const filterNode = (value, node) => {
|
||||
const keyword = (value || '').toLowerCase();
|
||||
|
||||
const nodeData = node || {}
|
||||
|
||||
// 处理区域节点匹配
|
||||
if (nodeData.type === 'area') {
|
||||
return (nodeData.rawName || '').toLowerCase().includes(keyword)
|
||||
}
|
||||
|
||||
// 处理站点节点匹配
|
||||
if (nodeData.type === 'site') {
|
||||
const parentData = node.parent?.data?.type === 'area' ? node.parent.data : {}
|
||||
const parentMatch = (parentData.rawName || '').toLowerCase().includes(keyword)
|
||||
return parentMatch || (nodeData.name || '').toLowerCase().includes(keyword)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
// 获取养护站列表分组
|
||||
const getTreeData = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/listAreaGroup?dataType=PERSONNEL',
|
||||
method: 'GET'
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
treeData.value = res.data.map((qx, index) => (
|
||||
{
|
||||
id: index,
|
||||
name: `${qx.qxmc}`,
|
||||
type: 'area',
|
||||
children: qx.yhzList.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.rysl})`,
|
||||
type: 'site',
|
||||
rawName: site.mc,
|
||||
})),
|
||||
rawName: qx.qxmc, // 原始名称
|
||||
})
|
||||
);
|
||||
console.log('treeData', toRaw(treeData.value))
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
// 处理节点点击事件
|
||||
const handleNodeClick = (data, node) => {
|
||||
if (!data || !data.type) return;
|
||||
if (data.type === 'area' && node.expanded === false) {
|
||||
console.log('树节点关闭', node.expanded)
|
||||
yhzid.value = ''; // 重置养护站id
|
||||
yhzmc.value = ''; // 重置养护站名称
|
||||
qxmc.value = ''; // 重置区县名称
|
||||
return;
|
||||
}
|
||||
if (data.type === 'area') {
|
||||
console.log('你点击的是区县', data.id)
|
||||
yhzid.value = ''; // 重置养护站id
|
||||
yhzmc.value = ''; // 重置养护站名称
|
||||
qxmc.value = data.id; // 保存区县名称
|
||||
|
||||
}
|
||||
if (data.type === 'site') {
|
||||
console.log('你点击的是站点', data.name)
|
||||
yhzid.value = data.id; // 保存养护站id
|
||||
yhzmc.value = data.rawName; // 保存养护站名称
|
||||
qxmc.value = ''; // 重置区县名称
|
||||
}
|
||||
};
|
||||
|
||||
// 获取养护站人员列表
|
||||
const getyhzryList = async (qxmc, yhzid, filterData) => {
|
||||
try {
|
||||
const data = {
|
||||
qxmc: qxmc,
|
||||
yhzid: yhzid,
|
||||
xm: filterData?.xm || '',
|
||||
pageNum: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
}
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhzry/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
tableData.value = res.data.records;
|
||||
pagination.total = res.data.total;
|
||||
} else {
|
||||
tableData.value = [];
|
||||
pagination.total = 0;
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
prop: 'xm',
|
||||
label: '姓名',
|
||||
},
|
||||
{
|
||||
prop: 'gw',
|
||||
label: '岗位',
|
||||
},
|
||||
{
|
||||
prop: 'sjhm',
|
||||
label: '手机号码',
|
||||
},
|
||||
{
|
||||
prop: 'cjsj',
|
||||
label: '创建时间',
|
||||
render: (row) => () => {
|
||||
// 解析 ISO 时间字符串
|
||||
const date = new Date(row.cjsj);
|
||||
|
||||
// 格式化为 YYYY-MM-DD HH:mm:ss
|
||||
const format = (n) => n.toString().padStart(2, '0');
|
||||
return h("div",
|
||||
`${date.getFullYear()}-${format(date.getMonth() + 1)}-${format(date.getDate())}
|
||||
${format(date.getHours())}:${format(date.getMinutes())}:${format(date.getSeconds())}`
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'ryjs',
|
||||
label: '人员角色',
|
||||
width: 100,
|
||||
render: (row) => () => {
|
||||
const roleConfig = {
|
||||
1: { label: '负责人', color: '#f56c6c' },
|
||||
2: { label: '普通工作人员', color: '#409eff' }
|
||||
};
|
||||
|
||||
const config = roleConfig[row.ryjs] || { label: '未知角色', color: '#909399' };
|
||||
|
||||
return h(
|
||||
ElTag,
|
||||
{
|
||||
style: { 'margin-right': '5px' },
|
||||
effect: "dark",
|
||||
type: row.ryjs === 1 ? 'danger' : 'primary'
|
||||
},
|
||||
() => config.label
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: 150,
|
||||
render: (row) => () =>
|
||||
h("div", { class: "action-btns" }, [
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
type: "primary",
|
||||
link: true,
|
||||
onClick: async () => {
|
||||
dialogType.value = 'detail'
|
||||
await getDetailData(row);
|
||||
},
|
||||
},
|
||||
() => "详情"
|
||||
),
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
type: "primary",
|
||||
link: true,
|
||||
onClick: async () => {
|
||||
dialogType.value = 'edit'
|
||||
await getDetailData(row);
|
||||
},
|
||||
},
|
||||
() => "编辑"
|
||||
),
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
type: "danger",
|
||||
link: true,
|
||||
onClick: async () => {
|
||||
try {
|
||||
await ElMessageBox.confirm("确定要删除该人员吗?", "删除确认", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yhzry/delete`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: row.id,
|
||||
}
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('删除成功');
|
||||
getyhzryList(qxmc.value, yhzid.value, filterData);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
() => "删除"
|
||||
),
|
||||
|
||||
]),
|
||||
},
|
||||
]
|
||||
|
||||
const handleEdit = async () => {
|
||||
try {
|
||||
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhzry/update',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('编辑成功');
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
getyhzryList(qxmc.value, yhzid.value, filterData);
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log('error', error)
|
||||
}
|
||||
};
|
||||
|
||||
// 获取养护站人员详情
|
||||
const getDetailData = async (row) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: `/snow-ops-platform/yhzry/getById?id=${row.id}`,
|
||||
method: 'GET',
|
||||
});
|
||||
if (!res || res.code !== '00000') {
|
||||
throw new Error('获取人员详情失败')
|
||||
}
|
||||
if (res.code === '00000') {
|
||||
if (dialogType.value === 'detail') {
|
||||
model.title = `人员详情`;
|
||||
model.content = DetailDialog;
|
||||
model.props = {
|
||||
detailData: res.data,
|
||||
};
|
||||
model.onCancel = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.width = '30%';
|
||||
modelVisible.value = true;
|
||||
}
|
||||
if (dialogType.value === 'edit') {
|
||||
model.title = `编辑人员`;
|
||||
model.content = EditDialog;
|
||||
Object.assign(form, res.data);
|
||||
model.props = {
|
||||
detailData: res.data,
|
||||
form: form,
|
||||
};
|
||||
model.onCancel = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = async () => {
|
||||
await handleEdit();
|
||||
};
|
||||
model.width = '30%';
|
||||
modelVisible.value = true;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 根据用户信息 查询角色列表
|
||||
const getUserList = async (key) => {
|
||||
try {
|
||||
const keyword = key;
|
||||
let url = '';
|
||||
if (keyword) {
|
||||
url = `/snow-ops-platform/yhzry/getUserByKey?key=${keyword}`
|
||||
} else {
|
||||
url = `/snow-ops-platform/yhzry/getUserByKey?key=`
|
||||
}
|
||||
const res = await request({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
return res.data;
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 根据养护站名称 查询养护站列表
|
||||
const getYhzList = async (key) => {
|
||||
try {
|
||||
const data = {
|
||||
mc: key,
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
}
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhz/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
return res.data.records
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 打开新增人员弹窗
|
||||
const openAddModel = () => {
|
||||
model.title = `新增人员`;
|
||||
model.content = AddDialog;
|
||||
model.width = '30%';
|
||||
Object.assign(form, INIT_FORM);
|
||||
model.props = {
|
||||
detailData: {},
|
||||
form: form,
|
||||
getUserList: getUserList,
|
||||
treeData: treeData,
|
||||
yhzid: yhzid,
|
||||
yhzmc: yhzmc,
|
||||
getYhzList: getYhzList,
|
||||
};
|
||||
model.onCancel = () => {
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
};
|
||||
model.onConfirm = async () => {
|
||||
try {
|
||||
form.cjsj = new Date().toLocaleString('sv-SE', { hour12: false }).replace('T', ' ');
|
||||
console.log('form', toRaw(form))
|
||||
const res = await request({
|
||||
url: '/snow-ops-platform/yhzry/add',
|
||||
method: 'POST',
|
||||
data: toRaw(form),
|
||||
});
|
||||
if (res.code === '00000') {
|
||||
ElMessage.success('新增人员成功');
|
||||
dialogType.value = '';
|
||||
modelVisible.value = false;
|
||||
getyhzryList(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);
|
||||
watch(() => filterText.value, (val) => {
|
||||
treeRef.value.filter(val || '')
|
||||
|
||||
// 添加自动点击逻辑
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
const visibleNodes = getFilteredVisibleNodes()
|
||||
if (visibleNodes.length === 2) {
|
||||
handleAutoClickNode(visibleNodes[1])
|
||||
}
|
||||
}, 100) // 增加 100ms 延迟确保过滤完成
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// 获取过滤后的可见节点
|
||||
const getFilteredVisibleNodes = () => {
|
||||
return Object.values(treeRef.value?.store?.nodesMap || {})
|
||||
.filter(node => node.visible && !node.isHidden)
|
||||
}
|
||||
const handleAutoClickNode = (node) => {
|
||||
// 展开父节点
|
||||
if (node.parent) {
|
||||
node.parent.expanded = true
|
||||
}
|
||||
|
||||
// 执行点击逻辑
|
||||
handleNodeClick(
|
||||
node.data,
|
||||
{
|
||||
data: node.data,
|
||||
expanded: false,
|
||||
isCurrent: true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
watch(
|
||||
[() => filterData, qxmc, yhzid],
|
||||
([newFilterData, newQxmc, newYhzid]) => {
|
||||
getyhzryList(newQxmc, newYhzid, newFilterData)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
onMounted(async () => {
|
||||
await getTreeData();
|
||||
await getyhzryList();
|
||||
const rowData = JSON.parse(decodeURIComponent(route.params.data));
|
||||
if (rowData) {
|
||||
filterText.value = rowData.mc;
|
||||
};
|
||||
});
|
||||
return {
|
||||
treeRef,
|
||||
treeData,
|
||||
treeProps,
|
||||
filterText,
|
||||
filterNode,
|
||||
handleNodeClick,
|
||||
|
||||
tableData,
|
||||
filterData,
|
||||
pagination,
|
||||
columns,
|
||||
modelVisible,
|
||||
dialogRef,
|
||||
model,
|
||||
openAddModel,
|
||||
}
|
||||
}
|
||||
146
packages/screen/src/views/PersonManagement/index.vue
Normal file
146
packages/screen/src/views/PersonManagement/index.vue
Normal file
@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="root">
|
||||
<div class="left-tree">
|
||||
<div class="fillter-box">
|
||||
<el-input
|
||||
v-model="script.filterText.value"
|
||||
placeholder="请输入养护站名称"
|
||||
clearable
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="tree-box">
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:data="script.treeData.value"
|
||||
:props="script.treeProps"
|
||||
@node-click="script.handleNodeClick"
|
||||
accordion
|
||||
:filter-node-method="script.filterNode"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-form">
|
||||
<div class="select-box">
|
||||
<div class="inline-flex">
|
||||
<label>人员姓名:</label>
|
||||
<el-input v-model="script.filterData.xm"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-box">
|
||||
<div class="event-box">
|
||||
<el-button type="primary" size="large" @click="script.openAddModel"
|
||||
>新增人员</el-button
|
||||
>
|
||||
<el-button type="info" size="large" @click="script.handelExport"
|
||||
>导出</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="form-content">
|
||||
<DynamicTable
|
||||
:dataSource="script.tableData.value"
|
||||
:columns="script.columns"
|
||||
:autoHeight="true"
|
||||
:pagination="script.pagination"
|
||||
></DynamicTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-box">
|
||||
<MyDialog
|
||||
v-model="script.modelVisible.value"
|
||||
:title="script.model?.title"
|
||||
:dynamicComponent="script.model?.content"
|
||||
:component-props="script.model?.props"
|
||||
:onConfirm="script.model?.onConfirm"
|
||||
:onCancel="script.model?.onCancel"
|
||||
ref="dialogRef"
|
||||
:width="script.model?.width"
|
||||
>
|
||||
</MyDialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import scriptFn from "./index.js";
|
||||
import DynamicTable from "../../component/DynamicTable";
|
||||
import MyDialog from "../../component/MyDialog";
|
||||
|
||||
const script = scriptFn();
|
||||
const { treeRef, dialogRef } = script;
|
||||
</script>
|
||||
<style scoped>
|
||||
.root {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
/* 左侧树形结构区域 */
|
||||
.left-tree {
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 25px 25px 0 25px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
flex-direction: column;
|
||||
}
|
||||
.fillter-box {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.tree-box {
|
||||
width: 100%;
|
||||
height: calc(100% - 60px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 右侧表单区域 */
|
||||
.right-form {
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
flex-direction: column;
|
||||
}
|
||||
.select-box {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
.inline-flex {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.inline-flex label {
|
||||
white-space: nowrap; /* 禁止换行 */
|
||||
}
|
||||
.form-box {
|
||||
width: 100%;
|
||||
height: calc(100% - 60px);
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.event-box {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.form-content {
|
||||
width: 100%;
|
||||
height: calc(100% - 60px);
|
||||
}
|
||||
.model-box {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
@ -546,6 +546,7 @@ const handleClickWz = (row) => {
|
||||
<style scoped>
|
||||
.root {
|
||||
height: 100%;
|
||||
padding: 25px;
|
||||
}
|
||||
.event-box {
|
||||
margin: 20px 0;
|
||||
|
||||
@ -90,17 +90,19 @@ const getTreeData = async () => {
|
||||
method: 'GET'
|
||||
})
|
||||
if (res.code === '00000') {
|
||||
treeData.value = Object.entries(res.data).map(([areaName, sites]) => ({
|
||||
id: areaName,
|
||||
name: `${areaName}(${sites.length})`,
|
||||
type: 'area',
|
||||
children: sites.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: areaName // 原始名称
|
||||
}));
|
||||
treeData.value = res.data.map((qx, index) => (
|
||||
{
|
||||
id: index,
|
||||
name: `${qx.qxmc}(${qx.bxsjsl})`,
|
||||
type: 'area',
|
||||
children: qx.yhzList.map(site => ({
|
||||
id: site.id,
|
||||
name: `${site.mc}(${site.bxsjsl})`,
|
||||
type: 'site'
|
||||
})),
|
||||
rawName: qx.qxmc, // 原始名称
|
||||
})
|
||||
);
|
||||
console.log('treeData', toRaw(treeData.value))
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
@ -355,44 +357,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 +431,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>
|
||||
@ -56,7 +56,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
: '/'
|
||||
const resolvedBase =
|
||||
command === 'build' ? normalizeBasePath(baseCandidate) : '/'
|
||||
const cesiumBaseUrl = resolvedBase === '/' ? '/cesium' : `${resolvedBase}cesium`
|
||||
const cesiumBaseUrl = resolvedBase === '/' ? '/cesium' : `/cesium`
|
||||
|
||||
return {
|
||||
base: resolvedBase,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user