| | |
| | | style={{ marginTop: 12 }} |
| | | > |
| | | <div className="label">{['A', 'B', 'C'][index]}类:</div> |
| | | <div> |
| | | <Button |
| | | type="primary" |
| | | onClick={() => this.addOrCondition(type)} |
| | | size="small" |
| | | > |
| | | 添加OR条件 |
| | | </Button> |
| | | |
| | | {assetRules[type].map((orGroup, orIndex) => ( |
| | | <div |
| | | key={orIndex} |
| | | style={{ |
| | | display: 'flex', |
| | | alignItems: "center", |
| | | flexWrap: "wrap", |
| | | marginTop: 5 |
| | | }} |
| | | className="flex" |
| | | { |
| | | type != 'a' && |
| | | <div> |
| | | <Button |
| | | type="primary" |
| | | onClick={() => this.addOrCondition(type)} |
| | | size="small" |
| | | > |
| | | {orIndex > 0 && ( |
| | | <div style={{ display: 'flex', alignItems: 'center' }}> |
| | | <span style={{ color: "#ff4d4f", margin: '0 5px' }}>OR</span> |
| | | <Icon |
| | | type="delete" |
| | | style={{ fontSize: 18, color: "#FF4D4F", cursor: "pointer", marginRight: 8 }} |
| | | onClick={() => this.removeOrCondition(type, orIndex)} |
| | | /> |
| | | </div> |
| | | )} |
| | | 添加OR条件 |
| | | </Button> |
| | | |
| | | <div style={{ border: '1px dashed #ccc', padding: 5, borderRadius: 4, display: 'flex', flexWrap: 'wrap', alignItems: 'center' }}> |
| | | {orGroup.map((andItem, andIndex) => { |
| | | const level = Object.keys(andItem)[0]; |
| | | const quantity = andItem[level]; |
| | | return ( |
| | | <div key={andIndex} style={{ display: "flex", alignItems: "center", margin: '2px 0' }}> |
| | | {andIndex > 0 && ( |
| | | <div style={{ display: 'flex', alignItems: 'center' }}> |
| | | <span style={{ marginLeft: 8, color: "#999" }}>and</span> |
| | | <Icon |
| | | type="minus-circle" |
| | | theme="filled" |
| | | style={{ marginLeft: 4, fontSize: 16, color: "#FF4D4F", cursor: "pointer", marginRight: 4 }} |
| | | onClick={() => this.removeAndCondition(type, orIndex, andIndex)} |
| | | /> |
| | | </div> |
| | | )} |
| | | <Select |
| | | style={{ width: 120 }} |
| | | placeholder="隐患级别" |
| | | value={level ? Number(level) : undefined} |
| | | onChange={(val) => this.updateCondition(type, orIndex, andIndex, "level", val)} |
| | | > |
| | | <Option value={1}>一级隐患</Option> |
| | | <Option value={2}>二级隐患</Option> |
| | | <Option value={3}>三级隐患</Option> |
| | | <Option value={4}>四级隐患</Option> |
| | | </Select> |
| | | |
| | | <Input |
| | | style={{ width: 80, marginLeft: 8 }} |
| | | type="number" |
| | | placeholder="数量" |
| | | value={quantity} |
| | | disabled={!level} |
| | | onChange={(e) => this.updateCondition(type, orIndex, andIndex, "quantity", e.target.value)} |
| | | {assetRules[type].map((orGroup, orIndex) => ( |
| | | <div |
| | | key={orIndex} |
| | | style={{ |
| | | display: 'flex', |
| | | alignItems: "center", |
| | | flexWrap: "wrap", |
| | | marginTop: 5 |
| | | }} |
| | | className="flex" |
| | | > |
| | | {orIndex > 0 && ( |
| | | <div style={{ display: 'flex', alignItems: 'center' }}> |
| | | <span style={{ color: "#ff4d4f", margin: '0 5px' }}>OR</span> |
| | | <Icon |
| | | type="delete" |
| | | style={{ fontSize: 18, color: "#FF4D4F", cursor: "pointer", marginRight: 8 }} |
| | | onClick={() => this.removeOrCondition(type, orIndex)} |
| | | /> |
| | | </div> |
| | | )})} |
| | | <Icon |
| | | type="plus-circle" |
| | | theme="filled" |
| | | style={{ marginLeft: 8, fontSize: 18, color: "#1DA57A", cursor: "pointer" }} |
| | | onClick={() => this.addAndCondition(type, orIndex)} |
| | | /> |
| | | )} |
| | | |
| | | <div style={{ border: '1px dashed #ccc', padding: 5, borderRadius: 4, display: 'flex', flexWrap: 'wrap', alignItems: 'center' }}> |
| | | {orGroup.map((andItem, andIndex) => { |
| | | const level = Object.keys(andItem)[0]; |
| | | const quantity = andItem[level]; |
| | | return ( |
| | | <div key={andIndex} style={{ display: "flex", alignItems: "center", margin: '2px 0' }}> |
| | | {andIndex > 0 && ( |
| | | <div style={{ display: 'flex', alignItems: 'center' }}> |
| | | <span style={{ marginLeft: 8, color: "#999" }}>and</span> |
| | | <Icon |
| | | type="minus-circle" |
| | | theme="filled" |
| | | style={{ marginLeft: 4, fontSize: 16, color: "#FF4D4F", cursor: "pointer", marginRight: 4 }} |
| | | onClick={() => this.removeAndCondition(type, orIndex, andIndex)} |
| | | /> |
| | | </div> |
| | | )} |
| | | <Select |
| | | style={{ width: 120 }} |
| | | placeholder="隐患级别" |
| | | value={level ? Number(level) : undefined} |
| | | onChange={(val) => this.updateCondition(type, orIndex, andIndex, "level", val)} |
| | | > |
| | | <Option value={1}>一级隐患</Option> |
| | | <Option value={2}>二级隐患</Option> |
| | | <Option value={3}>三级隐患</Option> |
| | | <Option value={4}>四级隐患</Option> |
| | | </Select> |
| | | |
| | | <Input |
| | | style={{ width: 80, marginLeft: 8 }} |
| | | type="number" |
| | | placeholder="数量" |
| | | value={quantity} |
| | | disabled={!level} |
| | | onChange={(e) => this.updateCondition(type, orIndex, andIndex, "quantity", e.target.value)} |
| | | /> |
| | | </div> |
| | | ) |
| | | })} |
| | | <Icon |
| | | type="plus-circle" |
| | | theme="filled" |
| | | style={{ marginLeft: 8, fontSize: 18, color: "#1DA57A", cursor: "pointer" }} |
| | | onClick={() => this.addAndCondition(type, orIndex)} |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | ))} |
| | | </div> |
| | | ))} |
| | | </div> |
| | | } |
| | | </div> |
| | | ))} |
| | | </div> |