// import React from 'react';
// import { Descriptions } from 'antd';

// type ListPageType = {
//    data: [{
//     title: string,
//     description: string,
//     type: 'text'| 'image',
//     name: string,
//     span?: number,
//     }
//    ],
//   };

// const ListPage = ({data}:ListPageType) => {

//   return (
//     <Descriptions column={2} title=" " >
//       {data.map((item)=>(
//         <Descriptions.Item
//         contentStyle={{paddingBottom:8}}
//         span={item.span||1}
//         key={item.name}
//         label={item.title}>
//         {item.type==='text'?item.description:<img src={item.description} alt=""/>}
//       </Descriptions.Item>
//       ))}

//   </Descriptions>
//   );
// };

// export default ListPage;

import { ProDescriptions } from '@ant-design/pro-components';
import {  useIntl } from '@umijs/max';
import { getRequest } from '@/services/common/role';
type ListPageType = {
  url: string,
  roleId:string | number
  };
const Descriptions = ({url,roleId}:ListPageType) => {
  const intl = useIntl();
  return (
    <ProDescriptions
      column={2}
      // dataSource={{
      //   dictLabel: '这是一段文本columns',
      //   dictValue: '20200809',
      //   status: 0,
      //   isDefault: 1,
      // }}
      request={async () => {
        const data = await getRequest(`${url}`, { roleId });
        return {data:data.data,success:true};
      }}
      columns={[
        {
          title: intl.formatMessage({ id: 'role.columns.title.roleName' }),
          dataIndex: 'roleName',
          key: 'roleName',
          valueType: 'text',
          span: 2,
        },
        {
          title: intl.formatMessage({ id: 'role.columns.title.remark' }),
          dataIndex: 'remark',
          key: 'remark',
          valueType: 'text',
          span: 2,
        },
        // {
        //   title: intl.formatMessage({ id: 'dictionaries.columns.title.status' }),
        //   dataIndex: 'status',
        //   key: 'status',
        //   render: (item) =>
        //     item === 1
        //       ? intl.formatMessage({ id: 'columns.handel.disabled' })
        //       : intl.formatMessage({ id: 'dictionaries.text.normal' }),
        // },
      ]}
    ></ProDescriptions>
  );
};
export default Descriptions;
