|
|
|
|
<template>
|
|
|
|
|
<basic-container>
|
|
|
|
|
<avue-crud :option="option"
|
|
|
|
|
:table-loading="loading"
|
|
|
|
|
:data="data"
|
|
|
|
|
ref="crud"
|
|
|
|
|
v-model="form"
|
|
|
|
|
:page.sync="page"
|
|
|
|
|
@search-change="searchChange"
|
|
|
|
|
@search-reset="searchReset"
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
@current-change="currentChange"
|
|
|
|
|
@size-change="sizeChange"
|
|
|
|
|
@refresh-change="onLoad(page, query)"
|
|
|
|
|
@on-load="onLoad">
|
|
|
|
|
<template slot="menuLeft">
|
|
|
|
|
<el-button type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
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">删 除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="menu"
|
|
|
|
|
slot-scope="{row}">
|
|
|
|
|
<el-button type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
size="small"
|
|
|
|
|
@click="handleDesign(row)">设计</el-button>
|
|
|
|
|
<el-button type="text"
|
|
|
|
|
icon="el-icon-s-promotion"
|
|
|
|
|
size="small"
|
|
|
|
|
@click="handleDeploy(row)">部署</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</avue-crud>
|
|
|
|
|
|
|
|
|
|
<el-dialog :visible.sync="categoryVisible"
|
|
|
|
|
append-to-body
|
|
|
|
|
title="选择分类">
|
|
|
|
|
<avue-form v-model="form"
|
|
|
|
|
:option="{column:[{type:'tree',label:'流程分类',span:24,props:{label:'name',value:'id'},prop:'category',dicUrl:'/api/blade-workflow/design/category/tree',required:true,rules:[{required:true,message:'请选择分类'}]}]}"
|
|
|
|
|
@submit="handleDeploySubmit"></avue-form>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</basic-container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { getList, remove, deploy } from "@/api/plugin/workflow/model";
|
|
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
form: {},
|
|
|
|
|
query: {},
|
|
|
|
|
loading: true,
|
|
|
|
|
page: {
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0
|
|
|
|
|
},
|
|
|
|
|
selectionList: [],
|
|
|
|
|
option: {
|
|
|
|
|
height: 'auto',
|
|
|
|
|
calcHeight: 30,
|
|
|
|
|
tip: false,
|
|
|
|
|
border: true,
|
|
|
|
|
index: true,
|
|
|
|
|
viewBtn: false,
|
|
|
|
|
addBtn: false,
|
|
|
|
|
editBtn: false,
|
|
|
|
|
selection: true,
|
|
|
|
|
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: [],
|
|
|
|
|
row: '',
|
|
|
|
|
categoryVisible: false,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters(["permission"]),
|
|
|
|
|
permissionList() {
|
|
|
|
|
return {
|
|
|
|
|
addBtn: this.vaildData(this.permission.wf_design_model_add, false),
|
|
|
|
|
viewBtn: this.vaildData(this.permission.wf_design_model_view, false),
|
|
|
|
|
delBtn: this.vaildData(this.permission.wf_design_model_delete, false),
|
|
|
|
|
editBtn: this.vaildData(this.permission.wf_design_model_edit, false)
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
ids() {
|
|
|
|
|
let ids = [];
|
|
|
|
|
this.selectionList.forEach(ele => {
|
|
|
|
|
ids.push(ele.id);
|
|
|
|
|
});
|
|
|
|
|
return ids.join(",");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleDeploySubmit(form, done) {
|
|
|
|
|
const { id, category } = form
|
|
|
|
|
deploy({ id, category }).then(() => {
|
|
|
|
|
this.$message.success("部署成功")
|
|
|
|
|
done()
|
|
|
|
|
this.categoryVisible = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleDeploy(row) {
|
|
|
|
|
this.form.id = row.id
|
|
|
|
|
this.categoryVisible = true
|
|
|
|
|
},
|
|
|
|
|
handleDesign(row) {
|
|
|
|
|
this.$router.push('/workflow/design/process/' + (row.id || 0))
|
|
|
|
|
},
|
|
|
|
|
rowDel(row) {
|
|
|
|
|
this.$confirm("确定将选择数据删除?", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
type: "warning"
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
return remove({ id: 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({ id: 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;
|
|
|
|
|
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>
|