|
|
@@ -3,7 +3,7 @@ import {
|
|
|
Button, DropdownButton, PaginationProps
|
|
|
} from 'ant-design-vue'
|
|
|
import { DownOutlined } from '@ant-design/icons-vue'
|
|
|
-import { PropType, computed, defineComponent, reactive, ref, defineEmits, FunctionalComponent } from 'vue'
|
|
|
+import { PropType, computed, defineComponent, reactive, ref, defineEmits, FunctionalComponent, onMounted } from 'vue'
|
|
|
|
|
|
/**
|
|
|
* @description Table Pro 超级table 将各种业务与操作融合起来
|
|
|
@@ -19,11 +19,12 @@ interface Props {
|
|
|
request: {
|
|
|
get: (record: any) => {data, sum},
|
|
|
params: any
|
|
|
- }
|
|
|
+ },
|
|
|
+ easy: boolean
|
|
|
}
|
|
|
|
|
|
const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
- const { request } = props
|
|
|
+ const { request, easy } = props
|
|
|
|
|
|
console.log('defineComponent:', props)
|
|
|
|
|
|
@@ -46,7 +47,7 @@ const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
onChange: (page: number, pageSize: number) => onChangePage(page, pageSize)
|
|
|
}, typeof props.pagination === 'boolean' ? {} : { ...props.pagination }))
|
|
|
|
|
|
- const dataSource = ref()
|
|
|
+ const dataSource = ref([])
|
|
|
|
|
|
const opraMeun = (
|
|
|
<Menu>
|
|
|
@@ -69,6 +70,8 @@ const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
}
|
|
|
|
|
|
const dispatchRequest = async () => {
|
|
|
+ console.log('调用')
|
|
|
+
|
|
|
loading.value = true
|
|
|
const { data, sum } = await request.get({
|
|
|
...request.params,
|
|
|
@@ -80,6 +83,14 @@ const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
dataSource.value = data
|
|
|
}
|
|
|
|
|
|
+ // dispatchRequest()
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ console.log('onMounted')
|
|
|
+
|
|
|
+ dispatchRequest()
|
|
|
+ })
|
|
|
+
|
|
|
/**
|
|
|
* 展示或者隐藏对应的column
|
|
|
*/
|
|
|
@@ -87,10 +98,12 @@ const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
columnsPro.value[index].hidden = !columnsPro.value[index].hidden
|
|
|
}
|
|
|
|
|
|
- return (
|
|
|
+ const RenderOpraRow = () => {
|
|
|
+ return (
|
|
|
<>
|
|
|
-
|
|
|
- <Row gutter={[8, 8]}>
|
|
|
+ {easy
|
|
|
+ ? null
|
|
|
+ : <Row gutter={[8, 8]}>
|
|
|
<Col span={12} >
|
|
|
{/* <solt name="search" ></solt> */}
|
|
|
</Col>
|
|
|
@@ -126,16 +139,24 @@ const TablePro: FunctionalComponent<Props> = (props) => {
|
|
|
</DropdownButton>
|
|
|
</Space>
|
|
|
</Col>
|
|
|
- </Row>
|
|
|
- {/* dataSource={dataSource} */}
|
|
|
- {/* <Table
|
|
|
+ </Row>}
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <RenderOpraRow />
|
|
|
+ {/* */}
|
|
|
+ <Table
|
|
|
columns={columnsFilter.value}
|
|
|
loading={loading.value}
|
|
|
pagination={typeof props.pagination === 'boolean' ? false : pagination}
|
|
|
+ dataSource={dataSource.value}
|
|
|
>
|
|
|
<slot></slot>
|
|
|
<slot name='action'></slot>
|
|
|
- </Table> */}
|
|
|
+ </Table>
|
|
|
</>
|
|
|
)
|
|
|
}
|