From 314e59a34fe767a39cecd74e6d651778d3b20096 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 31 Oct 2025 10:25:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=8A=80=E6=9C=AF=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableModel2/index.vue | 10 ++- .../technical/components/LeftType.vue | 4 +- .../technical/components/RightTable.vue | 65 ++++++++++++------- .../technical/components/TechnicalDetail.vue | 1 + .../technical/components/TechnicalForm.vue | 1 + .../technical/components/config.js | 4 +- .../enterpriseLibrary/technical/index.vue | 4 +- 7 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/components/TableModel2/index.vue b/src/components/TableModel2/index.vue index 31ca6e2..fa4135f 100644 --- a/src/components/TableModel2/index.vue +++ b/src/components/TableModel2/index.vue @@ -198,6 +198,11 @@ export default { type: [Number, String], default: 600 }, + // 是否自动加载数据 默认自动加载 + autoLoad: { + type: Boolean, + default: true + }, }, computed: { /* 根据操作栏控制表头是否显示 */ @@ -322,7 +327,10 @@ export default { this.$set(this.queryParams, key, this.sendParams[key]) } } - this.getTableList() + // 根据 autoLoad 属性决定是否自动加载数据 + if (this.autoLoad) { + this.getTableList() + } }, updated() { // 若需要自适应最小宽度,可启用下行;当前使用固定宽度 handleColWidth diff --git a/src/views/enterpriseLibrary/technical/components/LeftType.vue b/src/views/enterpriseLibrary/technical/components/LeftType.vue index 920a22f..044785a 100644 --- a/src/views/enterpriseLibrary/technical/components/LeftType.vue +++ b/src/views/enterpriseLibrary/technical/components/LeftType.vue @@ -57,14 +57,14 @@ export default { watch: { value(newVal) { if (newVal) { - this.activeCategory = newVal + this.activeCategory = parseInt(newVal) } }, immediate: true }, mounted() { if (this.value) { - this.activeCategory = this.value; + this.activeCategory = parseInt(this.value); } }, created() { diff --git a/src/views/enterpriseLibrary/technical/components/RightTable.vue b/src/views/enterpriseLibrary/technical/components/RightTable.vue index ce7a055..a0918eb 100644 --- a/src/views/enterpriseLibrary/technical/components/RightTable.vue +++ b/src/views/enterpriseLibrary/technical/components/RightTable.vue @@ -2,13 +2,13 @@
+ :columnsList="columnsList" :request-api="listAPI" :sendParams="sendParams" :autoLoad="false"> @@ -54,11 +64,13 @@ import ToolForm from './components/ToolForm.vue' import { listAPI, delDataAPI } from '@/api/enterpriseLibrary/tool/tool' import { encryptWithSM4, decryptWithSM4 } from '@/utils/sm' import { downloadFileWithLoading } from '@/utils/download' +import ImportExcelDialog from '@/views/common/ImportExcelDialog' export default { name: 'Tool', components: { TableModel, - ToolForm + ToolForm, + ImportExcelDialog }, data() { return { @@ -70,6 +82,10 @@ export default { isflag: false, isAdd: '', row: {}, + maxFileTips:'200MB', + importExcelDialogVisible: false, + // 批量导入上传地址(需要根据实际API接口修改) + importExcelDialogUploadUrl: process.env.VUE_APP_BASE_API + '/smartBid/mainDatabase/tool/importData', } }, @@ -126,8 +142,13 @@ export default { }, // 批量导入 handleBathchImport(){ - - + this.importExcelDialogVisible = true; + }, + handleImportSuccess() { + this.handleQuery(); + }, + handleImportClose() { + this.handleQuery(); }, closeDialog() { this.isflag = false; From afcece44ea064d0334606b7170d93dd21df69e62 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Mon, 3 Nov 2025 11:16:26 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=85=AC=E5=85=B1=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E3=80=81=E5=B7=A5=E5=99=A8=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/common/ImportExcelDialog.vue | 19 ++++++++++++++----- src/views/enterpriseLibrary/tool/index.vue | 12 +++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/views/common/ImportExcelDialog.vue b/src/views/common/ImportExcelDialog.vue index f997353..089e0f1 100644 --- a/src/views/common/ImportExcelDialog.vue +++ b/src/views/common/ImportExcelDialog.vue @@ -5,7 +5,7 @@ + :before-upload="beforeUpload" :on-change="handleFileChange" :auto-upload="false" drag :data="params" class="custom-upload">
@@ -56,6 +56,10 @@ export default { type: String, default: '20MB', }, + params:{ + type:Object, + default:()=>{} + } }, data() { return { @@ -64,7 +68,8 @@ export default { updateSupport: 0, headers: { Authorization: 'Bearer ' + getToken() - } + }, + fileList: [] } }, watch: { @@ -105,6 +110,10 @@ export default { } }, methods: { + // 添加文件变化监听 + handleFileChange(file, fileList) { + this.fileList = fileList + }, // 文件上传前的验证 beforeUpload(file) { // 验证文件大小 @@ -170,11 +179,11 @@ export default { }, // 提交上传 handleSubmit() { - if (!this.$refs.upload.fileList || this.$refs.upload.fileList.length === 0) { + if (this.fileList.length > 0) { + this.$refs.upload.submit() + } else { this.$message.warning('请先选择要上传的文件') - return } - this.$refs.upload.submit() }, // 关闭对话框 handleClose() { diff --git a/src/views/enterpriseLibrary/tool/index.vue b/src/views/enterpriseLibrary/tool/index.vue index 1c6d2d7..157d500 100644 --- a/src/views/enterpriseLibrary/tool/index.vue +++ b/src/views/enterpriseLibrary/tool/index.vue @@ -16,7 +16,7 @@
@@ -53,6 +54,7 @@ @upload-success="handleImportSuccess" @close="handleImportClose" :maxFileTips="maxFileTips" + :params = "params" /> @@ -65,6 +67,7 @@ import { listAPI, delDataAPI } from '@/api/enterpriseLibrary/tool/tool' import { encryptWithSM4, decryptWithSM4 } from '@/utils/sm' import { downloadFileWithLoading } from '@/utils/download' import ImportExcelDialog from '@/views/common/ImportExcelDialog' +const IMPORT_URL = '/smartBid/mainDatabase/tool/importData'; export default { name: 'Tool', components: { @@ -82,10 +85,13 @@ export default { isflag: false, isAdd: '', row: {}, - maxFileTips:'200MB', + maxFileTips:'20MB', importExcelDialogVisible: false, // 批量导入上传地址(需要根据实际API接口修改) - importExcelDialogUploadUrl: process.env.VUE_APP_BASE_API + '/smartBid/mainDatabase/tool/importData', + importExcelDialogUploadUrl: process.env.VUE_APP_BASE_API + IMPORT_URL, + params:{ + enterpriseId: decryptWithSM4(this.$route.query.enterpriseId) || '0', + }, } },