guhongwei 5 éve
szülő
commit
7fe0bf963d
1 módosított fájl, 7 hozzáadás és 5 törlés
  1. 7 5
      src/layout/user/mainForm.vue

+ 7 - 5
src/layout/user/mainForm.vue

@@ -192,21 +192,22 @@ export default {
     async handleSave() {
       let res;
       let msg;
-      let data = JSON.parse(JSON.stringify(this.form));
+      let data = this.form;
       if (this.isNew) {
         data.status = '1';
-        if (this.role == '2' || this.role == '3') {
+        data.code = this.user.code;
+        if (data.role == '2' || data.role == '3') {
           res = await this.create(data);
           msg = '用户创建成功';
-        } else if (this.role == '6') {
+        } else if (data.role == '6') {
           res = await this.exportuserCreate(data);
           msg = '用户创建成功';
         }
       } else {
-        if (this.role == '2' || this.role == '3') {
+        if (this.form.role == '2' || this.form.role == '3') {
           res = await this.update(data);
           msg = '用户审核成功';
-        } else if (this.role == '6') {
+        } else if (this.form.role == '6') {
           res = await this.exportuserUpdate(data);
           msg = '用户审核成功';
         }
@@ -228,6 +229,7 @@ export default {
     },
   },
   computed: {
+    ...mapState(['user']),
     id() {
       return this.$route.query.id;
     },