Ver Fonte

修复its的一些问题

valentichu há 1 ano atrás
pai
commit
691a71bd60

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
lib/index.js


+ 7 - 7
src/App.jsx

@@ -7,21 +7,21 @@ function Home(props) {
 
   return (
     <>
-      <Alarm.DetailModal
+      {/* <Alarm.DetailModal
         open={open}
         onCancel={() => setOpen(false)}
         options={{ ruleId: 25 }}
         // options={{
         //   pointId: "ABC123_AAA_chr1_AEff_MIN_H",
         // }}
-      ></Alarm.DetailModal>
-      {/* <Alarm.ComplexConfig ref={compRef} editId={50}></Alarm.ComplexConfig> */}
-      {/* <button onClick={() => compRef?.current?.ok()}>测试</button> */}
+      ></Alarm.DetailModal> */}
+      <Alarm.ComplexConfig ref={compRef} editId={-1}></Alarm.ComplexConfig>
+      <button onClick={() => compRef?.current?.ok()}>测试</button>
       {/* <Alarm.EasyConfig
         ref={compRef}
-        pointId="ZWB_ALARM_chr_5_AE"
-        readonly
-          // editId={-1}
+        // pointId="ZWB_ALARM_chr_5_AE"
+        // readonly
+          editId={-1}
       ></Alarm.EasyConfig> */}
     </>
   );

+ 13 - 8
src/pages/Alarm/components/complex.jsx

@@ -108,7 +108,8 @@ const Complex = (props, ref) => {
 
       const { state, data } = await API2.addRule(obj);
       if (state === 0) {
-        props.onConfirm(data?.id);
+        props?.onConfirm?.(data?.id);
+        form.resetFields();
         message.success("保存成功");
       } else {
         message.error("保存失败");
@@ -124,13 +125,13 @@ const Complex = (props, ref) => {
       };
       const { state } = await API2.editRule(obj);
       if (state === 0) {
-        props.onConfirm(data.id);
+        props?.onConfirm?.(data.id);
+        form.resetFields();
         message.success("保存成功");
       } else {
         message.error("保存失败");
       }
     }
-    form.resetFields();
   });
 
   useImperativeHandle(ref, () => {
@@ -208,6 +209,8 @@ const Complex = (props, ref) => {
         }
       } else if (showList) {
         setType(0);
+      } else if (!showList) {
+        setAlarmId(-1);
       }
     }
     run();
@@ -229,12 +232,14 @@ const Complex = (props, ref) => {
   }, [showList]);
 
   useEffect(() => {
-    if (type === 2) {
-      setAlarmId(-1);
-    } else if (alarmId === -1 && type !== 2) {
-      setAlarmId(null);
+    if (showList) {
+      if (type === 2) {
+        setAlarmId(-1);
+      } else if (alarmId === -1 && type !== 2) {
+        setAlarmId(null);
+      }
     }
-  }, [type, alarmId]);
+  }, [type, alarmId, showList]);
 
   return (
     <div className={styles.wrapper}>

+ 19 - 25
src/pages/Alarm/components/components/AlarmDetail/index.jsx

@@ -59,6 +59,19 @@ const levelMap = {
   3: TranslateText(["高", "High"]),
 };
 
+const rangePresets = [
+  { label: "最近30分钟", value: [dayjs().add(-30, "minute"), dayjs()] },
+  { label: "最近60分钟", value: [dayjs().add(-60, "minute"), dayjs()] },
+  { label: "最近2小时", value: [dayjs().add(-2, "hour"), dayjs()] },
+  { label: "最近4小时", value: [dayjs().add(-4, "hour"), dayjs()] },
+  { label: "最近8小时", value: [dayjs().add(-8, "hour"), dayjs()] },
+  { label: "最近12小时", value: [dayjs().add(-12, "hour"), dayjs()] },
+  { label: "最近24小时", value: [dayjs().add(-24, "hour"), dayjs()] },
+  { label: "最近48小时", value: [dayjs().add(-48, "hour"), dayjs()] },
+  { label: "最近72小时", value: [dayjs().add(-72, "hour"), dayjs()] },
+  { label: "最近7天", value: [dayjs().add(-7, "d"), dayjs()] },
+];
+
 const getDur = (text) => {
   if (text < 60) {
     return `${text}${timeTranslateMap["s"]}`;
@@ -107,10 +120,10 @@ const initialOption = {
     },
   },
   grid: {
-    top: 32,
-    left: 64,
-    right: 64,
+    top: 30,
     bottom: 0,
+    left: 0,
+    right: 0,
     containLabel: true,
   },
   xAxis: {
@@ -243,11 +256,6 @@ const Index = (props) => {
           width: 1,
           type: "dashed",
         },
-        endLabel: {
-          show: true,
-          formatter: "{a}",
-          color: "inherit",
-        },
       });
     }
     if (res?.data?.l) {
@@ -260,11 +268,6 @@ const Index = (props) => {
           width: 1,
           type: "dashed",
         },
-        endLabel: {
-          show: true,
-          formatter: "{a}",
-          color: "inherit",
-        },
       });
     }
     if (res?.data?.ll) {
@@ -277,11 +280,6 @@ const Index = (props) => {
           width: 1,
           type: "dashed",
         },
-        endLabel: {
-          show: true,
-          formatter: "{a}",
-          color: "inherit",
-        },
       });
     }
     if (res?.data?.threshold) {
@@ -294,11 +292,6 @@ const Index = (props) => {
           width: 1,
           type: "dashed",
         },
-        endLabel: {
-          show: true,
-          formatter: "{a}",
-          color: "inherit",
-        },
       });
     }
     setChartData(newData);
@@ -310,7 +303,7 @@ const Index = (props) => {
     <>
       <div className={styles.desc}>
         <Descriptions column={4} style={{ margin: 20 }}>
-          <Descriptions.Item span={3} label="告警名称">
+          <Descriptions.Item span={2} label="告警名称">
             {props.data?.data?.name}
           </Descriptions.Item>
           {props.data?.data?.point_id && (
@@ -357,12 +350,13 @@ const Index = (props) => {
               value={range}
               onChange={setRange}
               style={{ width: 360, marginTop: 20 }}
+              presets={rangePresets}
             />
           </div>
 
           {chartData && (
             <ReactECharts
-              style={{ height: 424 }}
+              style={{ height: "calc(100% - 250px)" }}
               option={chartData}
               notMerge={true}
             />

+ 6 - 0
src/pages/Alarm/components/detail.jsx

@@ -67,6 +67,11 @@ const Detail = (props) => {
     }
     setCurrent(record.id);
   };
+  const onAlarmConfirm = () => {
+    const newData = _.clone(currentData);
+    newData.data.op_status = 1;
+    setCurrent(newData);
+  };
 
   return (
     <>
@@ -170,6 +175,7 @@ const Detail = (props) => {
         currentAlarm={currentData?.data}
         open={showConfirm}
         onCancel={() => setShowConfirm(false)}
+        onConfirm={onAlarmConfirm}
       />
       {/* <AlarmConfig
         visible={showAlarmConfig}

+ 1 - 1
src/pages/Alarm/components/detail.module.less

@@ -34,5 +34,5 @@
   display: flex;
   justify-content: flex-end;
   flex: 1;
-  margin-top: -5px;
+  margin-top: -10px;
 }

+ 11 - 0
src/pages/Alarm/components/easy.jsx

@@ -338,6 +338,17 @@ const Easy = (props, ref) => {
           alarm_level: 1,
           sub_type: 14,
           point_id: props.pointId ?? "",
+          status:true,
+        });
+        setAllEnable(true);
+        setAlEnable(true);
+        setAhEnable(true);
+        setAhhEnable(true);
+        form.setFieldsValue({
+          ahh_enable: true,
+          ah_enable: true,
+          al_enable: true,
+          all_enable: true,
         });
         setSubType(14);
         if (props.pointId) {

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff