sort: Number()

in src/routes/Plugin/Common/Rule.js [206:485]


            sort: Number(values.sort),
            ruleConditions
          });
        }
      }
    });
  };

  handleAdd = () => {
    let { ruleConditions } = this.state;
    ruleConditions.push({
      paramType: "uri",
      operator: "pathPattern",
      paramName: "/",
      paramValue: ""
    });

    this.setState({ ruleConditions }, () => {
      let len = ruleConditions.length || 0;
      let key = `paramTypeValueEn${len - 1}`;
      this.setState({ [key]: true });
    });
  };

  handleDelete = index => {
    let { ruleConditions } = this.state;
    if (ruleConditions && ruleConditions.length > 1) {
      ruleConditions.splice(index, 1);
    } else {
      message.destroy();
      message.error("At least one condition");
    }
    this.setState({ ruleConditions });
  };

  handleAddHandle = () => {
    let { pluginHandleList } = this.state;
    let pluginHandle = pluginHandleList[0];
    let toAddPluginHandle = pluginHandle.map(e => {
      return { ...e, value: null };
    });
    pluginHandleList.push(toAddPluginHandle);
    this.setState({
      pluginHandleList
    });
  };

  handleDeleteHandle = index => {
    let { pluginHandleList } = this.state;
    if (pluginHandleList.length === 1) {
      message.destroy();
      message.error(getIntlContent("SHENYU.PLUGIN.HANDLE.TIP"));
    } else {
      pluginHandleList.splice(index, 1);
      this.setState({ pluginHandleList });
    }
  };

  conditionChange = (index, name, value) => {
    let { ruleConditions } = this.state;
    ruleConditions[index][name] = value;
    if (name === "paramType") {
      let key = `paramTypeValueEn${index}`;
      if (value === "uri" || value === "host" || value === "ip" || value === "req_method" || value === "domain") {
        this.setState({ [key]: true });
        ruleConditions[index].paramName = "/";
      } else {
        this.setState({ [key]: false });
      }
      if (value === "post") {
        ruleConditions[index].paramName = "filedName";
      }
      if (value === "query") {
        ruleConditions[index].paramName = "paramName";
      }
      if (value === "header") {
        ruleConditions[index].paramName = "headerName";
      }
      if (value === "cookie") {
        ruleConditions[index].paramName = "cookieName";
      }
      if (value === "uri") {
        ruleConditions[index].operator = "pathPattern";
      }
      else if (value === "req_method") {
        ruleConditions[index].operator = "=";
      }
      else {
        ruleConditions[index].operator = "";
      }
    }

    this.setState({ ruleConditions });
  };

  handleCopyData = copyData => {
    const { form } = this.props;
    const { ruleConditions, name, matchMode, loged, enabled, sort } = copyData;
    const formData = {
      name,
      matchMode: matchMode.toString(),
      loged,
      enabled,
      sort
    };
    this.initRuleCondition({
      ruleConditions: ruleConditions.map(v => {
        const {
          id: rawId,
          selectorId,
          dateCreated,
          dateUpdated,
          ...condition
        } = v;
        return condition;
      })
    });
    form.setFieldsValue(formData);
    this.setState({ visible: false });
  };

  renderOperatorOptions = (operators, paramType) => {
    if (operators && operators instanceof Array) {
      let operatorsFil = operators.map(operate => {
        return (
          <Option key={operate.dictValue} value={operate.dictValue}>
            {operate.dictName}
          </Option>
        )
      })
      if (paramType !== "uri") {
        operatorsFil = operatorsFil.filter(operate => {
          return operate.key !== "pathPattern" ? operate : ""
        })
      }
      if (paramType === "uri" || paramType === "host" || paramType === "ip" || paramType === "cookie" || paramType === "domain") {
        operatorsFil = operatorsFil.filter(operate => {
          return operate.key !== "TimeBefore" && operate.key !== "TimeAfter" ? operate : ""
        })
      }
      if (paramType === "req_method") {
        operatorsFil = operatorsFil.filter(operate => {
          return operate.key === "=" ? operate : ""
        })
      }
      return operatorsFil
    }

    return "";
  };

  getParamValueInput = (item, index) => {
    if (item.operator === "TimeBefore" || item.operator === "TimeAfter") {
      let date = new Date()
      const defaultDay = date.getFullYear().toString().concat("-").concat((date.getMonth() + 1)).concat("-").concat(date.getDate())
      let day = defaultDay
      return (
        <Input.Group
          compact
          style={{ width: 213, top: 0 }}
        >
          <DatePicker
            onChange={e => {
              day = e ? e.eraYear().toString().concat('-').concat((e.month() + 1)).concat("-").concat(e.date() < 10 ? '0'.concat(e.date()) : e.date()) : defaultDay
            }}
            style={{ width: "51%" }}
          />
          <TimePicker
            style={{ width: "49%" }}
            onChange={e => {
              let Time = e ? day.concat(" ").concat(e.hours()).concat(":").concat(e.minutes()).concat(":").concat(e.seconds() < 10 ? '0'.concat(e.seconds()) : e.seconds()) : ""
              this.conditionChange(
                index,
                "paramValue",
                Time
              );
            }}
          />
        </Input.Group>
      )
    }
    else {
      return (
        <Input
          onChange={e => {
            this.conditionChange(
              index,
              "paramValue",
              e.target.value
            );
          }}
          value={item.paramValue}
          style={{ width: 160 }}
        />
      )
    }
  }

  render() {
    let {
      onCancel,
      form,
      name = "",
      matchMode = "",
      loged = true,
      enabled = true,
      matchRestful = false,
      sort = "",
      multiRuleHandle,
      pluginName,
      handle
    } = this.props;
    const {
      ruleConditions,
      pluginHandleList,
      operatorDics,
      matchModeDics,
      paramTypeDics,
      customRulePage,
      visible
    } = this.state;

    let RuleHandleComponent;
    if (customRulePage) {
      RuleHandleComponent = PluginRuleHandle[pluginName];
    } else if (pluginHandleList) {
      RuleHandleComponent = CommonRuleHandle;
    }

    const { getFieldDecorator } = form;
    const formItemLayout = {
      labelCol: {
        sm: { span: 3 }
      },
      wrapperCol: {
        sm: { span: 21 }
      }
    };
    const formCheckLayout = {
      labelCol: {
        sm: { span: 18 }
      },
      wrapperCol: {
        sm: { span: 4 }
      }
    };
    return (
      <Modal
        width={1000}
        centered
        title={getIntlContent("SHENYU.RULE.NAME")}
        visible
        okText={getIntlContent("SHENYU.COMMON.SURE")}
        cancelText={getIntlContent("SHENYU.COMMON.CALCEL")}
        onOk={this.handleSubmit}
        onCancel={onCancel}
      >
        <Form onSubmit={this.handleSubmit} className="login-form">
          <FormItem
            label={getIntlContent("SHENYU.PLUGIN.SELECTOR.LIST.COLUMN.NAME")}
            {...formItemLayout}
          >
            {getFieldDecorator("name", {
              rules: [
                {
                  required: true,
                  message: getIntlContent("SHENYU.COMMON.INPUTNAME")
                }
              ],
              initialValue: name
            })(
              <Input
                placeholder={getIntlContent(
                  "SHENYU.PLUGIN.SELECTOR.LIST.COLUMN.NAME"
                )}
                addonAfter={
                  <Button
                    size="small"
                    type="link"
                    onClick={() => {