Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

liuyang 5 жил өмнө
parent
commit
1651a20253

+ 1 - 1
frontend_web/src/router/index.js

@@ -322,7 +322,7 @@ router.beforeEach(async (to, from, next) => {
 const originalPush = VueRouter.prototype.push
 VueRouter.prototype.push = function push (location, onResolve, onReject) {
   if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
-  return originalPush.call(this, location).catch(err => err)
+  return originalPush.call(this, location)
 }
 
 router.afterEach(to => {

+ 26 - 19
frontend_web/src/views/managingrooms/_opera/add.vue

@@ -46,7 +46,7 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="楼宇"
-                        prop="building"
+                        prop="Building"
                         label-width="100px">
             <el-select v-model="testlistform.Building"
                        placeholder="请选择楼宇"
@@ -60,7 +60,6 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="位置信息"
-                        required
                         prop="PositionInformation"
                         label-width="100px">
             <el-input v-model="testlistform.PositionInformation"
@@ -115,7 +114,7 @@ export default {
         RoomType: '',
         RoomDescribe: '',
         PositionInformation: '',
-        building: ''
+        Building: ''
       },
       classificationlist: [],
 
@@ -136,12 +135,12 @@ export default {
           message: '请选择实验室类型',
           trigger: 'blur'
         }],
-        PositionInformation: [{
-          required: true,
-          message: '请填写位置信息',
-          trigger: 'blur'
-        }],
-        building: [{
+        // PositionInformation: [{
+        //   required: true,
+        //   message: '请填写位置信息',
+        //   trigger: 'blur'
+        // }],
+        Building: [{
           required: true,
           message: '请选择楼宇',
           trigger: 'blur'
@@ -156,16 +155,23 @@ export default {
     // 保存实验室信息
     savedata () {
       let _this = this
-      saveroomdata(_this.testlistform)
-        .then(res => {
-          this.dialogvisible = false
-          // 刷新
-          this.$emit('initdata')
-        })
-        .catch(err => {
-          // handle error
-          console.error(err)
-        })
+      this.$refs.testlistform.validate(valid => {
+        if (valid) {
+          saveroomdata(_this.testlistform)
+            .then(res => {
+              this.dialogvisible = false
+              // 刷新
+              this.$emit('initdata')
+            })
+            .catch(err => {
+              // handle error
+              console.error(err)
+            })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
     deletedata (index) {
       let _this = this
@@ -187,6 +193,7 @@ export default {
       this.testlistform.RoomNum = ''
       this.testlistform.RoomName = ''
       this.testlistform.RoomType = ''
+      this.testlistform.Building = ''
       this.testlistform.PositionInformation = ''
       this.testlistform.RoomDescribe = ''
     }