Commit 2d6fe27b4337e84c86529bcc7067547cda98d6b2

Authored by YunaiV
1 parent e6fadf07

bpm:完成流程实例的列表界面

yudao-ui-admin-vue3/src/views/bpm/definition/index.vue
@@ -45,11 +45,9 @@ @@ -45,11 +45,9 @@
45 </XModal> 45 </XModal>
46 </ContentWrap> 46 </ContentWrap>
47 </template> 47 </template>
48 -  
49 <script setup lang="ts"> 48 <script setup lang="ts">
50 // 全局相关的 import 49 // 全局相关的 import
51 import { ref } from 'vue' 50 import { ref } from 'vue'
52 -// import { DICT_TYPE, getDictOptions } from '@/utils/dict'  
53 51
54 // 业务相关的 import 52 // 业务相关的 import
55 import * as DefinitionApi from '@/api/bpm/definition' 53 import * as DefinitionApi from '@/api/bpm/definition'
@@ -87,7 +85,7 @@ const handleFormDetail = async (row) =&gt; { @@ -87,7 +85,7 @@ const handleFormDetail = async (row) =&gt; {
87 // 弹窗打开 85 // 弹窗打开
88 formDetailVisible.value = true 86 formDetailVisible.value = true
89 } else { 87 } else {
90 - router.push({ 88 + await router.push({
91 path: row.formCustomCreatePath 89 path: row.formCustomCreatePath
92 }) 90 })
93 } 91 }
yudao-ui-admin-vue3/src/views/bpm/oa/leave/index.vue
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 @click="cancelLeave(row)" 15 @click="cancelLeave(row)"
16 /> 16 />
17 <!-- 操作: 详情 --> 17 <!-- 操作: 详情 -->
18 - <XTextButton preIcon="ep:delete" :title="t('action.detail')" @click="handleDetail(row)" /> 18 + <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
19 <!-- 操作: 审批进度 --> 19 <!-- 操作: 审批进度 -->
20 <XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" /> 20 <XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" />
21 </template> 21 </template>
yudao-ui-admin-vue3/src/views/bpm/processInstance/index.vue
@@ -14,97 +14,69 @@ @@ -14,97 +14,69 @@
14 </template> 14 </template>
15 <!-- 当前审批任务 --> 15 <!-- 当前审批任务 -->
16 <template #tasks_default="{ row }"> 16 <template #tasks_default="{ row }">
17 - <el-button  
18 - v-for="task in row.tasks"  
19 - :key="task.id"  
20 - type="text"  
21 - @click="handleFormDetail(task.id)"  
22 - > 17 + <el-button v-for="task in row.tasks" :key="task.id" type="text">
23 <span>{{ task.name }}</span> 18 <span>{{ task.name }}</span>
24 </el-button> 19 </el-button>
25 </template> 20 </template>
26 <!-- 操作 --> 21 <!-- 操作 -->
27 <template #actionbtns_default="{ row }"> 22 <template #actionbtns_default="{ row }">
  23 + <XButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
28 <XButton 24 <XButton
29 - type="primary" 25 + preIcon="ep:delete"
30 title="取消" 26 title="取消"
31 v-if="row.result === 1" 27 v-if="row.result === 1"
32 - preIcon="ep:delete"  
33 @click="handleCancel(row)" 28 @click="handleCancel(row)"
34 /> 29 />
35 - <XButton type="primary" title="详情" preIcon="ep:edit-pen" @click="handleDetail(row)" />  
36 </template> 30 </template>
37 </XTable> 31 </XTable>
38 </ContentWrap> 32 </ContentWrap>
39 </template> 33 </template>
40 <script setup lang="ts"> 34 <script setup lang="ts">
41 // 全局相关的 import 35 // 全局相关的 import
42 -import { ref } from 'vue'  
43 -import { ElMessage, ElMessageBox } from 'element-plus'  
44 -import { useXTable } from '@/hooks/web/useXTable'  
45 -import { useRouter } from 'vue-router' 36 +import { ElMessageBox } from 'element-plus'
46 37
47 // 业务相关的 import 38 // 业务相关的 import
48 import * as ProcessInstanceApi from '@/api/bpm/processInstance' 39 import * as ProcessInstanceApi from '@/api/bpm/processInstance'
49 -// import { decodeFields } from '@/utils/formGenerator' // TODO 芋艿:后续根据情况清理  
50 import { allSchemas } from './process.data' 40 import { allSchemas } from './process.data'
51 41
52 const router = useRouter() // 路由 42 const router = useRouter() // 路由
  43 +const message = useMessage() // 消息弹窗
  44 +const { t } = useI18n() // 国际化
53 45
54 // ========== 列表相关 ========== 46 // ========== 列表相关 ==========
55 -const [registerTable] = useXTable({ 47 +const [registerTable, { reload }] = useXTable({
56 allSchemas: allSchemas, 48 allSchemas: allSchemas,
57 getListApi: ProcessInstanceApi.getMyProcessInstancePageApi 49 getListApi: ProcessInstanceApi.getMyProcessInstancePageApi
58 }) 50 })
59 -// 流程表单的弹出框  
60 -const detailOpen = ref(false)  
61 -const detailForm = ref() 51 +
62 /** 发起流程操作 **/ 52 /** 发起流程操作 **/
63 const handleCreate = () => { 53 const handleCreate = () => {
64 router.push({ 54 router.push({
65 name: 'BpmProcessInstanceCreate' 55 name: 'BpmProcessInstanceCreate'
66 }) 56 })
67 } 57 }
68 -/** 流程表单的详情按钮操作 */  
69 -const handleFormDetail = (row) => {  
70 - // 情况一:使用流程表单  
71 - if (row.formId) {  
72 - // 设置值 TODO 芋艿:动态表单做完后,需要测试下  
73 - detailForm.value = {  
74 - ...JSON.parse(row.formConf),  
75 - fields: decodeFields([], row.formFields)  
76 - }  
77 - // 弹窗打开  
78 - detailOpen.value = true  
79 - // 情况二:使用业务表单  
80 - } else if (row.formCustomCreatePath) {  
81 - router.push({ path: row.formCustomCreatePath })  
82 - }  
83 -}  
84 58
85 // 列表操作 59 // 列表操作
86 const handleDetail = (row) => { 60 const handleDetail = (row) => {
87 - console.log(row, 'row')  
88 - router.push({ path: '/process-instance/detail', query: { id: row.id } }) 61 + router.push({
  62 + name: 'BpmProcessInstanceDetail',
  63 + query: {
  64 + id: row.processInstanceId
  65 + }
  66 + })
89 } 67 }
  68 +
90 /** 取消按钮操作 */ 69 /** 取消按钮操作 */
91 const handleCancel = (row) => { 70 const handleCancel = (row) => {
92 - const id = row.id  
93 - ElMessageBox.prompt('请输入取消原因?', '取消流程', {  
94 - type: 'warning',  
95 - confirmButtonText: '确定',  
96 - cancelButtonText: '取消', 71 + ElMessageBox.prompt('请输入取消原因', '取消流程', {
  72 + confirmButtonText: t('common.ok'),
  73 + cancelButtonText: t('common.cancel'),
97 inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格 74 inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
98 inputErrorMessage: '取消原因不能为空' 75 inputErrorMessage: '取消原因不能为空'
  76 + }).then(async ({ value }) => {
  77 + await ProcessInstanceApi.cancelProcessInstanceApi(row.id, value)
  78 + message.success('取消成功')
  79 + reload()
99 }) 80 })
100 - .then(({ value }) => {  
101 - return ProcessInstanceApi.cancelProcessInstanceApi(id, value)  
102 - })  
103 - .then(() => {  
104 - ElMessage({  
105 - message: '取消成功',  
106 - type: 'success'  
107 - })  
108 - })  
109 } 81 }
110 </script> 82 </script>
yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts
@@ -41,7 +41,7 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -41,7 +41,7 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
41 title: '当前审批任务', 41 title: '当前审批任务',
42 field: 'tasks', 42 field: 'tasks',
43 table: { 43 table: {
44 - width: 100, 44 + width: 140,
45 slots: { 45 slots: {
46 default: 'tasks_default' 46 default: 'tasks_default'
47 } 47 }
yudao-ui-admin/src/views/bpm/processInstance/index.vue
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 </el-table-column> 58 </el-table-column>
59 <el-table-column label="当前审批任务" align="center" prop="tasks"> 59 <el-table-column label="当前审批任务" align="center" prop="tasks">
60 <template v-slot="scope"> 60 <template v-slot="scope">
61 - <el-button v-for="task in scope.row.tasks" :key="task.id" type="text" @click="handleFormDetail(task.id)"> 61 + <el-button v-for="task in scope.row.tasks" :key="task.id" type="text"">
62 <span>{{ task.name }}</span> 62 <span>{{ task.name }}</span>
63 </el-button> 63 </el-button>
64 </template> 64 </template>