Bladeren bron

Merge branch 'master' of http://192.168.1.7:3000/xsh1997/hyyfClient

xsh 3 jaren geleden
bovenliggende
commit
399e92bbea

+ 4 - 4
src/views/Alarm/AlarmSet.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 15:06:41
- * @LastEditTime: 2021-12-01 16:16:56
+ * @LastEditTime: 2021-12-06 16:10:36
  * @LastEditors: Please set LastEditors
  * @Description: 报警阈值设置
  * @FilePath: \hyyfClient\src\views\Alarm\AlarmSet.vue
@@ -66,11 +66,11 @@ export default {
         await this.$refs["regularRef"].actionRegular();
         await this.$refs["alarmFormRef"].addPhonesAction();
         await this.$refs["alarmTableRef"].addAlarmSets();
-        loading.close();
         this.$message.success("设置成功");
       } catch (err) {
-        console.log(err);
-        this.$message.error("设置失败");
+        this.$message.error("设置失败:" + err.message);
+      } finally {
+        loading.close();
       }
     },
   },

+ 38 - 27
src/views/Alarm/alarm-set/AlarmForm.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 16:41:38
- * @LastEditTime: 2021-12-06 15:11:12
+ * @LastEditTime: 2021-12-06 16:00:29
  * @LastEditors: Please set LastEditors
  * @Description: 报警设置的 各个报警号码
  * @FilePath: \hyyfClient\src\views\Alarm\alarm-set\AlarmForm.vue
@@ -141,32 +141,43 @@ export default {
       });
     },
     addPhonesAction() {
-      // this.$refs[alarmForm]
-      const secondPhones = this.alarmForm.secondPhones.reduce((prev, item) => {
-        return prev + item.phone + ",";
-      }, "");
-      const thirdPhones = this.alarmForm.thirdPhones.reduce((prev, item) => {
-        return prev + item.phone + ",";
-      }, "");
-      postAlarmPhones([
-        {
-          id: this.secondId || undefined,
-          farmId: Number(localStorage.getItem("lastFarmId")),
-          wraningName: "二级报警",
-          phone: secondPhones,
-          level: 2,
-        },
-        {
-          id: this.thirdId || undefined,
-          farmId: Number(localStorage.getItem("lastFarmId")),
-          wraningName: "三级报警",
-          phone: thirdPhones,
-          level: 3,
-        },
-      ]).then((res) => {
-        console.log(res);
-        if (res.code === 10000) {
-          this.initGetPhones();
+      this.$refs["alarmForm"].validate((valid) => {
+        if (valid) {
+          const secondPhones = this.alarmForm.secondPhones.reduce(
+            (prev, item) => {
+              return prev + item.phone + ",";
+            },
+            ""
+          );
+          const thirdPhones = this.alarmForm.thirdPhones.reduce(
+            (prev, item) => {
+              return prev + item.phone + ",";
+            },
+            ""
+          );
+          postAlarmPhones([
+            {
+              id: this.secondId || undefined,
+              farmId: Number(localStorage.getItem("lastFarmId")),
+              wraningName: "二级报警",
+              phone: secondPhones,
+              level: 2,
+            },
+            {
+              id: this.thirdId || undefined,
+              farmId: Number(localStorage.getItem("lastFarmId")),
+              wraningName: "三级报警",
+              phone: thirdPhones,
+              level: 3,
+            },
+          ]).then((res) => {
+            console.log(res);
+            if (res.code === 10000) {
+              this.initGetPhones();
+            }
+          });
+        } else {
+          throw new Error("手机号有误");
         }
       });
     },

+ 6 - 12
src/views/PdcData/analysis/yingshouTable.config.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-10-11 16:12:07
- * @LastEditTime: 2021-11-25 13:54:45
+ * @LastEditTime: 2021-12-06 16:12:56
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\yingshouTable.config.js
@@ -10,14 +10,14 @@ export const yingshouTableItems = [
   {
     prop: 'rank',
     label: '排名',
-    minWidth: '200',
+    minWidth: '100',
     slotName: 'rank'
   },
   {
-    prop: 'farmName',
-    label: '牧场名称',
-    minWidth: '300',
-    slotName: 'farmName'
+    prop: 'suppier',
+    label: '供应商',
+    minWidth: '200',
+    slotName: 'suppier'
   },
   {
     prop: 'money',
@@ -25,12 +25,6 @@ export const yingshouTableItems = [
     minWidth: '150',
     slotName: 'number'
   },
-  {
-    prop: 'suppier',
-    label: '供应商',
-    minWidth: '200',
-    slotName: 'suppier'
-  }
 ]
 
 export const yingshouTableShows = {