From 42b603a8c4ada5a4f890f4e60322a719ff8428ab Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 15 Nov 2023 17:29:30 +0800
Subject: [PATCH] Merge branch 'feature_1.0'
---
src/views/toCarryOutLegislativeReforms/reform/index.vue | 106 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 96 insertions(+), 10 deletions(-)
diff --git a/src/views/toCarryOutLegislativeReforms/reform/index.vue b/src/views/toCarryOutLegislativeReforms/reform/index.vue
index b443b7e..ec3b62b 100644
--- a/src/views/toCarryOutLegislativeReforms/reform/index.vue
+++ b/src/views/toCarryOutLegislativeReforms/reform/index.vue
@@ -1,13 +1,23 @@
<template>
- <div class="main">
+ <div class="main" v-loading="loading">
<div>
<searchBar v-if="searchType" :search-type="'reform'" @handleSearch="handleSearchBut" @handleAdd="handleOpenDialog(null, 'add')" />
<newWorkOrder v-if="centerDialogVisible" ref="newWorkOrder" :parent-form-data="parentFormData" :title="title" :page-state="pageState" :visible.sync="centerDialogVisible" @handleSubmit="newHandleSubmit" />
+ <!-- <el-divider></el-divider> -->
<div class="tab">
- <el-table size="mini" :data="tableData" border max-height="680" style="width: 100%" :header-cell-style="{
+ <div class="exportBox">
+ <div>������������</div>
+ <div>
+ <el-button type="primary" size="mini" @click="handleOpenDialog(null, 'add')">������</el-button>
+ <el-button :disabled="!(selectionRows.length>0)" type="info" size="mini" @click="exportData">������</el-button>
+ </div>
+ </div>
+ <el-table size="mini" :data="tableData" border max-height="680" style="width: 100%" @selection-change="handleSelectionChange" :header-cell-style="{
color: '#101111',
fontSize: '16px'
}">
+ <el-table-column type="selection" width="40" align="center">
+ </el-table-column>
<el-table-column type="index" label="������" width="60px" align="center" />
<el-table-column align="center">
<template slot="header">
@@ -19,7 +29,7 @@
<div>{{ scope.row.escalationTime }}</div>
</template>
</el-table-column>
- <el-table-column align="center" prop="unitId" label="������������" :formatter="unitIdFormatter" />
+ <el-table-column align="center" prop="unitId" label="������������" width="150px" :formatter="unitIdFormatter" />
<el-table-column align="center" prop="polluteType" label="������������" width="120px" :formatter="polluteTypeFormatter" />
<el-table-column align="center">
<template slot="header">
@@ -60,7 +70,7 @@
</template>
</el-table-column>
<el-table-column align="center" prop="isInvalid" label="������������" width="60px" :formatter="isInvalidFormatter" />
- <el-table-column align="center">
+ <el-table-column align="center" width="150px">
<template slot="header">
<div>������������</div>
<div>���������</div>
@@ -70,7 +80,7 @@
<div>{{ updatUnitIdFormatter(scope.row) }}</div>
</template>
</el-table-column>
- <el-table-column align="center">
+ <el-table-column align="center" width="150px">
<template slot="header">
<div>���������</div>
<div>������������</div>
@@ -80,7 +90,7 @@
<div>{{ scope.row.updateTime }}</div>
</template>
</el-table-column>
- <el-table-column align="center" prop="createTime" width="100px" label="������">
+ <el-table-column align="center" prop="createTime" min-width="100px" label="������">
<template slot-scope="scope">
<el-button type="text" size="medium" @click="openWorkOrdinDialog(scope.row, 'detail')">
@@ -185,6 +195,8 @@
</template>
<script>
+import axios from 'axios'
+import qs from 'qs'
import searchBar from '@/views/toCarryOutLegislativeReforms/components/queryForm'
import newWorkOrder from '@/views/toCarryOutLegislativeReforms/components/newWorkOrder'
import workOrderInformation from '@/views/toCarryOutLegislativeReforms/components/workOrderInformation'
@@ -196,6 +208,8 @@
},
data() {
return {
+ loading: false,
+ selectionRows: [],
errorClass: 'errorClass',
searchType: 'reform',
pagination: {
@@ -203,7 +217,7 @@
// ������������������������������������������(���������������������������)
totalCount: 0,
// ������������������������������
- pageSizes: [10, 20, 30, 40],
+ pageSizes: [10, 30, 60, 100],
// ������������������������������������������
pageSize: 10
},
@@ -263,11 +277,75 @@
}
},
created() {
- this.handleSearch()
+ this.handleSearch({ isInvalid: 0, state: [9, 20, 30] })
this.getUnitList()
this.getContaminateList()
},
methods: {
+ handleSelectionChange(rows) {
+ console.log(rows)
+ this.selectionRows = rows
+ },
+ exportData() {
+ const CancelToken = axios.CancelToken
+ let cancel
+ let timer = setTimeout(() => {
+ cancel()
+ this.loading = false
+ this.$message.error('���������������������������������������������')
+ }, 30000)
+ this.loading = true
+ this.$request({
+ url: '/allocation/listExcel',
+ method: 'get',
+ responseType: 'blob',
+ params: {
+ id: this.selectionRows.map(item => item.allocationId)
+ },
+ cancelToken: new CancelToken(function executor(c) {
+ cancel = c
+ }),
+ paramsSerializer: params => {
+ return qs.stringify(params, {
+ indices: false
+ })
+ }
+ })
+ .then(res => {
+ clearTimeout(timer)
+ console.log('������������', res)
+ if (res.code === -1) {
+ this.$message.error(res.message)
+ } else {
+ this.getOutExcel('���������������.xlsx', res)
+ }
+ })
+ .catch(err => {
+ clearTimeout(timer)
+ this.loading = false
+ })
+ },
+ getOutExcel(fileName, res) {
+ let blob = new Blob([res], { type: 'application/x-xls' })
+ if (window.navigator.msSaveOrOpenBlob) {
+ //������ IE & EDGE
+ this.loading = false
+ 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)
+ this.loading = false
+ }
+ },
openEditDialog(row) {
this.editEscalationUnitData = row
this.dialogEditVisible = true
@@ -459,14 +537,14 @@
// ������������������������������������������(���������������������������)
totalCount: 0,
// ������������������������������
- pageSizes: [10, 20, 30, 40],
+ pageSizes: [10, 30, 60, 100],
// ������������������������������������������
pageSize: 10
}
this.handleSearch(obj)
},
handleSearch(obj) {
- this.searchData.isInvalid = 0
+ this.selectionRows = []
if (obj) {
this.searchData = obj
}
@@ -597,4 +675,12 @@
font-size: 16px;
font-weight: 700;
}
+.exportBox {
+ font-weight: 700;
+ font-size: 18px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 10px;
+}
</style>
--
Gitblit v1.8.0