|
@@ -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("手机号有误");
|
|
|
}
|
|
|
});
|
|
|
},
|