Auto Commit

上级 3e65edb0
......@@ -9,12 +9,13 @@ import { defineProps, reactive, watch } from 'vue';
import { exportExcelFunc } from './exportExcel';
const props = defineProps({
tableData: [],
userId:''
userId: ''
})
const state = reactive({
exportLoading: false,
dataSource: []
dataSource: [],
userId: ''
})
const onExport = () => {
......@@ -24,7 +25,7 @@ const onExport = () => {
return
}
state.exportLoading = true
exportExcelFunc(state.dataSource, props.userId).then(res => {
exportExcelFunc(state.dataSource, state.userId).then(res => {
state.exportLoading = false
console.log('res', res)
}).catch(r => {
......@@ -39,4 +40,11 @@ watch(() => props.tableData,
deep: true,
immediate: true
})
watch(() => props.userId,
(val) => {
state.userId = val
}, {
deep: true,
immediate: true
})
</script>
\ No newline at end of file
......@@ -76,13 +76,13 @@ const onSearch = () => {
onMounted(() => {
const storageUid = localStorage.getItem('csdnUid')
// const storageUid = localStorage.getItem('csdnUid')
console.log('window.localStorage', localStorage)
console.log('storageUid', storageUid)
if (storageUid) {
state.searchValue = storageUid
onSearch()
}
// console.log('storageUid', storageUid)
// if (storageUid) {
// state.searchValue = storageUid
// onSearch()
// }
document.addEventListener('keydown', (e) => {
console.log(e, 'e')
if (e.ctrlKey && e.keyCode === 89) {
......@@ -117,7 +117,7 @@ onUnmounted(() => {
</div>
<div>
<ExportBtn :table-data="state.dataSource" :userId="state.searchValue" />
<ExportBtn :table-data="state.dataSource" :user-id="state.searchValue" />
<a-table :scroll="{ x: 800, y: 600 }" :columns="state.columns" :data-source="state.dataSource"
:loading="state.loading" :pagination="state.pagination" bordered style="border-bottom:1px solid #f0f0f0;">
<template #bodyCell="{ column, record }">
......
......@@ -52,10 +52,10 @@ const tableToExcel = async (jsonData, fileName) => {
};
export const exportExcelFunc = async (tableData) => {
export const exportExcelFunc = async (tableData,name) => {
return new Promise(async (resolve) => {
try {
await tableToExcel(tableData)
await tableToExcel(tableData,name)
resolve(true)
}
catch (r) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册