徐景良 2024-12-02 14:20:56 +08:00
commit a1f2e14efa
5 changed files with 313 additions and 108 deletions

View File

@ -21,13 +21,13 @@
</template>
</a-slider>
</p>
<p>
<!-- <p>
历史影像树层级分类
<a-radio-group v-model:value="yingxiangTreeMenu" button-style="solid">
<a-radio-button value="0">时间</a-radio-button>
<a-radio-button value="1">区县</a-radio-button>
</a-radio-group>
</p>
</p> -->
<p>
历史影像透明度
<a-slider
@ -50,20 +50,24 @@
<script lang="ts" setup>
import { ref, watch } from 'vue';
// emit
const emit = defineEmits(['changeFillLayerOpacity_tuceng', 'changeFillLayerOpacity_yingxiang', 'changeYingxiangTreeMenu']);
const emit = defineEmits([
'changeFillLayerOpacity_tuceng',
'changeFillLayerOpacity_yingxiang',
'changeYingxiangTreeMenu',
]);
// -------------------------------------------------------
const treeRadio = ref(true);
// -------------------------------------------------------
const yingxiangTreeMenu = ref('0');
watch(
()=> yingxiangTreeMenu.value,
()=> {
() => yingxiangTreeMenu.value,
() => {
emit('changeYingxiangTreeMenu');
},
},
{
deep: true,
}
},
);
//

View File

@ -239,95 +239,95 @@
treeData.value[1].children = [];
// -
if (
popoverContentRef.value == undefined ||
popoverContentRef.value.yingxiangTreeMenu == '0'
) {
//
let dateDirArray: any = [];
res.items.forEach((item) => {
dateDirArray.push({
key: item.dateDir,
});
// if (
// popoverContentRef.value == undefined ||
// popoverContentRef.value.yingxiangTreeMenu == '0'
// ) {
//
let dateDirArray: any = [];
res.items.forEach((item) => {
dateDirArray.push({
key: item.dateDir,
});
//
yingxiang_uniqueKeysArray = Array.from(new Set(dateDirArray.map((item) => item.key))).sort(
(a, b) => dayjs(b) - dayjs(a),
);
// (-)
yingxiang_uniqueKeysArray = yingxiang_uniqueKeysArray.map(convertToYearWeek);
yingxiang_uniqueKeysArray = [...new Set(yingxiang_uniqueKeysArray)];
});
//
yingxiang_uniqueKeysArray = Array.from(new Set(dateDirArray.map((item) => item.key))).sort(
(a, b) => dayjs(b) - dayjs(a),
);
// (-)
yingxiang_uniqueKeysArray = yingxiang_uniqueKeysArray.map(convertToYearWeek);
yingxiang_uniqueKeysArray = [...new Set(yingxiang_uniqueKeysArray)];
yingxiang_uniqueKeysArray.forEach((array) => {
//
const [year, week] = array.split('-').map(Number);
//
const weekRange = getWeekRange(year, week);
treeData.value[1].children.push({
key: array,
title: year + '年 第' + week + '周 ' + weekRange.start + '至' + weekRange.end,
children: [],
});
searchKeyVlaue.push({
title: year + '年 第' + week + '周 ' + weekRange.start + '至' + weekRange.end,
key: treeData.value[1].key,
});
yingxiang_uniqueKeysArray.forEach((array) => {
//
const [year, week] = array.split('-').map(Number);
//
const weekRange = getWeekRange(year, week);
treeData.value[1].children.push({
key: array,
title: year + '年 第' + week + '周 ' + weekRange.start + '至' + weekRange.end,
children: [],
});
// -
res.items.forEach((item1) => {
treeData.value[1].children.forEach((item2) => {
if (convertToYearWeek(item1.dateDir) === item2.key) {
item2.children.push({
key: item1.id,
title: item1.layerName,
});
searchKeyVlaue.push({ title: item1.layerName, key: item2.key });
}
});
searchKeyVlaue.push({
title: year + '年 第' + week + '周 ' + weekRange.start + '至' + weekRange.end,
key: treeData.value[1].key,
});
} else {
let countrynameArray: any = [];
//
res.items.forEach((item) => {
//
let parts = item.tiffPath.split('\\');
if (parts.length <= 1) {
parts = item.tiffPath.split('/');
}
//
const countryname = parts[parts.length - 2];
countrynameArray.push({
key: countryname,
});
});
yingxiang_uniqueKeysArray = Array.from(new Set(countrynameArray.map((item) => item.key)));
yingxiang_uniqueKeysArray.forEach((array) => {
treeData.value[1].children.push({
key: array,
title: array,
children: [],
});
searchKeyVlaue.push({ title: array, key: treeData.value[1].key });
});
// -
res.items.forEach((item1) => {
treeData.value[1].children.forEach((item2) => {
let parts = item1.tiffPath.split('\\');
if (parts.length <= 1) {
parts = item1.tiffPath.split('/');
}
//
const countryname = parts[parts.length - 2];
if (countryname === item2.key) {
item2.children.push({
key: item1.id,
title: item1.layerName,
});
searchKeyVlaue.push({ title: item1.layerName, key: item2.key });
}
});
});
}
});
// -
// res.items.forEach((item1) => {
// treeData.value[1].children.forEach((item2) => {
// if (convertToYearWeek(item1.dateDir) === item2.key) {
// item2.children.push({
// key: item1.id,
// title: item1.layerName,
// });
// searchKeyVlaue.push({ title: item1.layerName, key: item2.key });
// }
// });
// });
// } else {
// let countrynameArray: any = [];
// //
// res.items.forEach((item) => {
// //
// let parts = item.tiffPath.split('\\');
// if (parts.length <= 1) {
// parts = item.tiffPath.split('/');
// }
// //
// const countryname = parts[parts.length - 2];
// countrynameArray.push({
// key: countryname,
// });
// });
// yingxiang_uniqueKeysArray = Array.from(new Set(countrynameArray.map((item) => item.key)));
// yingxiang_uniqueKeysArray.forEach((array) => {
// treeData.value[1].children.push({
// key: array,
// title: array,
// children: [],
// });
// searchKeyVlaue.push({ title: array, key: treeData.value[1].key });
// });
// // -
// res.items.forEach((item1) => {
// treeData.value[1].children.forEach((item2) => {
// let parts = item1.tiffPath.split('\\');
// if (parts.length <= 1) {
// parts = item1.tiffPath.split('/');
// }
// //
// const countryname = parts[parts.length - 2];
// if (countryname === item2.key) {
// item2.children.push({
// key: item1.id,
// title: item1.layerName,
// });
// searchKeyVlaue.push({ title: item1.layerName, key: item2.key });
// }
// });
// });
// }
});
//

View File

@ -0,0 +1,61 @@
<template>
<div>
<BasicTable @register="failYingxiangRegisterTable">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'fileName'">
<span class="content-full">{{ record.fileName }}</span>
</template>
<template v-if="column.key === 'filePath'">
<span class="content-full">{{ record.filePath }}</span>
</template>
<template v-if="column.key === 'action'">
<span class="content-full">
<a-button type="link" @click="copyToClipboard(record.fileName)"></a-button>
<a-button type="link" @click="copyToClipboard(record.filePath)"></a-button>
</span>
</template>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" setup>
import { defineProps } from 'vue';
import { BasicTable, useTable } from '@/components/Table';
import { useMessage } from '@/hooks/web/useMessage';
import { failColumns } from './util';
const { createMessage } = useMessage();
const props = defineProps(['failYingxiangData']);
//
const [failYingxiangRegisterTable, { reload, getSelectRows }] = useTable({
columns: failColumns,
dataSource: props.failYingxiangData,
showIndexColumn: true,
canResize: true,
useSearchForm: false,
showTableSetting: false,
bordered: true,
immediate: false,
});
//
const copyToClipboard = async (value) => {
try {
await navigator.clipboard.writeText(value);
createMessage.success('复制成功');
} catch (err) {
createMessage.error('复制失败');
}
};
</script>
<style lang="less">
.content-full {
white-space: pre-wrap;
word-break: break-all;
overflow-wrap: break-word;
max-width: 100%;
display: block;
}
</style>

View File

@ -6,6 +6,38 @@
<template #toolbar>
<a-button type="primary" @click="updateGeoTiff"></a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'layerName'">
<span class="content-full">{{ record.layerName }}</span>
</template>
<template v-if="column.key === 'dataTable'">
<span class="content-full">{{ record.dataTable }}</span>
</template>
<template v-if="column.key === 'shpPath'">
<span class="content-full">{{ record.shpPath }}</span>
</template>
<template v-if="column.key === 'tiffPath'">
<span class="content-full">{{ record.tiffPath }}</span>
</template>
<template v-if="column.key === 'createTime'">
<span class="content-full">{{ record.createTime }}</span>
</template>
<template v-if="column.key === 'updateTime'">
<span class="content-full">{{ record.updateTime }}</span>
</template>
<template v-if="column.key === 'accessUrl'">
<a-image
:src="getUrl(record)"
:style="{ marginRight: '10px' }"
:width="100"
:height="100"
:preview="{
visible,
onVisibleChange: setVisible,
}"
/>
</template>
</template>
</BasicTable>
</a-col>
<a-col :span="12">
@ -24,6 +56,17 @@
</div>
</a-col>
</a-row>
<a-modal
title="更新失败的影像"
:open="failOpen"
:maskClosable="false"
:footer="null"
:width="1000"
@cancel="failOpenClose"
>
<FailYingxiang :failYingxiangData="failYingxiangData" />
</a-modal>
</div>
</template>
@ -31,36 +74,41 @@
import { ref, watch, onMounted } from 'vue';
// vben
import { useMessage } from '@/hooks/web/useMessage';
import proj4 from 'proj4';
import { getAppEnvConfig } from '@/utils/env';
import { BasicTable, useTable } from '@/components/Table';
import { columns, searchFormSchema } from './util';
import MapComponent from '@/views/demo/system/geoservermanagement/clound/mapComponent.vue';
import FailYingxiang from './failYingxiang.vue';
// api
import {
GeoTiffManagerUpdateGeoTiff,
GeoTiffManagerLoadPage,
GeoTiffManagerGet,
} from '@/api/demo/system';
import proj4 from 'proj4';
//
const { VITE_GLOB_API_URL } = getAppEnvConfig();
const VITE_GLOB_API_URL_VAR = ref<String>(VITE_GLOB_API_URL + '/');
const { createMessage } = useMessage();
proj4.defs(
'EPSG:4548',
'+proj=tmerc +lat_0=37.56666666666666 +lon_0=126.93333333333333 +k=1 +x_0=200000 +y_0=500000 +ellps=bessel +towgs84=-119.819,-78.445,-112.283,0,0,0,0 +units=m +no_defs',
);
const { createMessage } = useMessage();
//
const [registerTable, { reload, getSelectRows }] = useTable({
title: '影像管理',
api: GeoTiffManagerLoadPage,
columns: columns,
useSearchForm: true,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
showIndexColumn: true,
useSearchForm: true,
ellipsis: false,
bordered: true,
showTableSetting: true,
handleSearchInfoFn(info) {
@ -69,11 +117,25 @@
immediate: false,
});
//
const failOpen = ref(false);
const failYingxiangData: any = ref();
//
function failOpenClose() {
failOpen.value = false;
}
// tiff
const updateGeoTiff = () => {
GeoTiffManagerUpdateGeoTiff()
.then((res) => {
if (res) {
// console.log(res);
if (res.lenght == 0) {
reload();
} else {
failYingxiangData.value = getFailYingxiangData(res);
console.log(failYingxiangData.value);
failOpen.value = true;
reload();
}
})
@ -82,6 +144,21 @@
});
};
//
function getFailYingxiangData(table) {
let result: any = [];
table.forEach((fullPath) => {
const lastSlashIndex = fullPath.lastIndexOf('/');
if (lastSlashIndex != -1) {
result.push({
fileName: fullPath.substring(lastSlashIndex + 1),
filePath: fullPath.substring(0, lastSlashIndex + 1),
});
}
});
return result;
}
//
const mapboxComponentRef = ref();
function handRowClick(record) {
@ -90,7 +167,6 @@
});
let bbox = getBboxFromUrl(record.accessUrl);
let lngLat = getCenterPoint(bbox);
console.log(lngLat);
//
const result = isProjectedCoordinates(parseFloat(lngLat[0]), parseFloat(lngLat[1]));
if (result) {
@ -156,9 +232,56 @@
});
}
// 使
const visible = ref<boolean>(false);
const setVisible = (value): void => {
visible.value = false;
};
// geoserver
function getUrl(record) {
let bbox: any = getBboxFromUrl(record.accessUrl);
const coords = bbox.split(',').map((coord) => parseFloat(coord));
let r1 = proj4('EPSG:4326', 'EPSG:3857', [coords[0], coords[1]]);
let r2 = proj4('EPSG:4326', 'EPSG:3857', [coords[2], coords[3]]);
let titeUrl: any = null;
if (new URL(VITE_GLOB_API_URL).hostname == 'localhost') {
titeUrl =
'http://localhost:8080/geoserver/my_workspace/wms?service=WMS&version=1.1.0&request=GetMap&layers=my_workspace:';
} else {
titeUrl =
'http://192.168.10.141:8080/geoserver/my_workspace/wms?service=WMS&version=1.1.0&request=GetMap&layers=my_workspace:';
}
let url =
titeUrl +
record.layerName +
'&styles=&bbox=' +
r1[0] +
',' +
r1[1] +
',' +
r2[0] +
',' +
r2[1] +
'&width=256&height=256&srs=EPSG:3857&format=image/png&TRANSPARENT=TRUE';
return url;
}
onMounted(() => {
reload();
//
forClearMap();
});
</script>
<style lang="less" scoped>
.content-full {
white-space: pre-wrap;
word-break: break-all;
overflow-wrap: break-word;
max-width: 100%;
display: block;
}
::v-deep .ant-image-mask {
display: none !important;
}
</style>

View File

@ -16,17 +16,16 @@ export const columns = [
dataIndex: 'dataTable',
width: 100,
},
{
title: '缩略图',
dataIndex: 'accessUrl',
width: 130,
},
{
title: '时间',
dataIndex: 'dateDir',
width: 80,
},
{
title: 'accessUrl',
dataIndex: 'accessUrl',
ifShow: false,
width: 300,
},
{
title: 'shpPath',
dataIndex: 'shpPath',
@ -40,12 +39,12 @@ export const columns = [
{
title: '创建时间',
dataIndex: 'createTime',
width: 120,
width: 90,
},
{
title: '修改时间',
dataIndex: 'updateTime',
width: 120,
width: 90,
},
];
@ -56,4 +55,22 @@ export const searchFormSchema = [
component: 'Input',
colProps: { span: 12 },
},
];
];
export const failColumns = [
{
title: '文件名称',
dataIndex: 'fileName',
width: 200,
},
{
title: '文件路径',
dataIndex: 'filePath',
width: 350,
},
{
title: '操作',
dataIndex: 'action',
width: 100,
}
];