index_new.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <ContentWrap>
  3. <div class="flex justify-between pl-20px items-center">
  4. <h3 class="font-extrabold">流程模型</h3>
  5. <!-- 搜索工作栏 -->
  6. <el-form
  7. class="-mb-15px flex"
  8. :model="queryParams"
  9. ref="queryFormRef"
  10. :inline="true"
  11. label-width="68px"
  12. >
  13. <el-form-item align="right" prop="key" class="ml-auto">
  14. <el-input
  15. v-model="queryParams.key"
  16. placeholder="搜索流程"
  17. clearable
  18. @keyup.enter="handleQuery"
  19. class="!w-240px"
  20. >
  21. <template #prefix>
  22. <Icon icon="ep:search" class="mx-10px" />
  23. </template>
  24. </el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button type="primary" @click="openForm('create')" v-hasPermi="['bpm:model:create']">
  28. <Icon icon="ep:plus" class="mr-5px" /> 新建模型
  29. </el-button>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-dropdown placement="bottom-end">
  33. <el-button class="w-30px" plain>
  34. <Icon icon="ep:setting" />
  35. </el-button>
  36. <template #dropdown>
  37. <el-dropdown-menu>
  38. <el-dropdown-item>
  39. <Icon icon="ep:circle-plus" :size="13" class="mr-5px" />
  40. 新建分类
  41. </el-dropdown-item>
  42. <el-dropdown-item>
  43. <Icon icon="fa:sort-amount-desc" :size="13" class="mr-5px" />
  44. 分类排序
  45. </el-dropdown-item>
  46. </el-dropdown-menu>
  47. </template>
  48. </el-dropdown>
  49. </el-form-item>
  50. </el-form>
  51. </div>
  52. <el-divider />
  53. <!-- 分类卡片组 -->
  54. <div class="px-15px">
  55. <ContentWrap
  56. v-loading="loading"
  57. :body-style="{ padding: 0 }"
  58. v-for="(list, title) in categoryGroup"
  59. :key="title"
  60. >
  61. <CategoryDraggableModel :dataList="list" :title="title" @success="getList" />
  62. </ContentWrap>
  63. </div>
  64. </ContentWrap>
  65. <!-- 表单弹窗:添加/修改流程 -->
  66. <ModelForm ref="formRef" @success="getList" />
  67. <!-- 弹窗:表单详情 -->
  68. <Dialog title="表单详情" v-model="formDetailVisible" width="800">
  69. <form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
  70. </Dialog>
  71. </template>
  72. <script lang="ts" setup>
  73. import * as ModelApi from '@/api/bpm/model'
  74. import ModelForm from './ModelForm.vue'
  75. import { groupBy } from 'lodash-es'
  76. import { mockData } from './mock'
  77. import CategoryDraggableModel from './CategoryDraggableModel.vue'
  78. defineOptions({ name: 'BpmModel' })
  79. const loading = ref(true) // 列表的加载中
  80. const queryParams = reactive({
  81. pageNo: 1,
  82. pageSize: 10,
  83. key: undefined,
  84. name: undefined,
  85. category: undefined
  86. })
  87. const queryFormRef = ref() // 搜索的表单
  88. const categoryGroup = ref<any>({}) // 按照category分组的数据
  89. /** 查询列表 */
  90. const getList = async () => {
  91. loading.value = true
  92. try {
  93. // TODO 芋艿:这里需要一个不分页查全部的流程模型接口
  94. const data = await ModelApi.getModelPage(queryParams)
  95. data.list = mockData
  96. categoryGroup.value = groupBy(data.list, 'categoryName')
  97. } finally {
  98. loading.value = false
  99. }
  100. }
  101. /** 搜索按钮操作 */
  102. const handleQuery = () => {
  103. queryParams.pageNo = 1
  104. getList()
  105. }
  106. /** 添加/修改操作 */
  107. const formRef = ref()
  108. const openForm = (type: string, id?: number) => {
  109. formRef.value.open(type, id)
  110. }
  111. /** 流程表单的详情按钮操作 */
  112. const formDetailVisible = ref(false)
  113. const formDetailPreview = ref({
  114. rule: [],
  115. option: {}
  116. })
  117. /** 初始化 **/
  118. onMounted(async () => {
  119. await getList()
  120. })
  121. </script>