WfInsList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <route lang="yaml">
  2. meta:
  3. enabled: false
  4. </route>
  5. <script lang="ts" setup>
  6. import { ElMessage, ElMessageBox } from 'element-plus'
  7. import { deleteWfInsById, getWfInsByPage } from '@/api/system/wfInsApi'
  8. import { wfInsStatusFilter } from '@/utils/tool'
  9. const state = reactive({
  10. loading: false,
  11. dataList: [],
  12. search: {
  13. wfDefId: -1,
  14. keywords: '',
  15. },
  16. })
  17. // 查询帐号列表
  18. const getWfInsData = async () => {
  19. state.loading = true
  20. const { data } = await getWfInsByPage(state.search)
  21. state.loading = false
  22. state.dataList = data
  23. state.loading = false
  24. }
  25. const wfInsTableRef = ref()
  26. // 查询
  27. const onSearch = () => {
  28. getWfInsData()
  29. }
  30. // 修改
  31. const onWfInsDetail = (row: any) => {
  32. // activityDefRef.value.showEditModel(row.wfDefId, row.activityDefId)
  33. }
  34. // 删除
  35. const onWfInsDelete = (row: any) => {
  36. const { ocId, wfInsId, wfInsTitle } = row
  37. ElMessageBox.confirm(`确认删除「${wfInsTitle}」吗?`, '确认信息').then(async () => {
  38. const { msg } = await deleteWfInsById(ocId, wfInsId)
  39. ElMessage.success(msg)
  40. await getWfInsData()
  41. })
  42. }
  43. defineExpose({
  44. loadData(wfDefId: number) {
  45. state.search.wfDefId = wfDefId
  46. getWfInsData()
  47. },
  48. })
  49. </script>
  50. <template>
  51. <div class="container">
  52. <tool-bar>
  53. <template #left>
  54. <span />
  55. </template>
  56. <template #right>
  57. <el-input v-model="state.search.keywords" placeholder="请输入名称,支持模糊查询" style="padding-right: 10px;" clearable />
  58. <el-button type="primary" @click="onSearch">
  59. <template #icon>
  60. <el-icon>
  61. <svg-icon name="i-ep:search" />
  62. </el-icon>
  63. </template>
  64. </el-button>
  65. </template>
  66. </tool-bar>
  67. <el-table ref="wfInsTableRef" v-loading="state.loading" class="list-table" size="small" :data="state.dataList" border stripe highlight-current-row>
  68. <el-table-column type="selection" width="50" align="center" />
  69. <el-table-column type="index" align="center" label="序号" width="70" />
  70. <el-table-column width="150px" label="单位名称" align="center" header-align="center">
  71. <template #default="scope">
  72. <span>{{ scope.row.ocName }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column align="center" header-align="center" label="实例名称">
  76. <template #default="scope">
  77. <span>{{ scope.row.wfInsTitle }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column align="center" header-align="center" label="开始时间">
  81. <template #default="scope">
  82. <span>{{ scope.row.beginTime }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column align="center" header-align="center" label="结束时间">
  86. <template #default="scope">
  87. <span>{{ scope.row.finishTime }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column width="150px" label="状态" align="center" header-align="center">
  91. <template #default="scope">
  92. <el-tag v-if="scope.row.status === 0" type="danger">
  93. {{ wfInsStatusFilter(scope.row.status) }}
  94. </el-tag>
  95. <el-tag v-else-if="scope.row.status === 1" type="warning">
  96. {{ wfInsStatusFilter(scope.row.status) }}
  97. </el-tag>
  98. <el-tag v-else type="info">
  99. {{ wfInsStatusFilter(scope.row.status) }}
  100. </el-tag>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="操作" width="150" align="center" fixed="right">
  104. <template #default="scope">
  105. <div>
  106. <el-button type="primary" size="small" plain @click="onWfInsDetail(scope.row)">
  107. 详情
  108. </el-button>
  109. <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onWfInsDelete(scope.row)">
  110. 删除
  111. </el-button>
  112. </div>
  113. </template>
  114. </el-table-column>
  115. </el-table>
  116. </div>
  117. </template>