Merge pull request 'feat:点击位置名称创建腾讯地图坐标' (#124) from fix/changeimgback into test

Reviewed-on: #124
pull/133/head
赵辉 1 year ago
commit 48e63eb920

@ -119,5 +119,6 @@
<div class="selection-box" style="border: 1px dotted black;position: absolute;display: none;"></div> <div class="selection-box" style="border: 1px dotted black;position: absolute;display: none;"></div>
<script>var globalThis = window;</script> <script>var globalThis = window;</script>
<script src="/src/main.ts" type="module"></script> <script src="/src/main.ts" type="module"></script>
<script src="https://map.qq.com/api/js?v=2.exp&key=GIABZ-YUQKX-JOI4L-ZAGIS-673KS-NKBMC"></script>
</body> </body>
</html> </html>

@ -0,0 +1,44 @@
import { Layout } from '@/router/constant'
import type { RouteRecordRaw } from 'vue-router'
/**
* @param name , ,
* @param meta
* @param redirect , 访,
* @param meta.disabled
* @param meta.title
* @param meta.icon
* @param meta.keepAlive
* @param meta.sort
*
*/
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'map',
redirect: '/map',
component: Layout,
meta: {
title: '地理位置',
permissions: ['task-main'],
svgname: 'task-approval',
svgsize: 22,
sort: 5,
disabled: true,
hidden: true,
},
children: [
{
path: 'map',
name: 'map-main',
meta: {
title: '地理位置',
},
component: () => import('@/views/map/index.vue'),
},
],
},
]
export default routes

@ -0,0 +1,92 @@
<script>
import { reactive, toRefs, onMounted } from "vue";
export default {
setup() {
let state = reactive({});
let methods = {
init() {
function getQueryParamsNew() {
const params = new URLSearchParams(window.location.search);
let paramsObj = {};
for (const [key, value] of params.entries()) {
if (paramsObj.hasOwnProperty(key)) {
if (Array.isArray(paramsObj[key])) {
paramsObj[key].push(value);
} else {
paramsObj[key] = [paramsObj[key], value];
}
} else {
paramsObj[key] = value;
}
}
return paramsObj;
}
var queryParamsNew = getQueryParamsNew();
state.queryParamsNew = queryParamsNew;
const lng = queryParamsNew.lng; //
const lat = queryParamsNew.lat; //
//
const center = new qq.maps.LatLng(lat, lng);
const map = new qq.maps.Map(document.getElementById("map-container"), {
center,
zoom: 15,
});
//
const marker = new qq.maps.Marker({
position: center,
map: map,
});
//
const infoWin = new qq.maps.InfoWindow({
map: map,
position: center,
});
infoWin.setContent(
`<div class="detailshow" >${queryParamsNew.name}</div>`
);
infoWin.open();
qq.maps.event.addListener(marker, "click", function () {
infoWin.open();
infoWin.setContent(
`<div class="detailshow" >${queryParamsNew.name}</div>`
);
infoWin.setPosition(centerLatLng);
});
},
};
onMounted(() => {
methods.init();
});
return {
...toRefs(state),
...methods,
};
},
components: {},
};
</script>
<template>
<div class="mapmain">
<div id="map-container" style="width: 100%; height: 100%"></div>
</div>
</template>
<style >
.layout-sider {
display: none;
}
.layout-main-header {
display: none;
}
.mapmain {
height: 100%;
width: 100%;
}
.detailshow {
width: 100%;
}
</style>

@ -271,17 +271,19 @@ async function getTableData() {
"拜访小结", "拜访小结",
"拜访项目类别", "拜访项目类别",
]; ];
fieldList.map((v) => { fieldList.map((v) => {
if (userFieldList.includes(v.name)) { if (userFieldList.includes(v.name)) {
let locationobj = {address:""} let locationobj = { address: "" };
if(v.name=='location'){ if (v.name == "location") {
locationobj=JSON.parse(taskDetailInfo.value.ocrPicture[v.name]); locationobj = JSON.parse(taskDetailInfo.value.ocrPicture[v.name]);
}
}
const item = { const item = {
label: v.fieldDesc, label: v.fieldDesc,
value: v.name=='location'?locationobj.address:taskDetailInfo.value.ocrPicture[v.name], value:
v.name == "location"
? locationobj.address
: taskDetailInfo.value.ocrPicture[v.name],
key: v.name, key: v.name,
blue: blueList.includes(v.fieldDesc), blue: blueList.includes(v.fieldDesc),
}; };
@ -389,6 +391,22 @@ function goBack() {
function switchBatch() { function switchBatch() {
setBatch(!batch.value); setBatch(!batch.value);
} }
function getrowValue(e) {
if (e.key == "location") {
let locationobj = JSON.parse(taskDetailInfo.value.ocrPicture.location);
let lat = locationobj.lat.$numberDecimal;
let lng = locationobj.lng.$numberDecimal;
let name = e.value;
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = window.location.port;
const hostWithPort = protocol + "//" + hostname + ":" + port + "/";
window.open(
hostWithPort + "map" + "?name=" + name + "&lat=" + lat + "&lng=" + lng
);
}
}
</script> </script>
<template> <template>
@ -737,6 +755,7 @@ function switchBatch() {
:data="taskDetailInfo" :data="taskDetailInfo"
:task-table-data="taskTableData" :task-table-data="taskTableData"
@show-modal="showActionsModal" @show-modal="showActionsModal"
@getrow-value="getrowValue"
/> />
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="picture-info" tab="图片信息"> <n-tab-pane name="picture-info" tab="图片信息">

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import * as XLSX from 'xlsx';
defineProps({ defineProps({
data: { data: {
@ -11,10 +12,14 @@ defineProps({
default: () => [[]], default: () => [[]],
}, },
}); });
const emit = defineEmits(["showModal"]); const emit = defineEmits(["showModal","getrowValue"]);
function showActionsModal() { function showActionsModal() {
emit("showModal"); emit("showModal");
} }
function getrowvalue(row){
emit("getrowValue",row);
}
</script> </script>
<template> <template>
@ -32,13 +37,13 @@ function showActionsModal() {
<th v-if="item && item[0]"> <th v-if="item && item[0]">
{{ item[0].label }} {{ item[0].label }}
</th> </th>
<td v-if="item && item[0]" :class="item[0].blue ? 'blue' : ''"> <td v-if="item && item[0]" :class="item[0].blue ? 'blue' : ''" @click="getrowvalue(item[0])">
{{ item[0].value }} {{ item[0].value }}
</td> </td>
<th v-if="item && item.length > 1"> <th v-if="item && item.length > 1">
{{ item[1].label }} {{ item[1].label }}
</th> </th>
<td v-if="item && item.length > 1" :class="item[1].blue ? 'blue' : ''"> <td v-if="item && item.length > 1" :class="item[1].blue ? 'blue' : ''" @click="getrowvalue(item[1])">
{{ item[1].value }} {{ item[1].value }}
</td> </td>
</tr> </tr>

Loading…
Cancel
Save