|
|
@@ -2,42 +2,20 @@
|
|
|
import { type VxeGridInstance, type VxeGridProps } from 'vxe-table'
|
|
|
import { useRowClickStyle } from '@/hooks/rowClickStyle'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { ref, onMounted } from 'vue'
|
|
|
+import { ref, onMounted, watch } from 'vue'
|
|
|
+interface ColumnsListItem {
|
|
|
+ field: String
|
|
|
+ title: String
|
|
|
+ type: String
|
|
|
+ formatter: String
|
|
|
+}
|
|
|
+const props = defineProps({
|
|
|
+ propsType: Boolean,
|
|
|
+ ColumnsList: Array<ColumnsListItem>
|
|
|
+})
|
|
|
+
|
|
|
+const columnstest = ref(props.ColumnsList)
|
|
|
|
|
|
-const columnstest = ref([
|
|
|
- {
|
|
|
- field: 'Event',
|
|
|
- title: 'Event',
|
|
|
- type: 'normal',
|
|
|
- formatter: ''
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'Event Details',
|
|
|
- title: 'Event Details',
|
|
|
- type: 'normal',
|
|
|
- formatter: ''
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'Frequency',
|
|
|
- title: 'Frequency',
|
|
|
- type: 'normal',
|
|
|
- formatter: ''
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'Methods',
|
|
|
- title: 'Methods',
|
|
|
- type: 'normal',
|
|
|
- formatter: ''
|
|
|
- }
|
|
|
-])
|
|
|
-const datatest = ref([
|
|
|
- {
|
|
|
- Event: '123',
|
|
|
- ['Event Details']: '123',
|
|
|
- Frequency: '123',
|
|
|
- Methods: '123'
|
|
|
- }
|
|
|
-])
|
|
|
const visible = ref(false)
|
|
|
const tableData = ref<VxeGridProps<any>>({
|
|
|
border: true,
|
|
|
@@ -81,24 +59,20 @@ const handleColumns = (columns: any) => {
|
|
|
// 获取表格列
|
|
|
const getTableColumns = async () => {
|
|
|
tableData.value.columns = handleColumns(columnstest.value)
|
|
|
- // await $api.getBookingTableColumns().then((res: any) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // tableData.value.columns = [
|
|
|
- // ...handleColumns(res.data.BookingTableColumns)
|
|
|
- // ]
|
|
|
- tableData.value.columns.push({
|
|
|
- title: 'Action',
|
|
|
- fixed: 'right',
|
|
|
- width: 80,
|
|
|
- slots: { default: 'action' }
|
|
|
- })
|
|
|
- // }
|
|
|
- // })
|
|
|
+ if (props.propsType) {
|
|
|
+ tableData.value.columns.push({
|
|
|
+ title: 'Action',
|
|
|
+ fixed: 'right',
|
|
|
+ width: 80,
|
|
|
+ slots: { default: 'action' }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
// 获取表格数据
|
|
|
-const getTableData = async () => {
|
|
|
+const getTableData = (val: any) => {
|
|
|
+ tableData.value.data = val.tableData
|
|
|
// 保存页长以及当前页码
|
|
|
- tableData.value.data = datatest.value
|
|
|
+ // tableData.value.data = datatest.value
|
|
|
// await $api
|
|
|
// .getBookingTableData({
|
|
|
// other_filed: '',
|
|
|
@@ -124,7 +98,9 @@ const handleDelete = (row: any) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getTableColumns()
|
|
|
- getTableData()
|
|
|
+})
|
|
|
+defineExpose({
|
|
|
+ getTableData
|
|
|
})
|
|
|
</script>
|
|
|
|