6/22完善引入,
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="任务时间">
|
||||
<div flex flex-wrap>
|
||||
<div class="flex flex-wrap">
|
||||
<div
|
||||
class="week-items"
|
||||
@click="checkoutWeekFun(item)"
|
||||
@@ -33,7 +33,7 @@
|
||||
<!-- <el-select v-model="form.taskTime" placeholder="选择任务时间段" style="width: 100%">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select> -->
|
||||
<div v-for="(item, index) in taskTime" :key="index" style="display: flex; align-items: center; margin-top: 10px">
|
||||
<div v-for="(_, index) in taskTime" :key="index" style="display: flex; align-items: center; margin-top: 10px">
|
||||
<el-time-picker
|
||||
v-model="taskTime[index]"
|
||||
is-range
|
||||
@@ -62,13 +62,13 @@
|
||||
</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" />
|
||||
<el-option v-for="item in playlist" :key="item.value" :label="item.routeName" :value="item.id" />
|
||||
</el-select>
|
||||
<div class="mapbox" id="PlanMapBox"></div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">提交</el-button>
|
||||
<el-button @click="routeback">返回</el-button>
|
||||
<el-button @click="outback">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -77,13 +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 { ref } from 'vue';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import { addPlan, getPlan, updatePlan } from '@/api/system/InspectionPlan';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
|
||||
|
||||
@@ -126,10 +126,10 @@ const editid = ref(null);
|
||||
|
||||
// 初始化
|
||||
// 路线列表
|
||||
const planlist = ref([]);
|
||||
const playlist = ref([]);
|
||||
async function init() {
|
||||
const res = await listRoute();
|
||||
planlist.value = res.rows;
|
||||
playlist.value = res.rows;
|
||||
if (route.query.id) {
|
||||
editid.value = route.query.id;
|
||||
getPlan(editid.value).then((res) => {
|
||||
@@ -173,7 +173,7 @@ async function init() {
|
||||
init();
|
||||
|
||||
// 返回
|
||||
function routeback() {
|
||||
function outback() {
|
||||
router.back();
|
||||
}
|
||||
|
||||
@@ -182,16 +182,16 @@ const map = ref(null);
|
||||
const mapReady = ref(false);
|
||||
|
||||
const markerlist = [];
|
||||
function handlChangeMap(val) {
|
||||
function handlChangeMap(val: string) {
|
||||
map.value.remove(markerlist);
|
||||
if (val) {
|
||||
const find = planlist.value.find((item) => item.id === val);
|
||||
const find = playlist.value.find((item) => item.id === val);
|
||||
if (find) {
|
||||
if (find.points && find.points.length > 0) {
|
||||
find.points.forEach((item, index) => {
|
||||
const lnglat = item.location.split(',').map(Number);
|
||||
find.points.forEach((item: { location: string; pointName: any }, index: number) => {
|
||||
const angular = item.location.split(',').map(Number);
|
||||
const marker = new AMapLib.value.Marker({
|
||||
position: new AMapLib.value.LngLat(lnglat[0], lnglat[1]), //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
||||
position: new AMapLib.value.LngLat(angular[0], angular[1]), //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
||||
title: item.pointName,
|
||||
content: `
|
||||
<div style="display:flex;align-items:center;justify-content:center;width:30px;height:30px;line-height:18px;border-radius:50%;background-color:rgba(26,117,255,0.3);">
|
||||
@@ -228,14 +228,14 @@ function handlChangeMap(val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
|
||||
const autoloader = 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: VITE_GCJ02_JS_CODE_GD };
|
||||
AMapLoader.load({
|
||||
key: aloaderkey,
|
||||
key: autoloader,
|
||||
version: '2.0',
|
||||
plugins: ['AMap.Scale', 'AMap.Marker']
|
||||
}).then(async (AMap) => {
|
||||
@@ -261,12 +261,12 @@ function submit() {
|
||||
if (editid.value) {
|
||||
updatePlan(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
routeback();
|
||||
outback();
|
||||
});
|
||||
} else {
|
||||
addPlan(form.value).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
routeback();
|
||||
outback();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,7 @@ function submit() {
|
||||
background-color: white;
|
||||
.bodybox {
|
||||
width: 600px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
margin: 20px auto 0;
|
||||
}
|
||||
.inspectorIdsBox {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user