perf: 统一左侧分类树形

saber
ssc 4 years ago
parent 5e2d602336
commit d4c676250e
  1. 31
      src/views/plugin/workflow/design/deployment.vue
  2. 21
      src/views/plugin/workflow/design/form-history.vue
  3. 82
      src/views/plugin/workflow/design/form.vue
  4. 30
      src/views/plugin/workflow/design/model-history.vue
  5. 30
      src/views/plugin/workflow/design/model.vue
  6. 47
      src/views/plugin/workflow/process/components/category.vue
  7. 34
      src/views/plugin/workflow/process/start.vue

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'category').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<avue-crud :option="option" <avue-crud :option="option"
@ -69,11 +68,13 @@
<script> <script>
import { getList, changeStatus, changeCategory, remove } from "@/api/plugin/workflow/deployment"; import { getList, changeStatus, changeCategory, remove } from "@/api/plugin/workflow/deployment";
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import WfCategory from '../process/components/category.vue'
export default { export default {
components: { WfCategory },
data() { data() {
return { return {
form: {}, form: {},
@ -153,17 +154,7 @@ export default {
] ]
}, },
data: [], data: [],
row: '',
categoryVisible: false, categoryVisible: false,
treeData: [],
treeOption: {
size: 'mini',
addBtn: false,
props: {
label: 'name',
value: 'id'
}
}
}; };
}, },
computed: { computed: {
@ -184,9 +175,6 @@ export default {
return ids.join(","); return ids.join(",");
} }
}, },
mounted() {
this.getCategoryList()
},
methods: { methods: {
handleChangeCategory() { handleChangeCategory() {
if (this.selectionList.length === 0) { if (this.selectionList.length === 0) {
@ -195,15 +183,6 @@ export default {
} }
this.categoryVisible = true 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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'categoryId').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<avue-crud :option="option" <avue-crud :option="option"
@ -62,11 +61,13 @@
<script> <script>
import { getList, remove, setMainVersion } from "@/api/plugin/workflow/form-history"; import { getList, remove, setMainVersion } from "@/api/plugin/workflow/form-history";
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import WfCategory from '../process/components/category.vue'
export default { export default {
components: { WfCategory },
data() { data() {
return { return {
formVisible: false, formVisible: false,
@ -167,19 +168,7 @@ export default {
return ids.join(","); return ids.join(",");
} }
}, },
mounted() {
this.getCategoryList()
},
methods: { 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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'categoryId').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<avue-crud ref="crud" <avue-crud ref="crud"
@ -97,13 +96,14 @@
<script> <script>
import { getList, add, update, remove, listType, changeCategory } from "@/api/plugin/workflow/form"; import { getList, add, update, remove, listType, changeCategory } from "@/api/plugin/workflow/form";
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import customFields from '../mixins/custom-fields' import customFields from '../mixins/custom-fields'
import WfCategory from '../process/components/category.vue'
export default { export default {
components: { WfCategory },
mixins: [customFields], mixins: [customFields],
data() { data() {
return { return {
@ -264,15 +264,6 @@ export default {
isCopy: false, isCopy: false,
copyVisible: false, copyVisible: false,
categoryVisible: false, categoryVisible: false,
treeData: [],
treeOption: {
size: 'mini',
addBtn: false,
props: {
label: 'name',
value: 'id'
}
},
title: '表单设计' title: '表单设计'
}; };
}, },
@ -296,7 +287,6 @@ export default {
}, },
mounted() { mounted() {
this.getDefaultValues() this.getDefaultValues()
this.getCategoryList()
}, },
methods: { methods: {
handleChangeCategorySubmit(form, done) { handleChangeCategorySubmit(form, done) {
@ -315,16 +305,6 @@ export default {
} }
this.categoryVisible = true 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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)
@ -333,28 +313,14 @@ export default {
this.$refs.formDesign.getData('string').then(data => { this.$refs.formDesign.getData('string').then(data => {
this.$refs.formDesign.getData('app').then(appData => { this.$refs.formDesign.getData('app').then(appData => {
if (this.isCopy) { if (this.isCopy) {
this.copyVisible = true this.copyVisible = true
this.form.content = data this.form.content = data
this.form.appContent = JSON.stringify(appData) 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
})
} else { } else {
this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', { this.row.content = data
distinguishCancelAndClose: true, this.row.appContent = JSON.stringify(appData)
confirmButtonText: '否',
cancelButtonText: '是', if (this.isNewVersion) {
type: 'warning'
}).then(() => {
this.row.newVersion = false this.row.newVersion = false
update(this.row).then(() => { update(this.row).then(() => {
@ -362,19 +328,33 @@ export default {
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query)
this.formVisible = false this.formVisible = false
}) })
}).catch(action => { } else {
if (action == 'cancel') { this.$confirm('是否将此表单保存为新版本?这意味着可以返回到以前的版本。', '提示', {
this.row.newVersion = true distinguishCancelAndClose: true,
confirmButtonText: '否',
cancelButtonText: '是',
type: 'warning'
}).then(() => {
this.row.newVersion = false
update(this.row).then(() => { update(this.row).then(() => {
this.$message.success("保存成功") this.$message.success("保存成功")
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query)
this.formVisible = false 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
})
}
})
}
} }
}
}) })
}) })
}, },

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'categoryId').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<avue-crud :option="option" <avue-crud :option="option"
@ -59,11 +58,13 @@
<script> <script>
import { getList, remove, setMainVersion } from "@/api/plugin/workflow/model-history"; import { getList, remove, setMainVersion } from "@/api/plugin/workflow/model-history";
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import WfCategory from '../process/components/category.vue'
export default { export default {
components: { WfCategory },
data() { data() {
return { return {
formVisible: false, formVisible: false,
@ -134,15 +135,6 @@ export default {
data: [], data: [],
viewVisible: false, viewVisible: false,
viewOption: {}, viewOption: {},
treeData: [],
treeOption: {
size: 'mini',
addBtn: false,
props: {
label: 'name',
value: 'id'
}
}
}; };
}, },
watch: { watch: {
@ -164,19 +156,7 @@ export default {
return ids.join(","); return ids.join(",");
} }
}, },
mounted() {
this.getCategoryList()
},
methods: { 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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'categoryId').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<avue-crud :option="option" <avue-crud :option="option"
@ -116,14 +115,14 @@
<script> <script>
import { getList, remove, deploy, changeCategory, getDetail, changeIcon } from "@/api/plugin/workflow/model"; 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 { getList as scopeList, submit as scopeSubmit } from '@/api/plugin/workflow/model-scope'
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import UserOption from '../process/components/user-option.vue' import UserOption from '../process/components/user-option.vue'
import WfCategory from '../process/components/category.vue'
export default { export default {
components: { UserOption }, components: { UserOption, WfCategory },
data() { data() {
return { return {
form: {}, form: {},
@ -206,15 +205,6 @@ export default {
deptUrl: '/api/blade-system/search/dept', deptUrl: '/api/blade-system/search/dept',
postUrl: '/api/blade-system/search/post', postUrl: '/api/blade-system/search/post',
}, },
treeData: [],
treeOption: {
size: 'mini',
addBtn: false,
props: {
label: 'name',
value: 'id'
}
},
iconVisible: false, iconVisible: false,
}; };
}, },
@ -236,9 +226,6 @@ export default {
return ids.join(","); return ids.join(",");
} }
}, },
mounted() {
this.getCategoryList()
},
methods: { methods: {
handleIcon(row) { handleIcon(row) {
this.form = { id: row.id, icon: row.icon } this.form = { id: row.id, icon: row.icon }
@ -273,15 +260,6 @@ export default {
this.categoryType = 'change' this.categoryType = 'change'
this.categoryVisible = true 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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)

@ -0,0 +1,47 @@
<template>
<avue-tree :option="option"
:data="data"
@node-click="handleNodeClick"></avue-tree>
</template>
<script>
import { tree } from '@/api/plugin/workflow/category';
export default {
name: 'wf-category',
data() {
return {
data: [],
option: {
size: 'mini',
menu: false,
addBtn: false,
props: {
label: 'name',
value: 'id'
}
}
}
},
mounted() {
this.getCategoryList()
},
methods: {
handleNodeClick({ id }) {
this.$emit('node-click', { id })
},
getCategoryList() {
tree().then(res => {
const data = res.data.data
this.$emit('list-change', this.deepClone(data))
this.data = data
this.data.unshift({ id: '', name: '全部' })
})
},
}
}
</script>
<style>
</style>

@ -2,9 +2,8 @@
<basic-container> <basic-container>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<avue-tree :option="treeOption" <wf-category @node-click="nodeClick"
:data="treeData" @list-change="findObject(option.column, 'category').dicData = $event"></wf-category>
@node-click="nodeClick"></avue-tree>
</el-aside> </el-aside>
<el-main style="margin-left: 10px;"> <el-main style="margin-left: 10px;">
<template v-if="mode == 'list'"> <template v-if="mode == 'list'">
@ -58,16 +57,16 @@
<script> <script>
import { processList as getList } from "@/api/plugin/workflow/process"; import { processList as getList } from "@/api/plugin/workflow/process";
import { tree } from '@/api/plugin/workflow/category';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import exForm from '../mixins/ex-form' import exForm from '../mixins/ex-form'
import WfStartGrid from './components/start/grid.vue' import WfStartGrid from './components/start/grid.vue'
import WfCategory from './components/category.vue'
export default { export default {
mixins: [exForm], mixins: [exForm],
components: { WfStartGrid }, components: { WfStartGrid, WfCategory },
data() { data() {
return { return {
mode: 'list', mode: 'list',
@ -95,7 +94,7 @@ export default {
searchMenuSpan: 6, searchMenuSpan: 6,
searchSize: 'mini', searchSize: 'mini',
column: [ column: [
{ {
label: "图标", label: "图标",
prop: "icon", prop: "icon",
type: 'upload', type: 'upload',
@ -143,17 +142,6 @@ export default {
] ]
}, },
data: [], data: [],
row: '',
categoryVisible: false,
treeData: [],
treeOption: {
size: 'mini',
addBtn: false,
props: {
label: 'name',
value: 'id'
}
}
}; };
}, },
computed: { computed: {
@ -177,9 +165,6 @@ export default {
return process.env.NODE_ENV === "development" return process.env.NODE_ENV === "development"
} }
}, },
mounted() {
this.getCategoryList()
},
created() { created() {
this.handleChangeMode(localStorage.getItem("wf-start-mode") || 'list') this.handleChangeMode(localStorage.getItem("wf-start-mode") || 'list')
}, },
@ -191,15 +176,6 @@ export default {
else this.page.pageSize = 10 else this.page.pageSize = 10
this.onLoad(this.page, this.query) this.onLoad(this.page, this.query)
}, },
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 }) { nodeClick({ id }) {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)

Loading…
Cancel
Save