From d4c676250eb934af4a17d87ee0cad25e3abd243a Mon Sep 17 00:00:00 2001 From: ssc <273702440@qq.com> Date: Tue, 22 Mar 2022 08:29:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=BB=9F=E4=B8=80=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A0=91=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/workflow/design/deployment.vue | 31 ++----- .../plugin/workflow/design/form-history.vue | 21 ++--- src/views/plugin/workflow/design/form.vue | 82 +++++++------------ .../plugin/workflow/design/model-history.vue | 30 ++----- src/views/plugin/workflow/design/model.vue | 30 +------ .../workflow/process/components/category.vue | 47 +++++++++++ src/views/plugin/workflow/process/start.vue | 34 ++------ 7 files changed, 102 insertions(+), 173 deletions(-) create mode 100644 src/views/plugin/workflow/process/components/category.vue diff --git a/src/views/plugin/workflow/design/deployment.vue b/src/views/plugin/workflow/design/deployment.vue index 4571a24..ad1a774 100644 --- a/src/views/plugin/workflow/design/deployment.vue +++ b/src/views/plugin/workflow/design/deployment.vue @@ -2,9 +2,8 @@ - + import { getList, changeStatus, changeCategory, remove } from "@/api/plugin/workflow/deployment"; -import { tree } from '@/api/plugin/workflow/category'; import { mapGetters } from "vuex"; +import WfCategory from '../process/components/category.vue' + export default { + components: { WfCategory }, data() { return { form: {}, @@ -153,17 +154,7 @@ export default { ] }, data: [], - row: '', categoryVisible: false, - treeData: [], - treeOption: { - size: 'mini', - addBtn: false, - props: { - label: 'name', - value: 'id' - } - } }; }, computed: { @@ -184,9 +175,6 @@ export default { return ids.join(","); } }, - mounted() { - this.getCategoryList() - }, methods: { handleChangeCategory() { if (this.selectionList.length === 0) { @@ -195,15 +183,6 @@ export default { } this.categoryVisible = true }, - getCategoryList() { - tree().then(res => { - const data = res.data.data - this.findObject(this.option.column, 'category').dicData = this.deepClone(data) - - this.treeData = data - this.treeData.unshift({ id: '', name: '全部' }) - }) - }, nodeClick({ id }) { this.categoryId = id this.searchChange(this.query) diff --git a/src/views/plugin/workflow/design/form-history.vue b/src/views/plugin/workflow/design/form-history.vue index 50879bc..28abe1e 100644 --- a/src/views/plugin/workflow/design/form-history.vue +++ b/src/views/plugin/workflow/design/form-history.vue @@ -2,9 +2,8 @@ - + import { getList, remove, setMainVersion } from "@/api/plugin/workflow/form-history"; -import { tree } from '@/api/plugin/workflow/category'; import { mapGetters } from "vuex"; +import WfCategory from '../process/components/category.vue' + export default { + components: { WfCategory }, data() { return { formVisible: false, @@ -167,19 +168,7 @@ export default { return ids.join(","); } }, - mounted() { - this.getCategoryList() - }, methods: { - getCategoryList() { - tree().then(res => { - const data = res.data.data - this.findObject(this.option.column, 'categoryId').dicData = this.deepClone(data) - - this.treeData = data - this.treeData.unshift({ id: '', name: '全部' }) - }) - }, nodeClick({ id }) { this.categoryId = id this.searchChange(this.query) diff --git a/src/views/plugin/workflow/design/form.vue b/src/views/plugin/workflow/design/form.vue index 6d8c26a..03b968f 100644 --- a/src/views/plugin/workflow/design/form.vue +++ b/src/views/plugin/workflow/design/form.vue @@ -2,9 +2,8 @@ - + import { getList, add, update, remove, listType, changeCategory } from "@/api/plugin/workflow/form"; -import { tree } from '@/api/plugin/workflow/category'; import { mapGetters } from "vuex"; import customFields from '../mixins/custom-fields' +import WfCategory from '../process/components/category.vue' export default { + components: { WfCategory }, mixins: [customFields], data() { return { @@ -264,15 +264,6 @@ export default { isCopy: false, copyVisible: false, categoryVisible: false, - treeData: [], - treeOption: { - size: 'mini', - addBtn: false, - props: { - label: 'name', - value: 'id' - } - }, title: '表单设计' }; }, @@ -296,7 +287,6 @@ export default { }, mounted() { this.getDefaultValues() - this.getCategoryList() }, methods: { handleChangeCategorySubmit(form, done) { @@ -315,16 +305,6 @@ export default { } this.categoryVisible = true }, - getCategoryList() { - tree().then(res => { - const data = res.data.data - this.findObject(this.option.column, 'categoryId').dicData = this.deepClone(data) - this.findObject(this.copyOption.column, 'categoryId').dicData = this.deepClone(data) - - this.treeData = data - this.treeData.unshift({ id: '', name: '全部' }) - }) - }, nodeClick({ id }) { this.categoryId = id this.searchChange(this.query) @@ -333,28 +313,14 @@ export default { this.$refs.formDesign.getData('string').then(data => { this.$refs.formDesign.getData('app').then(appData => { if (this.isCopy) { - this.copyVisible = true - this.form.content = data - this.form.appContent = JSON.stringify(appData) - } else { - this.row.content = data - this.row.appContent = JSON.stringify(appData) - - if (this.isNewVersion) { - this.row.newVersion = false - - update(this.row).then(() => { - this.$message.success("保存成功") - this.onLoad(this.page, this.query) - this.formVisible = false - }) + this.copyVisible = true + this.form.content = data + this.form.appContent = JSON.stringify(appData) } else { - this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', { - distinguishCancelAndClose: true, - confirmButtonText: '否', - cancelButtonText: '是', - type: 'warning' - }).then(() => { + this.row.content = data + this.row.appContent = JSON.stringify(appData) + + if (this.isNewVersion) { this.row.newVersion = false update(this.row).then(() => { @@ -362,19 +328,33 @@ export default { this.onLoad(this.page, this.query) this.formVisible = false }) - }).catch(action => { - if (action == 'cancel') { - this.row.newVersion = true + } else { + this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', { + distinguishCancelAndClose: true, + 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 }) - } - }) + }).catch(action => { + if (action == 'cancel') { + this.row.newVersion = true + + update(this.row).then(() => { + this.$message.success("保存成功") + this.onLoad(this.page, this.query) + this.formVisible = false + }) + } + }) + } } - } }) }) }, diff --git a/src/views/plugin/workflow/design/model-history.vue b/src/views/plugin/workflow/design/model-history.vue index 25ee5e4..90777e9 100644 --- a/src/views/plugin/workflow/design/model-history.vue +++ b/src/views/plugin/workflow/design/model-history.vue @@ -2,9 +2,8 @@ - + import { getList, remove, setMainVersion } from "@/api/plugin/workflow/model-history"; -import { tree } from '@/api/plugin/workflow/category'; import { mapGetters } from "vuex"; +import WfCategory from '../process/components/category.vue' + export default { + components: { WfCategory }, data() { return { formVisible: false, @@ -134,15 +135,6 @@ export default { data: [], viewVisible: false, viewOption: {}, - treeData: [], - treeOption: { - size: 'mini', - addBtn: false, - props: { - label: 'name', - value: 'id' - } - } }; }, watch: { @@ -164,19 +156,7 @@ export default { return ids.join(","); } }, - mounted() { - this.getCategoryList() - }, methods: { - getCategoryList() { - tree().then(res => { - const data = res.data.data - this.findObject(this.option.column, 'categoryId').dicData = this.deepClone(data) - - this.treeData = data - this.treeData.unshift({ id: '', name: '全部' }) - }) - }, nodeClick({ id }) { this.categoryId = id this.searchChange(this.query) diff --git a/src/views/plugin/workflow/design/model.vue b/src/views/plugin/workflow/design/model.vue index b382eb0..8fe7a55 100644 --- a/src/views/plugin/workflow/design/model.vue +++ b/src/views/plugin/workflow/design/model.vue @@ -2,9 +2,8 @@ - + import { getList, remove, deploy, changeCategory, getDetail, changeIcon } from "@/api/plugin/workflow/model"; import { getList as scopeList, submit as scopeSubmit } from '@/api/plugin/workflow/model-scope' -import { tree } from '@/api/plugin/workflow/category'; import { mapGetters } from "vuex"; import UserOption from '../process/components/user-option.vue' +import WfCategory from '../process/components/category.vue' export default { - components: { UserOption }, + components: { UserOption, WfCategory }, data() { return { form: {}, @@ -206,15 +205,6 @@ export default { deptUrl: '/api/blade-system/search/dept', postUrl: '/api/blade-system/search/post', }, - treeData: [], - treeOption: { - size: 'mini', - addBtn: false, - props: { - label: 'name', - value: 'id' - } - }, iconVisible: false, }; }, @@ -236,9 +226,6 @@ export default { return ids.join(","); } }, - mounted() { - this.getCategoryList() - }, methods: { handleIcon(row) { this.form = { id: row.id, icon: row.icon } @@ -273,15 +260,6 @@ export default { this.categoryType = 'change' this.categoryVisible = true }, - getCategoryList() { - tree().then(res => { - const data = res.data.data - this.findObject(this.option.column, 'categoryId').dicData = this.deepClone(data) - - this.treeData = data - this.treeData.unshift({ id: '', name: '全部' }) - }) - }, nodeClick({ id }) { this.categoryId = id this.searchChange(this.query) diff --git a/src/views/plugin/workflow/process/components/category.vue b/src/views/plugin/workflow/process/components/category.vue new file mode 100644 index 0000000..5e3c655 --- /dev/null +++ b/src/views/plugin/workflow/process/components/category.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/src/views/plugin/workflow/process/start.vue b/src/views/plugin/workflow/process/start.vue index d79887c..38add4b 100644 --- a/src/views/plugin/workflow/process/start.vue +++ b/src/views/plugin/workflow/process/start.vue @@ -2,9 +2,8 @@ - +