Forráskód Böngészése

feat(KIP-10665): C端 | HKC车辆管理功能调整

john 1 éve
szülő
commit
544d8489da

+ 27 - 24
src/pages/parkingFee/mixins/vehicleAddOrEdit.js

@@ -82,7 +82,6 @@ export default {
       this.ind = 0;
       this.active = 0;
       this.carType = index;
-
       if (this.carType == '1') {
         this.numArr = [
           this.numArr[0],
@@ -105,6 +104,7 @@ export default {
           this.numArr[6],
         ];
       }
+      this.vehicleNumber = this.numArr.toString().replace(/,/g, '')
     },
     // 唤起键盘
     clickShowKeyboard(index) {
@@ -168,29 +168,32 @@ export default {
         vehicleNo: this.vehicleNumber,
       };
       if(this.carInfo?.id) {
-        // 修改
-        const res = await editVehicles(this.carInfo?.id, {
-          id: this.carInfo?.id,
-          ...params
-        })
-        if(res.id) {
-          Toast({
-            message: '修改车牌成功',
-            position: 'top',
-            onClose: () => {
-              // this.$router.replace({
-              //   path: `vehicleManagement`,
-              // });
-              setTimeout(() => {
-                this.$router.go(-1)
-              }, 300)
-            }
-          });
-        } else {
-          const message = res.langMessage || '修改车牌失败';
-          Toast({
-            message: message,
-          });
+        try {
+          // 修改
+          const res = await editVehicles(this.carInfo?.id, {
+            id: this.carInfo?.id,
+            ...params
+          })
+          if(res.id) {
+            Toast({
+              message: '修改车牌成功',
+              position: 'top',
+              onClose: () => {
+                setTimeout(() => {
+                  this.$router.go(-1)
+                }, 300)
+              }
+            });
+          } else {
+            const message = res.langMessage || '修改车牌失败';
+            Toast({
+              message: message,
+            });
+          } 
+        } catch (err) {
+          if(err.code === 'FOUND_DUPLICATE') {
+            Toast('当前车牌已经存在,请勿重复绑定');
+          }
         }
         return
       } 

+ 27 - 24
src/pages/parkingFeeV2/mixins/vehicleAddOrEdit.js

@@ -61,7 +61,6 @@ export default {
       this.ind = 0;
       this.active = 0;
       this.carType = index;
-
       if (this.carType == '1') {
         this.numArr = [
           this.numArr[0],
@@ -84,6 +83,7 @@ export default {
           this.numArr[6],
         ];
       }
+      this.vehicleNumber = this.numArr.toString().replace(/,/g, '')
     },
     // 唤起键盘
     clickShowKeyboard(index) {
@@ -147,29 +147,32 @@ export default {
         vehicleNo: this.vehicleNumber,
       };
       if(this.carInfo?.id) {
-        // 修改
-        const res = await editVehicles(this.carInfo?.id, {
-          id: this.carInfo?.id,
-          ...params
-        })
-        if(res.id) {
-          Toast({
-            message: '修改车牌成功',
-            position: 'top',
-            onClose: () => {
-              // this.$router.replace({
-              //   path: `vehicleManagement`,
-              // });
-              setTimeout(() => {
-                this.$router.go(-1)
-              }, 300)
-            }
-          });
-        } else {
-          const message = res.langMessage || '修改车牌失败';
-          Toast({
-            message: message,
-          });
+        try {
+          // 修改
+          const res = await editVehicles(this.carInfo?.id, {
+            id: this.carInfo?.id,
+            ...params
+          })
+          if(res.id) {
+            Toast({
+              message: '修改车牌成功',
+              position: 'top',
+              onClose: () => {
+                setTimeout(() => {
+                  this.$router.go(-1)
+                }, 300)
+              }
+            });
+          } else {
+            const message = res.langMessage || '修改车牌失败';
+            Toast({
+              message: message,
+            });
+          } 
+        } catch (err) {
+          if(err.code === 'FOUND_DUPLICATE') {
+            Toast('当前车牌已经存在,请勿重复绑定');
+          }
         }
         return
       }