|
|
@@ -27,6 +27,9 @@
|
|
|
<el-form-item>
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
+ <el-button v-hasPermi="['balance:export']" type="warning" plain :loading="exportLoading" @click="handleExport">
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
|
@@ -76,14 +79,17 @@
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
-import { getBalancePage } from '@/api/elderly/fee/balance'
|
|
|
+import download from '@/utils/download'
|
|
|
+import { exportBalanceExcel, getBalancePage } from '@/api/elderly/fee/balance'
|
|
|
import { balanceColumn } from '../column'
|
|
|
import Form from './Form.vue'
|
|
|
defineOptions({ name: 'Balance' })
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
+const exportLoading = ref(false) // 导出的加载中
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
const list = ref([]) // 列表的数据
|
|
|
+const message = useMessage() // 消息弹窗
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -105,6 +111,39 @@ const getList = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/** 导出参数 */
|
|
|
+const buildExportParams = () => {
|
|
|
+ return {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 99999,
|
|
|
+ elderName: queryParams.elderName || undefined,
|
|
|
+ bedName: queryParams.bedName || undefined,
|
|
|
+ inStatus: queryParams.status
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 导出按钮操作 */
|
|
|
+const handleExport = async () => {
|
|
|
+ if (exportLoading.value) return
|
|
|
+ exportLoading.value = true
|
|
|
+ const fullscreenLoading = ElLoading.service({
|
|
|
+ lock: true,
|
|
|
+ text: '正在导出,请稍候...',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ })
|
|
|
+ try {
|
|
|
+ const data = await exportBalanceExcel(buildExportParams())
|
|
|
+ download.excel(data, '长者余额.xls')
|
|
|
+ message.success('导出成功')
|
|
|
+ } catch (error) {
|
|
|
+ console.error('导出失败:', error)
|
|
|
+ message.error('导出失败!')
|
|
|
+ } finally {
|
|
|
+ fullscreenLoading.close()
|
|
|
+ exportLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
queryParams.pageNo = 1
|