sparkles: 导出excel
All checks were successful
Release / lint (push) Successful in 42s
Release / Release (push) Successful in 2m7s

This commit is contained in:
my_ong 2025-03-15 19:03:06 +08:00
parent 994fd58bb0
commit a2d24b9492
3 changed files with 51 additions and 2 deletions

View File

@ -11,6 +11,7 @@
enter-button
@search="loadData()"
></a-input-search>
<a-button type="primary" @click="downloadData()">导出</a-button>
</a-col>
</a-row>
</template>
@ -38,6 +39,7 @@
<script setup lang="ts">
import api from '@/api'
import { IPage } from '@/api/api'
import { http } from '@/settings/http'
const searchKey = ref('')
const pagedata = ref<IPage<material.ApplyDTO>>()
@ -64,6 +66,12 @@
//
loadData()
//
const downloadData = () => {
// excel
const url = `${http.prefix}/apply/download-excel?applyType=1&type=${searchKey.value}&code=${searchKey.value}&name=${searchKey.value}`
window.open(url)
}
//
const columns = [
{

View File

@ -11,6 +11,7 @@
enter-button
@search="loadData()"
></a-input-search>
<a-button type="primary" @click="downloadData()">导出</a-button>
</a-col>
</a-row>
</template>
@ -78,6 +79,7 @@
import api from '@/api'
import { IPage } from '@/api/api'
import { useUserStore } from '@/stores/user'
import { http } from '@/settings/http'
const searchKey = ref('')
const pagedata = ref<IPage<material.ApplyDTO>>()
@ -105,6 +107,13 @@
//
loadData()
//
const downloadData = () => {
// excel
const url = `${http.prefix}/apply/download-excel?applyType=3&type=${searchKey.value}&code=${searchKey.value}&name=${searchKey.value}`
window.open(url)
}
//
const columns = [
{

View File

@ -3,7 +3,7 @@
<!-- 页面操作栏 -->
<template #ops>
<a-row>
<a-col :span="6" style="width: 180px">
<a-col :span="6" style="width: 280px">
<a-date-picker
v-model:value="startDate"
:format="'YYYY-MM-DD HH:mm:ss'"
@ -33,10 +33,11 @@
<a-select-option value="MANUAL">人工盘点</a-select-option>
</a-select>
</a-col>
<a-col :span="6">
<a-col :span="6" style="width: 180px">
<a-input-search v-model:value="taker" :placeholder="`盘点人`" allow-clear enter-button @search="loadData()" />
</a-col>
</a-row>
<a-button type="primary" @click="downloadData()">导出</a-button>
</template>
<!-- 页面表格内容 -->
<div style="min-height: calc(100vh - 305px)">
@ -125,6 +126,7 @@
import { IPage } from '@/api/api'
import resultForm from '../stocktaking/result-form.vue'
import { Dayjs } from 'dayjs'
import { http } from '@/settings/http'
const applyIdRef = ref()
const auditPage = ref<IPage<material.ApplyForm>>()
@ -162,6 +164,36 @@
//
loadData()
//
const downloadData = () => {
// URLSearchParams
const params = new URLSearchParams()
//
if (auditType.value) {
params.append('auditType', auditType.value)
}
if (startDate.value) {
// 'Z'
const formattedDate = startDate.value.toISOString().replace('Z', '').slice(0, -4)
params.append('createDate', formattedDate)
}
if (taker.value) {
params.append('taker', taker.value)
}
if (status.value && status.value.length > 0) {
//
status.value.forEach((value) => {
params.append('reviewResults', value)
})
}
// URL
const url = `${http.prefix}/apply/audit/download-excel?${params.toString()}`
//
window.open(url)
}
//
const columns = [
{