From 3939ff048747f57367371a86a69f8ce0af33cf72 Mon Sep 17 00:00:00 2001 From: fufeifei Date: Fri, 1 Nov 2024 16:29:26 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=89=E5=85=A8=E7=8E=AF=E4=BF=9D?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=AF=BC=E5=87=BAexcel=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=9A=84=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archive/components/info.vue | 20 +++++++++++++++++++ .../inspection/components/list.vue | 19 ++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/views/safetyenvironmental/archive/components/info.vue b/src/views/safetyenvironmental/archive/components/info.vue index cdc7b26..4ed4426 100644 --- a/src/views/safetyenvironmental/archive/components/info.vue +++ b/src/views/safetyenvironmental/archive/components/info.vue @@ -182,6 +182,7 @@
打印 返 回 + 导出
@@ -351,6 +352,25 @@ export default { goBack() { this.$parent.INSPECTION_ID = '' this.$parent.activeName = 'List' + }, + formatDate(dateStr) { + // 将字符串转换为 Date 对象 + const date = new Date(dateStr) + // 获取年、月、日、时、分、秒 + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') // 月份从0开始,需要加1 + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + // const seconds = String(date.getSeconds()).padStart(2, '0') + // 拼接成目标格式 + // return `${year}年${month}月${day}日${hours}时${minutes}分${seconds}秒` + return `${year}年${month}月${day}日${hours}时${minutes}分` + }, + // 导出表格的数据 + goExport() { + var dataStr = '?INSPECTION_ID=' + encodeURIComponent(this.$parent.INSPECTION_ID) + window.location.href = config.httpurl + 'safetyenvironmental/exportInfo' + dataStr } } } diff --git a/src/views/safetyenvironmental/inspection/components/list.vue b/src/views/safetyenvironmental/inspection/components/list.vue index 507fb54..5690f00 100644 --- a/src/views/safetyenvironmental/inspection/components/list.vue +++ b/src/views/safetyenvironmental/inspection/components/list.vue @@ -98,6 +98,9 @@ 重置 + + 导出 + @@ -371,6 +374,22 @@ export default { this.$refs.deptTree_Select1.clearHandle() this.$refs.deptTree_Select2.clearHandle() }, + // 将列表导出为本地的Excel表格 + goExportExcel() { + var dataStr = '?HIDDENDESCR=' + encodeURIComponent(this.search.HIDDENDESCR) + dataStr += '&INSPECTED_DEPARTMENT_ID=' + encodeURIComponent(this.search.INSPECTED_DEPARTMENT_ID) // 被检查单位 + dataStr += '&INSPECTION_DEPARTMENT_ID=' + encodeURIComponent(this.search.INSPECTION_DEPARTMENT_ID) // 检查部门 + dataStr += '&INSPECTION_ORIGINATOR_NAME=' + encodeURIComponent(this.search.INSPECTION_ORIGINATOR_NAME) // 检查发起人 + dataStr += '&INSPECTION_TYPE=' + encodeURIComponent(this.search.INSPECTION_TYPE) // 检查类型 + dataStr += '&INSPECTION_USER_NAME=' + encodeURIComponent(this.search.INSPECTION_USER_NAME) // 检查人员 + dataStr += '&INSPECTION_USER_PHONE=' + encodeURIComponent(this.search.INSPECTION_USER_PHONE) // 检查人员手机 + dataStr += '&INSPECTION_CASE=' + encodeURIComponent(this.search.INSPECTION_CASE) // 检查情况 + dataStr += '&INSPECTION_STATUS=' + encodeURIComponent(this.search.INSPECTION_STATUS) // 检查状态 + dataStr += '&INSPECTION_SUBJECT=' + encodeURIComponent(this.search.INSPECTION_SUBJECT) // 检查题目 + dataStr += '&INSPECTION_TIME_START=' + encodeURIComponent(this.search.INSPECTION_TIME[0]) // 开始检查时间 + dataStr += '&INSPECTION_TIME_END=' + encodeURIComponent(this.search.INSPECTION_TIME[1]) // 结束检查时间 + window.location.href = config.httpurl + 'safetyenvironmental/exportexcel' + dataStr + }, // 获取列表 getList() { this.listLoading = true