From 9ccde974b85157aee21943ca8aa718f7093985bc Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 09 一月 2023 17:25:50 +0800
Subject: [PATCH] 网格管理

---
 src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue |   64 ++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
index fa3c400..0109e2a 100644
--- a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
+++ b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
@@ -73,6 +73,10 @@
 </template>
   <script>
 import { validatePhone, validateName } from "@/utils/validate";
+
+import { createNamespacedHelpers } from "vuex";
+const { mapActions } = createNamespacedHelpers("handheldTerminal");
+
 export default {
   data() {
     const checkName = (rule, value, callback) => {
@@ -189,37 +193,41 @@
     // 鍒濆鍖栭儴闂ㄦ爲
     getDepartTree();
     // 鍒濆鍖栨暟鎹�
-    this.form = JSON.parse(JSON.stringify(this.info));
+    this.form = this.info;
     if (!this.form.departName) {
       this.form.departName = this.form.pdepartName;
     }
   },
+
+  watch: {
+    info(newVal) {
+      this.form = newVal; //瀵圭埗缁勪欢浼犺繃鏉ョ殑鍊艰繘琛岀洃鍚紝濡傛灉鏀瑰彉涔熷瀛愮粍浠跺唴閮ㄧ殑鍊艰繘琛屾敼鍙�
+    },
+  },
   methods: {
+    ...mapActions(["saveHandheldTerminal", "updateHandheldTerminal"]),
     // 淇敼鎵ф硶杞�
     handleUpdateLawCar() {
       this.$refs.formRef.validate((valid) => {
         if (valid) {
           const { form } = this;
-          this.$axios({
-            method: "put",
-            url: "sccg/car_Manage/modification_enforce",
-            data: {
-              ...form,
-            },
-          }).then((res) => {
-            if (res.code === 200) {
+          if (form.id > 0) {
+            this.updateHandheldTerminal(form).then((res) => {
               this.$message({
                 type: "success",
-                message: "淇敼杞﹁締鎴愬姛",
+                message: "淇敼鎵嬫寔璁惧鎴愬姛",
               });
               this.$emit("closeDialog", { flag: false, index: 1 });
-            } else {
+            });
+          } else {
+            this.saveHandheldTerminal(form).then((res) => {
               this.$message({
-                type: "error",
-                message: res.message,
+                type: "success",
+                message: "淇濆瓨鎵嬫寔璁惧鎴愬姛",
               });
-            }
-          });
+              this.$emit("closeDialog", { flag: false, index: 1 });
+            });
+          }
         } else {
           return false;
         }
@@ -268,13 +276,13 @@
   <style lang="scss" scoped>
 .create {
   border-radius: 1px;
-  background-color: #09152f;
+  // background-color: #09152f;
 
   main {
     // border: 1px solid #fff;
     text-align: left;
     padding: 0 55px;
-    background-color: #09152f;
+    // background-color: #09152f;
     padding-bottom: 50px;
 
     .mainContent {
@@ -314,18 +322,18 @@
     }
   }
 
-  &::v-deep .el-textarea__inner {
-    background-color: #09152f;
-    border: 1px solid #17324c;
-  }
+  // &::v-deep .el-textarea__inner {
+  //   background-color: #09152f;
+  //   border: 1px solid #17324c;
+  // }
 
-  ::v-deep .el-form-item__label {
-    color: #4b9bb7;
-  }
+  // ::v-deep .el-form-item__label {
+  //   color: #4b9bb7;
+  // }
 
-  ::v-deep .el-input__inner {
-    background-color: #09152f;
-    border: 1px solid #17324c;
-  }
+  // ::v-deep .el-input__inner {
+  //   background-color: #09152f;
+  //   border: 1px solid #17324c;
+  // }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0