From df8359bcf65013a908f2f376fe15cbc4dff76c50 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Thu, 28 Sep 2023 10:05:03 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9=E4=BC=81=E6=A0=87?= =?UTF-8?q?=E7=A8=BD=E6=9F=A5,=E4=BC=81=E6=A0=87=E8=AE=A1=E5=88=92?= =?UTF-8?q?=EF=BC=8C=E4=BC=81=E6=A0=87=E5=AE=A3=E8=B4=AF=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=90=8E=E7=BC=80=EF=BC=9B=E4=BC=81=E6=A0=87=E5=A4=8D=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1=E5=88=92=EF=BC=8C=E4=BC=81=E6=A0=87=E7=A8=BD=E6=9F=A5?= =?UTF-8?q?=EF=BC=8C=E4=BC=81=E6=A0=87=E8=AE=A1=E5=88=92=E4=B8=AD=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=97=A5=E6=9C=9F=E6=9C=89=E7=89=B9=E6=AE=8A=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/less/common.less | 5 ++ .../check/CheckList.vue | 56 ++++++++++++++++++- .../plan/PlanList.vue | 54 ++++++++++++++++-- .../publicize/EnterpriseStandardPublicize.vue | 44 +++++++++++++++ .../reviewPlan/ReviewPlanList.vue | 4 +- 5 files changed, 153 insertions(+), 10 deletions(-) diff --git a/src/assets/less/common.less b/src/assets/less/common.less index 89ce705a..3d56158c 100644 --- a/src/assets/less/common.less +++ b/src/assets/less/common.less @@ -335,6 +335,11 @@ text-overflow: ellipsis; } +/* 表格中需要标红的样式 */ +.table-red-text { + color: #D52C26; +} + /* 表格中换行链接的样式 */ .link-a { display: inline-block; diff --git a/src/views/enterpriseStandardLibrary/check/CheckList.vue b/src/views/enterpriseStandardLibrary/check/CheckList.vue index c811fb06..f3d4ae75 100644 --- a/src/views/enterpriseStandardLibrary/check/CheckList.vue +++ b/src/views/enterpriseStandardLibrary/check/CheckList.vue @@ -127,11 +127,11 @@ - + {{ text || text === 0 ? text : global.emptyLine }} - {{ text || text === 0 ? text : global.emptyLine }} + {{ text || text === 0 ? text : global.emptyLine }} @@ -324,14 +324,21 @@ export default { clickEvent: 'handleRectificationPlan', has: 'enterpriseStandardLibrary:check:rectificationPlan' } - ] + ], + sevenDaysAgo: undefined } }, mounted () { this.getSysCategoryTree() + this.sevenDaysAgo = this.getSevenDaysAgo() }, methods: { isHasPermission, + // 获取七天前日期 + getSevenDaysAgo () { + const dateStr = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + (new Date().getDate() - 7) + return new Date(Date.parse(dateStr)) + }, // 获取组织机构树 getSysCategoryTree () { queryDepartTreeList().then((res) => { @@ -361,6 +368,49 @@ export default { } }) }, + // 导出 + handleExportXls (fileName) { + if (!fileName || typeof fileName !== 'string') { + fileName = '导出文件' + } + const param = this.getQueryParams() + if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { + param.selections = this.selectedRowKeys.join(',') + } + console.log('导出参数', param) + // 加一个大的提示 + const modalLoading = this.$info({ + title: '提示', + content: 正在导出,请稍候 , + keyboard: false + }) + // 把知道了这个按钮去掉 + this.$nextTick(() => { + document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none' + }) + downFile(this.url.exportXlsUrl, param).then((data) => { + if (!data) { + this.$message.warning('文件下载失败') + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls') + } else { + const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) + const link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', fileName + '.xls') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) // 下载完成移除元素 + window.URL.revokeObjectURL(url) // 释放掉blob对象 + } + }).finally(() => { + // 销毁这个提示 + modalLoading.destroy() + }) + }, // 导出延期数据 handleExportPostponeData (fileName) { if (!fileName || typeof fileName !== 'string') { diff --git a/src/views/enterpriseStandardLibrary/plan/PlanList.vue b/src/views/enterpriseStandardLibrary/plan/PlanList.vue index ddb75a96..03f572d4 100644 --- a/src/views/enterpriseStandardLibrary/plan/PlanList.vue +++ b/src/views/enterpriseStandardLibrary/plan/PlanList.vue @@ -180,11 +180,11 @@ - + {{ text || text === 0 ? text : global.emptyLine }} - {{ text || text === 0 ? text : global.emptyLine }} + {{ text || text === 0 ? text : global.emptyLine }} @@ -204,6 +204,7 @@ import { queryDepartTreeList } from '@/api/api' import JTable from '@/components/jero/JTable' import { JeroListMixin } from '@/mixins/JeroListMixin' +import { downFile } from '../../../api/manage' export default { name: 'PlanList', @@ -320,21 +321,21 @@ export default { align: 'center', width: 180, dataIndex: 'draftPlannedCompleteDate', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'specialDate' } }, { // 征求意见稿计划完成日期 title: this.$t('enterpriseStandardLibrary.plan.exposureDraftPlanFinishDate'), align: 'center', width: 200, dataIndex: 'solicitationDraftPlanCompleteDate', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'specialDate' } }, { // 计划报批日期 title: this.$t('enterpriseStandardLibrary.plan.planSubmissionDate'), align: 'center', width: 180, dataIndex: 'planApprovalDate', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'specialDate' } }, { // 草稿完成日期 title: this.$t('enterpriseStandardLibrary.plan.draftFinishDate'), @@ -462,6 +463,49 @@ export default { id: record.id } }) + }, + // 导出 + handleExportXls (fileName) { + if (!fileName || typeof fileName !== 'string') { + fileName = '导出文件' + } + const param = this.getQueryParams() + if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { + param.selections = this.selectedRowKeys.join(',') + } + console.log('导出参数', param) + // 加一个大的提示 + const modalLoading = this.$info({ + title: '提示', + content: 正在导出,请稍候 , + keyboard: false + }) + // 把知道了这个按钮去掉 + this.$nextTick(() => { + document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none' + }) + downFile(this.url.exportXlsUrl, param).then((data) => { + if (!data) { + this.$message.warning('文件下载失败') + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls') + } else { + const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) + const link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', fileName + '.xls') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) // 下载完成移除元素 + window.URL.revokeObjectURL(url) // 释放掉blob对象 + } + }).finally(() => { + // 销毁这个提示 + modalLoading.destroy() + }) } } } diff --git a/src/views/enterpriseStandardLibrary/publicize/EnterpriseStandardPublicize.vue b/src/views/enterpriseStandardLibrary/publicize/EnterpriseStandardPublicize.vue index 32c90197..aeff9fc9 100644 --- a/src/views/enterpriseStandardLibrary/publicize/EnterpriseStandardPublicize.vue +++ b/src/views/enterpriseStandardLibrary/publicize/EnterpriseStandardPublicize.vue @@ -111,6 +111,7 @@ import Vue from 'vue' import { ACCESS_TOKEN } from '@/store/mutation-types' import { previewPdf } from '@/utils/previewPdf' import { getFileAccessHttpUrl } from '@/api/manage' +import { downFile } from '../../../api/manage' const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_PDF = 'pdf' @@ -226,6 +227,49 @@ export default { // 其余可预览文件仍使用KKFile进行预览 const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` window.open(url) + }, + // 导出 + handleExportXls (fileName) { + if (!fileName || typeof fileName !== 'string') { + fileName = '导出文件' + } + const param = this.getQueryParams() + if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { + param.selections = this.selectedRowKeys.join(',') + } + console.log('导出参数', param) + // 加一个大的提示 + const modalLoading = this.$info({ + title: '提示', + content: 正在导出,请稍候 , + keyboard: false + }) + // 把知道了这个按钮去掉 + this.$nextTick(() => { + document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none' + }) + downFile(this.url.exportXlsUrl, param).then((data) => { + if (!data) { + this.$message.warning('文件下载失败') + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls') + } else { + const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) + const link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', fileName + '.xls') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) // 下载完成移除元素 + window.URL.revokeObjectURL(url) // 释放掉blob对象 + } + }).finally(() => { + // 销毁这个提示 + modalLoading.destroy() + }) } } } diff --git a/src/views/enterpriseStandardLibrary/reviewPlan/ReviewPlanList.vue b/src/views/enterpriseStandardLibrary/reviewPlan/ReviewPlanList.vue index 09712368..dc60e824 100644 --- a/src/views/enterpriseStandardLibrary/reviewPlan/ReviewPlanList.vue +++ b/src/views/enterpriseStandardLibrary/reviewPlan/ReviewPlanList.vue @@ -85,11 +85,11 @@ - + {{ text || text === 0 ? text : global.emptyLine }} - {{ text || text === 0 ? text : global.emptyLine }} + {{ text || text === 0 ? text : global.emptyLine }}