From 2c6d91d758241e1f97fe2790d92b754ea2cc860c Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 28 Mar 2024 15:59:25 +0800 Subject: [PATCH] fix: 空气质量日报表显示 --- src/components/formTypeComponets/dialog/index.vue | 7 src/router/dynamicRouter.js | 7 src/views/toCarryOutLegislativeReforms/delay/index.vue | 2 src/views/statement/index.vue | 445 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 457 insertions(+), 4 deletions(-) diff --git a/src/components/formTypeComponets/dialog/index.vue b/src/components/formTypeComponets/dialog/index.vue index e7a63fd..3cd1e58 100644 --- a/src/components/formTypeComponets/dialog/index.vue +++ b/src/components/formTypeComponets/dialog/index.vue @@ -29,7 +29,7 @@ <el-button v-if="isShowSumbitBut" type="primary" - @click="close()" + @click="handleSumbmit()" > ��� ��� </el-button> @@ -81,8 +81,9 @@ this.visible = false this.$emit('update:dialogVisible', false) }, - handleClose () { - + handleSumbmit () { + this.close() + this.$emit('dialogSubmit', false) } } } diff --git a/src/router/dynamicRouter.js b/src/router/dynamicRouter.js index d794134..41d03a6 100644 --- a/src/router/dynamicRouter.js +++ b/src/router/dynamicRouter.js @@ -113,6 +113,12 @@ component: () => import('@/views/hand/index'), meta: { title: '������������', icon: 'example' } } +const statement = { + path: 'report/statement', + name: 'statement', + component: () => import('@/views/statement/index'), + meta: { title: '���������������������������', icon: 'example' } +} // ������������������������ const airQualityReportDisplay = { path: 'report/airQualityReportDisplay', @@ -247,6 +253,7 @@ staffManagement: staffManagement, showGovHourData: showGovHourData, hand: hand, + statement: statement, cityAirRank: cityAirRank, levelStatistic: levelStatistic, onlineRate: onlineRate, diff --git a/src/views/statement/index.vue b/src/views/statement/index.vue new file mode 100644 index 0000000..fd809b2 --- /dev/null +++ b/src/views/statement/index.vue @@ -0,0 +1,445 @@ +<template> + <div class="container"> + <div class="searchBox"> + <div>������:</div> + <el-date-picker + v-model="timePicker" + class="margOut" + type="daterange" + range-separator="���" + start-placeholder="������������" + end-placeholder="������������" + /> + <div> + <el-button + type="primary" + @click="handleSearch" + > + ������ + </el-button> + <el-button + type="primary" + @click="()=>isVisible = true" + > + ������������ + </el-button> + </div> + </div> + <div> + <el-row :gutter="24"> + <el-col :span="10"> + <el-table + :data="tableData" + style="width: 100%" + @row-click="rowClick" + > + <el-table-column + label="������" + type="index" + align="center" + width="100" + /> + <el-table-column + prop="reportTime" + align="center" + label="������" + width="180" + /> + <el-table-column + prop="reportContent" + align="center" + label="������" + > + <template slot-scope="scope"> + <div + style=" + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + " + v-html="scope.row.reportContent" + /> + </template> + </el-table-column> + </el-table> + </el-col> + <el-col + :span="14" + style="position: relative;" + > + <el-input + id="myText" + v-model="reportContent" + readonly + class="wordContent" + type="textarea" + resize="none" + /> + + <div + v-if="filesList.length > 0" + class="fileBox" + > + <el-row + type="flex" + align="middle" + > + <el-col :span="18"> + <div + v-for="item in filesList" + :key="item.fileId" + > + <el-button + type="text" + @click="handleExport(item)" + > + {{ item.fileName }} + </el-button> + </div> + </el-col> + <el-col + :span="6" + style="text-align: center;" + > + <div> + <el-button + type="text" + @click="copyText" + > + ������ + </el-button> + </div> + <el-button + type="text" + @click="()=>resetFileVisible = true" + > + ������������ + </el-button> + </el-col> + </el-row> + </div> + </el-col> + </el-row> + </div> + <div class="pagina"> + <el-pagination + background + :current-page="pagination.currentPage" + :page-sizes="pagination.pageSizes" + :page-size="pagination.pageSize" + :total="pagination.totalCount" + layout="total, sizes, prev, pager, next, jumper" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + <diaLog + v-if="isVisible" + :dialog-visible.sync="isVisible" + :title="`������������`" + :width="`500px`" + @dialogSubmit="dialogSubmit" + > + <template #body> + <div> + <el-form + label-width="80px" + :model="formInline" + > + <div style="width: 400px"> + <el-form-item label="������:"> + <el-date-picker + v-model="formInline.time" + style="width: 100%" + type="date" + placeholder="������������" + /> + </el-form-item> + <el-form-item label="������:"> + <el-input + v-model="formInline.code" + placeholder="���������" + /> + </el-form-item> + <p style="text-align: center;color: red"> + ���������������������������������������������! + </p> + </div> + </el-form> + </div> + </template> + </diaLog> + <diaLog + v-if="resetFileVisible" + :dialog-visible.sync="resetFileVisible" + :title="`������������`" + :width="`500px`" + @dialogSubmit="handleResetFile" + > + <template #body> + <div> + <div + v-for="(item,index) in filesList" + :key="item.fileId" + class="resetFileBox" + > + <span> + {{ item.fileName }} + </span> + <el-upload + class="upload-demo" + :action="uploadUrl" + accept=".xls,.xlsx" + :show-file-list="false" + :data="{sysCode}" + :on-success="handleUploadSuccess" + :headers="{ token: token }" + > + <el-button + type="text" + @click="updataFileid(index)" + > + ������������ + </el-button> + </el-upload> + </div> + </div> + </template> + </diaLog> + </div> +</template> + +<script> +import _ from 'lodash' +import requestObj from '@/utils/request' +import { getToken } from '@/utils/auth' +import diaLog from '@/components/formTypeComponets/dialog/index.vue' +import dayjs from 'dayjs' +export default { + components: { + diaLog + }, + data () { + return { + upFileList: [], + sysCode: '1250301', + token: getToken(), + isVisible: false, + resetFileVisible: false, + filesList: [], + reportContent: '', + formInline: { + code: '', + time: new Date() + }, + pagination: { + currentPage: 1, + // ������������������������������������������(���������������������������) + totalCount: 0, + // ������������������������������ + pageSizes: [10, 30, 60, 100], + // ������������������������������������������ + pageSize: 10 + }, + timePicker: [], + tableData: [], + clickId: '', + selectFileIndex: null + } + }, + computed: { + uploadUrl () { + return `${requestObj.baseUrl}/file/upload` + }, + exportUrl () { + return `${requestObj.baseUrl}/file/preview/` + } + }, + watch: { + resetFileVisible (newValue, oldValue) { + if (newValue) { this.upFileList = _.cloneDeep(this.filesList) } + } + }, + created () { + this.handleSearch() + }, + methods: { + handleExport (item) { + this.$request({ + url: `file/preview/${item.fileId}`, + method: 'get', + responseType: 'blob', + }).then(res => { + this.getOutExcel(`${item.fileName}.xlsx`, res) + }) + }, + getOutExcel (fileName, res) { + const blob = new Blob([res], { type: 'application/x-xls' }) + if (window.navigator.msSaveOrOpenBlob) { + // ������ IE & EDGE + navigator.msSaveBlob(blob, fileName) + } else { + var link = document.createElement('a') + // ������������������������URL������ + const url = window.URL || window.webkitURL || window.moxURL + // ������������������ + link.href = url.createObjectURL(blob) + // ������������������ + link.download = fileName + // ������������������ + link.click() + // ������������������������ + url.revokeObjectURL(link.href) + } + }, + updataFileid (index) { + this.selectFileIndex = index + }, + // ������������������ + handleUploadSuccess (response, file, fileList) { + this.upFileList[this.selectFileIndex] = response.data + console.log('this.upFileList', this.upFileList) + }, + handleResetFile (item) { + this.$request({ + url: '/cityReptiles/fileUpload', + method: 'post', + data: { + list: this.upFileList, + id: this.clickId + } + }).then((res) => { + this.$message({ + message: '������������', + type: 'success' + }) + }) + .catch(err => { + console.log(err) + this.$message.error('������������') + }) + }, + copyText () { + const textToCopy = document.getElementById('myText').value + this.copyToClipboard(textToCopy) + }, + async copyToClipboard (text) { + try { + await navigator.clipboard.writeText(text) + this.$message({ + message: '���������������������������������', + type: 'success' + }) + } catch (err) { + console.error('������������:', err) + } + }, + rowClick (val) { + this.reportContent = val.reportContent + this.filesList = val.list + this.clickId = val.id + }, + dialogSubmit () { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + this.$request({ + url: '/cityReptiles/report', + method: 'get', + params: { + code: this.formInline.code, + time: dayjs(this.formInline.time).format('YYYY-MM-DD') + } + }).then((res) => { + console.log('res', res) + this.handleSearch() + loading.close() + }) + .catch(err => { + loading.close() + console.log(err) + this.$message.error('������������') + }) + }, + handleSearch () { + this.$request({ + url: '/cityReptiles/page', + method: 'post', + data: { + 'page': this.pagination, + startTime: this.timePicker && this.timePicker.length > 0 ? dayjs(this.timePicker[0]).format('YYYY-MM-DD') : '', + endTime: this.timePicker && this.timePicker.length > 0 ? dayjs(this.timePicker[1]).format('YYYY-MM-DD') : '' + } + }).then((res) => { + this.tableData = res.data.list + this.pagination.totalCount = res.data.page.totalNum + this.reportContent = res.data.list.length > 0 ? res.data.list[0].reportContent : '' + this.filesList = res.data.list.length > 0 ? res.data.list[0].list : '' + this.clickId = res.data.list.length > 0 ? res.data.list[0].id : '' + }) + .catch(err => { + console.log(err) + this.$message.error('������������') + }) + }, + // ������ + // ��������������������� + handleSizeChange (val) { + // ��������������������������� + this.pagination.pageSize = val + // ��������������������������������������������������������������������������� + this.pagination.currentPage = 1 + this.handleSearch() + }, + // ��������������� + handleCurrentChange (val) { + // ��������������������� + this.pagination.currentPage = val + this.handleSearch() + // console.log(val) + }, + }, +} +</script> + +<style lang="scss" scoped> +.container{ + overflow-y:auto; + overflow-x:hidden; + height: 100%; + padding: 10px; + .searchBox{ + display: flex; + // font-size: 18px; + align-items: center; + .margOut{ + margin: 0 10px; + } + margin-bottom: 20px; + } +} +/deep/.wordContent{ + .el-textarea__inner{ + font-size: 14px; + height: 600px; + } +} +.fileBox{ + width: 100%; + position: absolute; +} +.copy{ + padding: 0; + margin-right: 20px; + text-align: right; +} +.resetFileBox{ + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; +} +</style> diff --git a/src/views/toCarryOutLegislativeReforms/delay/index.vue b/src/views/toCarryOutLegislativeReforms/delay/index.vue index 77db1b6..b7c8a2b 100644 --- a/src/views/toCarryOutLegislativeReforms/delay/index.vue +++ b/src/views/toCarryOutLegislativeReforms/delay/index.vue @@ -210,7 +210,7 @@ // ������������������������������������������(���������������������������) totalCount: 0, // ������������������������������ - pageSizes: [10, 20, 30, 40], + pageSizes: [10, 30, 60, 100], // ������������������������������������������ pageSize: 10 }, -- Gitblit v1.8.0