Commit 279acb5f authored by 何远江's avatar 何远江

添加导出

parent 6a0d260d
...@@ -10,35 +10,33 @@ ...@@ -10,35 +10,33 @@
show-footer show-footer
> >
<template #default> <template #default>
<vxe-table ref="xTable" border :data="data" size="small" height="400"> <vxe-table ref="xTable" border :data="data" size="small" height="400">
<vxe-column v-for="column in titles" <vxe-column
v-for="column in titles"
:key="item" :key="item"
:field="column" :field="column"
:title="column" :title="column"
show-overflow show-overflow
width="150"> width="150"
>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</template> </template>
<template #footer> <template #footer>
<el-button type="primary" @click="exportRunData">导出</el-button>
<el-button type="primary" @click="showEdit = false">关闭</el-button> <el-button type="primary" @click="showEdit = false">关闭</el-button>
</template> </template>
</vxe-modal> </vxe-modal>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue' import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue'
import { getCustomerPage } from '@/api/customer' import { getCustomerPage } from '@/api/customer'
import type { VxeTableInstance } from 'vxe-table' import type { VxeTableInstance } from 'vxe-table'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
export default defineComponent({ export default defineComponent({
name: 'TemplateVariables', name: 'TemplateVariables',
props: { props: {
visible: { visible: {
...@@ -60,7 +58,6 @@ ...@@ -60,7 +58,6 @@
const xTable = ref<VxeTableInstance>() const xTable = ref<VxeTableInstance>()
const tableData = ref([]) const tableData = ref([])
watch( watch(
() => props.visible, () => props.visible,
(val) => { (val) => {
...@@ -68,18 +65,21 @@ ...@@ -68,18 +65,21 @@
} }
) )
const onHide = () => { const onHide = () => {
emit('update:visible', false) emit('update:visible', false)
} }
const exportRunData = () => {
xTable.value?.exportData({ type: 'csv' })
}
return { return {
showEdit, showEdit,
xTable, xTable,
tableData, tableData,
onHide, onHide,
exportRunData
} }
} }
}) })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment