index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <!-- <doc-alert title="流程表达式" url="https://doc.iocoder.cn/bpm/expression/" /> -->
  3. <ContentWrap>
  4. <!-- 搜索工作栏 -->
  5. <el-form
  6. class="-mb-15px"
  7. :model="queryParams"
  8. ref="queryFormRef"
  9. :inline="true"
  10. label-width="68px"
  11. >
  12. <el-form-item label="名字" prop="name">
  13. <el-input
  14. v-model="queryParams.name"
  15. placeholder="请输入名字"
  16. clearable
  17. @keyup.enter="handleQuery"
  18. class="!w-240px"
  19. />
  20. </el-form-item>
  21. <el-form-item label="状态" prop="status">
  22. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
  23. <el-option
  24. v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
  25. :key="dict.value"
  26. :label="dict.label"
  27. :value="dict.value"
  28. />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="创建时间" prop="createTime">
  32. <el-date-picker
  33. v-model="queryParams.createTime"
  34. value-format="YYYY-MM-DD HH:mm:ss"
  35. type="daterange"
  36. start-placeholder="开始日期"
  37. end-placeholder="结束日期"
  38. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  39. class="!w-240px"
  40. />
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  44. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  45. <el-button
  46. type="primary"
  47. plain
  48. @click="openForm('create')"
  49. v-hasPermi="['bpm:process-expression:create']"
  50. >
  51. <Icon icon="ep:plus" class="mr-5px" /> 新增
  52. </el-button>
  53. </el-form-item>
  54. </el-form>
  55. </ContentWrap>
  56. <!-- 列表 -->
  57. <ContentWrap>
  58. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  59. <el-table-column label="编号" align="center" prop="id" />
  60. <el-table-column label="名字" align="center" prop="name" />
  61. <el-table-column label="状态" align="center" prop="status">
  62. <template #default="scope">
  63. <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="表达式" align="center" prop="expression" />
  67. <el-table-column
  68. label="创建时间"
  69. align="center"
  70. prop="createTime"
  71. :formatter="dateFormatter"
  72. width="180px"
  73. />
  74. <el-table-column label="操作" align="center">
  75. <template #default="scope">
  76. <el-button
  77. link
  78. type="primary"
  79. @click="openForm('update', scope.row.id)"
  80. v-hasPermi="['bpm:process-expression:update']"
  81. >
  82. 编辑
  83. </el-button>
  84. <el-button
  85. link
  86. type="danger"
  87. @click="handleDelete(scope.row.id)"
  88. v-hasPermi="['bpm:process-expression:delete']"
  89. >
  90. 删除
  91. </el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <!-- 分页 -->
  96. <Pagination
  97. :total="total"
  98. v-model:page="queryParams.pageNo"
  99. v-model:limit="queryParams.pageSize"
  100. @pagination="getList"
  101. />
  102. </ContentWrap>
  103. <!-- 表单弹窗:添加/修改 -->
  104. <ProcessExpressionForm ref="formRef" @success="getList" />
  105. </template>
  106. <script setup lang="ts">
  107. import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
  108. import { dateFormatter } from '@/utils/formatTime'
  109. import { ProcessExpressionApi, ProcessExpressionVO } from '@/api/bpm/processExpression'
  110. import ProcessExpressionForm from './ProcessExpressionForm.vue'
  111. /** BPM 流程表达式列表 */
  112. defineOptions({ name: 'BpmProcessExpression' })
  113. const message = useMessage() // 消息弹窗
  114. const { t } = useI18n() // 国际化
  115. const loading = ref(true) // 列表的加载中
  116. const list = ref<ProcessExpressionVO[]>([]) // 列表的数据
  117. const total = ref(0) // 列表的总页数
  118. const queryParams = reactive({
  119. pageNo: 1,
  120. pageSize: 10,
  121. name: undefined,
  122. status: undefined,
  123. createTime: []
  124. })
  125. const queryFormRef = ref() // 搜索的表单
  126. const exportLoading = ref(false) // 导出的加载中
  127. /** 查询列表 */
  128. const getList = async () => {
  129. loading.value = true
  130. try {
  131. const data = await ProcessExpressionApi.getProcessExpressionPage(queryParams)
  132. list.value = data.list
  133. total.value = data.total
  134. } finally {
  135. loading.value = false
  136. }
  137. }
  138. /** 搜索按钮操作 */
  139. const handleQuery = () => {
  140. queryParams.pageNo = 1
  141. getList()
  142. }
  143. /** 重置按钮操作 */
  144. const resetQuery = () => {
  145. queryFormRef.value.resetFields()
  146. handleQuery()
  147. }
  148. /** 添加/修改操作 */
  149. const formRef = ref()
  150. const openForm = (type: string, id?: number) => {
  151. formRef.value.open(type, id)
  152. }
  153. /** 删除按钮操作 */
  154. const handleDelete = async (id: number) => {
  155. try {
  156. // 删除的二次确认
  157. await message.delConfirm()
  158. // 发起删除
  159. await ProcessExpressionApi.deleteProcessExpression(id)
  160. message.success(t('common.delSuccess'))
  161. // 刷新列表
  162. await getList()
  163. } catch {}
  164. }
  165. /** 初始化 **/
  166. onMounted(() => {
  167. getList()
  168. })
  169. </script>