approvalRecord.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="container">
  3. <el-dialog v-model="visible" draggable title="审批记录" :width="props.width" :height="props.height" :close-on-click-modal="false">
  4. <el-tabs v-model="tabActiveName" class="demo-tabs">
  5. <el-tab-pane v-loading="loading" label="流程图" name="image" style="height: 68vh">
  6. <flowChart :ins-id="insId" v-if="insId" />
  7. </el-tab-pane>
  8. <el-tab-pane v-loading="loading" label="审批信息" name="info">
  9. <div>
  10. <el-table :data="historyList" style="width: 100%" border fit>
  11. <el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
  12. <el-table-column prop="nodeName" label="任务名称" sortable align="center"></el-table-column>
  13. <el-table-column prop="approveName" :show-overflow-tooltip="true" label="办理人" sortable align="center">
  14. <template #default="scope">
  15. <template v-if="scope.row.approveName">
  16. <el-tag v-for="(item, index) in scope.row.approveName.split(',')" :key="index" type="success">{{ item }}</el-tag>
  17. </template>
  18. <template v-else> <el-tag type="success">无</el-tag></template>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="flowStatus" label="状态" width="80" sortable align="center">
  22. <template #default="scope">
  23. <dict-tag :options="wf_task_status" :value="scope.row.flowStatus"></dict-tag>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="message" label="审批意见" :show-overflow-tooltip="true" sortable align="center"></el-table-column>
  27. <el-table-column prop="createTime" label="开始时间" width="160" :show-overflow-tooltip="true" sortable align="center"></el-table-column>
  28. <el-table-column prop="updateTime" label="结束时间" width="160" :show-overflow-tooltip="true" sortable align="center"></el-table-column>
  29. <el-table-column
  30. prop="runDuration"
  31. label="运行时长"
  32. width="140"
  33. :show-overflow-tooltip="true"
  34. sortable
  35. align="center"
  36. ></el-table-column>
  37. <el-table-column prop="attachmentList" width="120" label="附件" align="center">
  38. <template #default="scope">
  39. <el-popover v-if="scope.row.attachmentList && scope.row.attachmentList.length > 0" placement="right" :width="310" trigger="click">
  40. <template #reference>
  41. <el-button type="primary" style="margin-right: 16px">附件</el-button>
  42. </template>
  43. <el-table border :data="scope.row.attachmentList">
  44. <el-table-column prop="originalName" width="202" :show-overflow-tooltip="true" label="附件名称"></el-table-column>
  45. <el-table-column prop="name" width="80" align="center" :show-overflow-tooltip="true" label="操作">
  46. <template #default="tool">
  47. <el-button type="text" @click="handleDownload(tool.row.ossId)">下载</el-button>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. </el-popover>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </el-tab-pane>
  57. </el-tabs>
  58. </el-dialog>
  59. </div>
  60. </template>
  61. <script setup lang="ts">
  62. import { flowHisTaskList } from '@/api/workflow/instance';
  63. import { propTypes } from '@/utils/propTypes';
  64. import { listByIds } from '@/api/system/oss';
  65. import FlowChart from '@/components/Process/flowChart.vue';
  66. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  67. const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status'));
  68. const props = defineProps({
  69. width: propTypes.string.def('80%'),
  70. height: propTypes.string.def('100%')
  71. });
  72. const loading = ref(false);
  73. const visible = ref(false);
  74. const historyList = ref<Array<any>>([]);
  75. const tabActiveName = ref('image');
  76. const insId = ref(null);
  77. //初始化查询审批记录
  78. const init = async (businessId: string | number) => {
  79. visible.value = true;
  80. loading.value = true;
  81. tabActiveName.value = 'image';
  82. historyList.value = [];
  83. flowHisTaskList(businessId).then((resp) => {
  84. if (resp.data) {
  85. historyList.value = resp.data.list;
  86. insId.value = resp.data.instanceId;
  87. if (historyList.value.length > 0) {
  88. historyList.value.forEach((item) => {
  89. if (item.ext) {
  90. getIds(item.ext).then((res) => {
  91. item.attachmentList = res.data;
  92. });
  93. } else {
  94. item.attachmentList = [];
  95. }
  96. });
  97. }
  98. loading.value = false;
  99. }
  100. });
  101. };
  102. const getIds = async (ids: string | number) => {
  103. const res = await listByIds(ids);
  104. return res;
  105. };
  106. /** 下载按钮操作 */
  107. const handleDownload = (ossId: string) => {
  108. proxy?.$download.oss(ossId);
  109. };
  110. /**
  111. * 对外暴露子组件方法
  112. */
  113. defineExpose({
  114. init
  115. });
  116. </script>
  117. <style lang="scss" scoped>
  118. .container {
  119. :deep(.el-dialog .el-dialog__body) {
  120. max-height: calc(100vh - 170px) !important;
  121. min-height: calc(100vh - 170px) !important;
  122. }
  123. }
  124. </style>