|
|
|
@ -1,12 +1,16 @@ |
|
|
|
|
import React, { Component } from "react"; |
|
|
|
|
import { Button, Empty, Modal, notification, Popconfirm } from "antd"; |
|
|
|
|
import {Button, Empty, Form, Input, Modal, notification, Popconfirm, Select} from "antd"; |
|
|
|
|
import { getList } from "api/demo/index"; |
|
|
|
|
import { dictionary } from "api/dict/index"; |
|
|
|
|
|
|
|
|
|
const { Option } = Select |
|
|
|
|
|
|
|
|
|
interface States { |
|
|
|
|
resData: any |
|
|
|
|
visible: boolean |
|
|
|
|
title: string |
|
|
|
|
current: any |
|
|
|
|
current: any, |
|
|
|
|
sexDict: any |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class DemoList extends Component<any, States> { |
|
|
|
@ -16,12 +20,14 @@ class DemoList extends Component<any, States> { |
|
|
|
|
resData: undefined, |
|
|
|
|
visible: false, |
|
|
|
|
title: '新增公告', |
|
|
|
|
current: {} |
|
|
|
|
current: {}, |
|
|
|
|
sexDict: undefined |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
|
this.getList() |
|
|
|
|
this.getDict() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getList() { |
|
|
|
@ -33,39 +39,20 @@ class DemoList extends Component<any, States> { |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getStatusText(status: number): string { |
|
|
|
|
if (status === 1) { |
|
|
|
|
return "启用"; |
|
|
|
|
} else if (status === 0) { |
|
|
|
|
return "禁用"; |
|
|
|
|
} else { |
|
|
|
|
return ''; |
|
|
|
|
getDict() { |
|
|
|
|
dictionary('sex').then((res) => { |
|
|
|
|
if(res.data){ |
|
|
|
|
this.setState({ sexDict: res.data }) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handelCreate() { |
|
|
|
|
this.setState({ visible: true }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handelUpdate(item: any) { |
|
|
|
|
this.setState({ |
|
|
|
|
visible: true, |
|
|
|
|
title: '编辑公告', |
|
|
|
|
current: item |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleEnable(item: any) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleDisable(item: any) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleDel(item: any) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { resData, visible, title, current } = this.state; |
|
|
|
|
const { resData, visible, title, current, sexDict } = this.state; |
|
|
|
|
const handleCancel = () => { |
|
|
|
|
this.setState({ visible: false }) |
|
|
|
|
}; |
|
|
|
@ -73,6 +60,35 @@ class DemoList extends Component<any, States> { |
|
|
|
|
return ( |
|
|
|
|
<div className="container"> |
|
|
|
|
<div className="ikd-page-header"><div className="title">TABLE</div></div> |
|
|
|
|
<div className="list-filter"> |
|
|
|
|
<Form |
|
|
|
|
className="filter" |
|
|
|
|
layout="inline" |
|
|
|
|
name="basic" |
|
|
|
|
> |
|
|
|
|
<Form.Item |
|
|
|
|
label="性别:" |
|
|
|
|
name="sex"> |
|
|
|
|
<Select placeholder="全部" style={{ width: 120 }} allowClear> |
|
|
|
|
{ |
|
|
|
|
sexDict && sexDict.length > 0 ? |
|
|
|
|
(() => { |
|
|
|
|
let rows = []; |
|
|
|
|
for (let i = 0; i < sexDict.length; i++) { |
|
|
|
|
const item = sexDict[i]; |
|
|
|
|
rows.push( |
|
|
|
|
<Option value={item.dictKey}>{item.dictValue}</Option> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return rows; |
|
|
|
|
})() |
|
|
|
|
: |
|
|
|
|
<Option disabled>暂无数据</Option> |
|
|
|
|
} |
|
|
|
|
</Select> |
|
|
|
|
</Form.Item> |
|
|
|
|
</Form> |
|
|
|
|
</div> |
|
|
|
|
{ |
|
|
|
|
resData ? null : |
|
|
|
|
<Button type="primary" style={{ marginBottom: 15 }} onClick={this.handelCreate.bind(this)}>ADD</Button> |
|
|
|
|