import React from "react"; import { Balloon } from "@alifd/next"; interface Item { name: { last: string; }; email: string; phone: string; gender: "male" | "female"; } interface Result { total: number; list: Item[]; } function generateComplexSource(row) { const result: any = []; for (let i = 0; i < row; i++) { result.push({ title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible`, }, id: 2 + i, time: new Date().getTime() - 50000 * i, email: `${100306660940 + i}@alibaba-inc.com`, actions: [ { type: "action1", text: "操作1", }, { type: "action2", text: "操作2", }, { type: "action3", text: "操作3", }, { type: "action4", text: "操作4", }, ], }); } return result; } export const getTableData = ( { current, pageSize }, formData: Object ): Promise => { console.log(current, pageSize, formData) return new Promise((resolve) => { setTimeout(() => { resolve({ total: 20, list: generateComplexSource(12), }); }, 2000); }); // let query = `page=${current}&size=${pageSize}`; // Object.entries(formData).forEach(([key, value]) => { // if (value) { // query += `&${key}=${value}`; // } // }); // return fetch(`/api?results=${pageSize}&${query}`) // .then((res) => res.json()) // .then((res) => ({ // total: 55, // list: res.results.slice(0, 10), // })); }; export const getSchema = () => { const filterSchema = { props: { dataSource: [ { label: `事件编码: `, key: "name", placeholder: `请输入事件编码`, type: "Input", }, { label: `所在区域: `, key: "key1", placeholder: `请输入所在区域`, type: "Input", }, { label: `事件状态: `, key: "key2", placeholder: `请输入事件状态`, type: "Input", }, { label: `上报时间: `, key: "key3", placeholder: `请输入上报时间`, type: "Input", }, // { // label: `事件类型: `, // key: "key4", // placeholder: `请输入事件类型`, // type: "Input", // }, // { // label: `主办部门: `, // key: "key5", // placeholder: `请输入主办部门`, // type: "Input", // }, // { // label: `协办部门: `, // key: "key6", // placeholder: `请输入协办部门`, // type: "Input", // }, // { // label: `是否督办: `, // key: "key7", // placeholder: `请输入协办部门`, // type: "Input", // }, // { // label: `事件描述: `, // key: "key8", // placeholder: `请输入事件描述`, // type: "Input", // }, // { // label: `上报人: `, // key: "key8", // placeholder: `请输入上报人`, // type: "Input", // }, // { // label: `上报手机号: `, // key: "key9", // placeholder: `请输入上报手机号`, // type: "Input", // }, // { // label: `事件热度: `, // key: "key10", // placeholder: `请输入事件热度`, // type: "Input", // }, // { // label: `是否超期: `, // key: "key11", // placeholder: `请输入是否超期`, // type: "Input", // }, // { // label: `紧急度: `, // key: "key11", // placeholder: `请输入是否超期`, // type: "Input", // }, ], }, }; const tableSchema = { props: { columns: [ { title: "name", dataIndex: "name.last", width: 140, cell: (value) => value + '【自定义cell】', }, { title: (
要素名称 222} triggerType="hover" title="" align="t" > 双击要素可以修改
), dataIndex: "email", width: 140, type: "Input", }, { title: "time", dataIndex: "time", width: 140, type: "Date", }, { title: "phone", width: 140, dataIndex: "phone", type: "ExpandedRow", }, { title: "操作", dataIndex: "actions", width: 200, type: "Actions", }, ], }, }; return { filterSchema, tableSchema, }; // // return (new Promise(resolve => { // // setTimeout(() => { // // resolve({ // filterSchema, // tableSchema, // }); // }, 200); // })); };