Ver Fonte

备份流程图

lph há 1 ano atrás
pai
commit
c69c22c878

+ 10 - 0
ruoyi-ui/src/api/bpmprocess/process.js

@@ -47,3 +47,13 @@ export function delProcess(processId) {
     baseURL: process.env.VUE_APP_BASE_API4
   })
 }
+
+//备份流程
+export function bpmBackups(data) {
+  return request({
+    url: 'system/process/bpmBackups',
+    method: 'put',
+    data: data,
+    baseURL: process.env.VUE_APP_BASE_API4
+  })
+}

+ 65 - 0
ruoyi-ui/src/views/bpmprocess/index.vue

@@ -187,6 +187,16 @@
                   >修改</el-button
                 ></el-dropdown-item
               >
+              <el-dropdown-item
+                ><el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit"
+                  @click="backupProcess(scope.row)"
+                  v-hasPermi="['system:user:edit']"
+                  >备份流程图</el-button
+                ></el-dropdown-item
+              >
               <el-dropdown-item
                 ><el-button
                   size="mini"
@@ -287,6 +297,7 @@ import {
   delProcess,
   addProcess,
   updateProcess,
+  bpmBackups,
 } from "@/api/bpmprocess/process";
 
 export default {
@@ -337,6 +348,9 @@ export default {
   created() {
     this.getList();
   },
+  activated() {
+    this.getList();
+  },
   methods: {
     /** 查询流程定义列表 */
     getList() {
@@ -421,6 +435,57 @@ export default {
         },
       });
     },
+    // 备份流程图
+    backupProcess(row) {
+      this.$prompt("请输入备份描述:", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            if (instance.inputValue?.trim().length) {
+              instance.confirmButtonLoading = true;
+              instance.confirmButtonText = "保存中...";
+
+              try {
+                let data = {
+                  processId: row.processId,
+                  note: instance.inputValue.trim(),
+                };
+                let res = await bpmBackups(data);
+                if (res.code == 200) {
+                  this.$message.success("备份成功");
+                  instance.confirmButtonLoading = false;
+                  instance.confirmButtonText = "确定";
+                  done();
+                } else {
+                  this.$message.error("备份失败");
+                }
+                instance.confirmButtonLoading = false;
+                instance.confirmButtonText = "确定";
+              } catch (error) {
+                instance.confirmButtonLoading = false;
+                instance.confirmButtonText = "确定";
+                console.log(error);
+              }
+            } else {
+              this.$message({
+                type: "error",
+                message: "备份描述不能为空",
+              });
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(({ value }) => {})
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "取消备份",
+          });
+        });
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate((valid) => {