|
@@ -19,21 +19,24 @@ const Detail = (props) => {
|
|
|
const [tags, setTags] = useState([]);
|
|
const [tags, setTags] = useState([]);
|
|
|
const [current, setCurrent] = useState("history");
|
|
const [current, setCurrent] = useState("history");
|
|
|
const [ruleId, setRuleId] = useState(-1);
|
|
const [ruleId, setRuleId] = useState(-1);
|
|
|
- const getRuleIdByPointId = useMemoizedFn(async (pointId) => {
|
|
|
|
|
- const res = await API.getRuleIdByPointId(pointId);
|
|
|
|
|
- setRuleId(res?.data?.[0]?.id);
|
|
|
|
|
|
|
+ const getRuleIdByPointId = useMemoizedFn(async (ruleId, pointId) => {
|
|
|
|
|
+ const ids = [];
|
|
|
|
|
+ if (options.pointId) {
|
|
|
|
|
+ const res = await API.getRuleIdByPointId(pointId);
|
|
|
|
|
+ ids.push(res?.data?.[0]?.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (options.ruleId) {
|
|
|
|
|
+ ids.push(ruleId);
|
|
|
|
|
+ }
|
|
|
|
|
+ setRuleId(ids);
|
|
|
setCurrent("history");
|
|
setCurrent("history");
|
|
|
setTags([]);
|
|
setTags([]);
|
|
|
});
|
|
});
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (options.ruleId) {
|
|
|
|
|
- setRuleId(options.ruleId);
|
|
|
|
|
- setCurrent("history");
|
|
|
|
|
- setTags([]);
|
|
|
|
|
- } else if (options.pointId) {
|
|
|
|
|
- getRuleIdByPointId(options.pointId);
|
|
|
|
|
|
|
+ if (options.ruleId || options.pointId) {
|
|
|
|
|
+ getRuleIdByPointId(options.ruleId, options.pointId);
|
|
|
} else if (options.detail) {
|
|
} else if (options.detail) {
|
|
|
- setRuleId(options.detail.rule_id);
|
|
|
|
|
|
|
+ setRuleId([options.detail.rule_id]);
|
|
|
setTags([
|
|
setTags([
|
|
|
{
|
|
{
|
|
|
id: options.detail.id,
|
|
id: options.detail.id,
|