TableList.js 18.3 KB
Newer Older
ddcat1115's avatar
ddcat1115 committed
1
import React, { PureComponent, Fragment } from 'react';
2
import { connect } from 'dva';
ddcat1115's avatar
ddcat1115 committed
3
import moment from 'moment';
4
import router from 'umi/router';
jim's avatar
jim committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import {
  Row,
  Col,
  Card,
  Form,
  Input,
  Select,
  Icon,
  Button,
  Dropdown,
  Menu,
  InputNumber,
  DatePicker,
  Modal,
  message,
  Badge,
  Divider,
  Steps,
  Radio,
} from 'antd';
25
import StandardTable from '@/components/StandardTable';
26
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
27 28 29 30

import styles from './TableList.less';

const FormItem = Form.Item;
ddcat1115's avatar
ddcat1115 committed
31 32
const { Step } = Steps;
const { TextArea } = Input;
afc163's avatar
afc163 committed
33
const { Option } = Select;
ddcat1115's avatar
ddcat1115 committed
34
const RadioGroup = Radio.Group;
jim's avatar
jim committed
35 36 37 38
const getValue = obj =>
  Object.keys(obj)
    .map(key => obj[key])
    .join(',');
ddcat1115's avatar
ddcat1115 committed
39 40
const statusMap = ['default', 'processing', 'success', 'error'];
const status = ['关闭', '运行中', '已上线', '异常'];
41

jim's avatar
jim committed
42
const CreateForm = Form.create()(props => {
valleykid's avatar
valleykid committed
43
  const { modalVisible, form, handleAdd, handleModalVisible } = props;
44
  const okHandle = () => {
valleykid's avatar
valleykid committed
45
    form.validateFields((err, fieldsValue) => {
46
      if (err) return;
jim's avatar
jim committed
47
      form.resetFields();
valleykid's avatar
valleykid committed
48
      handleAdd(fieldsValue);
49 50 51 52
    });
  };
  return (
    <Modal
ddcat1115's avatar
ddcat1115 committed
53
      destroyOnClose
54 55 56
      title="新建规则"
      visible={modalVisible}
      onOk={okHandle}
valleykid's avatar
valleykid committed
57
      onCancel={() => handleModalVisible()}
58
    >
jim's avatar
jim committed
59
      <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="描述">
60
        {form.getFieldDecorator('desc', {
ddcat1115's avatar
ddcat1115 committed
61
          rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }],
jim's avatar
jim committed
62
        })(<Input placeholder="请输入" />)}
63 64 65 66 67
      </FormItem>
    </Modal>
  );
});

ddcat1115's avatar
ddcat1115 committed
68 69
@Form.create()
class UpdateForm extends PureComponent {
70 71 72 73 74 75
  static defaultProps = {
    handleUpdate: () => {},
    handleUpdateModalVisible: () => {},
    values: {},
  };

ddcat1115's avatar
ddcat1115 committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  constructor(props) {
    super(props);

    this.state = {
      formVals: {
        name: props.values.name,
        desc: props.values.desc,
        key: props.values.key,
        target: '0',
        template: '0',
        type: '1',
        time: '',
        frequency: 'month',
      },
      currentStep: 0,
    };

    this.formLayout = {
      labelCol: { span: 7 },
      wrapperCol: { span: 13 },
    };
  }
陈帅's avatar
陈帅 committed
98

jim's avatar
jim committed
99
  handleNext = currentStep => {
ddcat1115's avatar
ddcat1115 committed
100
    const { form, handleUpdate } = this.props;
陈帅's avatar
陈帅 committed
101
    const { formVals: oldValue } = this.state;
ddcat1115's avatar
ddcat1115 committed
102 103
    form.validateFields((err, fieldsValue) => {
      if (err) return;
陈帅's avatar
陈帅 committed
104
      const formVals = { ...oldValue, ...fieldsValue };
jim's avatar
jim committed
105 106 107 108 109 110 111 112
      this.setState(
        {
          formVals,
        },
        () => {
          if (currentStep < 2) {
            this.forward();
          } else {
陈帅's avatar
陈帅 committed
113
            handleUpdate(formVals);
jim's avatar
jim committed
114
          }
ddcat1115's avatar
ddcat1115 committed
115
        }
jim's avatar
jim committed
116
      );
ddcat1115's avatar
ddcat1115 committed
117
    });
jim's avatar
jim committed
118
  };
陈帅's avatar
陈帅 committed
119

ddcat1115's avatar
ddcat1115 committed
120
  backward = () => {
陈帅's avatar
陈帅 committed
121
    const { currentStep } = this.state;
ddcat1115's avatar
ddcat1115 committed
122
    this.setState({
陈帅's avatar
陈帅 committed
123
      currentStep: currentStep - 1,
ddcat1115's avatar
ddcat1115 committed
124
    });
jim's avatar
jim committed
125
  };
陈帅's avatar
陈帅 committed
126

ddcat1115's avatar
ddcat1115 committed
127
  forward = () => {
陈帅's avatar
陈帅 committed
128
    const { currentStep } = this.state;
ddcat1115's avatar
ddcat1115 committed
129
    this.setState({
陈帅's avatar
陈帅 committed
130
      currentStep: currentStep + 1,
ddcat1115's avatar
ddcat1115 committed
131
    });
jim's avatar
jim committed
132
  };
陈帅's avatar
陈帅 committed
133

ddcat1115's avatar
ddcat1115 committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
  renderContent = (currentStep, formVals) => {
    const { form } = this.props;
    if (currentStep === 1) {
      return [
        <FormItem key="target" {...this.formLayout} label="监控对象">
          {form.getFieldDecorator('target', {
            initialValue: formVals.target,
          })(
            <Select style={{ width: '100%' }}>
              <Option value="0">表一</Option>
              <Option value="1">表二</Option>
            </Select>
          )}
        </FormItem>,
        <FormItem key="template" {...this.formLayout} label="规则模板">
          {form.getFieldDecorator('template', {
            initialValue: formVals.template,
          })(
            <Select style={{ width: '100%' }}>
              <Option value="0">规则模板一</Option>
              <Option value="1">规则模板二</Option>
            </Select>
          )}
        </FormItem>,
        <FormItem key="type" {...this.formLayout} label="规则类型">
          {form.getFieldDecorator('type', {
            initialValue: formVals.type,
          })(
            <RadioGroup>
              <Radio value="0"></Radio>
              <Radio value="1"></Radio>
            </RadioGroup>
          )}
        </FormItem>,
      ];
    }
    if (currentStep === 2) {
      return [
        <FormItem key="time" {...this.formLayout} label="开始时间">
          {form.getFieldDecorator('time', {
            rules: [{ required: true, message: '请选择开始时间!' }],
          })(
            <DatePicker
              style={{ width: '100%' }}
              showTime
              format="YYYY-MM-DD HH:mm:ss"
              placeholder="选择开始时间"
            />
          )}
        </FormItem>,
        <FormItem key="frequency" {...this.formLayout} label="调度周期">
          {form.getFieldDecorator('frequency', {
            initialValue: formVals.frequency,
          })(
            <Select style={{ width: '100%' }}>
              <Option value="month"></Option>
              <Option value="week"></Option>
            </Select>
          )}
        </FormItem>,
      ];
    }
    return [
      <FormItem key="name" {...this.formLayout} label="规则名称">
        {form.getFieldDecorator('name', {
          rules: [{ required: true, message: '请输入规则名称!' }],
          initialValue: formVals.name,
jim's avatar
jim committed
201
        })(<Input placeholder="请输入" />)}
ddcat1115's avatar
ddcat1115 committed
202 203 204 205 206
      </FormItem>,
      <FormItem key="desc" {...this.formLayout} label="规则描述">
        {form.getFieldDecorator('desc', {
          rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }],
          initialValue: formVals.desc,
jim's avatar
jim committed
207
        })(<TextArea rows={4} placeholder="请输入至少五个字符" />)}
ddcat1115's avatar
ddcat1115 committed
208 209
      </FormItem>,
    ];
jim's avatar
jim committed
210
  };
陈帅's avatar
陈帅 committed
211

jim's avatar
jim committed
212
  renderFooter = currentStep => {
213
    const { handleUpdateModalVisible, values } = this.props;
ddcat1115's avatar
ddcat1115 committed
214 215
    if (currentStep === 1) {
      return [
jim's avatar
jim committed
216 217 218
        <Button key="back" style={{ float: 'left' }} onClick={this.backward}>
          上一步
        </Button>,
219
        <Button key="cancel" onClick={() => handleUpdateModalVisible(false, values)}>
jim's avatar
jim committed
220 221
          取消
        </Button>,
ddcat1115's avatar
ddcat1115 committed
222 223 224 225 226 227 228
        <Button key="forward" type="primary" onClick={() => this.handleNext(currentStep)}>
          下一步
        </Button>,
      ];
    }
    if (currentStep === 2) {
      return [
jim's avatar
jim committed
229 230 231
        <Button key="back" style={{ float: 'left' }} onClick={this.backward}>
          上一步
        </Button>,
232
        <Button key="cancel" onClick={() => handleUpdateModalVisible(false, values)}>
jim's avatar
jim committed
233 234
          取消
        </Button>,
ddcat1115's avatar
ddcat1115 committed
235 236 237 238 239 240
        <Button key="submit" type="primary" onClick={() => this.handleNext(currentStep)}>
          完成
        </Button>,
      ];
    }
    return [
241
      <Button key="cancel" onClick={() => handleUpdateModalVisible(false, values)}>
jim's avatar
jim committed
242 243
        取消
      </Button>,
ddcat1115's avatar
ddcat1115 committed
244 245 246 247
      <Button key="forward" type="primary" onClick={() => this.handleNext(currentStep)}>
        下一步
      </Button>,
    ];
jim's avatar
jim committed
248
  };
陈帅's avatar
陈帅 committed
249

ddcat1115's avatar
ddcat1115 committed
250
  render() {
251
    const { updateModalVisible, handleUpdateModalVisible, values } = this.props;
ddcat1115's avatar
ddcat1115 committed
252 253 254 255 256 257 258 259 260 261
    const { currentStep, formVals } = this.state;

    return (
      <Modal
        width={640}
        bodyStyle={{ padding: '32px 40px 48px' }}
        destroyOnClose
        title="规则配置"
        visible={updateModalVisible}
        footer={this.renderFooter(currentStep)}
262 263
        onCancel={() => handleUpdateModalVisible(false, values)}
        afterClose={() => handleUpdateModalVisible()}
ddcat1115's avatar
ddcat1115 committed
264
      >
ddcat1115's avatar
ddcat1115 committed
265
        <Steps style={{ marginBottom: 28 }} size="small" current={currentStep}>
ddcat1115's avatar
ddcat1115 committed
266 267 268 269
          <Step title="基本信息" />
          <Step title="配置规则属性" />
          <Step title="设定调度周期" />
        </Steps>
jim's avatar
jim committed
270
        {this.renderContent(currentStep, formVals)}
ddcat1115's avatar
ddcat1115 committed
271 272 273 274 275 276
      </Modal>
    );
  }
}

/* eslint react/no-multi-comp:0 */
Andreas Cederström's avatar
Andreas Cederström committed
277 278 279
@connect(({ rule, loading }) => ({
  rule,
  loading: loading.models.rule,
280 281
}))
@Form.create()
afc163's avatar
afc163 committed
282
class TableList extends PureComponent {
283 284 285 286 287 288 289 290 291
  state = {
    modalVisible: false,
    updateModalVisible: false,
    expandForm: false,
    selectedRows: [],
    formValues: {},
    stepFormValues: {},
  };

愚道's avatar
愚道 committed
292 293 294 295
  columns = [
    {
      title: '规则名称',
      dataIndex: 'name',
296
      render: text => <a onClick={() => this.previewItem(text)}>{text}</a>,
愚道's avatar
愚道 committed
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
    },
    {
      title: '描述',
      dataIndex: 'desc',
    },
    {
      title: '服务调用次数',
      dataIndex: 'callNo',
      sorter: true,
      render: val => `${val} 万`,
      // mark to display a total number
      needTotal: true,
    },
    {
      title: '状态',
      dataIndex: 'status',
      filters: [
        {
          text: status[0],
          value: 0,
        },
        {
          text: status[1],
          value: 1,
        },
        {
          text: status[2],
          value: 2,
        },
        {
          text: status[3],
          value: 3,
        },
      ],
      render(val) {
        return <Badge status={statusMap[val]} text={status[val]} />;
      },
    },
    {
      title: '上次调度时间',
      dataIndex: 'updatedAt',
      sorter: true,
      render: val => <span>{moment(val).format('YYYY-MM-DD HH:mm:ss')}</span>,
    },
    {
      title: '操作',
      render: (text, record) => (
        <Fragment>
          <a onClick={() => this.handleUpdateModalVisible(true, record)}>配置</a>
          <Divider type="vertical" />
          <a href="">订阅警报</a>
        </Fragment>
      ),
    },
  ];

353 354 355 356 357 358 359
  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'rule/fetch',
    });
  }

360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
  handleStandardTableChange = (pagination, filtersArg, sorter) => {
    const { dispatch } = this.props;
    const { formValues } = this.state;

    const filters = Object.keys(filtersArg).reduce((obj, key) => {
      const newObj = { ...obj };
      newObj[key] = getValue(filtersArg[key]);
      return newObj;
    }, {});

    const params = {
      currentPage: pagination.current,
      pageSize: pagination.pageSize,
      ...formValues,
      ...filters,
    };
    if (sorter.field) {
      params.sorter = `${sorter.field}_${sorter.order}`;
    }

    dispatch({
      type: 'rule/fetch',
      payload: params,
    });
jim's avatar
jim committed
384
  };
385

386 387 388 389
  previewItem = id => {
    router.push(`/profile/basic/${id}`);
  };

390 391 392
  handleFormReset = () => {
    const { form, dispatch } = this.props;
    form.resetFields();
393 394 395
    this.setState({
      formValues: {},
    });
396 397 398 399
    dispatch({
      type: 'rule/fetch',
      payload: {},
    });
jim's avatar
jim committed
400
  };
401 402

  toggleForm = () => {
陈帅's avatar
陈帅 committed
403
    const { expandForm } = this.state;
404
    this.setState({
陈帅's avatar
陈帅 committed
405
      expandForm: !expandForm,
406
    });
jim's avatar
jim committed
407
  };
408

jim's avatar
jim committed
409
  handleMenuClick = e => {
410 411 412
    const { dispatch } = this.props;
    const { selectedRows } = this.state;

413
    if (selectedRows.length === 0) return;
414 415 416 417 418
    switch (e.key) {
      case 'remove':
        dispatch({
          type: 'rule/remove',
          payload: {
ddcat1115's avatar
ddcat1115 committed
419
            key: selectedRows.map(row => row.key),
420 421 422 423 424 425 426 427 428 429 430
          },
          callback: () => {
            this.setState({
              selectedRows: [],
            });
          },
        });
        break;
      default:
        break;
    }
jim's avatar
jim committed
431
  };
432

jim's avatar
jim committed
433
  handleSelectRows = rows => {
434 435 436
    this.setState({
      selectedRows: rows,
    });
jim's avatar
jim committed
437
  };
438

jim's avatar
jim committed
439
  handleSearch = e => {
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
    e.preventDefault();

    const { dispatch, form } = this.props;

    form.validateFields((err, fieldsValue) => {
      if (err) return;

      const values = {
        ...fieldsValue,
        updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(),
      };

      this.setState({
        formValues: values,
      });

      dispatch({
        type: 'rule/fetch',
        payload: values,
      });
    });
jim's avatar
jim committed
461
  };
462

jim's avatar
jim committed
463
  handleModalVisible = flag => {
464 465 466
    this.setState({
      modalVisible: !!flag,
    });
jim's avatar
jim committed
467
  };
468

ddcat1115's avatar
ddcat1115 committed
469 470 471 472 473
  handleUpdateModalVisible = (flag, record) => {
    this.setState({
      updateModalVisible: !!flag,
      stepFormValues: record || {},
    });
jim's avatar
jim committed
474
  };
ddcat1115's avatar
ddcat1115 committed
475

jim's avatar
jim committed
476
  handleAdd = fields => {
陈帅's avatar
陈帅 committed
477 478
    const { dispatch } = this.props;
    dispatch({
479 480
      type: 'rule/add',
      payload: {
ddcat1115's avatar
ddcat1115 committed
481
        desc: fields.desc,
482 483 484 485
      },
    });

    message.success('添加成功');
ddcat1115's avatar
ddcat1115 committed
486
    this.handleModalVisible();
jim's avatar
jim committed
487
  };
ddcat1115's avatar
ddcat1115 committed
488

jim's avatar
jim committed
489
  handleUpdate = fields => {
陈帅's avatar
陈帅 committed
490
    const { dispatch } = this.props;
491
    const { formValues } = this.state;
陈帅's avatar
陈帅 committed
492
    dispatch({
ddcat1115's avatar
ddcat1115 committed
493 494
      type: 'rule/update',
      payload: {
495 496 497 498 499 500
        query: formValues,
        body: {
          name: fields.name,
          desc: fields.desc,
          key: fields.key,
        },
ddcat1115's avatar
ddcat1115 committed
501
      },
502
    });
ddcat1115's avatar
ddcat1115 committed
503 504 505

    message.success('配置成功');
    this.handleUpdateModalVisible();
jim's avatar
jim committed
506
  };
507

afc163's avatar
afc163 committed
508
  renderSimpleForm() {
陈帅's avatar
陈帅 committed
509 510 511
    const {
      form: { getFieldDecorator },
    } = this.props;
afc163's avatar
afc163 committed
512 513
    return (
      <Form onSubmit={this.handleSearch} layout="inline">
514 515
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
          <Col md={8} sm={24}>
ddcat1115's avatar
ddcat1115 committed
516
            <FormItem label="规则名称">
jim's avatar
jim committed
517
              {getFieldDecorator('name')(<Input placeholder="请输入" />)}
afc163's avatar
afc163 committed
518 519
            </FormItem>
          </Col>
520
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
521 522 523 524 525 526 527 528 529
            <FormItem label="使用状态">
              {getFieldDecorator('status')(
                <Select placeholder="请选择" style={{ width: '100%' }}>
                  <Option value="0">关闭</Option>
                  <Option value="1">运行中</Option>
                </Select>
              )}
            </FormItem>
          </Col>
530
          <Col md={8} sm={24}>
FOCUS's avatar
FOCUS committed
531
            <span className={styles.submitButtons}>
jim's avatar
jim committed
532 533 534 535 536 537
              <Button type="primary" htmlType="submit">
                查询
              </Button>
              <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
                重置
              </Button>
afc163's avatar
afc163 committed
538 539 540 541 542 543 544 545 546 547 548
              <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
                展开 <Icon type="down" />
              </a>
            </span>
          </Col>
        </Row>
      </Form>
    );
  }

  renderAdvancedForm() {
陈帅's avatar
陈帅 committed
549 550 551
    const {
      form: { getFieldDecorator },
    } = this.props;
afc163's avatar
afc163 committed
552 553
    return (
      <Form onSubmit={this.handleSearch} layout="inline">
afc163's avatar
afc163 committed
554
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
555
          <Col md={8} sm={24}>
ddcat1115's avatar
ddcat1115 committed
556
            <FormItem label="规则名称">
jim's avatar
jim committed
557
              {getFieldDecorator('name')(<Input placeholder="请输入" />)}
afc163's avatar
afc163 committed
558 559
            </FormItem>
          </Col>
560
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
561 562 563 564 565 566 567 568 569
            <FormItem label="使用状态">
              {getFieldDecorator('status')(
                <Select placeholder="请选择" style={{ width: '100%' }}>
                  <Option value="0">关闭</Option>
                  <Option value="1">运行中</Option>
                </Select>
              )}
            </FormItem>
          </Col>
570
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
571
            <FormItem label="调用次数">
jim's avatar
jim committed
572
              {getFieldDecorator('number')(<InputNumber style={{ width: '100%' }} />)}
afc163's avatar
afc163 committed
573 574 575
            </FormItem>
          </Col>
        </Row>
576 577
        <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
578 579 580 581 582 583
            <FormItem label="更新日期">
              {getFieldDecorator('date')(
                <DatePicker style={{ width: '100%' }} placeholder="请输入更新日期" />
              )}
            </FormItem>
          </Col>
584
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
585 586 587 588 589 590 591 592 593
            <FormItem label="使用状态">
              {getFieldDecorator('status3')(
                <Select placeholder="请选择" style={{ width: '100%' }}>
                  <Option value="0">关闭</Option>
                  <Option value="1">运行中</Option>
                </Select>
              )}
            </FormItem>
          </Col>
594
          <Col md={8} sm={24}>
afc163's avatar
afc163 committed
595 596 597 598 599 600 601 602 603 604
            <FormItem label="使用状态">
              {getFieldDecorator('status4')(
                <Select placeholder="请选择" style={{ width: '100%' }}>
                  <Option value="0">关闭</Option>
                  <Option value="1">运行中</Option>
                </Select>
              )}
            </FormItem>
          </Col>
        </Row>
afc163's avatar
afc163 committed
605
        <div style={{ overflow: 'hidden' }}>
陈帅's avatar
陈帅 committed
606
          <div style={{ marginBottom: 24 }}>
jim's avatar
jim committed
607 608 609 610 611 612
            <Button type="primary" htmlType="submit">
              查询
            </Button>
            <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
              重置
            </Button>
afc163's avatar
afc163 committed
613 614 615
            <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
              收起 <Icon type="up" />
            </a>
陈帅's avatar
陈帅 committed
616
          </div>
afc163's avatar
afc163 committed
617 618 619 620 621 622
        </div>
      </Form>
    );
  }

  renderForm() {
陈帅's avatar
陈帅 committed
623 624
    const { expandForm } = this.state;
    return expandForm ? this.renderAdvancedForm() : this.renderSimpleForm();
afc163's avatar
afc163 committed
625 626
  }

627
  render() {
陈帅's avatar
陈帅 committed
628 629 630 631
    const {
      rule: { data },
      loading,
    } = this.props;
jim's avatar
jim committed
632
    const { selectedRows, modalVisible, updateModalVisible, stepFormValues } = this.state;
633 634 635
    const menu = (
      <Menu onClick={this.handleMenuClick} selectedKeys={[]}>
        <Menu.Item key="remove">删除</Menu.Item>
636
        <Menu.Item key="approval">批量审批</Menu.Item>
637 638 639
      </Menu>
    );

640 641 642 643
    const parentMethods = {
      handleAdd: this.handleAdd,
      handleModalVisible: this.handleModalVisible,
    };
ddcat1115's avatar
ddcat1115 committed
644 645 646 647
    const updateMethods = {
      handleUpdateModalVisible: this.handleUpdateModalVisible,
      handleUpdate: this.handleUpdate,
    };
648
    return (
649
      <PageHeaderWrapper title="查询表格">
650
        <Card bordered={false}>
651
          <div className={styles.tableList}>
jim's avatar
jim committed
652
            <div className={styles.tableListForm}>{this.renderForm()}</div>
653
            <div className={styles.tableListOperator}>
afc163's avatar
afc163 committed
654 655 656
              <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>
                新建
              </Button>
jim's avatar
jim committed
657 658 659 660 661 662 663 664 665 666
              {selectedRows.length > 0 && (
                <span>
                  <Button>批量操作</Button>
                  <Dropdown overlay={menu}>
                    <Button>
                      更多操作 <Icon type="down" />
                    </Button>
                  </Dropdown>
                </span>
              )}
667 668 669
            </div>
            <StandardTable
              selectedRows={selectedRows}
Andreas Cederström's avatar
Andreas Cederström committed
670
              loading={loading}
671
              data={data}
ddcat1115's avatar
ddcat1115 committed
672
              columns={this.columns}
673 674 675 676 677
              onSelectRow={this.handleSelectRows}
              onChange={this.handleStandardTableChange}
            />
          </div>
        </Card>
jim's avatar
jim committed
678 679 680 681 682 683 684 685
        <CreateForm {...parentMethods} modalVisible={modalVisible} />
        {stepFormValues && Object.keys(stepFormValues).length ? (
          <UpdateForm
            {...updateMethods}
            updateModalVisible={updateModalVisible}
            values={stepFormValues}
          />
        ) : null}
686
      </PageHeaderWrapper>
687 688 689
    );
  }
}
lijiehua's avatar
lijiehua committed
690 691

export default TableList;