git commit -m 0911
This commit is contained in:
dhr
2025-09-11 18:45:28 +08:00
63 changed files with 1184 additions and 142 deletions

View File

@ -22,7 +22,7 @@
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-row :gutter="20" class="mb8">
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['gps:equipment:edit']"
>修改</el-button
@ -39,7 +39,12 @@
>
</el-col>
<el-col :span="2">
<el-button type="primary" plain @click="handleViewAll">{{ viewAllButtonText }}</el-button>
<el-button type="primary" plain @click="toggleGpsType">
{{ currentGpsType === 0 ? '显示用户数据' : '显示设备数据' }}
</el-button>
</el-col>
<el-col :span="2">
<el-button type="primary" v-if="queryParams.gpsType !== 1" plain @click="handleViewAll">{{ viewAllButtonText }}</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@ -102,7 +107,7 @@
type="primary"
icon="Location"
v-hasPermi="['gps:equipmentSon:getList']"
@click="handleGoToEmptyPage(scope.row.userId, scope.row.projectId, scope.row.clientId)"
@click="handleGoToEmptyPage(scope.row.userId, scope.row.projectId, scope.row.clientId, scope.row.gpsType)"
:disabled="!scope.row.userId || !scope.row.projectId"
></el-button>
</el-tooltip>
@ -189,7 +194,7 @@
type="primary"
icon="Location"
v-hasPermi="['gps:equipmentSon:getList']"
@click="handleGoToEmptyPage(scope.row.userId, scope.row.projectId, currentHistoryClientId)"
@click="handleGoToEmptyPage(scope.row.userId, scope.row.projectId, currentHistoryClientId, currentGpsType)"
></el-button>
</el-tooltip>
</template>
@ -301,6 +306,9 @@ const initFormData: EquipmentForm = {
remark: undefined
};
// 当前GPS类型 (0:设备数据, 1:用户数据)
const currentGpsType = ref(0);
// 页面数据
const data = reactive<PageData<EquipmentForm, EquipmentQuery>>({
form: { ...initFormData },
@ -317,6 +325,7 @@ const data = reactive<PageData<EquipmentForm, EquipmentQuery>>({
creationTime: undefined,
lastAccessedTime: undefined,
registered: undefined,
gpsType: 0, // 默认显示设备数据
params: {}
},
rules: {
@ -385,6 +394,15 @@ const formatDateTime = (timestamp: any): string => {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
/** 切换GPS数据类型 */
const toggleGpsType = () => {
currentGpsType.value = currentGpsType.value === 0 ? 1 : 0;
queryParams.value.gpsType = currentGpsType.value;
queryParams.value.pageNum = 1;
getList();
proxy?.$modal.msgSuccess(`已切换到${currentGpsType.value === 0 ? '设备数据' : '用户数据'}模式`);
};
/** 获取设备列表 */
const getList = async () => {
loading.value = true;
@ -397,6 +415,9 @@ const getList = async () => {
queryParams.value.projectId = undefined;
}
// 确保gpsType参数正确设置
queryParams.value.gpsType = currentGpsType.value;
const res = await listEquipment(queryParams.value);
equipmentList.value = res.rows as ExtendedEquipmentVO[];
total.value = res.total;
@ -490,16 +511,24 @@ const handleViewAll = () => {
getList();
};
const handleGoToEmptyPage = (userId: any, projectId: any, clientId: any) => {
console.log('userId:', userId, 'projectId:', projectId, 'clientId:', clientId);
const handleGoToEmptyPage = (userId: any, projectId: any, clientId: any, gpsType: number) => {
console.log('userId:', userId, 'projectId:', projectId, 'clientId:', clientId, 'gpsType:', gpsType);
const queryParams: any = {
userId: userId,
projectId: projectId,
gpsType: gpsType,
clientId: clientId
};
// 当gpsType为0时传入clientId为1时不传入
if (gpsType === 1 && clientId) {
queryParams.clientId = '';
}
router.push({
path: './equipmentGPS',
query: {
userId: userId,
projectId: projectId,
clientId: clientId
}
query: queryParams
});
};