import type { ActionType, ProColumns, ProFormInstance } from '@ant-design/pro-components'; import { ModalForm, PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; import '@umijs/max'; import { Select } from 'antd'; import React, { useRef, useState } from 'react'; import { CITY_CODE_TO_NAME_MAP, CITY_OPTIONS } from '@/constants/city'; import { getGroupList, updateGroupInfo } from '@/services/list'; const STATUS_OPTIONS = [ { label: '正常', value: 0 }, { label: '暂停', value: 1 }, ]; const TableList: React.FC = () => { const [updateModalOpen, handleUpdateModalOpen] = useState(false); const [currentRow, setCurrentRow] = useState(); const actionRef = useRef(); const formRef = useRef(); const columns: ProColumns[] = [ { title: '群名称', dataIndex: 'imGroupNick', valueType: 'textarea', copyable: true, }, { title: '群ID', dataIndex: 'id', valueType: 'textarea', copyable: true, }, { title: '所属城市', dataIndex: 'city', valueType: 'textarea', renderText(cityCode: string) { return CITY_CODE_TO_NAME_MAP.get(cityCode); }, renderFormItem() { return ( ; }, }, { title: '机器人ID', dataIndex: 'robotId', valueType: 'textarea', }, { title: '机器人微信昵称', dataIndex: 'robotImNick', valueType: 'textarea', }, { title: '机器人微信账号', dataIndex: 'robotImNo', valueType: 'textarea', }, { title: '操作', valueType: 'option', render: (_, record) => ( { handleUpdateModalOpen(true); setCurrentRow(record); }} > 修改 ), }, ]; return ( headerTitle="查询表格" actionRef={actionRef} rowKey="key" search={{ labelWidth: 120, collapsed: false, collapseRender: false }} request={getGroupList} columns={columns} /> { const params: API.UpdateGroupParams = { id: currentRow!.id, city: formData.city?.value, disable: formData.disable, }; console.log('update confirm', formData, params); try { await updateGroupInfo(params); actionRef.current?.reload(); formRef.current?.resetFields(); } catch (e) {} handleUpdateModalOpen(false); }} > ); }; export default TableList;