userName 2025-04-29 13:27:42 +08:00
commit 079ec0cbde
9 changed files with 307 additions and 168 deletions

View File

@ -238,14 +238,6 @@
//
const isEdit = window.location.href.includes('/chart/home/');
watch(
() => option.status.hide,
() => {
if (!option.status.hide) {
}
},
);
//
onMounted(() => {
// id
@ -264,10 +256,20 @@
});
});
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
option.dataset = resData;
});
// +
watch(
() => option.status.hide,
(newValue) => {
if (!newValue && !isEdit) {
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
}
},
);
</script>
<style lang="scss" scoped>

View File

@ -34,7 +34,6 @@
src="@/assets/images/chart/zhichu/component/SheXiangTouModal_Image.png"
/>
<MonitorHK
ref="MonitorHKRef"
v-if="!isEdit && !option.status.hide && manufacturer == '海康'"
:serialNumberValue="option.dataStyle.serialNumberValue"
:width="`${w - 2 * option.dataStyle.padding - 2 * option.dataStyle.borderWidth}`"
@ -42,7 +41,6 @@
:timestamp="option.dataStyle.timestamp"
/>
<MonitorLC
ref="MonitorLCRef"
v-if="!isEdit && !option.status.hide && manufacturer == '乐橙'"
:deviceId="option.dataStyle.serialNumberValue"
:channelId="0"
@ -52,7 +50,6 @@
:videoMuted="option.dataStyle.videoMuted"
/>
<MonitorTX
ref="MonitorTXRef"
v-if="!isEdit && !option.status.hide && manufacturer == '腾讯'"
:serialNumberValue="option.dataStyle.serialNumberValue"
:width="`${w - 2 * option.dataStyle.padding - 2 * option.dataStyle.borderWidth}`"
@ -150,12 +147,20 @@
});
});
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
// +
watch(
() => option.status.hide,
(newValue) => {
if (!newValue && !isEdit) {
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
}
},
);
</script>
<style lang="scss" scoped>

View File

@ -387,9 +387,20 @@
});
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
option.dataset = resData;
});
// +
watch(
() => option.status.hide,
(newValue) => {
if (!newValue && !isEdit) {
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
}
},
);
watch(
() => option.dataStyle.closeButtonWidth,

View File

@ -177,10 +177,20 @@
});
});
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
option.dataset = resData;
});
// +
watch(
() => option.status.hide,
(newValue) => {
if (!newValue && !isEdit) {
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
}
},
);
watch(
() => w.value,

View File

@ -256,10 +256,20 @@
});
});
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
option.dataset = resData;
});
// +
watch(
() => option.status.hide,
(newValue) => {
if (!newValue && !isEdit) {
// callback
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
if (resData) {
option.dataset = resData;
}
});
}
},
);
</script>
<style lang="scss" scoped>

View File

@ -6,15 +6,15 @@
<div class="modal-content">
<div class="cue-span">检测到以下数据存在冲突</div>
<div class="comparison-div">
<div style="flex: 1;padding-right: 10px;" >
<div style="flex: 1;padding-right: 10px;min-width: 0;overflow: hidden;" >
<div class="table-title">原数据</div>
<a-table rowKey="Id" ref="oldTable" :row-selection="oldRowSelection" :dataSource="props.originData" :columns="columns"
:scroll="{ y: 472 }" :footer="null" />
:scroll="{ x: 'max-content',y: 500 }" :pagination="false" />
</div>
<div style="flex: 1;padding-left: 10px;" >
<div style="flex: 1;padding-left: 10px;min-width: 0;overflow: hidden;" >
<div class="table-title">新数据</div>
<a-table rowKey="Id" ref="newTable" :row-selection="newRowSelection" :dataSource="props.nowData" :columns="columns"
:scroll="{ y: 472 }" :footer="null" />
:scroll="{ x: 'max-content',y: 500 }" :pagination="false" />
</div>
</div>
<div class="footer">
@ -159,6 +159,7 @@ onUnmounted(() => {
}
.comparison-div{
display: flex;
margin-bottom: 30px;
.table-title{
font-size: 20px;
margin-bottom: 10px;

View File

@ -10,10 +10,19 @@
:accept="'.xlsx,.csv,.xls,.zip'"
:showUploadList="false"
:custom-request="customRequest"
:beforeUpload="beforeUpload"
>
<a-button type="primary" class="upload-button" :icon="h(PlusOutlined)">上传</a-button>
</a-upload>
</div>
<a-progress
style="margin-bottom: 0px;"
v-show="showProgress"
:percent="uploadPercent"
:status="progresStatus"
size="default"
/>
<div v-show="showProgress">{{ fileName }}</div>
</div>
</div>
</div>
@ -55,6 +64,10 @@ import { PlusOutlined } from '@ant-design/icons-vue';
import MergeSourceModal from './MergeSourceModal/index.vue'
import { UploadShape1, Upload, UploadExcelInsert } from '@/api/demo/BatchProcessingModal'
import { message } from "ant-design-vue";
import axios from 'axios';
import { getAppEnvConfig } from '@/utils/env';
const { VITE_GLOB_API_URL } = getAppEnvConfig();
const props = defineProps(['tableName','tableColumn'])
const emits = defineEmits(['changeBatchProcessingModal'])
@ -62,53 +75,77 @@ const procedure = ref(0)
const mergeSourceModal = ref(false)
const nowData = ref([])
const originData = ref([])
const uploadPercent = ref(0);
const progresStatus = ref('')
const showProgress = ref(false)
const fileName = ref('')
const submit = () => {
mergeSourceModal.value = true
}
const closemergeSourceModal = () => {
mergeSourceModal.value = false
}
const customRequest = (file) => {
console.log('handleCustomRequest',file)
const name = file.file.name.toLowerCase();
if (name.endsWith('.zip')){
const formData = new FormData()
formData.append('files', file.file)
Upload(formData).then(res => {
console.log(res)
const filePath = res[0].filePath
let params = {
tableName: props.tableName,
zipFilePath: filePath
}
UploadShape1(params).then(result => {
if(result.nowData.length > 0){
nowData.value = result.nowData
originData.value = result.originData
mergeSourceModal.value = true
}else{
message.success('导入成功')
}
})
})
}else{
const formData = new FormData()
formData.append('file', file.file)
UploadExcelInsert({File: formData, tableName: props.tableName}).then(res => {
console.log('res',res)
if(res.nowData.length > 0){
nowData.value = res.nowData
originData.value = res.originData
mergeSourceModal.value = true
}else{
message.success('导入成功')
}
})
}
// procedure.value ++
return false
const beforeUpload = (file) => {
showProgress.value = true
fileName.value = file.name
}
const customRequest = async (file) => {
progresStatus.value = ''
const name = file.file.name.toLowerCase();
const formData = new FormData();
let url = '';
let params: any = {};
if (name.endsWith('.zip')) {
formData.append('files', file.file);
url = VITE_GLOB_API_URL + '/api/Files/Upload';
} else {
formData.append('file', file.file);
url = VITE_GLOB_API_URL + '/api/Layer/UploadExcelInsert';
params = { tableName: props.tableName };
}
try {
const response = await axios.post(url, formData, {
params,
headers: { 'Content-Type': 'multipart/form-data' },
onUploadProgress: (progressEvent) => {
if (progressEvent.total) {
uploadPercent.value = Math.round((progressEvent.loaded / progressEvent.total) * 100);
file.onProgress?.({ percent: uploadPercent.value });
}
},
});
const resData = response.data;
if (name.endsWith('.zip')) {
const filePath = resData.result[0].filePath;
const result = await UploadShape1({
tableName: props.tableName,
zipFilePath: filePath,
});
handleUploadResult(result.result);
} else {
handleUploadResult(resData.result);
}
file.onSuccess?.('ok');
progresStatus.value = 'success'
} catch (error) {
console.log('error',error)
message.error('上传失败');
file.onError?.(error);
progresStatus.value = 'exception'
}
}
const handleUploadResult = (result: any) => {
if (result.nowData && result.nowData.length > 0) {
nowData.value = result.nowData;
originData.value = result.originData;
mergeSourceModal.value = true;
} else {
message.success('导入成功');
}
};
</script>
<style lang="scss" scoped>
@ -140,6 +177,7 @@ const customRequest = (file) => {
font-size: 24px;
}
.upload-button-div{
position: relative;
display: flex;
justify-content: center;
.upload-button{

View File

@ -10,10 +10,19 @@
:accept="'.xlsx,.csv,.xls,.zip'"
:showUploadList="false"
:custom-request="customRequest"
:beforeUpload="beforeUpload"
>
<a-button type="primary" class="upload-button" :icon="h(PlusOutlined)">上传</a-button>
</a-upload>
</div>
<a-progress
style="margin-bottom: 0px;"
v-show="showProgress"
:percent="uploadPercent"
:status="progresStatus"
size="default"
/>
<div v-show="showProgress">{{ fileName }}</div>
</div>
</div>
</div>
@ -38,42 +47,72 @@ import { ref, h, defineEmits } from "vue"
import { PlusOutlined } from '@ant-design/icons-vue';
import { UploadShape1, Upload, UpdateTableOriginalData, AddUploadExcel } from '@/api/demo/BatchProcessingModal'
import { message } from "ant-design-vue";
import axios from 'axios';
import { getAppEnvConfig } from '@/utils/env';
const { VITE_GLOB_API_URL } = getAppEnvConfig();
const emits = defineEmits(['changeBatchProcessingModal'])
const props = defineProps(['tableName','tableColumn'])
const procedure = ref(0)
const customRequest = (file) => {
console.log('handleCustomRequest',file)
const uploadPercent = ref(0);
const progresStatus = ref('')
const showProgress = ref(false)
const fileName = ref('')
const beforeUpload = (file) => {
showProgress.value = true
fileName.value = file.name
}
const customRequest = async (file) => {
progresStatus.value = ''
const name = file.file.name.toLowerCase();
if (name.endsWith('.zip')){
const formData = new FormData()
formData.append('files', file.file)
Upload(formData).then(res => {
const filePath = res[0].filePath
let params = {
tableName: props.tableName,
zipFilePath: filePath
}
UploadShape1(params).then(result => {
let resultParams = {
tableName: props.tableName,
list: []
}
if(result.nowData.length > 0){
resultParams.list = result.nowData
}
UpdateTableOriginalData(resultParams).then(lastResult => {
message.success('更新成功')
})
})
})
const formData = new FormData();
let url = '';
let params: any = {};
if (name.endsWith('.zip')) {
formData.append('files', file.file);
url = VITE_GLOB_API_URL + '/api/Files/Upload';
}else{
const formData = new FormData()
formData.append('file', file.file)
AddUploadExcel({File: formData, tableName: props.tableName}).then(res => {
message.success('更新成功')
})
formData.append('file', file.file);
url = VITE_GLOB_API_URL + '/api/Layer/AddUploadExcel';
params = { tableName: props.tableName };
}
try {
const response = await axios.post(url, formData, {
params,
headers: { 'Content-Type': 'multipart/form-data' },
onUploadProgress: (progressEvent) => {
if (progressEvent.total) {
uploadPercent.value = Math.round((progressEvent.loaded / progressEvent.total) * 100);
file.onProgress?.({ percent: uploadPercent.value });
}
},
});
const resData = response.data;
if (name.endsWith('.zip')) {
const filePath = resData.result[0].filePath;
const result = await UploadShape1({
tableName: props.tableName,
zipFilePath: filePath,
});
let resultParams = {
tableName: props.tableName,
list: []
}
if(result.result.nowData.length > 0){
resultParams.list = result.result.nowData
}
const lastResult = await UpdateTableOriginalData(resultParams)
progresStatus.value = 'success'
message.success('更新成功')
}else{
progresStatus.value = 'success'
message.success('更新成功')
}
} catch ( error ) {
console.log('error',error)
message.error('上传失败');
progresStatus.value = 'exception'
}
return false
}
</script>

View File

@ -9,7 +9,7 @@
@remove="tableVisible = false"
/>
<div class="map-container w-3/4 xl:w-4/5">
<Map @onLoad="onMapLoad"/>
<Map @onLoad="onMapLoad" />
<!-- 数据列表 -->
<div class="table-constainer" v-show="tableVisible">
<div class="drawer-title-box">
@ -29,7 +29,7 @@
:accept="'.xlsx,.csv,.xls,.zip'"
:showUploadList="false"
:custom-request="customRequest"
style="margin-right: 0px;"
style="margin-right: 0px"
>
<a-button type="primary"> 数据导入 </a-button>
</a-upload>
@ -71,11 +71,16 @@
</div>
<!-- 详情 -->
<div class="data-detail" v-if="showTable == 'detail'">
<a-descriptions title="详情" :column="columnVal">
<a-descriptions-item v-for="(val, key) in selectVal" :key="key" :label="key">{{
val
}}</a-descriptions-item>
</a-descriptions>
<div class="detail-content">
<a-descriptions title="详情" :column="columnVal">
<a-descriptions-item
v-for="(item, index) in detailData"
:key="index"
:label="item.label"
>{{ item.value }}</a-descriptions-item
>
</a-descriptions>
</div>
<div class="detail-button">
<a-button type="primary" @click="showTable = 'edit'"> 编辑 </a-button>
<a-button type="primary" @click="showTable = ''" danger> 关闭 </a-button>
@ -93,11 +98,11 @@
<a-form-item
v-for="(item, index) in headData"
:ref="item"
:label="item"
:label="item.title"
:name="item"
:key="index"
>
<a-input v-model:value="formState[item]" />
<a-input v-model:value="formState[item.dataIndex]" />
</a-form-item>
</a-form>
<div class="data-button">
@ -171,25 +176,29 @@
import { uploadFile, fun_Delete } from '@/api/demo/files';
import { getAppEnvConfig } from '@/utils/env';
import BatchProcessingModal from './BatchProcessingModal/index.vue';
import { Upload, UploadShape, UploadExcelAll } from '@/api/demo/BatchProcessingModal'
import { Upload, UploadShape, UploadExcelAll } from '@/api/demo/BatchProcessingModal';
import { message } from 'ant-design-vue';
import { EventBus } from '@/utils/eventBus';
import {GetGeometryCenter,EditDrawingGeometry,AddDrawingGeometry,DrawingEnd} from "./geometryHandler.ts"
import {
GetGeometryCenter,
EditDrawingGeometry,
AddDrawingGeometry,
DrawingEnd,
} from './geometryHandler.ts';
import * as mars3d from 'mars3d';
let globalMap: mars3d.Map;
let globalMap: mars3d.Map;
const onMapLoad = (map) => {
globalMap = map;
}
EventBus.on("editLayerEnd",function(e){
};
EventBus.on('editLayerEnd', function (e) {
formState.value.geom = e;
console.log("formState",formState.value);
})
console.log('formState', formState.value);
});
const { VITE_GLOB_API_URL } = getAppEnvConfig();
const { createConfirm, createMessage } = useMessage();
@ -244,7 +253,7 @@
const formState = ref({});
const tableName = ref();
const applicationName = ref()
const applicationName = ref();
const styleName = ref();
const rules = {
name: [
@ -322,18 +331,29 @@
const handleSuccess = () => {
treeRef.value.fetch();
};
const detailData = ref([]);
const editData = (record) => {
selectVal.value = record;
formState.value = record;
showTable.value = 'edit';
EditDrawingGeometry(globalMap,record.geom)
EditDrawingGeometry(globalMap, record.geom);
};
const viewData = (record) => {
console.log('record', record);
selectVal.value = record;
formState.value = record;
showTable.value = 'detail';
detailData.value = [];
for (const key in record) {
for (var i = 0; i < headData.value.length; i++) {
if (headData.value[i].dataIndex == key) {
detailData.value.push({
label: headData.value[i].title,
value: record[key],
});
}
}
}
};
const delData = (record) => {
createConfirm({
@ -354,11 +374,9 @@
const fileUrl = ref('');
const fileUrlView: any = ref({});
const posData = (record) => {
let centerLngLat = GetGeometryCenter(record.geom)
globalMap.flyToPoint(centerLngLat,{radius:500})
let centerLngLat = GetGeometryCenter(record.geom);
globalMap.flyToPoint(centerLngLat, { radius: 500 });
};
const styleHandle = () => {
@ -443,7 +461,6 @@
limit: 10,
});
const handleTableChange = (values: any) => {
console.log(values);
searchData.page = values.current;
searchData.limit = values.pageSize;
getList();
@ -457,14 +474,14 @@
};
tableDataByTableName(querys).then((res) => {
setTableData(res.data);
headData.value = res.head;
let arr: any = [];
res.head.forEach((element) => {
res.head.forEach((element, index) => {
arr.push({
title: element,
title: res.headName[index],
dataIndex: element,
});
});
headData.value = arr;
setColumns(arr);
});
};
@ -472,35 +489,35 @@
openTempeleteModel(true);
};
onMounted(() => {});
const customRequest = (file) => {
console.log('handleCustomRequest',file)
const name = file.file.name.toLowerCase();
if (name.endsWith('.zip')){
const formData = new FormData()
formData.append('files', file.file)
Upload(formData).then(res => {
console.log(res)
const filePath = res[0].filePath
let params = {
tableName: tableName.value,
zipFilePath: filePath
}
UploadShape(params).then(result => {
message.success('导入成功')
reload()
})
})
}else{
const formData = new FormData()
formData.append('file', file.file)
UploadExcelAll({File: formData, tableName: tableName.value}).then(res => {
message.success('导入成功')
reload()
})
}
// procedure.value ++
return false
}
const customRequest = (file) => {
console.log('handleCustomRequest', file);
const name = file.file.name.toLowerCase();
if (name.endsWith('.zip')) {
const formData = new FormData();
formData.append('files', file.file);
Upload(formData).then((res) => {
console.log(res);
const filePath = res[0].filePath;
let params = {
tableName: tableName.value,
zipFilePath: filePath,
};
UploadShape(params).then((result) => {
message.success('导入成功');
reload();
});
});
} else {
const formData = new FormData();
formData.append('file', file.file);
UploadExcelAll({ File: formData, tableName: tableName.value }).then((res) => {
message.success('导入成功');
reload();
});
}
// procedure.value ++
return false;
};
</script>
<style lang="less" scoped>
@ -546,10 +563,16 @@ const customRequest = (file) => {
position: absolute;
bottom: 30px;
right: 40px;
background-color: @component-background;
button {
margin-left: 10px;
}
}
.detail-content{
overflow-y: scroll;
height: 80vh;
}
}
.data-edit {
position: absolute;
@ -596,8 +619,8 @@ const customRequest = (file) => {
}
</style>
<style>
.batch-modal-wrap .ant-modal {
transform: scale(0.75) !important;
transform-origin: center !important;
}
.batch-modal-wrap .ant-modal {
transform: scale(0.75) !important;
transform-origin: center !important;
}
</style>