|
@@ -4,10 +4,10 @@
|
|
|
<template #item="{ element }">
|
|
|
<div class="group_list">
|
|
|
<div class="group_header flex flex-pack-justify flex-align-center">
|
|
|
- <div class="group_header_title disabled">{{ element.name }}</div>
|
|
|
+ <div class="group_header_title disabled">{{ element.categoryName }}</div>
|
|
|
<div class="group_header_nameOperate">
|
|
|
<el-tooltip effect="dark" content="删除" placement="top">
|
|
|
- <el-icon><Delete @click="deleteItem" /></el-icon>
|
|
|
+ <el-icon><Delete @click="deleteItem(element)" /></el-icon>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -20,16 +20,12 @@
|
|
|
<script lang="tsx" setup>
|
|
|
import Draggable from 'vuedraggable'
|
|
|
import { Delete } from '@element-plus/icons-vue'
|
|
|
-import { ref } from 'vue'
|
|
|
-import { ElMessageBox } from 'element-plus'
|
|
|
+import { ref, nextTick, onMounted } from 'vue'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import flowGroup from '@/api/flow/group'
|
|
|
+import flowDefinition from '@/api/flow/definition'
|
|
|
const dragging = ref(false)
|
|
|
-const myArray = ref([
|
|
|
- { name: '考勤', id: 1 },
|
|
|
- { name: '人事', id: 2 },
|
|
|
- { name: '财务', id: 3 },
|
|
|
- { name: '行政', id: 4 }
|
|
|
-])
|
|
|
+const myArray = ref([])
|
|
|
|
|
|
const endDraggableEv = () => {
|
|
|
dragging.value = false
|
|
@@ -39,43 +35,63 @@ const endDraggableEv = () => {
|
|
|
|
|
|
const editFlowGroup = async () => {
|
|
|
try {
|
|
|
+ // todo
|
|
|
const param = JSON.parse(JSON.stringify(myArray.value))
|
|
|
+ param.map((item: any) => {
|
|
|
+ ;(item.id = item.categoryId), (item.name = item.categoryName), (item.sort = item.categorySort)
|
|
|
+ })
|
|
|
await flowGroup.flowGroupAddOrEditSaveApi(param)
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const deleteItem = (item) => {
|
|
|
- ElMessageBox.confirm('无法删除,请先删除组内的审批', '删除', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'error'
|
|
|
- }).then(() => {
|
|
|
- deleteFlowGroup(item)
|
|
|
- })
|
|
|
+const deleteItem = item => {
|
|
|
+ deleteFlowGroup(item)
|
|
|
}
|
|
|
|
|
|
// 流程组删除
|
|
|
const deleteFlowGroup = async item => {
|
|
|
try {
|
|
|
- await flowGroup.flowGroupDeleteApi([item.id])
|
|
|
- flowGroupListAll()
|
|
|
+ // todo 这里需要判断当前的流程组下是否有实例,有不能删除,没有 直接调用删除接口
|
|
|
+ ElMessageBox.confirm('是否删除该分组?', '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'error',
|
|
|
+ buttonSize: 'default'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ ElMessage({
|
|
|
+ message: '删除成功!',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ await flowGroup.flowGroupDeleteApi([item.categoryId])
|
|
|
+ flowGroupListAll()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ console.log('取消')
|
|
|
+ })
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 流程组列表
|
|
|
-const flowGroupListAll = () => {
|
|
|
+const flowGroupListAll = async () => {
|
|
|
try {
|
|
|
- const data = flowGroup.flowGroupListAllApi({})
|
|
|
+ const data = await flowDefinition.flowDefinitionListCategoryApi({})
|
|
|
+ myArray.value = data || []
|
|
|
console.log(data)
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ flowGroupListAll()
|
|
|
+ })
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|