HistoryApproveComment.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <!-- 历史评论信息 -->
  2. <template>
  3. <div v-if="historyProcessInstanceDescriptions != undefined">
  4. <div
  5. v-for="historyProcessInstanceDescription, index in historyProcessInstanceDescriptions"
  6. :key="historyProcessInstanceDescription.id"
  7. >
  8. <div class="page-header">
  9. <h4 style="display: inline-block; margin-right: 2rem;">
  10. {{ $t("lang.historyApproveComment.title") }}
  11. </h4>
  12. <a-tag color="warning">
  13. {{ index + 1 }} / {{ abandonCount == undefined ? "0" : abandonCount }}
  14. </a-tag>
  15. <a-tag v-if="historyProcessInstanceDescription.approvalHistory != null" color="processing">
  16. <template #icon>
  17. <close-circle-outlined />
  18. </template>
  19. {{ historyProcessInstanceDescription.approvalHistory.documentStatusChangeReason }}
  20. </a-tag>
  21. <a-tag color="success">
  22. <template #icon>
  23. <clock-circle-outlined />
  24. </template>
  25. {{ historyProcessInstanceDescription.startTime }}-{{ historyProcessInstanceDescription.endTime }}
  26. </a-tag>
  27. </div>
  28. <div>
  29. <ul
  30. class="media-list m-media-list"
  31. >
  32. <li class="media">
  33. <div class="media-left">
  34. <a>
  35. <AuthImage
  36. :auth-src="
  37. Common.getThumbnailImageSrc(
  38. 'com.leanwo.prodog.base.model.User',
  39. historyProcessInstanceDescription.startUserImageUrl
  40. )
  41. "
  42. class="media-object thumbnail m-image"
  43. />
  44. </a>
  45. </div>
  46. <div class="media-body">
  47. <h4 class="media-heading">
  48. {{ historyProcessInstanceDescription.startUserName }}
  49. <small class="badge alert-error">
  50. {{ $t("lang.approveComment.submitUser") }}
  51. </small>
  52. </h4>
  53. <h5 class="m-h5">{{ historyProcessInstanceDescription.startTime }}</h5>
  54. <p class="comment-text">{{ $t("lang.approveComment.submitApprove") }}</p>
  55. </div>
  56. </li>
  57. <template v-if="historyProcessInstanceDescription.historicTaskInstanceDescriptions != undefined">
  58. <li
  59. v-for="historicTaskInstanceDescription in historyProcessInstanceDescription.historicTaskInstanceDescriptions"
  60. :key="historicTaskInstanceDescription.id"
  61. class="media"
  62. >
  63. <div class="media-left">
  64. <a>
  65. <AuthImage
  66. :auth-src="
  67. Common.getThumbnailImageSrc(
  68. 'com.leanwo.prodog.base.model.User',
  69. historicTaskInstanceDescription.assigneeImageUrl
  70. )
  71. "
  72. class="media-object thumbnail m-image"
  73. />
  74. </a>
  75. </div>
  76. <div class="media-body">
  77. <h4 class="media-heading">
  78. {{ historicTaskInstanceDescription.assigneeName }}
  79. <small class="badge alert-error">{{ historicTaskInstanceDescription.name }}({{
  80. getTaskCompleteType(historicTaskInstanceDescription.completeReason)
  81. }})</small>
  82. </h4>
  83. <div v-if="historicTaskInstanceDescription.comments != undefined">
  84. <div
  85. v-for="commentItem in historicTaskInstanceDescription.comments"
  86. :key="commentItem.id"
  87. >
  88. <h5 class="m-h5">{{ commentItem.time }}</h5>
  89. <p class="comment-text">{{ commentItem.message }}</p>
  90. </div>
  91. </div>
  92. <ApproveTaskAttachmentView :enable-delete="false" :attachments="historicTaskInstanceDescription.attachments" />
  93. </div>
  94. </li>
  95. </template>
  96. </ul>
  97. </div>
  98. </div>
  99. <Loading v-if="loading" />
  100. </div>
  101. </template>
  102. <script>
  103. import Common from '../common/Common.js';
  104. import AuthImage from '../widget/AuthImage.vue';
  105. import { Notify } from 'pc-component-v3';
  106. import ApproveTaskAttachmentView from './ApproveTaskAttachmentView.vue';
  107. import { CheckCircleOutlined, SyncOutlined, ClockCircleOutlined, CloseCircleOutlined } from '@ant-design/icons-vue';
  108. export default {
  109. components: {
  110. AuthImage,
  111. ApproveTaskAttachmentView,
  112. CheckCircleOutlined, SyncOutlined, ClockCircleOutlined,
  113. CloseCircleOutlined,
  114. },
  115. props: {
  116. processInstanceId: {
  117. type: String,
  118. default: null,
  119. },
  120. recordId: {
  121. type: Number,
  122. default: null,
  123. },
  124. },
  125. emits: ['saveData'],
  126. data: function () {
  127. this.Common = Common;
  128. return {
  129. historyProcessInstanceDescriptions: null,
  130. abandonCount: 0,
  131. className: 'WorkFlow',
  132. loading: false,
  133. };
  134. },
  135. watch: {
  136. recordId: function (currentValue, oldValue) {
  137. this.refreshDebounce();
  138. },
  139. processInstanceId: function (currentValue, oldValue) {
  140. this.refreshDebounce();
  141. },
  142. },
  143. mounted: function () {
  144. var _self = this;
  145. this.refreshDebounce = Common.debounce(() => _self.refresh(), 1000);
  146. this.refreshDebounce();
  147. },
  148. methods: {
  149. /**
  150. * 刷新流程信息
  151. */
  152. refresh: function () {
  153. var _self = this;
  154. _self.historyProcessInstanceDescriptions = null;
  155. _self.abandonCount = 0;
  156. if (_self.recordId == null) {
  157. return;
  158. }
  159. _self.loading = true;
  160. $.ajax({
  161. url: Common.getApiURL(
  162. 'WorkflowResource/listAbandonHistoryProcessInstanceDescription',
  163. ),
  164. type: 'GET',
  165. dataType: 'json',
  166. data: {
  167. excludeProcessInstanceId: _self.processInstanceId,
  168. recordId: _self.recordId,
  169. },
  170. beforeSend: function (request) {
  171. Common.addTokenToRequest(request);
  172. },
  173. success: function (data) {
  174. _self.loading = false;
  175. if (data.errorCode == 0) {
  176. _self.historyProcessInstanceDescriptions = data.datas;
  177. _self.abandonCount = data.total;
  178. } else {
  179. _self.historyProcessInstanceDescriptions = null;
  180. _self.abandonCount = 0;
  181. Notify.error('历史审批记录查询失败', data.errorMessage, false);
  182. }
  183. },
  184. error: function (XMLHttpRequest, textStatus, errorThrown) {
  185. _self.loading = false;
  186. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  187. },
  188. });
  189. },
  190. /**
  191. * 获取评论的图片
  192. * @param {[type]} imageUrl [description]
  193. * @return {[type]} [description]
  194. */
  195. getCommentImageSrc: function (imageUrl) {
  196. console.log(imageUrl);
  197. var realImageUrl = Common.getImageSrc(
  198. this.className,
  199. 'thumbnail/' + imageUrl,
  200. );
  201. return realImageUrl;
  202. },
  203. /**
  204. * 打开图片附件的功能
  205. * @param {[type]} imageName [description]
  206. * @return {[type]} [description]
  207. */
  208. openImageAttachment: function (imageName) {
  209. if (imageName == undefined) {
  210. return;
  211. }
  212. var fullPath = Common.getImageSrc(this.className, imageName);
  213. window.open(fullPath);
  214. },
  215. getTaskCompleteType: function(completeReason){
  216. if(completeReason == 'APPROVE'){
  217. return '审批通过';
  218. }else if(completeReason == 'REJECT'){
  219. return '审批不通过';
  220. }else if(completeReason == 'WITHDRAW'){
  221. return '撤销';
  222. }else{
  223. return '未处理';
  224. }
  225. },
  226. },
  227. };
  228. </script>
  229. <style scoped>
  230. .m-label {
  231. margin-left: 10px;
  232. }
  233. .m-h5 {
  234. display: inline;
  235. }
  236. .m-image {
  237. width: 64px;
  238. height: 64px;
  239. margin-bottom: 0px;
  240. }
  241. .m-image1 {
  242. display: inline !important;
  243. width: 64px;
  244. height: 64px;
  245. cursor: pointer;
  246. margin-right: 5px;
  247. }
  248. .m-media-list{
  249. margin-bottom: 0px;
  250. }
  251. .comment-text{
  252. margin-bottom: 0px;
  253. }
  254. </style>