| | |
| | | import { optionsListApi } from '/@/api/demo/select'; |
| | | import { FormProps, FormSchema } from '/@/components/Table'; |
| | | import { BasicColumn } from '/@/components/Table/src/types/table'; |
| | | import { VxeFormItemProps, VxeGridPropTypes } from '/@/components/VxeTable'; |
| | | import { optionsListApi } from '@/api/demo/select'; |
| | | import { FormProps, FormSchema, BasicColumn } from '@/components/Table'; |
| | | import { VxeFormItemProps, VxeGridPropTypes } from '@/components/VxeTable'; |
| | | import { ref } from 'vue'; |
| | | import { Input } from 'ant-design-vue'; |
| | | |
| | | export function getBasicColumns(): BasicColumn[] { |
| | | return [ |
| | |
| | | } |
| | | |
| | | export function getMultipleHeaderColumns(): BasicColumn[] { |
| | | const testRef = ref('姓名:'); |
| | | return [ |
| | | { |
| | | title: 'ID', |
| | |
| | | }, |
| | | { |
| | | title: '姓名', |
| | | customHeaderRender() { |
| | | return ( |
| | | <Input placeholder="输入值 更新 自定义title" size="small" v-model:value={testRef.value} /> |
| | | ); |
| | | }, |
| | | dataIndex: 'name', |
| | | width: 120, |
| | | }, |
| | |
| | | children: [ |
| | | { |
| | | title: '编号', |
| | | customHeaderRender(column) { |
| | | // 【自定义渲染的】 |
| | | return ( |
| | | <div> |
| | | _ <span style="background: #f00; color: #fff;">{testRef.value}</span> _ |
| | | {column.customTitle} |
| | | </div> |
| | | ); |
| | | }, |
| | | dataIndex: 'no', |
| | | width: 120, |
| | | filters: [ |
| | |
| | | // title: '姓名', |
| | | dataIndex: 'name', |
| | | width: 120, |
| | | // slots: { title: 'customTitle' }, |
| | | }, |
| | | { |
| | | // title: '地址', |
| | | dataIndex: 'address', |
| | | width: 120, |
| | | // slots: { title: 'customAddress' }, |
| | | sorter: true, |
| | | }, |
| | | |
| | |
| | | ]; |
| | | } |
| | | export const getAdvanceSchema = (itemNumber = 6): FormSchema[] => { |
| | | const arr: any = []; |
| | | const arr: FormSchema[] = []; |
| | | for (let index = 0; index < itemNumber; index++) { |
| | | arr.push({ |
| | | field: `field${index}`, |
| | |
| | | { |
| | | field: `field11`, |
| | | label: `Slot示例`, |
| | | component: 'Select', |
| | | slot: 'custom', |
| | | colProps: { |
| | | xl: 12, |
| | |
| | | endTime: new Date().toLocaleString(), |
| | | children: [ |
| | | { |
| | | id: `l2-${index}`, |
| | | id: `l2-${index}-1`, |
| | | name: 'John Brown', |
| | | age: `1${index}`, |
| | | age: `1`, |
| | | no: `${index + 10}`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | children: [ |
| | | { |
| | | id: `l3-${index}-1-1`, |
| | | name: 'John Brown', |
| | | age: `11`, |
| | | no: `11`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | }, |
| | | { |
| | | id: `l3-${index}-1-2`, |
| | | name: 'John Brown', |
| | | age: `12`, |
| | | no: `12`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: `l2-${index}-2`, |
| | | name: 'John Brown', |
| | | age: `2`, |
| | | no: `${index + 10}`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | children: [ |
| | | { |
| | | id: `l3-${index}-2-1`, |
| | | name: 'John Brown', |
| | | age: `21`, |
| | | no: `21`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | }, |
| | | { |
| | | id: `l3-${index}-2-2`, |
| | | name: 'John Brown', |
| | | age: `22`, |
| | | no: `22`, |
| | | address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', |
| | | beginTime: new Date().toLocaleString(), |
| | | endTime: new Date().toLocaleString(), |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }); |