approvalRecord.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 :defJson="defJson" v-if="defJson != ''" />
  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 { flowImage } 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 imgUrl = ref('');
  77. const defJson = ref<any>('');
  78. //初始化查询审批记录
  79. const init = async (businessId: string | number) => {
  80. visible.value = true;
  81. loading.value = true;
  82. tabActiveName.value = 'image';
  83. historyList.value = [];
  84. flowImage(businessId).then((resp) => {
  85. if (resp.data) {
  86. historyList.value = resp.data.list;
  87. imgUrl.value = 'data:image/gif;base64,' + resp.data.image;
  88. defJson.value = resp.data.defChart.defJson;
  89. if (historyList.value.length > 0) {
  90. historyList.value.forEach((item) => {
  91. if (item.ext) {
  92. getIds(item.ext).then((res) => {
  93. item.attachmentList = res.data;
  94. });
  95. } else {
  96. item.attachmentList = [];
  97. }
  98. });
  99. }
  100. loading.value = false;
  101. }
  102. });
  103. };
  104. const getIds = async (ids: string | number) => {
  105. const res = await listByIds(ids);
  106. return res;
  107. };
  108. /** 下载按钮操作 */
  109. const handleDownload = (ossId: string) => {
  110. proxy?.$download.oss(ossId);
  111. };
  112. /**
  113. * 对外暴露子组件方法
  114. */
  115. defineExpose({
  116. init
  117. });
  118. </script>
  119. <style lang="scss" scoped>
  120. .container {
  121. :deep(.el-dialog .el-dialog__body) {
  122. max-height: calc(100vh - 170px) !important;
  123. min-height: calc(100vh - 170px) !important;
  124. }
  125. }
  126. </style>