From 89607e12b2d5dbe546a40c7ac75b11ceb199aa27 Mon Sep 17 00:00:00 2001 From: smallchill Date: Fri, 7 Feb 2020 14:50:57 +0800 Subject: [PATCH] =?UTF-8?q?:bulb:=20=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=9F=E6=88=B7=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/flow/flow.js | 3 +- src/views/desk/notice.vue | 3 +- src/views/flow/deploy.vue | 78 ++++++++++++- src/views/flow/model.vue | 159 ++++++++++++++++++-------- src/views/work/claim.vue | 1 - src/views/work/process/leave/form.vue | 2 +- src/views/work/start.vue | 32 +++++- src/views/work/todo.vue | 1 - 8 files changed, 217 insertions(+), 62 deletions(-) diff --git a/src/api/flow/flow.js b/src/api/flow/flow.js index 2fe5b04..b6b29ef 100644 --- a/src/api/flow/flow.js +++ b/src/api/flow/flow.js @@ -63,9 +63,10 @@ export const changeState = (params) => { }) } -export const deployUpload = (category, files) => { +export const deployUpload = (category, tenantIds, files) => { const formData = new FormData(); formData.append('category', category); + formData.append('tenantIds', tenantIds); files.forEach(file => { formData.append('files', file); }); diff --git a/src/views/desk/notice.vue b/src/views/desk/notice.vue index 0f7e949..5feddbe 100644 --- a/src/views/desk/notice.vue +++ b/src/views/desk/notice.vue @@ -101,9 +101,10 @@ { label: "通知时间", prop: "releaseTimeRange", - type: "datetimerange", + type: "datetime", format: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd hh:mm:ss", + searchRange:true, hide: true, addDisplay: false, editDisplay: false, diff --git a/src/views/flow/deploy.vue b/src/views/flow/deploy.vue index 0030cc3..1eff751 100644 --- a/src/views/flow/deploy.vue +++ b/src/views/flow/deploy.vue @@ -1,6 +1,6 @@ @@ -13,7 +13,8 @@ return { form: { flowCategory: '', - imgUrl: [], + tenantId: '', + flowFile: [], file: {}, }, option: { @@ -29,6 +30,8 @@ label: "dictValue", value: "dictKey" }, + row: true, + span: 12, dataType: "number", 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: '附件上传', - prop: 'imgUrl', + prop: 'flowFile', type: 'upload', loadText: '附件上传中,请稍等', 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: { uploadBefore(file, done) { - this.$message.success('部署开始') + this.$message.success('部署开始'); this.file = file; done() }, @@ -66,11 +124,19 @@ loading() return false; } + if (this.form.flowType === 1 && !this.form.tenantId) { + this.$message.warning('清先选择对应租户'); + loading(); + return false; + } 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; if (data.success) { - this.$message.success('部署结束') done() } else { this.$message.error(data.msg); diff --git a/src/views/flow/model.vue b/src/views/flow/model.vue index d94cf53..2aada09 100644 --- a/src/views/flow/model.vue +++ b/src/views/flow/model.vue @@ -83,33 +83,18 @@ 取 消 - 确 定 + 确 定 - - - - - - - - + 取 消 - 确 定 + 确 定 @@ -121,15 +106,85 @@ import {getDictionary} from "@/api/system/dict"; import {modelList, removeModel, deployModel} from "@/api/flow/flow"; import {flowCategory} from "@/util/flow"; + import {leaveProcess} from "@/api/work/process"; export default { data() { return { 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: '', selectionList: [], query: {}, loading: true, + deployLoading: false, page: { pageSize: 10, currentPage: 1, @@ -138,8 +193,6 @@ deployBox: false, flowBox: false, flowUrl: '', - category: [], - categoryValue: '', option: { height: 'auto', calcHeight: 30, @@ -193,6 +246,15 @@ data: [] }; }, + watch: { + 'form.flowType'() { + this.$refs.form.option.column.filter(item => { + if (item.prop === "tenantId") { + item.display = this.form.flowType === 2; + } + }); + } + }, computed: { ...mapGetters(["permission"]), ids() { @@ -204,6 +266,33 @@ } }, 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() { this.query = {}; this.onLoad(this.page); @@ -256,28 +345,7 @@ this.selectionId = row.id; }, handleDoDeploy() { - if (!this.categoryValue) { - 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 - }); - } - }) + this.$refs.form.submit(); }, handleDownload(row) { window.open(`${website.flowDesignUrl}/app/rest/models/${row.id}/bpmn20`); @@ -304,10 +372,10 @@ this.flowBox = false; this.onLoad(this.page); }, - currentChange(currentPage){ + currentChange(currentPage) { this.page.currentPage = currentPage; }, - sizeChange(pageSize){ + sizeChange(pageSize) { this.page.pageSize = pageSize; }, refreshChange() { @@ -322,9 +390,6 @@ this.loading = false; this.selectionClear(); }); - getDictionary({code: 'flow'}).then(res => { - this.category = res.data.data; - }) } } }; diff --git a/src/views/work/claim.vue b/src/views/work/claim.vue index 6f8ac9a..66bce48 100644 --- a/src/views/work/claim.vue +++ b/src/views/work/claim.vue @@ -5,7 +5,6 @@ :data="data" ref="crud" v-model="form" - :page="page" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" diff --git a/src/views/work/process/leave/form.vue b/src/views/work/process/leave/form.vue index 91600a3..8e3bb00 100644 --- a/src/views/work/process/leave/form.vue +++ b/src/views/work/process/leave/form.vue @@ -1,6 +1,6 @@ diff --git a/src/views/work/start.vue b/src/views/work/start.vue index d08c515..e8e23bc 100644 --- a/src/views/work/start.vue +++ b/src/views/work/start.vue @@ -13,6 +13,12 @@ @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> + +