From e006ca8aacff62bc938f19a5317a13aa77dd92f0 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Wed, 19 Mar 2025 10:10:49 +0800 Subject: [PATCH] =?UTF-8?q?bug#1938=E6=99=BA=E8=83=BD=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=9F=E8=AE=A1=E7=B1=BB=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=20bug#1940=E4=BD=BF=E7=94=A8=E5=B7=B2=E6=9C=89=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=8A=8A=E6=A0=87=E7=AD=BE=E5=90=8D=E7=A7=B0=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/smartExcel/cpts/export-view.vue | 126 +++++++++++++----- src/views/modules/base/smartExcel/report.vue | 2 +- 2 files changed, 95 insertions(+), 33 deletions(-) diff --git a/src/views/modules/base/smartExcel/cpts/export-view.vue b/src/views/modules/base/smartExcel/cpts/export-view.vue index 29929a417..6d7463d56 100644 --- a/src/views/modules/base/smartExcel/cpts/export-view.vue +++ b/src/views/modules/base/smartExcel/cpts/export-view.vue @@ -4,11 +4,11 @@
返回 - 上传统计模板 + 上传统计模板 数据列表导出 - 数据统计条件 + 数据统计条件 + 自动检查
导出 @@ -30,23 +30,27 @@ :close-on-click-modal="false"> - + - + -
- +
+ {{ fileName }} 删除
+ @@ -404,10 +408,13 @@ export default { workbookId: '', formCode: "", columnsJson: [], - searchForm: {} + searchForm: {}, + moduleUrl:'' }, dataRule: { - reportName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] + reportName: [{ required: true, message: '报表名称长度5-10个字符', trigger: 'blur',max:30,min:5 }], + moduleUrl:[{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] + }, tagRule: { tagName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] @@ -457,7 +464,7 @@ export default { showConditionDetailsDialog:false, luckysheetLoading:false, reportId:'', - moduleUrl:'' + fileName:'' }; }, props: { @@ -536,6 +543,47 @@ export default { }) }, methods: { + removeFile() { + this.dataForm.moduleUrl = ''; + this.fileName = ''; + }, + async handleClickInspect() { + // 获取celldata并转换为list + const list = luckysheet.getAllSheets()[0].celldata.map(item => ({ + r: item.r, + c: item.c, + v: item.v.v || '' + })); + // 发送请求获取异常数据 + let { data, code, msg } = await requestPost('/actual/base/intelligentImportData/checkData', list); + if (code === 0) { + if (data && data.length > 0) { + for (const { r, c } of data) { + luckysheet.setCellFormat(r, c, 'bg', '#f5504a'); + } + const findArr = this.findUniqueElements(luckysheet.getAllSheets()[0].celldata, data); + findArr.forEach(({ r, c, v }) => { + if (v.bg === "#f5504a") { + luckysheet.setCellFormat(r, c, 'bg', '#ffffff'); + } + }); + } else { + console.log(luckysheet.getAllSheets()[0].celldata); + luckysheet.getAllSheets()[0].celldata.forEach(item=>{ + if(item.v.bg==="#f5504a"){ + luckysheet.setCellFormat(item.r, item.c, 'bg', '#ffffff'); + } + }) + this.$message.success('没有找到异常'); + } + } + }, + findUniqueElements(A, B) { + // 创建B中r和c组合的键集合 + const bCombinations = new Set(B.map(item => `${item.r},${item.c}`)); + // 过滤A中不存在于B的组合 + return A.filter(item => !bCombinations.has(`${item.r},${item.c}`)); + }, async handelRemoveTag(row){ const url = `/governance/resiSearchTag/deleteResiSearchTag/${row.tagId}`; let { code, msg } = await requestPost(url); @@ -570,11 +618,11 @@ export default { }, async initForm(type, row) { - this.tagForm.tagName = row.tagName; - if (type == "info") { + if (type == "view") { await this.getFormEdit(row.tagId); } else if (type == "edit") { await this.getFormEdit(row.tagId); + this.tagForm.tagName = row.tagName; } this.tagForm.tagId = row.tagId; for (let i in this.tableData) { @@ -593,7 +641,7 @@ export default { } }, handelClickTag(item) { - this.initForm("edit", item); + this.initForm("view", item); }, async fetchData(url, params) { try { @@ -704,7 +752,7 @@ export default { } }, // 获取已选择条件 - async getConditions4Cell() { + async getConditions4Cell(type) { let url = '/actual/base/intellgentizeReport/getConditions4Cell'; let parm = { axis: this.selectedCell, @@ -712,7 +760,7 @@ export default { } const { data, code, msg } = await requestGet(url, parm) if (code === 0) { - this.initForm('info',data) + this.initForm(type,data) } }, @@ -926,16 +974,27 @@ export default { }, handleExcelSuccess(e) { if (e.code === 0) { - this.moduleUrl = e.data.url; - const newUrl = e.data.url.replace( + this.dataForm.moduleUrl = e.data.url; + this.fullscreenLoading = false; + } + }, + handleSaveTemplate(){ + this.$refs['dataForm'].validate(valid=>{ + if (!valid) { + return false + } + const newUrl = this.dataForm.moduleUrl.replace( /^https:\/\/elink-esua-epdc\.oss-cn-qingdao\.aliyuncs\.com/, `${location.origin}` ); - this.urlToFile(newUrl) - this.showTemplate = false; // this.urlToFile('http://localhost:9001/epmet-work-pc/test1.xlsx') - this.fullscreenLoading = false; - } + this.urlToFile(`${process.env.NODE_ENV === "development" ?'http://localhost:9001/epmet-work-pc/test1.xlsx':newUrl}`) + this.showTemplate = false; + }) + }, + handleCloseTemplate(){ + this.$refs['dataForm'].resetFields(); + this.showTemplate = false; }, async urlToFile(url, fileName = 'file') { try { @@ -991,13 +1050,13 @@ export default { if((this.$store.state.user.id === this.infoObj.creatorId) || this.importType === 'template'){ this.showConditionDetailsDialog = false; let statisticalValue = luckysheet.getCellValue(row-1,column-1) - if(statisticalValue&&(statisticalValue !== 0 && statisticalValue !== null)){ + if(statisticalValue && (statisticalValue !== 0 && statisticalValue !== null)){ this.activeName = 'history'; - this.getConditions4Cell(); + this.getConditions4Cell('edit'); } }else{ this.showConditionDetailsDialog = true; - this.getConditions4Cell() + this.getConditions4Cell('view') } } }, @@ -1055,7 +1114,7 @@ export default { } }, // 上传模板 - async handleClickInspect() { + async handleClickUploadTemplate() { this.showTemplate = true; this.importType = 'template' }, @@ -1083,6 +1142,9 @@ export default { range: `A2:${bottomRightCorner}${listData.length}`, }) this.reportId = val.id; + this.infoObj.reportType = 0; + this.pageType = 'info'; + this.getSheetList(); this.luckysheetLoading = false; }, async saveLuckysheetHead(head) { @@ -1175,7 +1237,7 @@ export default { padding: 0px; z-index: 2; width: calc(100vw - 400px); - height: calc(100vh - 250px); + height: calc(100vh - 220px); } .luckysheet-wrap-all { @@ -1183,7 +1245,7 @@ export default { padding: 0px; z-index: 2; width: calc(100vw - 100px); - height: calc(100vh - 250px); + height: calc(100vh - 200px); } #luckysheet-export { @@ -1199,10 +1261,10 @@ export default { width: 100%; } -.upload-demo { - position: absolute; - z-index: 999999; - margin: 20px 0 0 22px; +.upload-img{ + width: 30px; + height: 30px; + margin-right: 10px; } .right-slider { diff --git a/src/views/modules/base/smartExcel/report.vue b/src/views/modules/base/smartExcel/report.vue index 91a4af34d..36ee0aa39 100644 --- a/src/views/modules/base/smartExcel/report.vue +++ b/src/views/modules/base/smartExcel/report.vue @@ -155,7 +155,7 @@ export default { computed: { maxTableHeight() { const h = this.clientHeight - this.searchH - 275; - const _h = this.clientHeight - 275 - this.searchH; + const _h = this.clientHeight - 220 - this.searchH; return this.$store.state.inIframe ? h : _h; }, ...mapGetters(["clientHeight"]),