💡 工作流程增加租户绑定

dev
smallchill 6 years ago
parent 5897aa1907
commit 89607e12b2
  1. 3
      src/api/flow/flow.js
  2. 3
      src/views/desk/notice.vue
  3. 78
      src/views/flow/deploy.vue
  4. 159
      src/views/flow/model.vue
  5. 1
      src/views/work/claim.vue
  6. 2
      src/views/work/process/leave/form.vue
  7. 32
      src/views/work/start.vue
  8. 1
      src/views/work/todo.vue

@ -63,9 +63,10 @@ export const changeState = (params) => {
}) })
} }
export const deployUpload = (category, files) => { export const deployUpload = (category, tenantIds, files) => {
const formData = new FormData(); const formData = new FormData();
formData.append('category', category); formData.append('category', category);
formData.append('tenantIds', tenantIds);
files.forEach(file => { files.forEach(file => {
formData.append('files', file); formData.append('files', file);
}); });

@ -101,9 +101,10 @@
{ {
label: "通知时间", label: "通知时间",
prop: "releaseTimeRange", prop: "releaseTimeRange",
type: "datetimerange", type: "datetime",
format: "yyyy-MM-dd hh:mm:ss", format: "yyyy-MM-dd hh:mm:ss",
valueFormat: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd hh:mm:ss",
searchRange:true,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,

@ -1,6 +1,6 @@
<template> <template>
<basic-container> <basic-container>
<avue-form :option="option" v-model="form" :upload-before="uploadBefore" :upload-after="uploadAfter"></avue-form> <avue-form ref="form" :option="option" v-model="form" :upload-before="uploadBefore" :upload-after="uploadAfter"/>
</basic-container> </basic-container>
</template> </template>
@ -13,7 +13,8 @@
return { return {
form: { form: {
flowCategory: '', flowCategory: '',
imgUrl: [], tenantId: '',
flowFile: [],
file: {}, file: {},
}, },
option: { option: {
@ -29,6 +30,8 @@
label: "dictValue", label: "dictValue",
value: "dictKey" value: "dictKey"
}, },
row: true,
span: 12,
dataType: "number", dataType: "number",
rules: [ rules: [
{ {
@ -38,9 +41,55 @@
} }
] ]
}, },
{
label: "流程模式",
prop: "flowType",
type: "radio",
dicData: [
{
label: "通用流程",
value: 1
},
{
label: "定制流程",
value: 2
}
],
value: 1,
row: true,
span: 12,
rules: [
{
required: true,
message: '请选择流程模式',
trigger: 'blur'
}
],
},
{
label: "所属租户",
prop: "tenantId",
type: "tree",
multiple: true,
dicUrl: "/api/blade-system/tenant/select",
props: {
label: "tenantName",
value: "tenantId"
},
display: false,
row: true,
span: 12,
rules: [
{
required: true,
message: '请选择所属租户',
trigger: 'blur'
}
],
},
{ {
label: '附件上传', label: '附件上传',
prop: 'imgUrl', prop: 'flowFile',
type: 'upload', type: 'upload',
loadText: '附件上传中,请稍等', loadText: '附件上传中,请稍等',
span: 24, span: 24,
@ -54,9 +103,18 @@
} }
} }
}, },
watch: {
'form.flowType'() {
this.$refs.form.option.column.filter(item => {
if (item.prop === "tenantId") {
item.display = this.form.flowType === 2;
}
});
}
},
methods: { methods: {
uploadBefore(file, done) { uploadBefore(file, done) {
this.$message.success('部署开始') this.$message.success('部署开始');
this.file = file; this.file = file;
done() done()
}, },
@ -66,11 +124,19 @@
loading() loading()
return false; return false;
} }
if (this.form.flowType === 1 && !this.form.tenantId) {
this.$message.warning('清先选择对应租户');
loading();
return false;
}
if (res.success) { if (res.success) {
deployUpload(flowCategory(this.form.flowCategory), [this.file]).then(res => { deployUpload(
flowCategory(this.form.flowCategory),
(this.form.tenantId) ? this.form.tenantId.join(",") : "",
[this.file]
).then(res => {
const data = res.data; const data = res.data;
if (data.success) { if (data.success) {
this.$message.success('部署结束')
done() done()
} else { } else {
this.$message.error(data.msg); this.$message.error(data.msg);

@ -83,33 +83,18 @@
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
<el-button @click="flowBox = false"> </el-button> <el-button @click="flowBox = false"> </el-button>
<el-button type="primary" <el-button type="primary" @click="handleRefresh"> </el-button>
@click="handleRefresh"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="流程部署" <el-dialog title="流程部署"
append-to-body append-to-body
:visible.sync="deployBox" :visible.sync="deployBox"
width="20%"> width="20%">
<el-form :model="form" <avue-form ref="form" :option="optionDeploy" v-model="form" @submit="handleSubmit"/>
ref="form"
label-width="80px">
<el-form-item label="流程类型">
<el-select v-model="categoryValue" placeholder="请选择" value="">
<el-option
v-for="item in category"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
<el-button @click="deployBox = false"> </el-button> <el-button @click="deployBox = false"> </el-button>
<el-button type="primary" <el-button type="primary" @click="handleDoDeploy" :loading="deployLoading"> </el-button>
@click="handleDoDeploy"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</basic-container> </basic-container>
@ -121,15 +106,85 @@
import {getDictionary} from "@/api/system/dict"; import {getDictionary} from "@/api/system/dict";
import {modelList, removeModel, deployModel} from "@/api/flow/flow"; import {modelList, removeModel, deployModel} from "@/api/flow/flow";
import {flowCategory} from "@/util/flow"; import {flowCategory} from "@/util/flow";
import {leaveProcess} from "@/api/work/process";
export default { export default {
data() { data() {
return { return {
form: {}, form: {},
optionDeploy: {
menuBtn: false,
column: [
{
label: "流程类型",
type: "select",
dicUrl: "/api/blade-system/dict/dictionary?code=flow",
props: {
label: "dictValue",
value: "dictKey"
},
dataType: "number",
slot: true,
prop: "categoryValue",
search: true,
span: 24,
rules: [{
required: true,
message: "请选择流程类型",
trigger: "blur"
}]
},
{
label: "流程模式",
prop: "flowType",
type: "radio",
dicData: [
{
label: "通用流程",
value: 1
},
{
label: "定制流程",
value: 2
}
],
value: 1,
span: 24,
rules: [
{
required: true,
message: '请选择流程模式',
trigger: 'blur'
}
],
},
{
label: "所属租户",
prop: "tenantId",
type: "tree",
multiple: true,
dicUrl: "/api/blade-system/tenant/select",
props: {
label: "tenantName",
value: "tenantId"
},
display: false,
span: 24,
rules: [
{
required: true,
message: '请选择所属租户',
trigger: 'blur'
}
],
},
],
},
selectionId: '', selectionId: '',
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
deployLoading: false,
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -138,8 +193,6 @@
deployBox: false, deployBox: false,
flowBox: false, flowBox: false,
flowUrl: '', flowUrl: '',
category: [],
categoryValue: '',
option: { option: {
height: 'auto', height: 'auto',
calcHeight: 30, calcHeight: 30,
@ -193,6 +246,15 @@
data: [] data: []
}; };
}, },
watch: {
'form.flowType'() {
this.$refs.form.option.column.filter(item => {
if (item.prop === "tenantId") {
item.display = this.form.flowType === 2;
}
});
}
},
computed: { computed: {
...mapGetters(["permission"]), ...mapGetters(["permission"]),
ids() { ids() {
@ -204,6 +266,33 @@
} }
}, },
methods: { methods: {
handleSubmit(form, done) {
this.deployLoading = true;
deployModel({
modelId: this.selectionId,
category: flowCategory(form.categoryValue),
tenantIds: form.tenantId.join(",")
}).then(res => {
const data = res.data;
if (data.success) {
this.$message({
type: "success",
message: data.msg
});
done();
this.$refs.form.resetForm();
this.deployBox = false;
this.deployLoading = false;
} else {
done();
this.deployLoading = false;
this.$message({
type: "warn",
message: data.msg
});
}
})
},
searchReset() { searchReset() {
this.query = {}; this.query = {};
this.onLoad(this.page); this.onLoad(this.page);
@ -256,28 +345,7 @@
this.selectionId = row.id; this.selectionId = row.id;
}, },
handleDoDeploy() { handleDoDeploy() {
if (!this.categoryValue) { this.$refs.form.submit();
this.$message({
type: "warn",
message: "请先选择流程类型!"
});
return;
}
deployModel({modelId: this.selectionId, category: flowCategory(this.categoryValue)}).then(res => {
const data = res.data;
if (data.success) {
this.$message({
type: "success",
message: data.msg
});
this.deployBox = false;
} else {
this.$message({
type: "warn",
message: data.msg
});
}
})
}, },
handleDownload(row) { handleDownload(row) {
window.open(`${website.flowDesignUrl}/app/rest/models/${row.id}/bpmn20`); window.open(`${website.flowDesignUrl}/app/rest/models/${row.id}/bpmn20`);
@ -304,10 +372,10 @@
this.flowBox = false; this.flowBox = false;
this.onLoad(this.page); this.onLoad(this.page);
}, },
currentChange(currentPage){ currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
sizeChange(pageSize){ sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
refreshChange() { refreshChange() {
@ -322,9 +390,6 @@
this.loading = false; this.loading = false;
this.selectionClear(); this.selectionClear();
}); });
getDictionary({code: 'flow'}).then(res => {
this.category = res.data.data;
})
} }
} }
}; };

@ -5,7 +5,6 @@
:data="data" :data="data"
ref="crud" ref="crud"
v-model="form" v-model="form"
:page="page"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@selection-change="selectionChange" @selection-change="selectionChange"

@ -1,6 +1,6 @@
<template> <template>
<basic-container> <basic-container>
<avue-form :option="option" v-model="form" @submit="handleSubmit"></avue-form> <avue-form :option="option" v-model="form" @submit="handleSubmit"/>
</basic-container> </basic-container>
</template> </template>

@ -13,6 +13,12 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad"> @on-load="onLoad">
<template slot="menuLeft">
<el-radio-group v-model="mode" size="small">
<el-radio-button label="1">通用流程</el-radio-button>
<el-radio-button label="2">定制流程</el-radio-button>
</el-radio-group>
</template>
<template slot-scope="scope" slot="menu"> <template slot-scope="scope" slot="menu">
<el-button type="text" <el-button type="text"
size="small" size="small"
@ -29,6 +35,10 @@
@click.stop="handleImage(scope.row,scope.index)">流程图 @click.stop="handleImage(scope.row,scope.index)">流程图
</el-button> </el-button>
</template> </template>
<template slot-scope="{row}"
slot="tenantId">
<el-tag>{{row.tenantId===''?'通用':row.tenantId}}</el-tag>
</template>
<template slot-scope="{row}" <template slot-scope="{row}"
slot="version"> slot="version">
<el-tag>v{{row.version}}</el-tag> <el-tag>v{{row.version}}</el-tag>
@ -69,12 +79,14 @@
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import {startList} from "@/api/work/work"; import {startList} from "@/api/work/work";
import {flowCategory,flowRoute} from "@/util/flow"; import {flowCategory, flowRoute} from "@/util/flow";
import func from "@/util/func";
export default { export default {
data() { data() {
return { return {
form: {}, form: {},
mode: '1',
selectionId: '', selectionId: '',
selectionList: [], selectionList: [],
query: {}, query: {},
@ -103,6 +115,12 @@
menuWidth: 150, menuWidth: 150,
dialogWidth: 900, dialogWidth: 900,
column: [ column: [
{
label: '租户编号',
prop: 'tenantId',
slot: true,
width: 150,
},
{ {
label: "流程分类", label: "流程分类",
type: "select", type: "select",
@ -149,6 +167,11 @@
data: [] data: []
}; };
}, },
watch: {
'mode'() {
this.onLoad(this.page);
}
},
computed: { computed: {
...mapGetters(["permission", "flowRoutes"]), ...mapGetters(["permission", "flowRoutes"]),
ids() { ids() {
@ -184,10 +207,10 @@
this.flowUrl = `/api/blade-flow/process/resource-view?processDefinitionId=${row.id}`; this.flowUrl = `/api/blade-flow/process/resource-view?processDefinitionId=${row.id}`;
this.flowBox = true; this.flowBox = true;
}, },
currentChange(currentPage){ currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
sizeChange(pageSize){ sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
refreshChange() { refreshChange() {
@ -196,7 +219,8 @@
onLoad(page, params = {}) { onLoad(page, params = {}) {
const query = { const query = {
...this.query, ...this.query,
category: (params.category) ? flowCategory(params.category) : null category: (params.category) ? flowCategory(params.category) : null,
mode: this.mode
}; };
this.loading = true; this.loading = true;
startList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => { startList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {

@ -5,7 +5,6 @@
:data="data" :data="data"
ref="crud" ref="crud"
v-model="form" v-model="form"
:page="page"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@selection-change="selectionChange" @selection-change="selectionChange"

Loading…
Cancel
Save