Compare commits
No commits in common. "0c828777cdba63920c0a89cdd03ce4e578682c01" and "0bf320757863dafc427fb8d4267a7c1bd009939c" have entirely different histories.
0c828777cd
...
0bf3207578
@ -22,15 +22,10 @@ const routes = [
|
|||||||
component: () => import('../views/Material/MaterialManagement.vue')
|
component: () => import('../views/Material/MaterialManagement.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/staffManage/:data',
|
path: '/staffManage',
|
||||||
name: 'StaffManage',
|
name: 'StaffManage',
|
||||||
component: () => import('../views/Staff/StaffManagement.vue')
|
component: () => import('../views/Staff/StaffManagement.vue')
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/staffDetail/:data',
|
|
||||||
name: 'StaffDetail',
|
|
||||||
component: () => import('../views/Staff/StaffDetail.vue')
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/equipDetail/:data',
|
path: '/equipDetail/:data',
|
||||||
name: 'EquipDetail',
|
name: 'EquipDetail',
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<van-cell title="当前站点" :value="equipmentInfo.sbwz" />
|
<van-cell title="当前站点" :value="equipmentInfo.sbwz" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="content" v-if="equipmentDetailInfo">
|
<div class="content">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell
|
||||||
title="设备信息"
|
title="设备信息"
|
||||||
@ -657,7 +657,7 @@ const onSelect = (action) => {
|
|||||||
};
|
};
|
||||||
const equipmentInfo = ref({});
|
const equipmentInfo = ref({});
|
||||||
const yhzInfo = ref({});
|
const yhzInfo = ref({});
|
||||||
const equipmentDetailInfo = ref();
|
const equipmentDetailInfo = ref({});
|
||||||
const photos = ref([]);
|
const photos = ref([]);
|
||||||
const statusList = ref([]);
|
const statusList = ref([]);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<van-nav-bar title="愉快政" fixed left-arrow />
|
<van-nav-bar title="愉快政" fixed left-arrow />
|
||||||
|
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell title="当前站点" :value="yhzinfo.mc" />
|
<van-cell title="当前站点" :value="detailData.mc" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -13,7 +13,7 @@
|
|||||||
text="设备管理"
|
text="设备管理"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'EquipManage',
|
name: 'EquipManage',
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
|
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<van-grid-item
|
<van-grid-item
|
||||||
@ -21,46 +21,25 @@
|
|||||||
text="物资管理"
|
text="物资管理"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'MaterialManage',
|
name: 'MaterialManage',
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
|
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||||
}"
|
|
||||||
/>
|
|
||||||
<van-grid-item
|
|
||||||
icon="setting-o"
|
|
||||||
text="人员管理"
|
|
||||||
:to="{
|
|
||||||
name: 'StaffManage',
|
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
|
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
|
<van-grid-item icon="setting-o" text="人员管理" to="/StaffManage" />
|
||||||
<van-grid-item
|
<van-grid-item
|
||||||
icon="setting-o"
|
icon="setting-o"
|
||||||
text="冰雪灾害"
|
text="冰雪灾害"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'IceEventManage',
|
name: 'IceEventManage',
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
|
params: { data: encodeURIComponent(JSON.stringify(detailData)) },
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</van-grid>
|
</van-grid>
|
||||||
</div>
|
</div>
|
||||||
<van-popup
|
|
||||||
:show="YHZConfirmpopup"
|
<!-- <van-tabbar v-model="active" route>
|
||||||
position="center"
|
<van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
|
||||||
round
|
<van-tabbar-item icon="user-o" to="/user">我的</van-tabbar-item>
|
||||||
close-on-click-overlay
|
</van-tabbar> -->
|
||||||
:style="{ height: '20%', width: '80%' }"
|
|
||||||
@close="onYHZConfirmClose"
|
|
||||||
class="confirmpopup"
|
|
||||||
>
|
|
||||||
<div class="confirmpopup__content">
|
|
||||||
<h3>请在服务站授权定位</h3>
|
|
||||||
</div>
|
|
||||||
<div class="btn-box">
|
|
||||||
<van-button class="btn" @click="onYHZConfirmClose">取消</van-button>
|
|
||||||
<van-button class="btn" type="primary" @click="getLocation"
|
|
||||||
>授权定位</van-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</van-popup>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -73,11 +52,32 @@ import { showToast } from "vant";
|
|||||||
import { request } from "../../../shared/utils/request";
|
import { request } from "../../../shared/utils/request";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const active = ref(0);
|
||||||
|
const detailData = ref({});
|
||||||
const yhzinfo = ref({});
|
const yhzinfo = ref({});
|
||||||
|
|
||||||
|
// 获取养护站详情
|
||||||
|
const getYHZDetail = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request({
|
||||||
|
url: `/snow-ops-platform/yhz/getById?id=${yhzinfo.value.id}`,
|
||||||
|
method: "GET",
|
||||||
|
});
|
||||||
|
if (res.code && res.code === "00000") {
|
||||||
|
detailData.value = res.data;
|
||||||
|
} else {
|
||||||
|
throw new Error(res.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showToast({
|
||||||
|
message: error.message,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const token = route.query.token;
|
const token = route.query.token;
|
||||||
const YHZConfirmpopup = ref(false);
|
|
||||||
|
|
||||||
// 获取当前登录用于就职的养护站信息
|
// 获取当前登录用于就职的养护站信息
|
||||||
const getYHZinfo = async () => {
|
const getYHZinfo = async () => {
|
||||||
@ -99,10 +99,6 @@ const getYHZinfo = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onYHZConfirmClose = () => {
|
|
||||||
YHZConfirmpopup.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (token) {
|
if (token) {
|
||||||
localStorage.setItem("token", token);
|
localStorage.setItem("token", token);
|
||||||
@ -111,12 +107,7 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
await getYHZinfo();
|
await getYHZinfo();
|
||||||
if (
|
await getYHZDetail();
|
||||||
yhzinfo.value.isManager &&
|
|
||||||
(yhzinfo.value.jd === "" || yhzinfo.value.wd === "")
|
|
||||||
) {
|
|
||||||
YHZConfirmpopup.value = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const goToUser = () => {
|
const goToUser = () => {
|
||||||
@ -126,7 +117,7 @@ const goToUser = () => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.home {
|
.home {
|
||||||
padding-top: var(--van-nav-bar-height);
|
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@ -137,17 +128,7 @@ const goToUser = () => {
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-box {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
gap: 16px;
|
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
.btn {
|
.btn {
|
||||||
width: 50%;
|
margin-top: 24px;
|
||||||
}
|
|
||||||
|
|
||||||
.confirmpopup__content {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="content" v-if="eventDetailData">
|
<div class="content">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell
|
||||||
title="基本信息"
|
title="基本信息"
|
||||||
@ -94,11 +94,9 @@
|
|||||||
>
|
>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
<van-cell
|
<van-cell
|
||||||
v-if="eventDetailData?.traffic?.hasStrandedVehicles === 1"
|
v-if = 'eventDetailData?.traffic?.hasStrandedVehicles === 1'
|
||||||
:title="
|
:title="
|
||||||
'滞留车辆数:' +
|
'滞留车辆数:' + eventDetailData?.traffic?.strandedVehicleCount + ' 辆'
|
||||||
eventDetailData?.traffic?.strandedVehicleCount +
|
|
||||||
' 辆'
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
@ -108,7 +106,11 @@
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
<van-cell :title="'附件: '">
|
<van-cell
|
||||||
|
:title="
|
||||||
|
'附件: '
|
||||||
|
"
|
||||||
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<van-image
|
<van-image
|
||||||
v-for="(item, index) in eventDetailData?.photos"
|
v-for="(item, index) in eventDetailData?.photos"
|
||||||
@ -116,8 +118,6 @@
|
|||||||
:src="item.photoUrl"
|
:src="item.photoUrl"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
width="100px"
|
width="100px"
|
||||||
height="100px"
|
|
||||||
style="margin: 10px"
|
|
||||||
@click="showImage(item.photoUrl)"
|
@click="showImage(item.photoUrl)"
|
||||||
></van-image>
|
></van-image>
|
||||||
</template>
|
</template>
|
||||||
@ -138,7 +138,7 @@ const route = useRoute();
|
|||||||
|
|
||||||
const yhzDetail = ref({});
|
const yhzDetail = ref({});
|
||||||
const event = ref();
|
const event = ref();
|
||||||
const eventDetailData = ref(); // 冰雪事件详情数据
|
const eventDetailData = ref({}); // 冰雪事件详情数据
|
||||||
|
|
||||||
// 获取冰雪事件详情数据
|
// 获取冰雪事件详情数据
|
||||||
const getEventDetailData = async () => {
|
const getEventDetailData = async () => {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="content" v-if="wzDetailData">
|
<div class="content">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell
|
||||||
title="物资信息"
|
title="物资信息"
|
||||||
@ -109,7 +109,7 @@ const route = useRoute();
|
|||||||
|
|
||||||
const yhzDetail = ref({});
|
const yhzDetail = ref({});
|
||||||
const wzData = ref([]);
|
const wzData = ref([]);
|
||||||
const wzDetailData = ref(); // 物资详情数据
|
const wzDetailData = ref({}); // 物资详情数据
|
||||||
const photos = ref([]); // 物资图片数据
|
const photos = ref([]); // 物资图片数据
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -441,7 +441,7 @@ const handleGetLocation = async () => {
|
|||||||
loadingToast.close();
|
loadingToast.close();
|
||||||
} else {
|
} else {
|
||||||
loadingToast.close();
|
loadingToast.close();
|
||||||
showToast("定位失败 请检查网络情况后重试");
|
showToast(result);
|
||||||
console.log("result", result);
|
console.log("result", result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,239 +0,0 @@
|
|||||||
<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" v-if="staffDetailData">
|
|
||||||
<van-cell-group>
|
|
||||||
<van-cell
|
|
||||||
title="人员信息"
|
|
||||||
style="font-size: 18px; font-weight: bold; line-height: inherit"
|
|
||||||
>
|
|
||||||
</van-cell>
|
|
||||||
<van-cell :title="'姓名: ' + staffDetailData.xm"></van-cell>
|
|
||||||
<van-cell :title="'手机号码: ' + staffDetailData.sjhm"> </van-cell>
|
|
||||||
<van-cell :title="'岗位: ' + staffDetailData.gw"> </van-cell>
|
|
||||||
<van-cell :title="'登记日期: ' + staffDetailData.cjsj"> </van-cell>
|
|
||||||
<van-cell
|
|
||||||
:title="
|
|
||||||
'人员角色: ' +
|
|
||||||
(staffDetailData.ryjs === 1
|
|
||||||
? '负责人'
|
|
||||||
: staffDetailData.ryjs === 2
|
|
||||||
? '一般工作人员'
|
|
||||||
: '未知角色')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
</van-cell>
|
|
||||||
</van-cell-group>
|
|
||||||
</div>
|
|
||||||
<van-tabbar>
|
|
||||||
<van-tabbar-item>
|
|
||||||
<template #default>
|
|
||||||
<van-button
|
|
||||||
type="primary"
|
|
||||||
style="width: 100px; border-radius: 10px"
|
|
||||||
@click="onEditPopupOpen"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</van-button>
|
|
||||||
</template>
|
|
||||||
</van-tabbar-item>
|
|
||||||
<van-tabbar-item>
|
|
||||||
<template #default>
|
|
||||||
<van-button
|
|
||||||
type="primary"
|
|
||||||
style="width: 100px; border-radius: 10px"
|
|
||||||
@click="onEditPopupOpen"
|
|
||||||
>
|
|
||||||
重置密码
|
|
||||||
</van-button>
|
|
||||||
</template>
|
|
||||||
</van-tabbar-item>
|
|
||||||
<van-tabbar-item>
|
|
||||||
<template #default>
|
|
||||||
<van-button
|
|
||||||
type="danger"
|
|
||||||
style="width: 100px; border-radius: 10px"
|
|
||||||
@click="onDeletePopupOpen"
|
|
||||||
>
|
|
||||||
删除人员
|
|
||||||
</van-button>
|
|
||||||
</template>
|
|
||||||
</van-tabbar-item>
|
|
||||||
</van-tabbar>
|
|
||||||
|
|
||||||
<van-popup
|
|
||||||
:show="showDeletePopup"
|
|
||||||
position="bottom"
|
|
||||||
closeable
|
|
||||||
close-on-click-overlay
|
|
||||||
:style="{ height: '20%' }"
|
|
||||||
@close="onDeletePopupClose"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style="
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 16px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<h1
|
|
||||||
style="
|
|
||||||
margin: 0 0 20px 0;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
确认删除?
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<div style="display: flex; gap: 20px; width: 100%">
|
|
||||||
<van-button
|
|
||||||
type="default"
|
|
||||||
style="flex: 1; border-radius: 8px"
|
|
||||||
@click="onDeletePopupClose"
|
|
||||||
>
|
|
||||||
取消
|
|
||||||
</van-button>
|
|
||||||
<van-button
|
|
||||||
type="primary"
|
|
||||||
style="flex: 1; border-radius: 8px"
|
|
||||||
@click="onDeleteConfirm"
|
|
||||||
>
|
|
||||||
确认
|
|
||||||
</van-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</van-popup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted, toRaw, reactive } from "vue";
|
|
||||||
import { useRouter, useRoute } from "vue-router";
|
|
||||||
import { showToast, showLoadingToast, showImagePreview } from "vant";
|
|
||||||
import { request } from "../../../../shared/utils/request";
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const yhzDetail = ref({});
|
|
||||||
const staffData = ref([]);
|
|
||||||
const staffDetailData = ref(); // 人员详情数据
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const data = JSON.parse(decodeURIComponent(route.params.data));
|
|
||||||
yhzDetail.value = data.yhzDetail;
|
|
||||||
staffData.value = data.staffData;
|
|
||||||
console.log("传递过来的参数:", data);
|
|
||||||
getStaffDetail();
|
|
||||||
});
|
|
||||||
|
|
||||||
const onClickLeft = () => {
|
|
||||||
router.push({
|
|
||||||
name: "StaffManage",
|
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) },
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 获取养护站人员详情
|
|
||||||
const getStaffDetail = async () => {
|
|
||||||
try {
|
|
||||||
const res = await request({
|
|
||||||
url: `/snow-ops-platform/yhzry/getById?id=${staffData.value.id}`,
|
|
||||||
method: "GET",
|
|
||||||
});
|
|
||||||
if (res.code === "00000") {
|
|
||||||
staffDetailData.value = res.data;
|
|
||||||
} else {
|
|
||||||
throw new Error(res.message);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
showToast({ type: "fail", message: error.message });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 删除人员相关
|
|
||||||
const showDeletePopup = ref(false);
|
|
||||||
const onDeletePopupOpen = () => {
|
|
||||||
showDeletePopup.value = true;
|
|
||||||
};
|
|
||||||
const onDeletePopupClose = () => {
|
|
||||||
showDeletePopup.value = false;
|
|
||||||
};
|
|
||||||
const onDeleteConfirm = async () => {
|
|
||||||
try {
|
|
||||||
showLoadingToast({
|
|
||||||
message: "删除中...",
|
|
||||||
forbidClick: true,
|
|
||||||
loadingType: "spinner",
|
|
||||||
});
|
|
||||||
const res = await request({
|
|
||||||
url: `/snow-ops-platform/yhzry/delete`,
|
|
||||||
method: "POST",
|
|
||||||
data: {
|
|
||||||
id: staffData.value.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (res.code === "00000") {
|
|
||||||
showToast({ type: "success", message: "删除成功" });
|
|
||||||
router.push({
|
|
||||||
name: "StaffManage",
|
|
||||||
params: {
|
|
||||||
data: encodeURIComponent(JSON.stringify(yhzDetail.value)),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
throw new Error(res.data.message);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
showToast({ type: "error", message: "删除失败" });
|
|
||||||
console.log("error", error);
|
|
||||||
}
|
|
||||||
showDeletePopup.value = false;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.home {
|
|
||||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 16px 16px 80px 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>
|
|
||||||
|
|
||||||
@ -1,318 +1,129 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="home">
|
<div class="home">
|
||||||
<van-nav-bar title="人员管理" fixed left-arrow @click-left="onClickLeft">
|
<van-nav-bar title="人员管理" fixed left-arrow @click-left="onClickLeft">
|
||||||
</van-nav-bar>
|
</van-nav-bar>
|
||||||
<van-search
|
<van-search
|
||||||
shape="round"
|
shape="round"
|
||||||
v-model="searchValue"
|
:value="searchValue"
|
||||||
:show-action="false"
|
:show-action="false"
|
||||||
placeholder="请输入人员姓名"
|
placeholder="请输入人员名称"
|
||||||
/>
|
/>
|
||||||
<van-cell-group>
|
|
||||||
<van-cell title="当前站点" :value="yhzDetail.mc" />
|
|
||||||
</van-cell-group>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell title="当前站点" value="李家坝仓库" />
|
||||||
v-for="(item, index) in staffList"
|
|
||||||
:key="index"
|
|
||||||
:title="item.xm"
|
|
||||||
is-link
|
|
||||||
:value="
|
|
||||||
item.ryjs === 1
|
|
||||||
? '负责人'
|
|
||||||
: item.ryjs === 2
|
|
||||||
? '一般工作人员'
|
|
||||||
: '其他'
|
|
||||||
"
|
|
||||||
:to="{
|
|
||||||
name: 'StaffDetail',
|
|
||||||
params: {
|
|
||||||
data: encodeURIComponent(
|
|
||||||
JSON.stringify({
|
|
||||||
yhzDetail: yhzDetail,
|
|
||||||
staffData: item,
|
|
||||||
})
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
></van-cell>
|
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</div>
|
|
||||||
|
|
||||||
<van-button type="primary" class="add-btn" icon="plus" @click="handleAdd">
|
<div class="content">
|
||||||
添加人员
|
<van-cell-group>
|
||||||
</van-button>
|
|
||||||
|
|
||||||
<!-- 弹出层 -->
|
|
||||||
<van-popup
|
|
||||||
:show="showPopup"
|
|
||||||
position="bottom"
|
|
||||||
closeable
|
|
||||||
close-on-click-overlay
|
|
||||||
:style="{ height: '80%' }"
|
|
||||||
@close="onPopupClose"
|
|
||||||
>
|
|
||||||
<div class="popup-content">
|
|
||||||
<h3>添加人员</h3>
|
|
||||||
<van-search
|
|
||||||
shape="round"
|
|
||||||
v-model="addSearchValue"
|
|
||||||
:show-action="false"
|
|
||||||
placeholder="请输入电话号码或姓名"
|
|
||||||
/>
|
|
||||||
<van-cell-group class="add-cell-group">
|
|
||||||
<van-cell
|
<van-cell
|
||||||
v-for="item in personList"
|
title="张三"
|
||||||
:key="item.userId"
|
is-link
|
||||||
:title="item.realName"
|
value="作业人员"
|
||||||
:label="`电话:${item.phone}`"
|
|
||||||
clickable
|
|
||||||
@click="handleRadioClick(item)"
|
|
||||||
>
|
>
|
||||||
<template #right-icon>
|
</van-cell>
|
||||||
<van-radio
|
<van-cell title="李四" is-link value="站长">
|
||||||
:name="item.userId"
|
</van-cell>
|
||||||
v-model="selectedUserId"
|
<van-cell title="王麻子" is-link value="站长,作业人员">
|
||||||
@click.stop="handleRadioClick(item)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</van-cell>
|
</van-cell>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<div
|
|
||||||
style="
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
padding: 16px;
|
|
||||||
background: white;
|
|
||||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
|
||||||
z-index: 100;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<van-button
|
|
||||||
round
|
|
||||||
block
|
|
||||||
type="primary"
|
|
||||||
native-type="submit"
|
|
||||||
@click="handleConfirmAdd"
|
|
||||||
>
|
|
||||||
确认添加
|
|
||||||
</van-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</van-popup>
|
|
||||||
</div>
|
<van-button
|
||||||
</template>
|
type="primary"
|
||||||
|
class="add-btn"
|
||||||
|
icon="plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
添加人员
|
||||||
|
</van-button>
|
||||||
|
|
||||||
|
<!-- 弹出层 -->
|
||||||
|
<van-popup
|
||||||
|
:show="showPopup"
|
||||||
|
position="bottom"
|
||||||
|
closeable
|
||||||
|
close-on-click-overlay
|
||||||
|
:style="{ height: '80%' }"
|
||||||
|
@close="onPopupClose"
|
||||||
|
>
|
||||||
|
<div class="popup-content">
|
||||||
|
<h3>添加新人员</h3>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, reactive, toRaw, watch } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { showToast } from "vant";
|
import { showToast } from "vant";
|
||||||
import { request } from "../../../../shared/utils/request";
|
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
const searchValue = ref(""); // 搜索框输入值
|
|
||||||
const showPopup = ref(false); // 控制弹出层显示隐藏
|
|
||||||
const yhzDetail = ref({}); // 养护站详情数据
|
|
||||||
const staffList = ref([]); // 养护站人员列表数据
|
|
||||||
const addSearchValue = ref(""); // 添加人员搜索框输入值
|
|
||||||
const personList = ref([]); // 人员列表数据
|
|
||||||
const selectedUserId = ref(null); // 选择的用户id
|
|
||||||
const selectedUser = ref(null); // 选择的用户对象
|
|
||||||
|
|
||||||
// 获取养护站人员列表
|
const router = useRouter();
|
||||||
const getStaffList = async (xm) => {
|
const searchValue = ref(""); // 搜索框输入值
|
||||||
try {
|
const showPopup = ref(false); // 控制弹出层显示隐藏
|
||||||
const yhzid = yhzDetail.value.id;
|
|
||||||
if (!yhzid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const data = {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 9999,
|
|
||||||
yhzid,
|
|
||||||
xm,
|
|
||||||
};
|
|
||||||
const res = await request({
|
|
||||||
url: "/snow-ops-platform/yhzry/list",
|
|
||||||
method: "get",
|
|
||||||
params: data,
|
|
||||||
});
|
|
||||||
if (res.code === "00000") {
|
|
||||||
staffList.value = res.data.records;
|
|
||||||
}
|
|
||||||
} catch (error) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 组件挂载时获取数据
|
const onClickLeft = () => {
|
||||||
onMounted(() => {
|
router.push("/");
|
||||||
yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data));
|
|
||||||
getStaffList();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => searchValue.value,
|
|
||||||
(newVal, oldVal) => {
|
|
||||||
if (newVal !== oldVal) {
|
|
||||||
getStaffList(newVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const onClickLeft = () => {
|
|
||||||
router.push("/");
|
|
||||||
};
|
|
||||||
|
|
||||||
// 获取人员列表
|
|
||||||
const getPersonList = 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") {
|
|
||||||
personList.value = res.data;
|
|
||||||
} else {
|
|
||||||
throw new Error(res.message);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
showToast({
|
|
||||||
type: "error",
|
|
||||||
message: error.message || "获取人员列表失败",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// 打开添加人员弹窗
|
|
||||||
const handleAdd = async () => {
|
|
||||||
await getPersonList();
|
|
||||||
showPopup.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 选择要添加的人员
|
|
||||||
const handleRadioClick = (item) => {
|
|
||||||
selectedUserId.value = item.userId;
|
|
||||||
selectedUser.value = {
|
|
||||||
xm: item.realName,
|
|
||||||
sjhm: item.phone,
|
|
||||||
yhzid: yhzDetail.value.id,
|
|
||||||
ryjs: 2,
|
|
||||||
userId: item.userId,
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
const handleAdd = () => {
|
||||||
() => addSearchValue.value,
|
showPopup.value = true;
|
||||||
(newVal, oldVal) => {
|
};
|
||||||
if (newVal !== oldVal) {
|
|
||||||
getPersonList(newVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const onPopupClose = () => {
|
const onPopupClose = () => {
|
||||||
selectedUserId.value = null;
|
showPopup.value = false;
|
||||||
selectedUser.value = null;
|
};
|
||||||
addSearchValue.value = "";
|
</script>
|
||||||
personList.value = [];
|
|
||||||
showPopup.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 确认添加人员
|
|
||||||
const handleConfirmAdd = async () => {
|
|
||||||
try {
|
|
||||||
// console.log('toRaw(selectedUser.value)',toRaw(selectedUser.value));
|
|
||||||
|
|
||||||
const res = await request({
|
|
||||||
url: "/snow-ops-platform/yhzry/add",
|
|
||||||
method: "POST",
|
|
||||||
data: toRaw(selectedUser.value),
|
|
||||||
});
|
|
||||||
if (res.code === "00000") {
|
|
||||||
showToast({
|
|
||||||
type: "success",
|
|
||||||
message: "添加人员成功",
|
|
||||||
});
|
|
||||||
onPopupClose();
|
|
||||||
getStaffList(searchValue.value);
|
|
||||||
} else {
|
|
||||||
throw new Error(res.message);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
showToast({
|
|
||||||
type: "fail",
|
|
||||||
message: error.message || "添加人员失败",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.home {
|
.home {
|
||||||
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content .van-cell-group .van-cell {
|
.content .van-cell-group .van-cell {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-btn {
|
.add-btn {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
left: 16px;
|
left: 16px;
|
||||||
right: 16px;
|
right: 16px;
|
||||||
width: calc(100% - 32px);
|
width: calc(100% - 32px);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-tag {
|
.status-tag {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 3px 8px;
|
padding: 3px 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
.status-good {
|
.status-good {
|
||||||
background-color: #07c160;
|
background-color: #07c160;
|
||||||
}
|
}
|
||||||
.status-warning {
|
.status-warning {
|
||||||
background-color: #ff976a;
|
background-color: #ff976a;
|
||||||
}
|
}
|
||||||
.status-danger {
|
.status-danger {
|
||||||
background-color: #ee0a24;
|
background-color: #ee0a24;
|
||||||
}
|
}
|
||||||
.popup-content {
|
</style>
|
||||||
padding: 16px 16px 80px 16px;
|
|
||||||
}
|
|
||||||
.add-cell-group {
|
|
||||||
height: calc(100vh * 0.8 - 200px);
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user