5
0

10 Commits 2802259772 ... a901aa13b1

Autor SHA1 Mensagem Data
  valentichu a901aa13b1 更新版本号至 1.1.27 há 2 meses atrás
  valentichu 36fc7d75c5 Enhance translation support in Easy component labels há 2 meses atrás
  valentichu c11b14bb8f v1.1.26 há 4 meses atrás
  valentichu 7eb24573f9 修复标签显示:将标签详情文本从“详情1”更改为“详情” há 4 meses atrás
  valentichu 5a7fc172a3 v1.1.25 há 4 meses atrás
  valentichu 24606569c4 Add additional properties to complex alarm configuration há 4 meses atrás
  valentichu b9038553d1 v1.1.24 há 4 meses atrás
  valentichu 1aec53b44c Refactor Alarm components: Update label alignment, modify button labels for symbols, and enhance form validation messages há 4 meses atrás
  valentichu 94bd5649b9 v1.1.23 há 4 meses atrás
  valentichu 8b34d0283e 添加告警开关和延时告警功能,移除多余的显示逻辑 há 4 meses atrás

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


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "dt-alarm-component",
-  "version": "1.1.21",
+  "version": "1.1.27",
   "description": "",
   "main": "lib/index.js",
   "scripts": {

+ 87 - 4
src/pages/Alarm/components/complex.jsx

@@ -5,7 +5,7 @@ import React, {
   forwardRef,
   useImperativeHandle,
 } from "react";
-import { Form, Input, Select, message } from "antd";
+import { Form, Input, Select, Switch, Checkbox, App } from "antd";
 import { Modal, Button, Table, Radio } from "antd";
 import Formular from "./components/Formular";
 import API2 from "../../../api/alarm";
@@ -33,7 +33,10 @@ function TranslateText(arr) {
 }
 
 const Complex = (props, ref) => {
+  const { message } = App.useApp();
   const { editId, groupList = [], showList, formula } = props;
+  const [status, setStatus] = useState(2);
+  const [dateTime, setDateTime] = useState(null);
 
   const [form] = Form.useForm();
   const formuRef = useRef();
@@ -70,7 +73,10 @@ const Complex = (props, ref) => {
     async function run() {
       if (alarmId && alarmId != -1) {
         const { state, data } = await API2.detailAlarm(Number(alarmId));
+        setStatus(data.defer_seconds > 0 ? 1 : 2);
+        setDateTime(data.defer_seconds);
         form.setFieldsValue({
+          status: data.status === 1,
           name: data.name,
           alarm_level: data.alarm_level,
           group_id: data.group_id,
@@ -102,8 +108,9 @@ const Complex = (props, ref) => {
         is_complex: true,
         type: 1,
         sub_type: 12,
-        status: 1,
+        status: value.status ? 1 : 2,
         defer_unit: 2,
+        defer_seconds: Number(dateTime) ?? 0,
       };
 
       const { state, data, state_info } = await API2.addRule(obj);
@@ -122,6 +129,12 @@ const Complex = (props, ref) => {
         ...value,
         formula: formuRef.current.getFinalStr(),
         ext_notify_list: [],
+        is_complex: true,
+        type: 1,
+        sub_type: 12,
+        status: value.status ? 1 : 2,
+        defer_unit: 2,
+        defer_seconds: Number(dateTime) ?? 0,
       };
       const { state, state_info } = await API2.editRule(obj);
       if (state === 0) {
@@ -257,7 +270,7 @@ const Complex = (props, ref) => {
             autoComplete="off"
             form={form}
             requiredMark={true}
-            labelAlign="left"
+            labelAlign="right"
             colon={false}
             labelCol={{
               flex: "84px",
@@ -404,7 +417,7 @@ const Complex = (props, ref) => {
                       {">"}
                     </Button>
                     <Button type="primary" onClick={symbClick}>
-                      =
+                      ==
                     </Button>
                     <Button type="primary" onClick={symbClick}>{`<`}</Button>
                     <Button type="primary" onClick={symbClick}>
@@ -446,6 +459,76 @@ const Complex = (props, ref) => {
                 >
                   <Formular ref={formuRef} key={`${type}-${alarmId}`} />
                 </Form.Item>
+
+                <Form.Item
+                  label={TranslateText(["启用状态", "Enable"])}
+                  name="status"
+                >
+                  <Switch size={"small"} />
+                </Form.Item>
+
+                <Form.Item
+                  name={"defer_seconds"}
+                  label={TranslateText(["延时告警", "Delayed alarm"])}
+                >
+                  <div>
+                    <div
+                      style={{
+                        display: "flex",
+                        gap: 8,
+                        alignItems: "center",
+                      }}
+                    >
+                      <Checkbox
+                        checked={status === 1}
+                        onChange={(e) => {
+                          setStatus(e.target.checked ? 1 : 2);
+                          if (e.target.checked) {
+                            setDateTime(null);
+                          } else {
+                            setDateTime(0);
+                          }
+                        }}
+                      ></Checkbox>
+                      <span
+                        style={{
+                          color: "var(--dt-text-color1)",
+                          fontWeight: 400,
+                          fontSize: 14,
+                        }}
+                      >
+                        {TranslateText(["持续", "Alarm after"])}
+                      </span>
+                      <Input
+                        disabled={status !== 1}
+                        value={dateTime}
+                        onChange={(e) => {
+                          console.log(e.target.value);
+                          setDateTime(e.target.value?.replace(/\D/g, ""));
+                        }}
+                        placeholder={TranslateText(["请输入", "Please input"])}
+                        style={{ width: 100 }}
+                      />
+                      <span
+                        style={{
+                          color: "var(--dt-text-color1)",
+                          fontWeight: 400,
+                          fontSize: 14,
+                        }}
+                      >
+                        {TranslateText(["分钟", "minutes"])}
+                        {TranslateText(["后报警", "of duration"])}
+                      </span>
+                    </div>
+                    {dateTime !== null &&
+                      ["", undefined, null].indexOf(dateTime) !== -1 &&
+                      status === 1 && (
+                        <div style={{ color: "var(--dt-error-color1)" }}>
+                          请输入数字
+                        </div>
+                      )}
+                  </div>
+                </Form.Item>
               </>
             )}
           </Form>

+ 1 - 1
src/pages/Alarm/components/components/AlarmHistory/index.jsx

@@ -121,7 +121,7 @@ const periodOptions = [
 ];
 
 const Index = (props) => {
-  const [tags, setTags] = useState([{ name: "详情1", id: "1" }]);
+  const [tags, setTags] = useState([{ name: "详情", id: "1" }]);
   const [current, setCurrent] = useState("history");
   const [loading, setLoading] = useState(false);
   const [data, setData] = useState([]);

+ 1 - 1
src/pages/Alarm/components/detail.jsx

@@ -123,7 +123,7 @@ const Detail = (props) => {
                     ...tags.map((item, index) => ({
                       label: (
                         <div className={styles.tagContainer}>
-                          <div className={styles.label}>详情{index + 1}</div>
+                          <div className={styles.label}>详情</div>
                           <CloseOutlined
                             style={{ fontSize: 10 }}
                             onClick={(e) => {

+ 9 - 45
src/pages/Alarm/components/easy.jsx

@@ -59,7 +59,6 @@ const Easy = (props, ref) => {
   const [ahEnable, setAhEnable] = useState(false);
   const [alEnable, setAlEnable] = useState(false);
   const [allEnable, setAllEnable] = useState(false);
-  const [showMore, setShowMore] = useState(false);
   const [alarmId, setAlarmId] = useState(-1);
 
   const onModalOk = useMemoizedFn(async () => {
@@ -468,7 +467,7 @@ const Easy = (props, ref) => {
         autoComplete="off"
         form={form}
         // requiredMark={false}
-        labelAlign="left"
+        labelAlign="right"
         colon={false}
         labelCol={{
           flex: "84px",
@@ -599,7 +598,7 @@ const Easy = (props, ref) => {
               <div>
                 <Space size={8}>
                   <div className={styles.itemContainer}>
-                    {!!ah && <div className={styles.label}>上限</div>}
+                    {!!ah && <div className={styles.label}>{TranslateText(["上限", "Upper Limit"])}</div>}
                     <Form.Item
                       name="ah_value"
                       key={ahEnable}
@@ -643,7 +642,7 @@ const Easy = (props, ref) => {
                     className={styles.itemContainer}
                     style={{ marginLeft: 8 }}
                   >
-                    {!!ahh && <div className={styles.label}>上上限</div>}
+                    {!!ahh && <div className={styles.label}>{TranslateText(["上上限", "Ultra Upper Limit"])}</div>}
                     <Form.Item
                       name="ahh_value"
                       key={ahhEnable}
@@ -694,7 +693,7 @@ const Easy = (props, ref) => {
               <div style={{ marginTop: 10 }}>
                 <Space size={8}>
                   <div className={styles.itemContainer}>
-                    {!!al && <div className={styles.label}>下限</div>}
+                    {!!al && <div className={styles.label}>{TranslateText(["下限", "Lower Limit"])}</div>}
                     <Form.Item
                       name="al_value"
                       key={alEnable}
@@ -739,7 +738,7 @@ const Easy = (props, ref) => {
                     className={styles.itemContainer}
                     style={{ marginLeft: 8 }}
                   >
-                    {!!all && <div className={styles.label}>下下限</div>}
+                    {!!all && <div className={styles.label}>{TranslateText(["下下限", "Ultra Lower Limit"])}</div>}
                     <Form.Item
                       name="all_value"
                       key={allEnable}
@@ -811,27 +810,10 @@ const Easy = (props, ref) => {
             </Select.Option>
           </Select>
         </Form.Item>
-        <Form.Item label={TranslateText(["告警开关", "Enable"])} name="status">
+        <Form.Item label={TranslateText(["启用状态", "Enable"])} name="status">
           <Switch size={"small"} />
         </Form.Item>
-
-        {!showMore && (
-          <Form.Item
-            label={
-              <Button
-                type="link"
-                onClick={() => {
-                  setShowMore(true);
-                }}
-                style={{ marginLeft: -16 }}
-              >
-                {TranslateText(["更多", "More"])}
-                <DownOutlined></DownOutlined>
-              </Button>
-            }
-          ></Form.Item>
-        )}
-
+        
         <Form.Item
           label={TranslateText(["单位", "Unit"])}
           name="unit"
@@ -841,7 +823,6 @@ const Easy = (props, ref) => {
               message: TranslateText(["请输入单位", "Please input"]),
             },
           ]}
-          style={!showMore ? { display: "none" } : null}
         >
           <Input
             placeholder={TranslateText(["请输入", "Please input"])}
@@ -852,14 +833,13 @@ const Easy = (props, ref) => {
         <Form.Item
           label={TranslateText(["告警组", "Group"])}
           name={"group_id"}
-          style={!showMore ? { display: "none" } : null}
         >
           <Select
             style={{ width: 200 }}
             options={[
               ...[
                 {
-                  label: "未分组",
+                  label: TranslateText(["未分组", "Ungrouped"]),
                   value: 0,
                 },
               ],
@@ -878,7 +858,6 @@ const Easy = (props, ref) => {
           name={isDisabled ? "" : "defer_seconds"}
           disabled={isDisabled}
           label={TranslateText(["延时告警", "Delayed alarm"])}
-          style={!showMore ? { display: "none" } : null}
         >
           <div>
             <div
@@ -928,7 +907,7 @@ const Easy = (props, ref) => {
               >
                 {deferUnit === 1
                   ? TranslateText(["秒", "seconds"])
-                  : TranslateText(["分钟", "minutes"])}{" "}
+                  : TranslateText(["分钟", "minutes"])}
                 {TranslateText(["后报警", "of duration"])}
               </span>
             </div>
@@ -942,21 +921,6 @@ const Easy = (props, ref) => {
               )}
           </div>
         </Form.Item>
-
-        {showMore && (
-          <Form.Item
-            label={
-              <Button
-                type="link"
-                onClick={() => {
-                  setShowMore(false);
-                }}
-              >
-                收起<UpOutlined></UpOutlined>
-              </Button>
-            }
-          ></Form.Item>
-        )}
       </Form>
     </div>
   );

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