From 68c0c5e04a6a53b5a775e893bcc692d9369161c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=95=E5=B5=A9?= <17854119262@163.com> Date: Tue, 29 Apr 2025 08:36:48 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8E=E5=86=8D=E6=89=A7=E8=A1=8Csql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Zhigan/ZhiGan_ModalTimeLine/index.vue | 26 ++++++++++--------- .../Zhigan/Zhigan/ZhiGan_ModalVideo/index.vue | 23 +++++++++------- .../Zhigan/ZhiGan_SheXiangTouModal/index.vue | 17 +++++++++--- .../ZhiGan_WuRenJiShiShiHuaMian/index.vue | 18 ++++++++++--- .../Zhiku/HuoQingDetailTimeLine/index.vue | 18 ++++++++++--- 5 files changed, 70 insertions(+), 32 deletions(-) diff --git a/src/packages/components/Zhigan/Zhigan/ZhiGan_ModalTimeLine/index.vue b/src/packages/components/Zhigan/Zhigan/ZhiGan_ModalTimeLine/index.vue index c739a90..639a159 100644 --- a/src/packages/components/Zhigan/Zhigan/ZhiGan_ModalTimeLine/index.vue +++ b/src/packages/components/Zhigan/Zhigan/ZhiGan_ModalTimeLine/index.vue @@ -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; + } + }); + } + }, + ); From 1cc206bb5b761830fb3681f9d03f7ad4219c1ed3 Mon Sep 17 00:00:00 2001 From: zhufu <17863654727@163.com> Date: Tue, 29 Apr 2025 10:16:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=9B=E5=BA=A6=E6=9D=A1=EF=BC=8C=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImportComponent/index.vue | 118 ++++++++++++------ .../UpdateComponent/index.vue | 99 ++++++++++----- 2 files changed, 147 insertions(+), 70 deletions(-) diff --git a/src/views/demo/layer/BatchProcessingModal/ImportComponent/index.vue b/src/views/demo/layer/BatchProcessingModal/ImportComponent/index.vue index 2bbd808..0d0e0c0 100644 --- a/src/views/demo/layer/BatchProcessingModal/ImportComponent/index.vue +++ b/src/views/demo/layer/BatchProcessingModal/ImportComponent/index.vue @@ -10,10 +10,19 @@ :accept="'.xlsx,.csv,.xls,.zip'" :showUploadList="false" :custom-request="customRequest" + :beforeUpload="beforeUpload" > 上传 + +
{{ fileName }}
@@ -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('导入成功'); + } +};