同步6/16

This commit is contained in:
Zy
2026-06-01 18:12:58 +08:00
parent 38274ab612
commit 50e7b14fd6
183 changed files with 8956 additions and 4803 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;
});
};
/** 取消按钮 */
@@ -185,10 +178,11 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = async (row?: ItemVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editItem',
query: {
id: row.id
id: _ids
}
});
};

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>
@@ -52,12 +60,6 @@
<el-option v-for="item in com_inspection_remind_tiime" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="巡检设置">
<el-radio-group v-model="form.inspectSetting">
<el-radio label="必须拍照" value="1" />
<el-radio label="允许跳检" value="0" />
</el-radio-group>
</el-form-item>
<el-form-item label="计划路线">
<el-select @change="handlChangeMap" v-model="form.routeIds" placeholder="请选择" style="width: 100%">
<el-option v-for="item in planlist" :key="item.value" :label="item.routeName" :value="item.id" />
@@ -75,15 +77,13 @@
</template>
<script setup lang="ts">
// TODO 巡检计划 添加
import { listRoute } from '@/api/system/InspectionRoute';
import PageHeader from '@/components/Pageheader/index.vue';
import { numToWeek } from '@/utils/time';
import { Delete } from '@element-plus/icons-vue';
import { ref } from 'vue';
import AMapLoader from '@amap/amap-jsapi-loader';
import { addPlan, getPlan, updatePlan } from '@/api/system/InspectionPlan';
import { getVillageByIdAPI } from '@/api/system/community';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
@@ -98,7 +98,7 @@ const form = ref({
executeDay: '', // 执行周期具体的周几
remindTime: '', // 提醒时间
routeIds: '', // 计划路线id
inspectSetting: '1' // 巡检设置
inspectSetting: 0 // 巡检设置
});
const rules = ref({
planName: [{ required: true, message: '请输入巡检计划名称', trigger: 'blur' }],
@@ -108,16 +108,6 @@ const rules = ref({
// 初始化 taskTime,确保至少有一个时间段
const taskTime = ref<[string, string][]>([['', '']]);
// 新增时间段
function addTaskTime() {
taskTime.value.push(['', '']);
}
// 删除时间段
function removeTaskTime(index: number) {
taskTime.value.splice(index, 1);
}
// 选择周几
const checkoutWeek = ref([]);
function checkoutWeekFun(val: number) {
@@ -129,13 +119,6 @@ function checkoutWeekFun(val: number) {
}
}
// 任务时间
const options = ref([
{
value: '09:00-11:00; 13:00-15:00',
label: '09:00-11:00; 13:00-15:00'
}
]);
// 提醒时间
// 巡检计划id
@@ -158,7 +141,7 @@ async function init() {
executeDay: res.data.executeDay, // 执行周期具体的周几
remindTime: res.data.remindTime, // 提醒时间
routeIds: res.data.routeIds, // 计划路线id
inspectSetting: String(res.data.inspectSetting) // 巡检设置
inspectSetting: res.data.inspectSetting // 巡检设置
};
checkoutWeek.value = res.data.executeDay
.split(',')
@@ -245,11 +228,14 @@ function handlChangeMap(val) {
}
}
}
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
onMounted(async () => {
await nextTick();
window._AMapSecurityConfig = { securityJsCode: '09534b3534d8da53968529a9ce164118' };
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
AMapLoader.load({
key: '8e302fe1be5f4db62bc734db23dca149',
key: aloaderkey,
version: '2.0',
plugins: ['AMap.Scale', 'AMap.Marker']
}).then(async (AMap) => {

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;
});
};
/** 取消按钮 */
@@ -202,10 +206,12 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = async (row?: PlanVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editPlan',
query: {
id: row.id
id: _ids
}
});
};
@@ -216,22 +222,6 @@ function handleChangeStatus(id: string, status: string) {
getList();
});
}
/** 提交按钮 */
const submitForm = () => {
planFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updatePlan(form.value).finally(() => (buttonLoading.value = false));
} else {
await addPlan(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: PlanVO) => {

View File

@@ -25,11 +25,11 @@
</div>
</div>
</el-form-item>
<el-form-item label="打卡方式" prop="checkMode">
<!-- <el-form-item label="打卡方式" prop="checkMode">
<el-select v-model="form.checkMode" placeholder="请选择打卡方式" clearable>
<el-option v-for="dict in com_inspection_point_checkmode" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="巡检点状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="item in com_inspection_point_status" :value="item.value" :key="item.value" :label="item.value">{{
@@ -67,7 +67,7 @@ import AMapLoader from '@amap/amap-jsapi-loader';
import { getVillageByIdAPI } from '@/api/system/community';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_point_checkmode } = toRefs<any>(proxy?.useDict('com_inspection_point_checkmode'));
// const { com_inspection_point_checkmode } = toRefs<any>(proxy?.useDict('com_inspection_point_checkmode'));
const { com_inspection_point_status } = toRefs<any>(proxy?.useDict('com_inspection_point_status'));
const router = useRouter();
@@ -79,6 +79,7 @@ const form = ref({
pointName: '',
itemId: '',
location: '',
locationName: '',
status: '0',
checkMode: '9999'
});
@@ -106,7 +107,11 @@ function checkoutItem(id: string) {
}
function init() {
// 获取巡检项目列表
listItem().then((res) => {
listItem({
status: '0',
pageNum: 1,
pageSize: 9999
}).then((res) => {
pointItemlist.value = res.rows;
});
@@ -157,27 +162,31 @@ const mapReady = ref(false);
const map = ref(null);
const marker = ref(null);
const villageid = localStorage.getItem('villageid');
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
onMounted(async () => {
await nextTick();
window._AMapSecurityConfig = { securityJsCode: '09534b3534d8da53968529a9ce164118' };
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
AMapLoader.load({
key: '8e302fe1be5f4db62bc734db23dca149',
key: aloaderkey,
version: '2.0',
plugins: ['AMap.Scale', 'AMap.Marker']
}).then(async (AMap) => {
const villageinfo = await getVillageByIdAPI(villageid);
const city = villageinfo.data.city.replaceAll('/', '');
map.value = new AMap.Map('containerMap', {
viewMode: '3D',
zoom: 11,
center: [116.397428, 39.90923]
});
AMap.plugin('AMap.Geocoder', function () {
const city = villageinfo.data.city.replaceAll('/', '');
const geocoder = new AMap.Geocoder({
city: city // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
});
const address = villageinfo.data.address;
geocoder.getLocation(address, function (status, result) {
geocoder.getLocation(city, function (status, result) {
if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息
map.value.setCenter(result.geocodes[0].location.toArray());
@@ -185,14 +194,8 @@ onMounted(async () => {
});
});
map.value = new AMap.Map('containerMap', {
viewMode: '3D',
zoom: 11,
center: [116.397428, 39.90923]
});
mapReady.value = true;
handleMap(AMap);
handleMap(AMap, city);
initLocation(AMap);
});
});
@@ -206,11 +209,21 @@ function clearLocation() {
}
}
function handleMap(AMap) {
function handleMap(AMap, city = '010') {
// 添加点击事件
map.value.on('click', (e) => {
const lnglat = e.lnglat;
form.value.location = `${lnglat.lng},${lnglat.lat}`;
const lnglatarr = [lnglat.lng, lnglat.lat];
const geocoder = new AMap.Geocoder({
city: city // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
});
geocoder.getAddress(lnglatarr, function (status, result) {
if (status === 'complete' && result.info === 'OK') {
// result为对应的地理位置详细信息
form.value.locationName = result.regeocode.formattedAddress;
}
});
// 如果有 marker.value,先移除
if (marker.value) {
map.value.remove(marker.value);

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;
});
};
/** 取消按钮 */
@@ -190,27 +194,11 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = async (row?: PointVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editInspectionPoint',
query: {
id: row?.id
}
});
};
/** 提交按钮 */
const submitForm = () => {
pointFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updatePoint(form.value).finally(() => (buttonLoading.value = false));
} else {
await addPoint(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
id: _ids
}
});
};

View File

@@ -21,11 +21,13 @@
</div>
<div class="infobox">
<div class="label">开始时间 :</div>
<div class="value">{{ form.actualStartTime }}</div>
<!-- <div class="value">{{ form.actualStartTime }}</div> -->
<div class="value">{{ form.taskTime.split(' - ')[0] }}</div>
</div>
<div class="infobox">
<div class="label">结束时间 :</div>
<div class="value">{{ form.actualEndTime }}</div>
<!-- <div class="value">{{ form.actualEndTime }}</div> -->
<div class="value">{{ form.taskTime.split(' - ')[1] }}</div>
</div>
<div class="infobox">
<div class="label">执行状态 :</div>
@@ -46,13 +48,55 @@
<div class="AddBuildingBody">
<div class="title">巡检记录</div>
<div class="">
<el-table :data="form.details" style="width: 100%">
<div class="timequerybox">
<div class="label">筛选日期:</div>
<el-date-picker
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
clearable
:disabled-date="disabledDate"
v-model="date"
type="date"
placeholder="选择查看日期"
/>
<el-button style="margin-left: 10px" @click="querySeale">查询</el-button>
</div>
<el-table
:default-sort="{
prop: 'checkTime',
order: 'descending'
}"
:data="form.details"
style="width: 100%"
>
<el-table-column type="index" align="center" label="序号" width="85" />
<el-table-column prop="pointName" align="center" label="巡检点" />
<el-table-column prop="checkTime" align="center" label=" 巡检时间" />
<el-table-column prop="location" align="center" label="巡检地址" />
<el-table-column prop="checkResult" align="center" label="巡检结果" />
<el-table-column prop="photos" align="center" label="图片" />
<el-table-column sortable prop="checkTime" align="center" label=" 巡检时间" />
<el-table-column prop="status" align="center" label="巡检状态">
<template #default="scope">
<el-tag v-if="scope.row.status === 0" type="success">正常</el-tag>
<el-tag v-else type="danger">异常</el-tag>
</template>
</el-table-column>
<!-- <el-table-column prop="location" align="center" label="巡检地址" /> -->
<el-table-column prop="remark" align="left" label="巡检结果" />
<el-table-column label="图片">
<template #default="scope">
<div>
<el-image
v-for="(item, index) in scope.row.photoslist"
:key="index"
:src="item"
:preview-src-list="scope.row.photoslist"
show-progress
fit="cover"
:initial-index="0"
:preview-teleported="true"
style="width: 80px; height: 50px; margin-right: 10px"
/>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
@@ -64,6 +108,7 @@ import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getRecord } from '@/api/system/InspectionRecord';
import { RecordVO } from '@/api/system/InspectionRecord/type';
import { formatDate } from '@/utils/time';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
@@ -74,51 +119,98 @@ const route = useRoute();
const formRef = ref();
const form = ref<RecordVO>({
taskName: '',
taskTime: '',
inspectorName: '',
planName: '',
actualStartTime: '',
actualEndTime: '',
createByName: '',
details: [],
status: '0',
createTime: '',
updateTime: ''
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getRecord(userid.value).then((res) => {
const date = ref<string | null>(null);
// 设置默认日期的函数
const setDefaultDate = () => {
const today = new Date();
today.setHours(0, 0, 0, 0);
console.log(!form.value.taskTime);
if (!form.value.taskTime) {
console.log('date', formatDate(today, 'YYYY-MM-DD'));
date.value = formatDate(today, 'YYYY-MM-DD');
return;
}
const timeRange = form.value.taskTime.split(' - ');
const startDate = new Date(timeRange[0]);
startDate.setHours(0, 0, 0, 0);
const endDate = new Date(timeRange[1]);
endDate.setHours(0, 0, 0, 0);
// 逻辑:优先选今天;如果今天不在范围内,选开始日期
if (today.getTime() >= startDate.getTime() && today.getTime() <= endDate.getTime()) {
date.value = formatDate(today, 'YYYY-MM-DD');
} else if (today.getTime() < startDate.getTime()) {
// 今天早于开始时间,默认选开始时间
date.value = formatDate(startDate, 'YYYY-MM-DD');
} else {
// 今天晚于结束时间,默认选结束时间
date.value = formatDate(endDate, 'YYYY-MM-DD');
}
};
// 禁用 form.value.taskTime.split(' - ') 范围外的所有日期,包括边界日期(开始和结束当天)
const disabledDate = (time: Date) => {
if (!form.value.taskTime || !form.value.taskTime.includes(' - ')) {
return true; // 如果没有有效时间范围,默认禁用
}
const timeRange = form.value.taskTime.split(' - ');
// 获取开始日期的零点时间戳
const startDate = new Date(timeRange[0]);
startDate.setHours(0, 0, 0, 0);
// 获取结束日期的零点时间戳
const endDate = new Date(timeRange[1]);
endDate.setHours(0, 0, 0, 0);
// 获取当前选择日期的零点时间戳
const selectDate = new Date(time);
selectDate.setHours(0, 0, 0, 0);
// 禁用早于开始日期 或 晚于结束日期的日期
// 注意:这里使用 < 和 >,意味着等于开始或结束日期时返回 false(不禁用/可选)
return selectDate.getTime() < startDate.getTime() || selectDate.getTime() > endDate.getTime();
};
// ! table
function querySeale() {
getRecord(userid.value, date.value).then((res) => {
form.value = {
...form.value,
...res.data
};
if (form.value.details.length > 0) {
form.value.details.forEach((item) => {
item.photoslist = item.imgUrl.split(',');
item.photoslist = item.photoslist.filter((item) => item);
});
}
});
}
// ! table
const tableData = [
{
date: '2016-05-03',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-02',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-04',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-01',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
function init() {
setDefaultDate();
if (route.query.id) {
userid.value = route.query.id;
querySeale();
}
];
// ! table
}
init();
// 推出
const cancelForm = () => {
router.back();
@@ -166,5 +258,16 @@ const cancelForm = () => {
}
}
}
.timequerybox {
display: flex;
align-items: center;
.label {
width: 100px;
text-align: right;
margin-right: 10px;
}
margin-bottom: 20px;
}
}
</style>

View File

@@ -43,17 +43,18 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务名称" align="center" prop="taskName" />
<el-table-column label="巡检人员" align="center" prop="inspectorName" />
<el-table-column label="任务开始时间" align="center" prop="startTime" width="180">
<!-- <el-table-column label="任务周期" align="center" prop="taskTime" /> -->
<el-table-column label="任务开始时间" align="center" prop="taskTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.actualStartTime, '{y}-{m}-{d}') }}</span>
<span>{{ scope.row.taskTime.split(' - ')[0] }}</span>
</template>
</el-table-column>
<el-table-column label="任务结束时间" align="center" prop="endTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.actualEndTime, '{y}-{m}-{d}') }}</span>
<span>{{ scope.row.taskTime.split(' - ')[1] }}</span>
</template>
</el-table-column>
<el-table-column label="执行状态" align="center" prop="status">
<el-table-column label="执行状态" align="center" prop="status" width="120">
<template #default="scope">
<DictTag :options="com_inspection_task_status" :value="scope.row.status"></DictTag>
</template>
@@ -72,9 +73,8 @@
</template>
<script setup name="Record" lang="ts">
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from '@/api/system/InspectionRecord/index';
import { listRecord, delRecord, addRecord, updateRecord } from '@/api/system/InspectionRecord/index';
import { RecordVO, RecordQuery, RecordForm } from '@/api/system/InspectionRecord/type';
import { getUserByRoleKey } from '@/api/system/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
@@ -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
@@ -57,19 +57,15 @@
</template>
<script setup lang="ts">
import { ref, toRefs, nextTick } from 'vue';
import { getCurrentInstance, ComponentInternalInstance } from 'vue';
import { ref, nextTick } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import PageHeader from '@/components/Pageheader/index.vue';
import { addPoint, getPoint, listPoint, updatePoint } from '@/api/system/InspectionPoint';
import { listPoint } from '@/api/system/InspectionPoint';
import { onMounted, onUnmounted } from 'vue';
import AMapLoader from '@amap/amap-jsapi-loader';
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 router = useRouter();
const route = useRoute();
@@ -193,7 +189,7 @@ function init() {
});
}
}
// TODO 巡检路线开关
// ! map
const mapReady = ref(false);
const AMapLib = ref(null);
@@ -203,28 +199,26 @@ const markers = ref<Record<string, any>>({});
const mouseTool = ref(null);
const drawnPolylines = ref([]); // 存所有线条
const villageid = localStorage.getItem('villageid');
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
onMounted(async () => {
// 获取巡检点列表
if (!routeid.value) {
listPoint().then((res) => {
listPoint({}).then((res) => {
pointslist.value = res.rows;
});
}
await nextTick();
window._AMapSecurityConfig = { securityJsCode: '09534b3534d8da53968529a9ce164118' };
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
AMapLoader.load({
key: '8e302fe1be5f4db62bc734db23dca149',
key: aloaderkey,
version: '2.0',
plugins: ['AMap.Scale', 'AMap.Marker']
}).then(async (AMap) => {
AMapLib.value = AMap;
map.value = new AMap.Map('containerMap', {
viewMode: '3D',
zoom: 11,
center: [116.397428, 39.90923]
zoom: 11
});
const villageinfo = await getVillageByIdAPI(villageid);
@@ -233,10 +227,7 @@ onMounted(async () => {
const geocoder = new AMap.Geocoder({
city: city // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
});
const address = villageinfo.data.address;
geocoder.getLocation(address, function (status, result) {
geocoder.getLocation(city, function (status, result) {
if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息
map.value.setCenter(result.geocodes[0].location.toArray());
@@ -331,8 +322,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';
@@ -191,27 +197,21 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = async (row?: RouteVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/Inspection/editRoute',
query: { id: row?.id }
query: { id: _ids }
});
};
/** 提交按钮 */
const submitForm = () => {
routeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateRoute(form.value).finally(() => (buttonLoading.value = false));
} else {
await addRoute(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
const switchchangebtn = (id, val) => {
changeStatusRoute(id, val)
.then(() => {
ElMessage.success('修改成功');
})
.catch(() => {
ElMessage.error('修改失败');
});
};
/** 删除按钮操作 */

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);
});
@@ -239,11 +248,13 @@ function handleRoute(route: RouteVO) {
maploading.value = false;
}
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
onMounted(async () => {
await nextTick();
window._AMapSecurityConfig = { securityJsCode: '09534b3534d8da53968529a9ce164118' };
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
AMapLoader.load({
key: '8e302fe1be5f4db62bc734db23dca149',
key: aloaderkey,
version: '2.0',
plugins: ['AMap.Scale', 'AMap.Marker']
}).then(async (AMap) => {
@@ -258,6 +269,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

@@ -63,11 +63,6 @@
<el-table-column label="巡检任务名称" align="center" prop="taskName" />
<el-table-column label="巡检人员" align="center" prop="inspectorName" />
<el-table-column label="起止日期" align="center" prop="taskTime" />
<el-table-column label="巡检设置" align="center" prop="inspectSetting">
<template #default="scope">
<dict-tag :options="com_inspection_plan_setting" :value="scope.row.inspectSetting"></dict-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="com_inspection_task_status" :value="scope.row.status"></dict-tag>
@@ -78,7 +73,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>
@@ -99,7 +94,6 @@ import { checkPermi } from '@/utils/permission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_inspection_task_status } = toRefs<any>(proxy?.useDict('com_inspection_task_status'));
const { com_inspection_plan_setting } = toRefs<any>(proxy?.useDict('com_inspection_plan_setting'));
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
const router = useRouter();
const taskList = ref<TaskVO[]>([]);
@@ -143,16 +137,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;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
listTask(queryParams.value)
.then((res) => {
taskList.value = res.rows;
total.value = res.total;
})
.finally(() => {
loading.value = false;
});
};
/** 表单重置 */
@@ -189,27 +181,11 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = async (row?: TaskVO) => {
const _ids = row?.id || ids.value[0];
router.push({
path: '/inspection/editTask',
query: {
id: row.id
}
});
};
/** 提交按钮 */
const submitForm = () => {
taskFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateTask(form.value).finally(() => (buttonLoading.value = false));
} else {
await addTask(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
id: _ids
}
});
};
@@ -223,17 +199,6 @@ const handleDelete = async (row?: TaskVO) => {
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'system/task/export',
{
...queryParams.value
},
`task_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});

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;
});
};
/** 搜索按钮操作 */