index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <XTable @register="registerTable">
  5. <!-- 流程名称 -->
  6. <template #name_default="{ row }">
  7. <XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
  8. </template>
  9. <!-- 表单信息 -->
  10. <template #formId_default="{ row }">
  11. <XTextButton
  12. v-if="row.formType === 10"
  13. :title="row.formName"
  14. @click="handleFormDetail(row)"
  15. />
  16. <XTextButton v-else :title="row.formCustomCreatePath" @click="handleFormDetail(row)" />
  17. </template>
  18. <!-- 流程版本 -->
  19. <template #version_default="{ row }">
  20. <el-tag>v{{ row.version }}</el-tag>
  21. </template>
  22. <!-- 激活状态 -->
  23. <template #suspensionState_default="{ row }">
  24. <el-tag type="success" v-if="row.suspensionState === 1">激活</el-tag>
  25. <el-tag type="warning" v-if="row.suspensionState === 2">挂起</el-tag>
  26. </template>
  27. <!-- 操作 -->
  28. <template #actionbtns_default="{ row }">
  29. <XTextButton
  30. preIcon="ep:user"
  31. title="分配规则"
  32. v-hasPermi="['bpm:task-assign-rule:query']"
  33. @click="handleAssignRule(row)"
  34. />
  35. </template>
  36. </XTable>
  37. <!-- 表单详情的弹窗 -->
  38. <XModal v-model="formDetailVisible" width="800" title="表单详情" :show-footer="false">
  39. <ViewForm
  40. :rule="formDetailPreview.rule"
  41. :option="formDetailPreview.option"
  42. v-if="formDetailVisible"
  43. />
  44. </XModal>
  45. </ContentWrap>
  46. </template>
  47. <script setup lang="ts">
  48. // 全局相关的 import
  49. import { ref } from 'vue'
  50. // import { DICT_TYPE, getDictOptions } from '@/utils/dict'
  51. // 业务相关的 import
  52. import * as DefinitionApi from '@/api/bpm/definition'
  53. // import * as ModelApi from '@/api/bpm/model'
  54. import { allSchemas } from './definition.data'
  55. const message = useMessage() // 消息弹窗
  56. const router = useRouter() // 路由
  57. const { query } = useRoute() // 查询参数
  58. import viewForm from '@form-create/element-ui'
  59. const ViewForm = viewForm.$form()
  60. import { setConfAndFields2 } from '@/utils/formCreate'
  61. // ========== 列表相关 ==========
  62. const queryParams = reactive({
  63. key: query.key
  64. })
  65. const [registerTable] = useXTable({
  66. allSchemas: allSchemas,
  67. getListApi: DefinitionApi.getProcessDefinitionPageApi,
  68. params: queryParams
  69. })
  70. // 流程表单的详情按钮操作
  71. const formDetailVisible = ref(false)
  72. const formDetailPreview = ref({
  73. rule: [],
  74. option: {}
  75. })
  76. const handleFormDetail = async (row) => {
  77. if (row.formType == 10) {
  78. // 设置表单
  79. setConfAndFields2(formDetailPreview, row.formConf, row.formFields)
  80. // 弹窗打开
  81. formDetailVisible.value = true
  82. } else {
  83. router.push({
  84. path: row.formCustomCreatePath
  85. })
  86. }
  87. }
  88. // 流程图的详情按钮操作
  89. const handleBpmnDetail = (row) => {
  90. // TODO 芋艿:流程组件开发中
  91. console.log(row)
  92. message.success('流程组件开发中,预计 2 月底完成')
  93. }
  94. // 点击任务分配按钮
  95. const handleAssignRule = (row) => {
  96. router.push({
  97. name: 'BpmTaskAssignRuleList',
  98. query: {
  99. modelId: row.id
  100. }
  101. })
  102. }
  103. </script>