|  | @@ -1,17 +1,98 @@
 | 
	
		
			
				|  |  |  import Header from '@/components/Header'
 | 
	
		
			
				|  |  |  import Slot from '@/components/Header/slot'
 | 
	
		
			
				|  |  | -import { Button } from 'antd'
 | 
	
		
			
				|  |  | -import React from 'react'
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +import { userStore } from '@/store/mobx'
 | 
	
		
			
				|  |  | +import { iUserInfo } from '@/types/setting'
 | 
	
		
			
				|  |  | +import consts from '@/utils/consts'
 | 
	
		
			
				|  |  | +import { Button, Input, Table } from 'antd'
 | 
	
		
			
				|  |  | +import { ColumnsType } from 'antd/lib/table'
 | 
	
		
			
				|  |  | +import React, { useEffect, useState } from 'react'
 | 
	
		
			
				|  |  | +import { apiAccountList } from './api'
 | 
	
		
			
				|  |  | +import styles from './index.module.scss'
 | 
	
		
			
				|  |  |  export default function Info() {
 | 
	
		
			
				|  |  | +  const { Search } = Input
 | 
	
		
			
				|  |  | +  const [ userList, setUserList ] = useState<iUserInfo[]>([ {
 | 
	
		
			
				|  |  | +    "account": "",
 | 
	
		
			
				|  |  | +    "accountGroup": 0,
 | 
	
		
			
				|  |  | +    "company": "",
 | 
	
		
			
				|  |  | +    "csrf": "",
 | 
	
		
			
				|  |  | +    "enable": 0,
 | 
	
		
			
				|  |  | +    "id": "",
 | 
	
		
			
				|  |  | +    "isAdmin": 0,
 | 
	
		
			
				|  |  | +    "mobile": "",
 | 
	
		
			
				|  |  | +    "name": "",
 | 
	
		
			
				|  |  | +    "password": "",
 | 
	
		
			
				|  |  | +    "position": "",
 | 
	
		
			
				|  |  | +    "projectId": "",
 | 
	
		
			
				|  |  | +    "role": "",
 | 
	
		
			
				|  |  | +    "telephone": ""
 | 
	
		
			
				|  |  | +  } ])
 | 
	
		
			
				|  |  | +  const initData = async () => {
 | 
	
		
			
				|  |  | +    const { code = -1, data } = await apiAccountList(userStore.userInfo.id)
 | 
	
		
			
				|  |  | +    if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  | +      setUserList(data)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  useEffect(() => {
 | 
	
		
			
				|  |  | +    initData()
 | 
	
		
			
				|  |  | +  }, [])
 | 
	
		
			
				|  |  | +  const columns: ColumnsType<iUserInfo> = [
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '账号',
 | 
	
		
			
				|  |  | +      dataIndex: 'account'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '姓名',
 | 
	
		
			
				|  |  | +      dataIndex: 'name'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '单位',
 | 
	
		
			
				|  |  | +      dataIndex: 'company'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '职位',
 | 
	
		
			
				|  |  | +      dataIndex: 'postition'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '手机',
 | 
	
		
			
				|  |  | +      dataIndex: 'mobile'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '电话',
 | 
	
		
			
				|  |  | +      dataIndex: 'telephone'
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      title: '操作',
 | 
	
		
			
				|  |  | +      // eslint-disable-next-line react/display-name
 | 
	
		
			
				|  |  | +      render: (_: any, record: iUserInfo) => {
 | 
	
		
			
				|  |  | +        return (
 | 
	
		
			
				|  |  | +          <div>
 | 
	
		
			
				|  |  | +            <Button size="small" className="pi-mg-right-5">编辑</Button>
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +              !record.isAdmin && record.enable ? <Button danger size="small">停用</Button> : <Button size="small" className={styles.greenBtn}>启用</Button>
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          </div>
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  ]
 | 
	
		
			
				|  |  |    return (
 | 
	
		
			
				|  |  |      <div className="content-wrap">
 | 
	
		
			
				|  |  | -      <Header title="账号设置">
 | 
	
		
			
				|  |  | +      <Header>
 | 
	
		
			
				|  |  |          <Slot position="right">
 | 
	
		
			
				|  |  |            <Button type="primary" size="small">添加账号</Button>
 | 
	
		
			
				|  |  |          </Slot>
 | 
	
		
			
				|  |  | +        <Slot position="left">
 | 
	
		
			
				|  |  | +          <Search placeholder="账号/姓名/单位/手机 搜索" loading={false} size="small"></Search>
 | 
	
		
			
				|  |  | +        </Slot>
 | 
	
		
			
				|  |  |        </Header>
 | 
	
		
			
				|  |  | -      <div className="pi-flex-column"></div>
 | 
	
		
			
				|  |  | +      <div className={styles.SettingContent}>
 | 
	
		
			
				|  |  | +        <Table<iUserInfo>
 | 
	
		
			
				|  |  | +          dataSource={userList}
 | 
	
		
			
				|  |  | +          columns={columns}
 | 
	
		
			
				|  |  | +          bordered
 | 
	
		
			
				|  |  | +          rowKey={record => record.id}
 | 
	
		
			
				|  |  | +        ></Table>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  |    )
 | 
	
		
			
				|  |  |  }
 |