App端 设备确认
This commit is contained in:
parent
49696342fa
commit
0fe113c904
@ -36,6 +36,11 @@ const routes = [
|
|||||||
name: 'EquipDetail',
|
name: 'EquipDetail',
|
||||||
component: () => import('../views/Equipment/EquipmentDetails.vue')
|
component: () => import('../views/Equipment/EquipmentDetails.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/equipConfirm/:data',
|
||||||
|
name: 'EquipConfirm',
|
||||||
|
component: () => import('../views/Equipment/EquipmentConfirm.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/materialDetail/:data',
|
path: '/materialDetail/:data',
|
||||||
name: 'MaterialDetail',
|
name: 'MaterialDetail',
|
||||||
|
|||||||
127
packages/mobile/src/views/Equipment/EquipmentConfirm.vue
Normal file
127
packages/mobile/src/views/Equipment/EquipmentConfirm.vue
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<div class="home">
|
||||||
|
<van-nav-bar title="设备确认" fixed left-arrow @click-left="onClickLeft" />
|
||||||
|
|
||||||
|
<van-cell-group>
|
||||||
|
<van-cell title="当前站点" :value="yhzInfo.mc" />
|
||||||
|
</van-cell-group>
|
||||||
|
|
||||||
|
<div class="content" v-if="pendingConfirmList">
|
||||||
|
<van-cell-group>
|
||||||
|
<van-cell
|
||||||
|
v-for="(item, index) in pendingConfirmList"
|
||||||
|
:key="index"
|
||||||
|
:title="item.sbmc"
|
||||||
|
is-link
|
||||||
|
:label="`设备类型: ` + item.sblx"
|
||||||
|
:to="{
|
||||||
|
name: 'EquipDetail',
|
||||||
|
params: {
|
||||||
|
data: encodeURIComponent(
|
||||||
|
JSON.stringify({
|
||||||
|
equipmentInfo: item,
|
||||||
|
yhzInfo: yhzInfo,
|
||||||
|
isConfirm: true,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #value>
|
||||||
|
<span
|
||||||
|
:class="[
|
||||||
|
'status-tag',
|
||||||
|
`status-` +
|
||||||
|
(item.sbzt === '完好'
|
||||||
|
? 'good'
|
||||||
|
: item.sbzt === '损坏'
|
||||||
|
? 'warning'
|
||||||
|
: 'danger'),
|
||||||
|
]"
|
||||||
|
>{{ item.sbzt }}</span
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</van-cell>
|
||||||
|
</van-cell-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
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 yhzInfo = ref({}); // 养护站详情数据
|
||||||
|
const pendingConfirmList = ref([]); // 待确认列表数据
|
||||||
|
|
||||||
|
// 获取养护站详情数据
|
||||||
|
onMounted(() => {
|
||||||
|
yhzInfo.value = JSON.parse(decodeURIComponent(route.params.data));
|
||||||
|
console.log("yhzInfo", toRaw(yhzInfo.value));
|
||||||
|
getPendingConfirmList();
|
||||||
|
});
|
||||||
|
|
||||||
|
const getPendingConfirmList = async (sbmc) => {
|
||||||
|
try {
|
||||||
|
const data = {
|
||||||
|
yhzid: yhzInfo.value.id,
|
||||||
|
sbmc,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 9999,
|
||||||
|
};
|
||||||
|
const res = await request({
|
||||||
|
url: "/snow-ops-platform/yjsb/pendingConfirmList",
|
||||||
|
method: "get",
|
||||||
|
params: data,
|
||||||
|
});
|
||||||
|
if (res.code === "00000") {
|
||||||
|
pendingConfirmList.value = res.data.records;
|
||||||
|
} else {
|
||||||
|
throw new Error(res.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showToast({
|
||||||
|
type: "fail",
|
||||||
|
message: error.message,
|
||||||
|
});
|
||||||
|
console.log("error", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClickLeft = () => {
|
||||||
|
router.push({
|
||||||
|
name: "EquipManage",
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzInfo.value)) },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.home {
|
||||||
|
padding-top: var(--van-nav-bar-height); /* 自动匹配导航栏高度 */
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 16px 16px 80px 16px;
|
||||||
|
}
|
||||||
|
.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>
|
||||||
@ -73,7 +73,7 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<van-tabbar>
|
<van-tabbar v-if="!isConfirm">
|
||||||
<van-tabbar-item>
|
<van-tabbar-item>
|
||||||
<van-popover
|
<van-popover
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
@ -108,8 +108,8 @@
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</van-button>
|
</van-button>
|
||||||
</template></van-tabbar-item
|
</template>
|
||||||
>
|
</van-tabbar-item>
|
||||||
<van-tabbar-item
|
<van-tabbar-item
|
||||||
><template #default>
|
><template #default>
|
||||||
<van-button
|
<van-button
|
||||||
@ -119,9 +119,176 @@
|
|||||||
>
|
>
|
||||||
备注
|
备注
|
||||||
</van-button>
|
</van-button>
|
||||||
</template></van-tabbar-item
|
</template>
|
||||||
>
|
</van-tabbar-item>
|
||||||
</van-tabbar>
|
</van-tabbar>
|
||||||
|
<van-tabbar v-else>
|
||||||
|
<van-tabbar-item>
|
||||||
|
<template #default>
|
||||||
|
<van-button
|
||||||
|
type="warning"
|
||||||
|
style="width: 150px; border-radius: 10px"
|
||||||
|
@click="notYHZPopupOpen"
|
||||||
|
>
|
||||||
|
不是本站点设备
|
||||||
|
</van-button>
|
||||||
|
</template>
|
||||||
|
</van-tabbar-item>
|
||||||
|
<van-tabbar-item
|
||||||
|
><template #default>
|
||||||
|
<van-button
|
||||||
|
type="primary"
|
||||||
|
style="width: 150px; border-radius: 10px"
|
||||||
|
@click="addToThisYHZPopupOpen"
|
||||||
|
>
|
||||||
|
添加到服务站
|
||||||
|
</van-button>
|
||||||
|
</template>
|
||||||
|
</van-tabbar-item>
|
||||||
|
</van-tabbar>
|
||||||
|
|
||||||
|
<van-popup
|
||||||
|
:show="addToThisYHZPupup"
|
||||||
|
position="bottom"
|
||||||
|
closeable
|
||||||
|
close-on-click-overlay
|
||||||
|
@close="addToThisYHZPopupClose"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 16px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
v-if="equipmentDetailInfo.glry && equipmentDetailInfo.czy"
|
||||||
|
style="
|
||||||
|
margin: 20px 0 20px 0;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
确认添加
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<h1
|
||||||
|
style="
|
||||||
|
margin: 20px 0 20px 0;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
添加到服务站
|
||||||
|
</h1>
|
||||||
|
<!-- 管理人员 -->
|
||||||
|
<van-field
|
||||||
|
v-model="editForm.equipment.glry"
|
||||||
|
is-link
|
||||||
|
arrow-direction="down"
|
||||||
|
readonly
|
||||||
|
label="管理人员"
|
||||||
|
placeholder="请选择设备管理人员"
|
||||||
|
@click="showAdminPicker = true"
|
||||||
|
/>
|
||||||
|
<!-- 操作员 -->
|
||||||
|
<van-field
|
||||||
|
v-model="editForm.equipment.czy"
|
||||||
|
is-link
|
||||||
|
arrow-direction="down"
|
||||||
|
readonly
|
||||||
|
label="操作员"
|
||||||
|
placeholder="请选择操作员"
|
||||||
|
@click="showOperatorPicker = true"
|
||||||
|
/>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; gap: 20px; width: 100%">
|
||||||
|
<van-button
|
||||||
|
type="default"
|
||||||
|
style="flex: 1; border-radius: 8px"
|
||||||
|
@click="addToThisYHZPopupClose"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</van-button>
|
||||||
|
<van-button
|
||||||
|
type="primary"
|
||||||
|
style="flex: 1; border-radius: 8px"
|
||||||
|
@click="AddToThisTHZConfirm"
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</van-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
|
||||||
|
<van-popup
|
||||||
|
:show="notYHZPopup"
|
||||||
|
position="bottom"
|
||||||
|
closeable
|
||||||
|
close-on-click-overlay
|
||||||
|
:style="{ height: '20%' }"
|
||||||
|
@close="notYHZPopupClose"
|
||||||
|
>
|
||||||
|
<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="notYHZPopupClose"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</van-button>
|
||||||
|
<van-button
|
||||||
|
type="primary"
|
||||||
|
style="flex: 1; border-radius: 8px"
|
||||||
|
@click="notYHZConfirm"
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</van-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
|
||||||
<van-popup
|
<van-popup
|
||||||
:show="showRemarkPopup"
|
:show="showRemarkPopup"
|
||||||
@ -660,6 +827,7 @@ const yhzInfo = ref({});
|
|||||||
const equipmentDetailInfo = ref();
|
const equipmentDetailInfo = ref();
|
||||||
const photos = ref([]);
|
const photos = ref([]);
|
||||||
const statusList = ref([]);
|
const statusList = ref([]);
|
||||||
|
const isConfirm = ref(false); // 是否是在确认设备
|
||||||
|
|
||||||
// 获取设备详情
|
// 获取设备详情
|
||||||
const getEquipmentDetailInfo = async () => {
|
const getEquipmentDetailInfo = async () => {
|
||||||
@ -684,8 +852,8 @@ const getEquipmentDetailInfo = async () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const data = JSON.parse(decodeURIComponent(route.params.data));
|
const data = JSON.parse(decodeURIComponent(route.params.data));
|
||||||
equipmentInfo.value = data.equipmentInfo;
|
equipmentInfo.value = data.equipmentInfo;
|
||||||
|
|
||||||
yhzInfo.value = data.yhzInfo;
|
yhzInfo.value = data.yhzInfo;
|
||||||
|
isConfirm.value = data.isConfirm;
|
||||||
getEquipmentDetailInfo();
|
getEquipmentDetailInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1102,7 +1270,7 @@ const afterRead = async (file) => {
|
|||||||
const onEditSubmit = async () => {
|
const onEditSubmit = async () => {
|
||||||
try {
|
try {
|
||||||
showLoadingToast({ message: "提交中...", forbidClick: true });
|
showLoadingToast({ message: "提交中...", forbidClick: true });
|
||||||
console.log('editForm',toRaw(editForm))
|
console.log("editForm", toRaw(editForm));
|
||||||
|
|
||||||
const res = await request({
|
const res = await request({
|
||||||
url: "/snow-ops-platform/yjsb/update",
|
url: "/snow-ops-platform/yjsb/update",
|
||||||
@ -1129,6 +1297,81 @@ const showImage = (photos) => {
|
|||||||
closeable: true,
|
closeable: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 确认设备相关
|
||||||
|
const notYHZPopup = ref(false);
|
||||||
|
const notYHZPopupOpen = () => {
|
||||||
|
notYHZPopup.value = true;
|
||||||
|
};
|
||||||
|
const notYHZPopupClose = () => {
|
||||||
|
notYHZPopup.value = false;
|
||||||
|
};
|
||||||
|
const notYHZConfirm = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request({
|
||||||
|
url: "/snow-ops-platform/yjsb/confirm",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
rid: equipmentDetailInfo.value.rid,
|
||||||
|
confirmType: 2, // 确认类型 1-确认添加到本站,2-拒绝
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res.code === "00000") {
|
||||||
|
router.push({
|
||||||
|
name: "EquipManage",
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzInfo.value)) },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new Error(res.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showToast({ type: "fail", message: error.message || "操作失败" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const addToThisYHZPupup = ref(false);
|
||||||
|
const addToThisYHZPopupOpen = async () => {
|
||||||
|
await getPersonList();
|
||||||
|
Object.assign(editForm, {
|
||||||
|
equipment: equipmentDetailInfo.value,
|
||||||
|
photos: photos.value,
|
||||||
|
});
|
||||||
|
fileList.value = photos.value.map((photo) => ({
|
||||||
|
url: photo.photoUrl, // 显示用的URL
|
||||||
|
status: "done", // 上传状态为已完成
|
||||||
|
message: "上传成功", // 提示信息
|
||||||
|
serverUrl: photo.photoUrl, // 保留服务器返回的原始URL
|
||||||
|
}));
|
||||||
|
|
||||||
|
addToThisYHZPupup.value = true;
|
||||||
|
};
|
||||||
|
const addToThisYHZPopupClose = () => {
|
||||||
|
addToThisYHZPupup.value = false;
|
||||||
|
};
|
||||||
|
const AddToThisTHZConfirm = async () => {
|
||||||
|
await onEditSubmit();
|
||||||
|
console.log("详情更新完了");
|
||||||
|
try {
|
||||||
|
const res = await request({
|
||||||
|
url: "/snow-ops-platform/yjsb/confirm",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
rid: equipmentDetailInfo.value.rid,
|
||||||
|
confirmType: 1, // 确认类型 1-确认添加到本站,2-拒绝
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res.code === "00000") {
|
||||||
|
router.push({
|
||||||
|
name: "EquipManage",
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzInfo.value)) },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new Error(res.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showToast({ type: "fail", message: error.message || "操作失败" });
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -11,7 +11,12 @@
|
|||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell title="当前站点" :value="detailData.mc" />
|
<van-cell title="当前站点" :value="detailData.mc" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<van-notice-bar mode="link" v-if="pendingConfirmList.length">{{ pendingConfirmList.length }}个设备待确认</van-notice-bar>
|
<van-notice-bar
|
||||||
|
mode="link"
|
||||||
|
v-if="pendingConfirmList.length"
|
||||||
|
@click="handleConfirm"
|
||||||
|
>{{ pendingConfirmList.length }}个设备待确认</van-notice-bar
|
||||||
|
>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
@ -28,6 +33,7 @@
|
|||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
equipmentInfo: item,
|
equipmentInfo: item,
|
||||||
yhzInfo: detailData,
|
yhzInfo: detailData,
|
||||||
|
isConfirm: false,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -484,9 +490,20 @@ const getPendingConfirmList = async (sbmc) => {
|
|||||||
type: "fail",
|
type: "fail",
|
||||||
message: error.message,
|
message: error.message,
|
||||||
});
|
});
|
||||||
|
console.log("error", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 跳转到待确认设备页
|
||||||
|
const handleConfirm = () => {
|
||||||
|
router.push({
|
||||||
|
name: "EquipConfirm",
|
||||||
|
params: {
|
||||||
|
data: encodeURIComponent(JSON.stringify(detailData.value)),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 获取养护站设备列表
|
// 获取养护站设备列表
|
||||||
const getEquipmentList = async (sbmc) => {
|
const getEquipmentList = async (sbmc) => {
|
||||||
try {
|
try {
|
||||||
@ -794,6 +811,7 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
onPopupClose();
|
onPopupClose();
|
||||||
getEquipmentList(searchValue.value);
|
getEquipmentList(searchValue.value);
|
||||||
|
getPendingConfirmList();
|
||||||
} else {
|
} else {
|
||||||
console.log("res", res);
|
console.log("res", res);
|
||||||
throw new Error(res.message);
|
throw new Error(res.message);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user