疯狂的狮子li
2021-12-24 5ca038d888922e93bf45c7bd37f3c6dce849dcff
ruoyi-ui/src/views/demo/tree/index.vue
@@ -102,7 +102,7 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
@@ -110,7 +110,7 @@
</template>
<script>
import { listTree, getTree, delTree, addTree, updateTree, exportTree } from "@/api/demo/tree";
import { listTree, getTree, delTree, addTree, updateTree } from "@/api/demo/tree";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@@ -121,6 +121,8 @@
  },
  data() {
    return {
      //按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 显示搜索条件
@@ -250,20 +252,22 @@
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.loading = true;
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateTree(this.form).then(response => {
              this.loading = false;
              this.msgSuccess("修改成功");
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addTree(this.form).then(response => {
              this.loading = false;
              this.msgSuccess("新增成功");
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
@@ -271,18 +275,16 @@
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$confirm('是否确认删除测试树表编号为"' + row.id + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
      this.$modal.confirm('是否确认删除测试树表编号为"' + row.id + '"的数据项?').then(() => {
        this.loading = true;
        return delTree(row.id);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.msgSuccess("删除成功");
      })
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    }
  }
};