diff --git a/src/api/plugin/workflow/form-history.js b/src/api/plugin/workflow/form-history.js
new file mode 100644
index 0000000..796a2ed
--- /dev/null
+++ b/src/api/plugin/workflow/form-history.js
@@ -0,0 +1,57 @@
+import request from '@/router/axios';
+
+const prefix = '/api/blade-workflow/design/form/history'
+
+export const getList = (current, size, params) => {
+ return request({
+ url: `${prefix}/list`,
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
+export const getDetail = (params) => {
+ return request({
+ url: `${prefix}/detail`,
+ method: 'get',
+ params
+ })
+}
+
+export const remove = (ids) => {
+ return request({
+ url: `${prefix}/remove`,
+ method: 'post',
+ params: {
+ ids,
+ }
+ })
+}
+
+export const add = (row) => {
+ return request({
+ url: `${prefix}/submit`,
+ method: 'post',
+ data: row
+ })
+}
+
+export const update = (row) => {
+ return request({
+ url: `${prefix}/submit`,
+ method: 'post',
+ data: row
+ })
+}
+
+export const setMainVersion = (row) => {
+ return request({
+ url: `${prefix}/setMainVersion`,
+ method: 'post',
+ data: row
+ })
+}
diff --git a/src/api/plugin/workflow/form.js b/src/api/plugin/workflow/form.js
index 2c52815..8a2b111 100644
--- a/src/api/plugin/workflow/form.js
+++ b/src/api/plugin/workflow/form.js
@@ -22,13 +22,11 @@ export const getDetail = (params) => {
})
}
-export const remove = (ids) => {
+export const remove = (data) => {
return request({
url: `${prefix}/remove`,
method: 'post',
- params: {
- ids,
- }
+ data
})
}
diff --git a/src/api/plugin/workflow/model-history.js b/src/api/plugin/workflow/model-history.js
new file mode 100644
index 0000000..8ddb4fa
--- /dev/null
+++ b/src/api/plugin/workflow/model-history.js
@@ -0,0 +1,57 @@
+import request from '@/router/axios';
+
+const prefix = '/api/blade-workflow/design/model/history'
+
+export const getList = (current, size, params) => {
+ return request({
+ url: `${prefix}/list`,
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
+export const getDetail = (params) => {
+ return request({
+ url: `${prefix}/detail`,
+ method: 'get',
+ params
+ })
+}
+
+export const remove = (ids) => {
+ return request({
+ url: `${prefix}/remove`,
+ method: 'post',
+ params: {
+ ids,
+ }
+ })
+}
+
+export const add = (row) => {
+ return request({
+ url: `${prefix}/submit`,
+ method: 'post',
+ data: row
+ })
+}
+
+export const update = (row) => {
+ return request({
+ url: `${prefix}/submit`,
+ method: 'post',
+ data: row
+ })
+}
+
+export const setMainVersion = (row) => {
+ return request({
+ url: `${prefix}/setMainVersion`,
+ method: 'post',
+ data: row
+ })
+}
diff --git a/src/router/views/index.js b/src/router/views/index.js
index 2691c53..cb10524 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -113,6 +113,18 @@ export default [{
component: () =>
import( /* webpackChunkName: "views" */ '@/views/plugin/workflow/design'),
},
+ {
+ path: 'design/model/history/:id',
+ name: '模型历史',
+ component: () =>
+ import( /* webpackChunkName: "views" */ '@/views/plugin/workflow/design/model-history'),
+ },
+ {
+ path: 'design/form/history/:id',
+ name: '表单历史',
+ component: () =>
+ import( /* webpackChunkName: "views" */ '@/views/plugin/workflow/design/form-history'),
+ },
{
path: 'process/start/:params',
name: '新建流程',
diff --git a/src/views/plugin/workflow/design/form-history.vue b/src/views/plugin/workflow/design/form-history.vue
new file mode 100644
index 0000000..37b71c8
--- /dev/null
+++ b/src/views/plugin/workflow/design/form-history.vue
@@ -0,0 +1,227 @@
+
+
+
+
+ 删 除
+
+
+
+ 预览
+ 设为主版本
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/plugin/workflow/design/form.vue b/src/views/plugin/workflow/design/form.vue
index ce92691..b70d693 100644
--- a/src/views/plugin/workflow/design/form.vue
+++ b/src/views/plugin/workflow/design/form.vue
@@ -17,15 +17,6 @@
@size-change="sizeChange"
@refresh-change="onLoad(page, query)"
@on-load="onLoad">
-
- 删 除
-
-
拷贝
-
+ @click="handleHistory(row)">历史
@@ -97,6 +88,7 @@ export default {
},
selectionList: [],
option: {
+ menuWidth: 350,
size: 'mini',
height: 'auto',
calcHeight: 30,
@@ -104,7 +96,6 @@ export default {
border: true,
index: true,
selection: true,
- delBtn: false,
dialogType: 'drawer',
align: 'center',
searchMenuSpan: 6,
@@ -211,6 +202,7 @@ export default {
}],
},]
},
+ isNewVersion: false,
isCopy: false,
copyVisible: false
};
@@ -241,11 +233,7 @@ export default {
this.form.content = data
} else {
this.row.content = data
- this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', {
- confirmButtonText: '否',
- cancelButtonText: '是',
- type: 'warning'
- }).then(() => {
+ if (this.isNewVersion) {
this.row.newVersion = false
update(this.row).then(() => {
@@ -253,20 +241,36 @@ export default {
this.onLoad(this.page, this.query)
this.formVisible = false
})
- }).catch(() => {
- this.row.newVersion = true
+ } else {
+ this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', {
+ confirmButtonText: '否',
+ cancelButtonText: '是',
+ type: 'warning'
+ }).then(() => {
+ this.row.newVersion = false
- update(this.row).then(() => {
- this.$message.success("保存成功")
- this.onLoad(this.page, this.query)
- this.formVisible = false
+ update(this.row).then(() => {
+ this.$message.success("保存成功")
+ this.onLoad(this.page, this.query)
+ this.formVisible = false
+ })
+ }).catch(() => {
+ this.row.newVersion = true
+
+ update(this.row).then(() => {
+ this.$message.success("保存成功")
+ this.onLoad(this.page, this.query)
+ this.formVisible = false
+ })
})
- })
+ }
}
})
},
handleDesign(row) {
this.options = this.deepClone(row.content || '')
+ if (row.content) this.isNewVersion = false
+ else this.isNewVersion = true
this.row = row
this.isCopy = false
this.formVisible = true
@@ -295,6 +299,9 @@ export default {
done()
})
},
+ handleHistory(row) {
+ this.$router.push('/workflow/design/form/history/' + row.id)
+ },
rowSave(row, loading, done) {
add(row).then(() => {
loading();
@@ -322,21 +329,29 @@ export default {
});
},
rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
+ this.$confirm("删除全部版本或者回退到最后版本?", {
+ confirmButtonText: "回退",
+ cancelButtonText: "全部删除",
type: "warning"
- })
- .then(() => {
- return remove(row.id);
+ }).then(() => {
+ const param = {
+ id: row.id,
+ rollback: true
+ }
+ remove(param).then(() => {
+ this.onLoad(this.page);
+ this.$message.success("操作成功")
})
- .then(() => {
+ }).catch(() => {
+ const param = {
+ id: row.id,
+ rollback: false
+ }
+ remove(param).then(() => {
this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
+ this.$message.success("操作成功")
+ })
+ })
},
handleDelete() {
if (this.selectionList.length === 0) {
diff --git a/src/views/plugin/workflow/design/model-history.vue b/src/views/plugin/workflow/design/model-history.vue
new file mode 100644
index 0000000..e087ba9
--- /dev/null
+++ b/src/views/plugin/workflow/design/model-history.vue
@@ -0,0 +1,225 @@
+
+
+
+
+ 删 除
+
+
+
+ 预览
+ 设为主版本
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/plugin/workflow/design/model.vue b/src/views/plugin/workflow/design/model.vue
index b5d3a84..a0586ed 100644
--- a/src/views/plugin/workflow/design/model.vue
+++ b/src/views/plugin/workflow/design/model.vue
@@ -16,29 +16,29 @@
@on-load="onLoad">
创 建
-
- 删 除
+ @click="handleDesign({})"> 新 增
- 设计
- 部署
+ 历史
@@ -69,6 +69,7 @@ export default {
},
selectionList: [],
option: {
+ size: 'mini',
height: 'auto',
calcHeight: 30,
tip: false,
@@ -145,22 +146,33 @@ export default {
handleDesign(row) {
this.$router.push('/workflow/design/process/' + (row.id || 0))
},
+ handleHistory(row) {
+ this.$router.push('/workflow/design/model/history/' + row.id)
+ },
rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
+ this.$confirm("删除全部版本或者回退到最后版本?", {
+ confirmButtonText: "回退",
+ cancelButtonText: "全部删除",
type: "warning"
- })
- .then(() => {
- return remove({ id: row.id });
+ }).then(() => {
+ const param = {
+ id: row.id,
+ rollback: true
+ }
+ remove(param).then(() => {
+ this.onLoad(this.page);
+ this.$message.success("操作成功")
})
- .then(() => {
+ }).catch(() => {
+ const param = {
+ id: row.id,
+ rollback: false
+ }
+ remove(param).then(() => {
this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
+ this.$message.success("操作成功")
+ })
+ })
},
handleDelete() {
if (this.selectionList.length === 0) {