Browse Source

出入库记录 跨页多选导出

master
x_ying 3 years ago
parent
commit
c1d8f9850f
  1. 9
      src/api/archivesManage/outInStorage.js
  2. 28
      src/views/archivesManage/outInStorage/outInHistory/index.vue

9
src/api/archivesManage/outInStorage.js

@ -32,4 +32,11 @@ export function grant(params) {
method: 'post' method: 'post'
}) })
} }
export default { initCaseByArchives, isOccupy, collect, grant }
// 出入库记录 导出
export function exportStorageLogList(params) {
return request({
url: 'api/storage/exportStorageLogList' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
export default { initCaseByArchives, isOccupy, collect, grant, exportStorageLogList }

28
src/views/archivesManage/outInStorage/outInHistory/index.vue

@ -2,7 +2,7 @@
<div> <div>
<div class="head-container"> <div class="head-container">
<!-- <crudOperation /> --> <!-- <crudOperation /> -->
<el-button v-permission="permission.download" :loading="crud.downloadLoading" size="mini" icon="el-icon-download" @click="handleExport">导出</el-button>
<el-button v-permission="permission.download" :loading="crud.downloadLoading" :disabled="!selections.length" size="mini" icon="el-icon-download" @click="handleExport">导出</el-button>
<el-select v-model="storageType" class="filter-item" style="width: 100px; height: 30px;margin:0 0 0 10px" @change="crud.toQuery"> <el-select v-model="storageType" class="filter-item" style="width: 100px; height: 30px;margin:0 0 0 10px" @change="crud.toQuery">
<el-option v-for="item in storageTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in storageTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
@ -34,12 +34,13 @@
height="calc(100vh - 357px)" height="calc(100vh - 357px)"
:data="crud.data" :data="crud.data"
:loading="crud.downloadLoading" :loading="crud.downloadLoading"
:row-key="getRowKey"
:cell-class-name="cell" :cell-class-name="cell"
@row-click="clickRowHandler" @row-click="clickRowHandler"
@row-dblclick="handleDbClick" @row-dblclick="handleDbClick"
@selection-change="selectionChangeHandler" @selection-change="selectionChangeHandler"
> >
<el-table-column type="selection" width="55" />
<el-table-column type="selection" :reserve-selection="true" width="55" />
<el-table-column type="index" label="序号" align="center" width="80" /> <el-table-column type="index" label="序号" align="center" width="80" />
<el-table-column prop="storageType" label="状态" align="center" width="90"> <el-table-column prop="storageType" label="状态" align="center" width="90">
<template slot-scope="scope"> <template slot-scope="scope">
@ -73,8 +74,10 @@ import rrOperation from '@crud/RR.operation'
import CRUD, { presenter, crud } from '@crud/crud' import CRUD, { presenter, crud } from '@crud/crud'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
// import crudOperation from '@crud/CRUD.operation' // import crudOperation from '@crud/CRUD.operation'
import { exportFile } from '@/utils/index'
// import { exportFile } from '@/utils/index'
import detailDialog from '../module/detailDialog.vue' import detailDialog from '../module/detailDialog.vue'
// import { mapGetters } from 'vuex'
import { initCaseByArchives } from '@/api/archivesManage/outInStorage'
// exportFile // exportFile
export default { export default {
@ -97,7 +100,7 @@ export default {
data() { data() {
return { return {
permission: { permission: {
download: ['admin', 'permission:download']
download: ['admin', 'outInHistory:download']
}, },
msgVisible: false, msgVisible: false,
selections: [], selections: [],
@ -120,6 +123,11 @@ export default {
] ]
} }
}, },
// computed: {
// ...mapGetters([
// 'baseApi'
// ])
// },
created() { created() {
this.getData() this.getData()
}, },
@ -143,9 +151,12 @@ export default {
clickRowHandler(row) { clickRowHandler(row) {
this.$refs.table.toggleRowSelection(row) // this.$refs.table.toggleRowSelection(row) //
}, },
getRowKey(row) {
return row.id
},
selectionChangeHandler(val) { selectionChangeHandler(val) {
this.selections = val this.selections = val
// console.log(val, '-----')
console.log(this.selections, '-----')
}, },
// //
cell({ row, columnIndex }) { cell({ row, columnIndex }) {
@ -162,7 +173,12 @@ export default {
// //
handleExport() { handleExport() {
this.crud.downloadLoading = true this.crud.downloadLoading = true
exportFile(this.baseApi + '/api/storage/exportStorageLogList')
// exportFile(this.baseApi + '/api/storage/exportStorageLogList')
// console.log(this.baseApi)
const params = this.selections.map(item => { return item.id })
initCaseByArchives(params).then(res => {
console.log(res, '导出成功')
})
this.crud.downloadLoading = false this.crud.downloadLoading = false
}, },
// //

Loading…
Cancel
Save