🎉 1.0.4.RELEASE

saber
ssc 5 years ago
parent a2a271cac8
commit 2cac23e637
  1. 57
      src/api/plugin/workflow/form-history.js
  2. 6
      src/api/plugin/workflow/form.js
  3. 57
      src/api/plugin/workflow/model-history.js
  4. 12
      src/router/views/index.js
  5. 227
      src/views/plugin/workflow/design/form-history.vue
  6. 87
      src/views/plugin/workflow/design/form.vue
  7. 225
      src/views/plugin/workflow/design/model-history.vue
  8. 58
      src/views/plugin/workflow/design/model.vue

@ -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
})
}

@ -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
})
}

@ -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
})
}

@ -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: '新建流程',

@ -0,0 +1,227 @@
<template>
<basic-container>
<avue-crud :option="option"
:table-loading="loading"
:data="data"
:page.sync="page"
:search.sync="query"
v-model="form"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="onLoad(page, query)">
<template slot="menuLeft">
<el-button type="danger"
size="mini"
icon="el-icon-delete"
plain
v-if="permission.wf_design_form_history_delete"
@click="handleDelete">
</el-button>
</template>
<template slot="menu"
slot-scope="{row}">
<el-button v-if="permission.wf_design_form_history_view"
type="text"
size="mini"
icon="el-icon-view"
@click="handlePreview(row)">预览</el-button>
<el-button v-if="permission.wf_design_form_history_main"
type="text"
size="mini"
icon="el-icon-edit"
@click="handleMain(row)">设为主版本</el-button>
</template>
</avue-crud>
<el-drawer :visible.sync="viewVisible"
title="表单预览"
size="50%"
append-to-body>
<avue-form v-if="viewVisible"
ref="viewForm"
v-model="viewForm"
:option="viewOption">
</avue-form>
</el-drawer>
</basic-container>
</template>
<script>
import { getList, remove, setMainVersion } from "@/api/plugin/workflow/form-history";
import { mapGetters } from "vuex";
export default {
data() {
return {
formVisible: false,
options: {},
form: {},
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: {
size: 'mini',
height: 'auto',
calcHeight: 30,
tip: false,
border: true,
index: true,
selection: true,
addBtn: false,
editBtn: false,
delBtn: false,
dialogType: 'drawer',
align: 'center',
searchMenuSpan: 6,
column: [
{
label: "表单key",
prop: "key",
search: true
},
{
label: "表单名称",
prop: "name",
search: true
},
{
label: '备注',
prop: 'remark',
type: 'textarea',
span: 24
},
{
label: '版本',
prop: 'version',
display: false
},
]
},
data: [],
viewVisible: false,
viewForm: {},
viewOption: {}
};
},
watch: {
'$route.params.id': {
handler(val) {
this.formId = val
this.onLoad(this.page, this.query)
},
immediate: true
}
},
computed: {
...mapGetters(["permission", "tag"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
handleMain(row) {
this.$confirm("当前主版本会自动保存到历史,确定要将此版本设为主版本吗?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
setMainVersion({ id: row.id }).then(() => {
this.$message.success("操作成功")
this.$store.commit('DEL_TAG', this.tag)
this.$router.push("/plugin/workflow/design/form")
})
})
},
handlePreview(row) {
this.viewOption = { ...eval('(' + row.content + ')'), menuBtn: false }
this.viewVisible = true
setTimeout(() => {
this.$refs.viewForm.clearValidate()
})
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.onLoad(this.page, params);
done()
},
selectionChange(list) {
this.selectionList = list;
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
onLoad(page, params = {}) {
this.loading = true;
params.formId = this.formId
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
});
}
}
};
</script>
<style>
</style>

@ -17,15 +17,6 @@
@size-change="sizeChange"
@refresh-change="onLoad(page, query)"
@on-load="onLoad">
<template slot="menuLeft">
<el-button type="danger"
size="mini"
icon="el-icon-delete"
plain
v-if="permission.wf_design_form_delete"
@click="handleDelete">
</el-button>
</template>
<template slot="menu"
slot-scope="{row}">
<el-button v-if="permission.wf_design_form_design"
@ -38,11 +29,11 @@
size="mini"
icon="el-icon-document-copy"
@click="handleCopy(row)">拷贝</el-button>
<!-- <el-button v-if="permission.wf_design_form_history && row.version > 1"
<el-button v-if="permission.wf_design_form_history"
type="text"
size="mini"
icon="el-icon-time"
@click="handleHistory(row)">历史</el-button> -->
@click="handleHistory(row)">历史</el-button>
</template>
</avue-crud>
@ -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) {

@ -0,0 +1,225 @@
<template>
<basic-container>
<avue-crud :option="option"
:table-loading="loading"
:data="data"
:page.sync="page"
:search.sync="query"
v-model="form"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="onLoad(page, query)">
<template slot="menuLeft">
<el-button type="danger"
size="mini"
icon="el-icon-delete"
plain
v-if="permission.wf_design_form_history_delete"
@click="handleDelete">
</el-button>
</template>
<template slot="menu"
slot-scope="{row}">
<el-button v-if="permission.wf_design_form_history_view"
type="text"
size="mini"
icon="el-icon-view"
@click="handlePreview(row)">预览</el-button>
<el-button v-if="permission.wf_design_form_history_main"
type="text"
size="mini"
icon="el-icon-edit"
@click="handleMain(row)">设为主版本</el-button>
</template>
</avue-crud>
<el-dialog :visible.sync="viewVisible"
title="模型预览"
destroy-on-close
append-to-body>
<wf-design ref="bpmn"
style="height: 500px;"
:options="viewOption"></wf-design>
</el-dialog>
</basic-container>
</template>
<script>
import { getList, remove, setMainVersion } from "@/api/plugin/workflow/model-history";
import { mapGetters } from "vuex";
export default {
data() {
return {
formVisible: false,
options: {},
form: {},
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: {
size: 'mini',
height: 'auto',
calcHeight: 30,
tip: false,
border: true,
index: true,
selection: true,
addBtn: false,
editBtn: false,
delBtn: false,
dialogType: 'drawer',
align: 'center',
searchMenuSpan: 6,
column: [
{
label: "模型key",
prop: "modelKey",
overHidden: true,
search: true,
},
{
label: "模型名称",
prop: "name",
overHidden: true,
search: true
},
{
label: "描述",
prop: "description",
overHidden: true,
},
{
label: "版本",
prop: "version",
width: 80
},
]
},
data: [],
viewVisible: false,
viewOption: {}
};
},
watch: {
'$route.params.id': {
handler(val) {
this.modelId = val
this.onLoad(this.page, this.query)
},
immediate: true
}
},
computed: {
...mapGetters(["permission", "tag"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
handleMain(row) {
this.$confirm("当前主版本会自动保存到历史,确定要将此版本设为主版本吗?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
setMainVersion({ id: row.id }).then(() => {
this.$message.success("操作成功")
this.$store.commit('DEL_TAG', this.tag)
this.$router.push("/plugin/workflow/design/model")
})
})
},
handlePreview(row) {
this.viewOption = {
mode: 'view',
xml: row.xml,
}
this.viewVisible = true
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.onLoad(this.page, params);
done()
},
selectionChange(list) {
this.selectionList = list;
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
onLoad(page, params = {}) {
this.loading = true;
params.modelId = this.formId
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
});
}
}
};
</script>
<style>
</style>

@ -16,29 +16,29 @@
@on-load="onLoad">
<template slot="menuLeft">
<el-button type="primary"
size="small"
size="mini"
icon="el-icon-plus"
v-if="permission.wf_design_model_add"
@click="handleDesign({})">
</el-button>
<el-button type="danger"
size="small"
icon="el-icon-delete"
plain
v-if="permission.wf_design_model_delete"
@click="handleDelete">
@click="handleDesign({})">
</el-button>
</template>
<template slot="menu"
slot-scope="{row}">
<el-button type="text"
<el-button v-if="permission.wf_design_model_design"
type="text"
icon="el-icon-edit"
size="small"
@click="handleDesign(row)">设计</el-button>
<el-button type="text"
<el-button v-if="permission.wf_design_model_deploy"
type="text"
icon="el-icon-s-promotion"
size="small"
@click="handleDeploy(row)">部署</el-button>
<el-button v-if="permission.wf_design_model_history"
type="text"
size="mini"
icon="el-icon-time"
@click="handleHistory(row)">历史</el-button>
</template>
</avue-crud>
@ -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) {

Loading…
Cancel
Save