index.vue 5.1 KB

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