Browse Source

Refactor Alarm components: Update label alignment, modify button labels for symbols, and enhance form validation messages

valentichu 10 tháng trước cách đây
mục cha
commit
1aec53b44c

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
lib/index.js


+ 67 - 67
src/pages/Alarm/components/complex.jsx

@@ -264,7 +264,7 @@ const Complex = (props, ref) => {
             autoComplete="off"
             form={form}
             requiredMark={true}
-            labelAlign="left"
+            labelAlign="right"
             colon={false}
             labelCol={{
               flex: "84px",
@@ -391,7 +391,71 @@ const Complex = (props, ref) => {
                 </Form.Item>
 
                 <Form.Item
-                  label={TranslateText(["告警开关", "Enable"])}
+                  label={TranslateText(["条件符号", "Symbol"])}
+                  // name="symb"
+                >
+                  <div className="symb">
+                    <Button type="primary" onClick={symbClick}>
+                      ()
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      {"&&(and)"}
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      {"||(or)"}
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      ≥
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      {">"}
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      ==
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>{`<`}</Button>
+                    <Button type="primary" onClick={symbClick}>
+                      ≤
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      +
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      -
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      *
+                    </Button>
+                    <Button type="primary" onClick={symbClick}>
+                      /
+                    </Button>
+                  </div>
+                </Form.Item>
+
+                <Form.Item
+                  label={TranslateText(["条件编辑", "Edit"])}
+                  name="formu"
+                  rules={[
+                    {
+                      required: true,
+                      message: "请输入条件",
+                      validator: () => {
+                        return new Promise((resolve, reject) => {
+                          if (formuRef.current.getFinalStr()) {
+                            resolve();
+                          } else {
+                            reject();
+                          }
+                        });
+                      },
+                    },
+                  ]}
+                >
+                  <Formular ref={formuRef} key={`${type}-${alarmId}`} />
+                </Form.Item>
+
+                <Form.Item
+                  label={TranslateText(["启用状态", "Enable"])}
                   name="status"
                 >
                   <Switch size={"small"} />
@@ -446,7 +510,7 @@ const Complex = (props, ref) => {
                           fontSize: 14,
                         }}
                       >
-                        {TranslateText(["分钟", "minutes"])}{" "}
+                        {TranslateText(["分钟", "minutes"])}
                         {TranslateText(["后报警", "of duration"])}
                       </span>
                     </div>
@@ -459,70 +523,6 @@ const Complex = (props, ref) => {
                       )}
                   </div>
                 </Form.Item>
-
-                <Form.Item
-                  label={TranslateText(["条件符号", "Symbol"])}
-                  // name="symb"
-                >
-                  <div className="symb">
-                    <Button type="primary" onClick={symbClick}>
-                      ()
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      {"&&(and)"}
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      {"||(or)"}
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      ≥
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      {">"}
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      ==
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>{`<`}</Button>
-                    <Button type="primary" onClick={symbClick}>
-                      ≤
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      +
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      -
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      *
-                    </Button>
-                    <Button type="primary" onClick={symbClick}>
-                      /
-                    </Button>
-                  </div>
-                </Form.Item>
-
-                <Form.Item
-                  label={TranslateText(["条件编辑", "Edit"])}
-                  name="formu"
-                  rules={[
-                    {
-                      required: true,
-                      message: "请输入条件",
-                      validator: () => {
-                        return new Promise((resolve, reject) => {
-                          if (formuRef.current.getFinalStr()) {
-                            resolve();
-                          } else {
-                            reject();
-                          }
-                        });
-                      },
-                    },
-                  ]}
-                >
-                  <Formular ref={formuRef} key={`${type}-${alarmId}`} />
-                </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([]);

+ 3 - 3
src/pages/Alarm/components/easy.jsx

@@ -467,7 +467,7 @@ const Easy = (props, ref) => {
         autoComplete="off"
         form={form}
         // requiredMark={false}
-        labelAlign="left"
+        labelAlign="right"
         colon={false}
         labelCol={{
           flex: "84px",
@@ -810,7 +810,7 @@ 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>
         
@@ -907,7 +907,7 @@ const Easy = (props, ref) => {
               >
                 {deferUnit === 1
                   ? TranslateText(["秒", "seconds"])
-                  : TranslateText(["分钟", "minutes"])}{" "}
+                  : TranslateText(["分钟", "minutes"])}
                 {TranslateText(["后报警", "of duration"])}
               </span>
             </div>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác