Commit 2d6fe27b4337e84c86529bcc7067547cda98d6b2

Authored by YunaiV
1 parent e6fadf07

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

yudao-ui-admin-vue3/src/views/bpm/definition/index.vue
... ... @@ -45,11 +45,9 @@
45 45 </XModal>
46 46 </ContentWrap>
47 47 </template>
48   -
49 48 <script setup lang="ts">
50 49 // 全局相关的 import
51 50 import { ref } from 'vue'
52   -// import { DICT_TYPE, getDictOptions } from '@/utils/dict'
53 51  
54 52 // 业务相关的 import
55 53 import * as DefinitionApi from '@/api/bpm/definition'
... ... @@ -87,7 +85,7 @@ const handleFormDetail = async (row) =&gt; {
87 85 // 弹窗打开
88 86 formDetailVisible.value = true
89 87 } else {
90   - router.push({
  88 + await router.push({
91 89 path: row.formCustomCreatePath
92 90 })
93 91 }
... ...
yudao-ui-admin-vue3/src/views/bpm/oa/leave/index.vue
... ... @@ -15,7 +15,7 @@
15 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 20 <XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" />
21 21 </template>
... ...
yudao-ui-admin-vue3/src/views/bpm/processInstance/index.vue
... ... @@ -14,97 +14,69 @@
14 14 </template>
15 15 <!-- 当前审批任务 -->
16 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 18 <span>{{ task.name }}</span>
24 19 </el-button>
25 20 </template>
26 21 <!-- 操作 -->
27 22 <template #actionbtns_default="{ row }">
  23 + <XButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
28 24 <XButton
29   - type="primary"
  25 + preIcon="ep:delete"
30 26 title="取消"
31 27 v-if="row.result === 1"
32   - preIcon="ep:delete"
33 28 @click="handleCancel(row)"
34 29 />
35   - <XButton type="primary" title="详情" preIcon="ep:edit-pen" @click="handleDetail(row)" />
36 30 </template>
37 31 </XTable>
38 32 </ContentWrap>
39 33 </template>
40 34 <script setup lang="ts">
41 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 38 // 业务相关的 import
48 39 import * as ProcessInstanceApi from '@/api/bpm/processInstance'
49   -// import { decodeFields } from '@/utils/formGenerator' // TODO 芋艿:后续根据情况清理
50 40 import { allSchemas } from './process.data'
51 41  
52 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 48 allSchemas: allSchemas,
57 49 getListApi: ProcessInstanceApi.getMyProcessInstancePageApi
58 50 })
59   -// 流程表单的弹出框
60   -const detailOpen = ref(false)
61   -const detailForm = ref()
  51 +
62 52 /** 发起流程操作 **/
63 53 const handleCreate = () => {
64 54 router.push({
65 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 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 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 74 inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
98 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 82 </script>
... ...
yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts
... ... @@ -41,7 +41,7 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
41 41 title: '当前审批任务',
42 42 field: 'tasks',
43 43 table: {
44   - width: 100,
  44 + width: 140,
45 45 slots: {
46 46 default: 'tasks_default'
47 47 }
... ...
yudao-ui-admin/src/views/bpm/processInstance/index.vue
... ... @@ -58,7 +58,7 @@
58 58 </el-table-column>
59 59 <el-table-column label="当前审批任务" align="center" prop="tasks">
60 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 62 <span>{{ task.name }}</span>
63 63 </el-button>
64 64 </template>
... ...