This commit is contained in:
Zy
2026-06-01 18:12:58 +08:00
parent 38274ab612
commit ae1f9f6ee2
123 changed files with 2729 additions and 1563 deletions

View File

@@ -78,10 +78,14 @@ const { queryParams } = toRefs(data);
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
loading.value = true;
const res = await listItem(queryParams.value);
itemList.value = res.rows;
total.value = res.total;
loading.value = false;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */

View File

@@ -20,17 +20,6 @@
<el-card class="flex-1" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:item:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:item:edit']">编辑</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:item:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:disable-delete="multiple"
:disable-edit="single"
@@ -53,8 +42,8 @@
<el-switch
@change="(val: string) => handleChange(val, scope.row.id)"
v-model="scope.row.status"
active-value="1"
inactive-value="0"
active-value="0"
inactive-value="1"
></el-switch>
</template>
</el-table-column>
@@ -137,10 +126,14 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询巡检项目列表 */
const getList = async () => {
loading.value = true;
const res = await listItem(queryParams.value);
itemList.value = res.rows;
total.value = res.total;
loading.value = false;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */

View File

@@ -78,10 +78,14 @@ const { queryParams } = toRefs(data);
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
loading.value = true;
const res = await listItem(queryParams.value);
itemList.value = res.rows;
total.value = res.total;
loading.value = false;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */

View File

@@ -39,11 +39,19 @@
is-range
range-separator=""
start-placeholder="开始时间"
format="HH:mm"
value-format="HH:mm:00"
end-placeholder="结束时间"
style="width: 100%"
/>
<el-button v-if="taskTime.length > 1" icon="Minus" circle style="margin-left: 10px" @click="removeTaskTime(index)"></el-button>
<el-button v-if="taskTime.length === index + 1" icon="Plus" circle style="margin-left: 10px" @click="addTaskTime"></el-button>
<!-- <el-button v-if="taskTime.length > 1" icon="Minus" circle style="margin-left: 10px" @click="removeTaskTime(index)"></el-button>
<el-button
v-if="taskTime.length === index + 1 && taskTime.length <= 8"
icon="Plus"
circle
style="margin-left: 10px"
@click="addTaskTime"
></el-button> -->
</div>
</el-form-item>
@@ -75,6 +83,7 @@
</template>
<script setup lang="ts">
// TODO 巡检计划 添加
import { listRoute } from '@/api/system/InspectionRoute';
import PageHeader from '@/components/Pageheader/index.vue';
import { numToWeek } from '@/utils/time';

View File

@@ -63,7 +63,7 @@
active-value="0"
inactive-value="1"
></el-switch>
<!-- 0关闭 1开启 -->
<!-- 1关闭 0开启 -->
</template>
</el-table-column>
<el-table-column label="操作" width="110" align="center" fixed="right" class-name="small-padding fixed-width">
@@ -148,17 +148,21 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询巡检计划列表 */
const getList = async () => {
loading.value = true;
const res = await listPlan(queryParams.value);
planList.value = res.rows;
planList.value.forEach((item) => {
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
item.executeDayNames = item.executeDay
.split(',')
.sort((a, b) => Number(a) - Number(b))
.map((item) => Number(item));
});
total.value = res.total;
loading.value = false;
listPlan(queryParams.value)
.then((res) => {
planList.value = res.rows;
planList.value.forEach((item) => {
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
item.executeDayNames = item.executeDay
.split(',')
.sort((a, b) => Number(a) - Number(b))
.map((item) => Number(item));
});
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */

View File

@@ -143,10 +143,14 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询巡检点列表 */
const getList = async () => {
loading.value = true;
const res = await listPoint(queryParams.value);
pointList.value = res.rows;
total.value = res.total;
loading.value = false;
listPoint(queryParams.value)
.then((res) => {
pointList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */

View File

@@ -124,11 +124,14 @@ const { queryParams, form } = toRefs(data);
/** 查询巡检记录主列表 */
const getList = async () => {
loading.value = true;
const res = await listRecord(queryParams.value);
recordList.value = res.rows;
total.value = res.total;
loading.value = false;
listRecord(queryParams.value)
.then((res) => {
recordList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
// 处理日期选择

View File

@@ -8,19 +8,19 @@
<el-form-item label="巡检路线名称" prop="routeName">
<el-input v-model.trim="form.routeName" placeholder="请输入巡检路线名称" />
</el-form-item>
<el-form-item label="巡检路线描述" prop="description">
<!-- <el-form-item label="巡检路线描述" prop="description">
<el-input type="textarea" :rows="3" v-model.trim="form.description" placeholder="请输入巡检路线描述" />
</el-form-item>
<el-form-item label="预计巡检时长" prop="estimatedTime">
</el-form-item> -->
<!-- <el-form-item label="预计巡检时长" prop="estimatedTime">
<el-input v-model.trim.number="form.estimatedTime" placeholder="预计巡检时长">
<template #append>分钟</template>
</el-input>
</el-form-item>
<el-form-item label="巡检路线状态" prop="routeStatus">
</el-form-item> -->
<!-- <el-form-item label="巡检路线状态" prop="routeStatus">
<el-radio-group v-model="form.routeStatus">
<el-radio v-for="(item, index) in com_inspection_route_status" :key="index" :value="item.value" :label="item.label"></el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<el-form-item label="巡检点">
<div class="itembox">
<div
@@ -68,7 +68,7 @@ import { addRoute, getRoute, updateRoute } from '@/api/system/InspectionRoute';
import { getVillageByIdAPI } from '@/api/system/community';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_route_status } = toRefs<any>(proxy?.useDict('com_inspection_route_status'));
// const { com_inspection_route_status } = toRefs<any>(proxy?.useDict('com_inspection_route_status'));
const router = useRouter();
const route = useRoute();
@@ -193,7 +193,7 @@ function init() {
});
}
}
// TODO 巡检路线开关
// ! map
const mapReady = ref(false);
const AMapLib = ref(null);
@@ -206,7 +206,7 @@ const villageid = localStorage.getItem('villageid');
onMounted(async () => {
// 获取巡检点列表
if (!routeid.value) {
listPoint().then((res) => {
listPoint({}).then((res) => {
pointslist.value = res.rows;
});
}
@@ -331,8 +331,10 @@ function clearAll() {
// !!! 核心:获取绘制的路线经纬度数组
function getPolylinePath() {
if (drawnPolylines.value.length === 0) return [];
const lastLine = drawnPolylines.value.pop();
const path = lastLine.getPath().map((p) => [p.lng, p.lat]);
// 获取最后一条线
const lastPolyline = drawnPolylines.value[drawnPolylines.value.length - 1];
// const lastLine = drawnPolylines.value.pop();
const path = lastPolyline.getPath().map((p) => [p.lng, p.lat]);
return path;
}
/**

View File

@@ -47,19 +47,25 @@
<el-table v-loading="loading" border :data="routeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="巡检路线名称" width="220" align="center" prop="routeName" />
<el-table-column label="路线描述" align="center" prop="description" />
<!-- <el-table-column label="路线描述" align="center" prop="description" /> -->
<el-table-column label="巡检点" align="center" prop="pointNames" show-overflow-tooltip />
<el-table-column label="预计巡检时长(分钟)" width="140" align="center" prop="estimatedTime" />
<!-- <el-table-column label="预计巡检时长(分钟)" width="140" align="center" prop="estimatedTime" /> -->
<el-table-column label="巡检路线状态" width="120" align="center" prop="routeStatus">
<template #default="scope">
<dict-tag :options="com_inspection_route_status" :value="scope.row.routeStatus"></dict-tag>
<!-- <dict-tag :options="com_inspection_route_status" :value="scope.row.routeStatus"></dict-tag> -->
<el-switch
v-model="scope.row.routeStatus"
active-value="0"
inactive-value="1"
@change="(val) => switchchangebtn(scope.row.id, val)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="起点经度" width="120" align="center" prop="startLng" />
<el-table-column label="起点纬度" width="120" align="center" prop="startLat" />
<el-table-column label="终点经度" width="120" align="center" prop="endLng" />
<el-table-column label="终点纬度" width="120" align="center" prop="endLat" />
<el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="起点经度" width="120" align="center" prop="startLng" /> -->
<!-- <el-table-column label="起点纬度" width="120" align="center" prop="startLat" /> -->
<!-- <el-table-column label="终点经度" width="120" align="center" prop="endLng" /> -->
<!-- <el-table-column label="终点纬度" width="120" align="center" prop="endLat" /> -->
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:route:edit']">修改</el-button>
@@ -74,7 +80,7 @@
</template>
<script setup name="Route" lang="ts">
import { listRoute, getRoute, delRoute, addRoute, updateRoute } from '@/api/system/InspectionRoute/index';
import { listRoute, getRoute, delRoute, addRoute, updateRoute, changeStatusRoute } from '@/api/system/InspectionRoute/index';
import { RouteVO, RouteQuery, RouteForm } from '@/api/system/InspectionRoute/type';
import { checkPermi } from '@/utils/permission';
@@ -197,6 +203,16 @@ const handleUpdate = async (row?: RouteVO) => {
});
};
const switchchangebtn = (id, val) => {
changeStatusRoute(id, val)
.then(() => {
ElMessage.success('修改成功');
})
.catch(() => {
ElMessage.error('修改失败');
});
};
/** 提交按钮 */
const submitForm = () => {
routeFormRef.value?.validate(async (valid: boolean) => {

View File

@@ -80,10 +80,14 @@ const { queryParams } = toRefs(data);
/** 查询巡检路线列表 */
const getList = async () => {
loading.value = true;
const res = await list_statapi(queryParams.value);
routeList.value = res.rows;
total.value = res.total;
loading.value = false;
list_statapi(queryParams.value)
.then((res) => {
routeList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */

View File

@@ -33,7 +33,14 @@
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
v-model="form.taskTime"
v-model="taskTime"
@update:model-value="
(val) => {
if (val.length > 0) {
form.taskTime = val.join(' - ');
}
}
"
type="daterange"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
@@ -93,6 +100,7 @@ const form = ref({
remindTime: '', // 提醒时间
planId: '' // 计划路线id
});
const taskTime = ref([]);
const rules = ref({
taskName: [{ required: true, message: '请输入巡检任务名称', trigger: 'blur' }],
taskTime: [{ required: true, message: '请选择巡检任务时间', trigger: 'blur' }],
@@ -134,10 +142,11 @@ async function init() {
id: res.data.id,
taskName: res.data.taskName, // 巡检计划名称
inspectorId: res.data.inspectorId, // 巡检人员
taskTime: res.data.taskTime, // 巡检人员
taskTime: '', // 巡检人员
remindTime: res.data.remindTime, // 提醒时间
planId: res.data.planId // 计划路线id
};
taskTime.value = res.data.taskTime ? res.data.taskTime.split(' - ') : [];
checkoutUserlist.value = Array.isArray(res.data.inspectorInfo) ? res.data.inspectorInfo : [res.data.inspectorInfo];
handlChangeMap(res.data.planId);
});
@@ -258,6 +267,11 @@ onMounted(async () => {
});
const formRef = ref();
function submit() {
if (taskTime.value.length > 0) {
form.value.taskTime = taskTime.value.join(' - ');
} else {
form.value.taskTime = '';
}
form.value.inspectorId = checkoutUserlist.value.map((item) => item.userId).join(',');
formRef.value?.validate(async (valid: boolean) => {
if (valid) {

View File

@@ -78,7 +78,7 @@
<dict-tag :options="com_inspection_remind_tiime" :value="scope.row.remindTime"></dict-tag>
</template>
</el-table-column>
<el-table-column label="关联巡检计划" align="center" prop="planId" />
<el-table-column label="关联巡检计划" align="center" prop="planName" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:task:edit']">编辑</el-button>
@@ -143,10 +143,14 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询巡检任务列表 */
const getList = async () => {
loading.value = true;
const res = await listTask(queryParams.value);
taskList.value = res.rows;
total.value = res.total;
loading.value = false;
listTask(queryParams.value)
.then((res) => {
taskList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 取消按钮 */

View File

@@ -77,10 +77,14 @@ const { queryParams } = toRefs(data);
const getList = async () => {
queryParams.value.statDate = starDate.value.join('-');
loading.value = true;
const res = await listItem(queryParams.value);
itemList.value = res.rows;
total.value = res.total;
loading.value = false;
listItem(queryParams.value)
.then((res) => {
itemList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 搜索按钮操作 */