NotApproveWorkflow.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <a-row type="flex" justify="space-between">
  3. <a-col>
  4. <a-input-search
  5. v-model:value="searchParams.condition"
  6. :placeholder="$t('lang.NeedApproveWorkflow.describe1')"
  7. enter-button="搜索"
  8. allow-clear
  9. style="width: 300px"
  10. @search="queryDatas"
  11. />
  12. </a-col>
  13. <a-col>
  14. <WorkflowType @get-type="getTypeNo" />
  15. <WorkflowSearch :function-type="6" @get-search-params="searchWorkflow" />
  16. </a-col>
  17. </a-row>
  18. <a-table
  19. sticky
  20. bordered
  21. :pagination="false"
  22. :columns="approveColumns"
  23. :data-source="notApproveDatas"
  24. >
  25. <template #bodyCell="{ column, record }">
  26. <template v-if="column.key === 'description'">
  27. <span style="white-space: pre-line">{{ record.content }}</span>
  28. </template>
  29. <template v-if="column.key === 'documentStatus'">
  30. <a-tag v-if="record.documentStatus === '已完成'" color="success">
  31. 已完成
  32. </a-tag>
  33. <a-tag v-if="record.documentStatus === '进行中'" color="processing">
  34. 进行中
  35. </a-tag>
  36. </template>
  37. <template v-if="column.key === 'operation'">
  38. <a-button type="link" @click="selectTaskInfo(record)">
  39. {{ $t("lang.NeedApproveWorkflow.viewTasks") }}
  40. </a-button>
  41. </template>
  42. </template>
  43. <template v-if="notApproveDatas.length > 0 && isShowMore" #footer>
  44. <div style="text-align: center">
  45. <a-button type="link" @click="loadMore">加载更多</a-button>
  46. </div>
  47. </template>
  48. </a-table>
  49. <Loading v-if="isLoading" />
  50. <CustomerTask
  51. ref="customerTask"
  52. :task-id="selectedTaskId"
  53. @closed="() => searchDatas"
  54. />
  55. </template>
  56. <script setup>
  57. import { ref, reactive, defineEmits, onMounted } from 'vue';
  58. import Common from '../common/Common';
  59. import WorkflowType from './WorkflowType.vue';
  60. import WorkflowSearch from './WorkflowSearch.vue';
  61. import { ajaxApi } from '../api/workflow/workflow.js';
  62. import { message } from 'ant-design-vue';
  63. import { approvedColumns } from './configData.js';
  64. import TaskOpenUtil from './TaskOpenUtil.js';
  65. import WindowService from '../common/WindowService.js';
  66. import CustomerTask from './CustomerTask.vue';
  67. import { Notify } from 'pc-component-v3';
  68. const emit = defineEmits(['refreshStasticCount']);
  69. const customerTask = ref(null);
  70. const selectedTaskId = ref(null);
  71. const isLoading = ref(false);
  72. const isShowMore = ref(true);
  73. const notApproveDatas = ref([]);
  74. const approveColumns = ref(approvedColumns);
  75. const searchParams = ref({});
  76. const filterParams = ref({});
  77. const pager = reactive({
  78. start: 0,
  79. length: 10,
  80. });
  81. onMounted(() => {
  82. searchDatas();
  83. });
  84. // 查询条件时从0开始
  85. const queryDatas = () => {
  86. pager.start = 0;
  87. isShowMore.value = true;
  88. searchDatas(true);
  89. };
  90. // 加载更多时push
  91. const loadMore = () => {
  92. pager.start += 10;
  93. searchDatas();
  94. };
  95. // 查询
  96. const searchDatas = isSearch => {
  97. const params = { ...searchParams.value, ...filterParams.value, ...pager };
  98. searchApprove(params, isSearch);
  99. };
  100. // 获取类型no
  101. const getTypeNo = windowNo => {
  102. pager.start = 0;
  103. isShowMore.value = true;
  104. searchParams.value.windowNo = windowNo;
  105. searchDatas(true);
  106. };
  107. // 通过高级查询搜索
  108. const searchWorkflow = value => {
  109. pager.start = 0;
  110. isShowMore.value = true;
  111. filterParams.value = value;
  112. searchDatas(true);
  113. };
  114. // 查询数据API
  115. const searchApprove = (params, isSearch) => {
  116. isLoading.value = true;
  117. const url = 'api/WorkflowResource/refuse';
  118. ajaxApi(url, params).then(
  119. success => {
  120. if (success.errorCode === 0) {
  121. if (success.datas && success.datas.length > 0) {
  122. success.datas.forEach(item => {
  123. item.content = parseContent(item.content);
  124. if (!isSearch) {
  125. notApproveDatas.value.push(item);
  126. }
  127. });
  128. if (isSearch) {
  129. notApproveDatas.value = success.datas;
  130. }
  131. } else {
  132. if (!isSearch) {
  133. message.info('没有更多数据了。');
  134. isShowMore.value = false;
  135. isLoading.value = false;
  136. return;
  137. }
  138. notApproveDatas.value = [];
  139. }
  140. } else {
  141. message.warning(success.errorMessage);
  142. }
  143. isLoading.value = false;
  144. },
  145. error => {
  146. isLoading.value = false;
  147. Common.processException(error);
  148. },
  149. );
  150. };
  151. // 选择了taskInfo
  152. const selectTaskInfo = taskInfo => {
  153. TaskOpenUtil.openTask(taskInfo).then(
  154. successData => {
  155. if (successData.type === 'newWindow') {
  156. WindowService.open(successData.url, '待处理', function () {
  157. searchDatas();
  158. emit('refreshStasticCount');
  159. });
  160. } else if (successData.type === 'customerTask') {
  161. // 打开自定义的界面
  162. selectedTaskId.value = taskInfo.id;
  163. customerTask.value.show();
  164. searchDatas();
  165. emit('refreshStasticCount');
  166. }
  167. },
  168. errorData => {
  169. if (errorData != null) {
  170. Notify.error(errorData.title, errorData.message, false);
  171. }
  172. },
  173. );
  174. };
  175. // 处理content json
  176. const parseContent = content => {
  177. const x = content;
  178. try {
  179. let content = JSON.parse(x);
  180. let parentForm = '';
  181. if (content != null && content.parentForm != null) {
  182. content.parentForm.forEach(item => {
  183. parentForm = parentForm + item.title + ':' + item.content + ',\n';
  184. });
  185. return parentForm;
  186. } else {
  187. return null;
  188. }
  189. // eslint-disable-next-line no-empty
  190. } catch (e) {}
  191. };
  192. </script>
  193. <style scoped>
  194. .ant-table-wrapper {
  195. margin-top: 8px;
  196. }
  197. </style>