Преглед изворни кода

feat: 解决新增壁纸后,页面不会刷新

332777428@qq.com пре 6 месеци
родитељ
комит
b3e90e9d20
1 измењених фајлова са 22 додато и 22 уклоњено
  1. 22 22
      src/views/operation/piano/index.vue

+ 22 - 22
src/views/operation/piano/index.vue

@@ -158,7 +158,6 @@ export default {
     getList() {
       this.loading = true;
       list(this.form).then((res) => {
-        console.log("gadfadfqwwerqewr===" + JSON.stringify(res));
         if (res.code === 0) {
           this.tableData = res.data.records;
           this.total = res.data.total;
@@ -234,51 +233,52 @@ export default {
 
     // 上传
     uploadCode(e) {
-      if (e != null && e.size != null && e.size > 0) {
-        this.dialogData.pic = e.file;
-      }
+      this.dialogData.pic = e.file;
     },
 
     // 提交分类表单
     getDialogSubmit() {
-      var pic = this.dialogData.pic;
+      var that = this;
+      var pic = that.dialogData.pic;
       if (pic == null || pic == "") {
-        this.$message.success("请上传图片");
+        that.$message.success("请上传图片");
         return;
       }
 
-      var sort = this.dialogData.sort;
+      var sort = that.dialogData.sort;
       if (sort == null || sort == "") {
-        this.$message.success("请选择排序");
+        that.$message.success("请选择排序");
         return;
       }
 
-      if (!this.isChecked1 && !this.isChecked2) {
-        this.$message.success("请选择应用类型");
+      if (!that.isChecked1 && !that.isChecked2) {
+        that.$message.success("请选择应用类型");
         return;
       }
 
-      if (this.isChecked1 && this.isChecked2) {
-        this.dialogData.applicationType = "[0,1]";
-      } else if (this.isChecked2) {
-        this.dialogData.applicationType = "[1]";
+      if (that.isChecked1 && that.isChecked2) {
+        that.dialogData.applicationType = "[0,1]";
+      } else if (that.isChecked2) {
+        that.dialogData.applicationType = "[1]";
       } else {
-        this.dialogData.applicationType = "[0]";
+        that.dialogData.applicationType = "[0]";
       }
 
       ///新增
-      if (this.dialogStatus == 0) {
-        add(this.dialogData).then((res) => {
+      if (that.dialogStatus == 0) {
+        add(that.dialogData).then((res) => {
           if (res.code === 0) {
-            this.$message.success("添加成功!");
-            this.getDialogClose();
+            that.$message.success("添加成功!");
+            that.getDialogClose();
+            that.getList();
           }
         });
       } else {
-        edit(this.dialogData).then((res) => {
+        edit(that.dialogData).then((res) => {
           if (res.code === 0) {
-            this.$message.success("修改成功!");
-            this.getDialogClose();
+            that.$message.success("修改成功!");
+            that.getDialogClose();
+            that.getList();
           }
         });
       }