NotApproveWorkflow.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 CustomerTask from './CustomerTask.vue';
  65. import { Uuid } from 'pc-component-v3';
  66. const emit = defineEmits(['refreshStasticCount']);
  67. const customerTask = ref(null);
  68. const selectedTaskId = ref(null);
  69. const isLoading = ref(false);
  70. const isShowMore = ref(true);
  71. const notApproveDatas = ref([]);
  72. const approveColumns = ref(approvedColumns);
  73. const searchParams = ref({});
  74. const filterParams = ref({});
  75. const pager = reactive({
  76. start: 0,
  77. length: 10,
  78. });
  79. onMounted(() => {
  80. searchDatas();
  81. });
  82. // 查询条件时从0开始
  83. const queryDatas = () => {
  84. pager.start = 0;
  85. isShowMore.value = true;
  86. searchDatas(true);
  87. };
  88. // 加载更多时push
  89. const loadMore = () => {
  90. pager.start += 10;
  91. searchDatas();
  92. };
  93. // 查询
  94. const searchDatas = isSearch => {
  95. const params = { ...searchParams.value, ...filterParams.value, ...pager };
  96. searchApprove(params, isSearch);
  97. };
  98. // 获取类型no
  99. const getTypeNo = windowNo => {
  100. pager.start = 0;
  101. isShowMore.value = true;
  102. searchParams.value.windowNo = windowNo;
  103. searchDatas(true);
  104. };
  105. // 通过高级查询搜索
  106. const searchWorkflow = value => {
  107. pager.start = 0;
  108. isShowMore.value = true;
  109. filterParams.value = value;
  110. searchDatas(true);
  111. };
  112. // 查询数据API
  113. const searchApprove = (params, isSearch) => {
  114. isLoading.value = true;
  115. const url = 'api/WorkflowResource/refuse';
  116. ajaxApi(url, params).then(
  117. success => {
  118. if (success.errorCode === 0) {
  119. if (success.datas && success.datas.length > 0) {
  120. success.datas.forEach(item => {
  121. item.content = parseContent(item.content);
  122. if (!isSearch) {
  123. notApproveDatas.value.push(item);
  124. }
  125. });
  126. if (isSearch) {
  127. notApproveDatas.value = success.datas;
  128. }
  129. } else {
  130. if (!isSearch) {
  131. message.info('没有更多数据了。');
  132. isShowMore.value = false;
  133. isLoading.value = false;
  134. return;
  135. }
  136. notApproveDatas.value = [];
  137. }
  138. } else {
  139. message.warning(success.errorMessage);
  140. }
  141. isLoading.value = false;
  142. },
  143. error => {
  144. isLoading.value = false;
  145. Common.processException(error);
  146. },
  147. );
  148. };
  149. // 选择了taskInfo
  150. const selectTaskInfo = taskInfo => {
  151. const type = 'view';
  152. const windowNo = taskInfo.windowNo;
  153. const tabIndex = taskInfo.tabIndex;
  154. const recordId = taskInfo.recordId;
  155. const url =
  156. '/desktop/window/window-read/' +
  157. type +
  158. '/' +
  159. windowNo +
  160. '/' +
  161. tabIndex +
  162. '/' +
  163. recordId +
  164. '?workflowType=approve&taskInfoId=' +
  165. taskInfo.id +
  166. '&currIndex=1&totalCount=1&canGoBack=false&uuid=' +
  167. Uuid.createUUID();
  168. window.open(Common.getRedirectUrl('#' + url));
  169. };
  170. // 处理content json
  171. const parseContent = content => {
  172. const x = content;
  173. try {
  174. let content = JSON.parse(x);
  175. let parentForm = '';
  176. if (content != null && content.parentForm != null) {
  177. content.parentForm.forEach(item => {
  178. parentForm = parentForm + item.title + ':' + item.content + ',\n';
  179. });
  180. return parentForm;
  181. } else {
  182. return null;
  183. }
  184. // eslint-disable-next-line no-empty
  185. } catch (e) {}
  186. };
  187. </script>
  188. <style scoped>
  189. .ant-table-wrapper {
  190. margin-top: 8px;
  191. }
  192. </style>