| | |
| | | <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"> |
| | |
| | | <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')"> |
| | |
| | | </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' |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | | selectionRows: [], |
| | | errorClass: 'errorClass', |
| | | searchType: 'reform', |
| | | pagination: { |
| | |
| | | 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', |
| | | 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 |
| | |
| | | this.handleSearch(obj) |
| | | }, |
| | | handleSearch(obj) { |
| | | this.selectionRows = [] |
| | | if (obj) { |
| | | this.searchData = obj |
| | | } |
| | |
| | | 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> |