fix:岗位导出问题

This commit is contained in:
不做码农 2023-01-30 18:21:55 +08:00
parent e4115977c8
commit bf5dd6ac51
2 changed files with 21 additions and 22 deletions

View File

@ -1,5 +1,5 @@
import request from '@/utils/request'
import { downFile } from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
@ -44,10 +44,11 @@ export function delPost(postId) {
}
// 导出岗位
export function exportPost(query) {
return request({
url: '/system/post/export',
method: 'get',
params: query
})
export async function exportPost(query) {
// return request({
// url: '/system/post/export',
// method: 'get',
// params: query
// })
await downFile('/system/post/export', query)
}

View File

@ -123,7 +123,7 @@ let queryParams = reactive({
pageSize: 10,
postCode: undefined,
postName: undefined,
status: undefined,
status: undefined
})
//
@ -132,8 +132,8 @@ const state = reactive({
rules: {
postName: [{ required: true, message: '岗位名称不能为空', trigger: 'blur' }],
postCode: [{ required: true, message: '岗位编码不能为空', trigger: 'blur' }],
postSort: [{ required: true, message: '岗位顺序不能为空', trigger: 'blur' }],
},
postSort: [{ required: true, message: '岗位顺序不能为空', trigger: 'blur' }]
}
})
const formRef = ref(null)
const { form, rules } = toRefs(state)
@ -159,7 +159,7 @@ function reset() {
postName: undefined,
postSort: 0,
status: '0',
remark: undefined,
remark: undefined
}
proxy.resetForm('formRef')
}
@ -225,7 +225,7 @@ function handleDelete(row) {
.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
type: 'warning'
})
.then(function () {
return delPost(postIds)
@ -237,16 +237,14 @@ function handleDelete(row) {
}
/** 导出按钮操作 */
function handleExport() {
this.$confirm('是否确认导出所有岗位数据项?', '警告', {
proxy
.$confirm('是否确认导出所有岗位数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
type: 'warning'
})
.then(function () {
return exportPost(queryParams)
})
.then((response) => {
proxy.download(response.data.path)
.then(async () => {
await exportPost(queryParams)
})
}
handleQuery()