render()

in src/routes/Plugin/PluginRuleHandle/ParamPluginRuleHandle.js [227:304]


  render() {
    const { activeKey } = this.state;

    const columns = [
      {
        title: "Type",
        dataIndex: "type",
        width: 180,
        render: (value, row) => {
          return (
            <Select
              value={row.type}
              onChange={(type) => this.onChangeConfig({ type }, row.id)}
            >
              {TypeKey[activeKey].map((v) => (
                <Option key={v} value={v}>
                  {v}
                </Option>
              ))}
            </Select>
          );
        },
      },
      {
        title: "Config",
        dataIndex: "config",
        align: "center",
        render: (value, row) => this.renderConfig(row),
      },
      {
        title: "Operater",
        dataIndex: "id",
        with: 80,
        fixed: "right",
        render: (value, row, index) => {
          return (
            this.state[activeKey].length - 1 !== index && (
              <Button
                type="danger"
                onClick={() => {
                  this.setState({
                    // eslint-disable-next-line react/no-access-state-in-setstate
                    [activeKey]: this.state[activeKey].filter(
                      (v) => v.id !== row.id,
                    ),
                  });
                }}
              >
                {getIntlContent("SHENYU.COMMON.DELETE.NAME")}
              </Button>
            )
          );
        },
      },
    ];

    return (
      <>
        <Tabs
          activeKey={activeKey}
          onChange={(key) =>
            this.setState({
              activeKey: key,
            })
          }
        >
          <TabPane tab="Body" key="body" />
        </Tabs>
        <Table
          rowKey="id"
          size="small"
          columns={activeKey === "body" ? columns : columns}
          dataSource={this.state[activeKey]}
          pagination={false}
        />
      </>
    );
  }