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

添加导出

parent 6a0d260d
<template> <template>
<vxe-modal <vxe-modal
v-model="showEdit" v-model="showEdit"
:z-index="1006" :z-index="1006"
@hide="onHide" @hide="onHide"
title="客户选择" title="客户选择"
width="800" width="800"
esc-closable esc-closable
mask-closable mask-closable
show-footer show-footer
> >
<template #default> <template #default>
<vxe-table ref="xTable" border :data="data" size="small" height="400">
<vxe-column
<vxe-table ref="xTable" border :data="data" size="small" height="400"> 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-table>
</template>
</vxe-column> <template #footer>
</vxe-table> <el-button type="primary" @click="exportRunData">导出</el-button>
<el-button type="primary" @click="showEdit = false">关闭</el-button>
</template>
</template> </vxe-modal>
</template>
<template #footer>
<el-button type="primary" @click="showEdit = false">关闭</el-button> <script lang="ts">
</template> import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue'
</vxe-modal> import { getCustomerPage } from '@/api/customer'
</template> import type { VxeTableInstance } from 'vxe-table'
import { ElMessage } from 'element-plus'
<script lang="ts">
import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue' export default defineComponent({
import { getCustomerPage } from '@/api/customer' name: 'TemplateVariables',
import type { VxeTableInstance } from 'vxe-table' props: {
import { ElMessage } from 'element-plus' visible: {
type: Boolean,
export default defineComponent({ default: false
name: 'TemplateVariables',
props: {
visible: {
type: Boolean,
default: false
},
titles: {
type: Array,
default: () => []
},
data: {
type: Array,
default: () => []
}
}, },
emits: ['update:visible'], titles: {
setup(props, { emit }) { type: Array,
const showEdit = ref(false) default: () => []
const xTable = ref<VxeTableInstance>() },
const tableData = ref([]) data: {
type: Array,
default: () => []
watch( }
() => props.visible, },
(val) => { emits: ['update:visible'],
showEdit.value = val setup(props, { emit }) {
} const showEdit = ref(false)
) const xTable = ref<VxeTableInstance>()
const tableData = ref([])
watch(
const onHide = () => { () => props.visible,
emit('update:visible', false) (val) => {
} showEdit.value = val
return {
showEdit,
xTable,
tableData,
onHide,
} }
)
const onHide = () => {
emit('update:visible', false)
}
const exportRunData = () => {
xTable.value?.exportData({ type: 'csv' })
}
return {
showEdit,
xTable,
tableData,
onHide,
exportRunData
} }
}) }
</script> })
<style lang="scss" scoped></style> </script>
<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