This commit is contained in:
weipengfei 2023-08-17 12:08:04 +08:00
parent dc4f4712a5
commit 39ee686c66
5 changed files with 54 additions and 27 deletions

View File

@ -7,25 +7,41 @@ import AMapLoader from "@amap/amap-jsapi-loader";
import { shallowRef } from "@vue/reactivity";
const map = shallowRef(null);
let AMap: any = null;
let marker: any = null;
const initMap = () => {
AMapLoader.load({
key: "4f8f55618010007147aab96fc72bb408", // WebKey load
version: "2.0", // JSAPI 1.4.15
plugins: [""], // 使'AMap.Scale'
})
.then((AMap) => {
map.value = new AMap.Map("container", {
//id
viewMode: "2D", //3D
zoom: 10, //
center: [105.602725, 37.076636], //
});
})
.catch((e) => {
console.log("地图错误", e);
ElMessage.error("未知错误");
const initMap = async () => {
const loader = AMapLoader.load({
key: "4f8f55618010007147aab96fc72bb408",
version: "2.0",
});
AMap = await loader;
map.value = new AMap.Map("container", {
zoom: 13,
});
map.value.on("click", (e: any) => {
console.log("点击", e);
if (marker) return;
//
marker = new AMap.Marker({
position: e.lnglat,
offset: new AMap.Pixel(-10, -10),
title: "位置",
});
map.value.add(marker);
//
marker.on("click", (event: any) => {
console.log("点击了标记点", event);
//
map.value.remove(marker);
marker = null;
});
});
};
onMounted(() => {

View File

@ -14,11 +14,11 @@
label-width="90px"
:rules="formRules"
>
<el-form-item label="主题" prop="title">
<el-form-item label="任务名称" prop="title">
<el-input
v-model="formData.title"
clearable
placeholder="请输入主题"
placeholder="请输入任务名称"
/>
</el-form-item>
<el-form-item label="阶段类型" prop="types">
@ -185,7 +185,7 @@ const formRules = reactive<any>({
title: [
{
required: true,
message: "请输入主题",
message: "请输入任务名称",
trigger: ["blur"],
},
],

View File

@ -2,12 +2,12 @@
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px] formtabel" :model="queryParams" inline>
<el-form-item label-width="100px" label="主题" prop="title">
<el-form-item label-width="100px" label="任务名称" prop="title">
<el-input
class="w-[280px]"
v-model="queryParams.title"
clearable
placeholder="请输入主题"
placeholder="请输入任务名称"
/>
</el-form-item>
<el-form-item label-width="100px" label="创建人" prop="admin_id">
@ -97,7 +97,11 @@
prop="id"
show-overflow-tooltip
/>
<el-table-column label="主题" prop="title" show-overflow-tooltip />
<el-table-column
label="任务名称"
prop="title"
show-overflow-tooltip
/>
<el-table-column
label="创建人"
prop="admin_name"

View File

@ -2,12 +2,12 @@
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px] formtabel" :model="queryParams" inline>
<el-form-item label-width="100px" label="主题" prop="title">
<el-form-item label-width="100px" label="任务名称" prop="title">
<el-input
class="w-[280px]"
v-model="queryParams.title"
clearable
placeholder="请输入主题"
placeholder="请输入任务名称"
/>
</el-form-item>
<el-form-item label-width="100px" label="">
@ -21,7 +21,11 @@
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<div class="mt-4">
<el-table :data="pager.lists" @cell-click="handleSelectionChange">
<el-table-column label="主题" prop="title" show-overflow-tooltip />
<el-table-column
label="任务名称"
prop="title"
show-overflow-tooltip
/>
<el-table-column
label="创建人"
prop="admin_name"

View File

@ -10,7 +10,10 @@
>
<el-form>
<el-form-item label="">
<el-input style="width: 300px; margin-right: 16px" />
<el-input
style="width: 300px; margin-right: 16px"
placeholder="请输入要搜索的地址"
/>
<el-button type="primary">搜索</el-button>
</el-form-item>
<el-form-item label="地图">