kuaifan 5 anos atrás
pai
commit
f8020d4433

+ 15 - 6
resources/assets/js/main/components/WHeader.vue

@@ -422,6 +422,9 @@
                 this.$set(this.formDatum, 'nickname', this.userInfo.nickname)
                 this.$set(this.formDatum, 'profession', this.userInfo.profession)
                 this.$set(this.formSetting, 'bgid', this.userInfo.bgid)
+                this.formDatum__reset = $A.cloneData(this.formDatum);
+                this.formSetting__reset = $A.cloneData(this.formSetting);
+                this.formPass__reset = $A.cloneData(this.formPass);
             };
             this.userInfo = $A.getUserInfo((res) => {
                 this.userInfo = res;
@@ -488,12 +491,14 @@
                     },
                     success: (res) => {
                         if (res.ret === 1) {
-                            this.formSystem = res.data;
-                            this.formSystem.github = this.formSystem.github || 'show';
-                            this.formSystem.reg = this.formSystem.reg || 'open';
-                            this.formSystem.callav = this.formSystem.callav || 'open';
-                            this.formSystem.autoArchived = this.formSystem.autoArchived || 'close';
-                            this.formSystem.archivedDay = this.formSystem.archivedDay || 7;
+                            let tempData = res.data;
+                            tempData.github = tempData.github || 'show';
+                            tempData.reg = tempData.reg || 'open';
+                            tempData.callav = tempData.callav || 'open';
+                            tempData.autoArchived = tempData.autoArchived || 'close';
+                            tempData.archivedDay = tempData.archivedDay || 7;
+                            this.formSystem = tempData;
+                            this.formSystem__reset = $A.cloneData(this.formSystem);
                             if (save) {
                                 this.$Message.success(this.$L('修改成功'));
                             }
@@ -578,6 +583,10 @@
                 })
             },
             handleReset(name) {
+                if (typeof this[name + '__reset'] !== "undefined") {
+                    this[name] = $A.cloneData(this[name + '__reset']);
+                    return;
+                }
                 this.$refs[name].resetFields();
             },
             formArchived(value) {

+ 5 - 0
resources/assets/js/main/components/docs/setting.vue

@@ -160,6 +160,7 @@
                             data.role_look = data.role_look || 'edit';
                             data.role_view = data.role_view || 'all';
                             this.formSystem = data;
+                            this.formSystem__reset = $A.cloneData(this.formSystem);
                             if (save) {
                                 this.$Message.success(this.$L('修改成功'));
                             }
@@ -184,6 +185,10 @@
                 })
             },
             handleReset(name) {
+                if (typeof this[name + '__reset'] !== "undefined") {
+                    this[name] = $A.cloneData(this[name + '__reset']);
+                    return;
+                }
                 this.$refs[name].resetFields();
             },
         }

+ 5 - 0
resources/assets/js/main/components/project/setting.vue

@@ -143,6 +143,7 @@
                     success: (res) => {
                         if (res.ret === 1) {
                             this.formSystem = res.data;
+                            this.formSystem__reset = $A.cloneData(this.formSystem);
                             if (save) {
                                 this.$Message.success(this.$L('修改成功'));
                                 this.$emit('on-change', res.data);
@@ -168,6 +169,10 @@
                 })
             },
             handleReset(name) {
+                if (typeof this[name + '__reset'] !== "undefined") {
+                    this[name] = $A.cloneData(this[name + '__reset']);
+                    return;
+                }
                 this.$refs[name].resetFields();
             },
         }