index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '新增',
  14. action: () => clickAdd(),
  15. },
  16. ]"
  17. @get-list="getList"
  18. @clickReset="clickReset">
  19. <template #code="{ item }">
  20. <div>
  21. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  22. </div>
  23. </template>
  24. </byTable>
  25. </el-card>
  26. </div>
  27. </template>
  28. <script setup>
  29. import byTable from "@/components/byTable/index";
  30. const { proxy } = getCurrentInstance();
  31. const flowStatus = ref([
  32. {
  33. dictKey: "0",
  34. dictValue: "未发起",
  35. },
  36. {
  37. dictKey: "1",
  38. dictValue: "进行中",
  39. },
  40. {
  41. dictKey: "2",
  42. dictValue: "已通过",
  43. },
  44. {
  45. dictKey: "3",
  46. dictValue: "已驳回",
  47. },
  48. {
  49. dictKey: "4",
  50. dictValue: "已采购",
  51. },
  52. ]);
  53. const sourceList = ref({
  54. data: [],
  55. pagination: {
  56. total: 0,
  57. pageNum: 1,
  58. pageSize: 10,
  59. code: "",
  60. flowStatus: "",
  61. beginTime: "",
  62. endTime: "",
  63. },
  64. });
  65. const loading = ref(false);
  66. const searchConfig = computed(() => {
  67. return [
  68. {
  69. type: "input",
  70. prop: "code",
  71. label: "申购单号",
  72. },
  73. {
  74. type: "select",
  75. prop: "flowStatus",
  76. data: flowStatus.value,
  77. label: "流程状态",
  78. },
  79. {
  80. type: "date",
  81. propList: ["beginTime", "endTime"],
  82. label: "申购日期",
  83. },
  84. ];
  85. });
  86. const config = computed(() => {
  87. return [
  88. {
  89. attrs: {
  90. label: "申购单号",
  91. slot: "code",
  92. width: 220,
  93. },
  94. },
  95. {
  96. attrs: {
  97. label: "申购时间",
  98. prop: "applyTime",
  99. align: "center",
  100. width: 160,
  101. },
  102. },
  103. {
  104. attrs: {
  105. label: "申购人",
  106. prop: "applyName",
  107. width: 160,
  108. },
  109. },
  110. {
  111. attrs: {
  112. label: "状态",
  113. prop: "flowStatus",
  114. width: 160,
  115. },
  116. render(val) {
  117. return proxy.dictKeyValue(val, flowStatus.value);
  118. },
  119. },
  120. {
  121. attrs: {
  122. label: "申购说明",
  123. prop: "remark",
  124. },
  125. },
  126. {
  127. attrs: {
  128. label: "操作",
  129. width: 80,
  130. align: "center",
  131. fixed: "right",
  132. },
  133. renderHTML(row) {
  134. return [
  135. row.flowStatus == "0"
  136. ? {
  137. attrs: {
  138. label: "编辑",
  139. type: "primary",
  140. text: true,
  141. },
  142. el: "button",
  143. click() {
  144. clickUpdate(row);
  145. },
  146. }
  147. : {},
  148. ];
  149. },
  150. },
  151. ];
  152. });
  153. const getList = async (req, status) => {
  154. if (status) {
  155. sourceList.value.pagination = {
  156. pageNum: sourceList.value.pagination.pageNum,
  157. pageSize: sourceList.value.pagination.pageSize,
  158. };
  159. } else {
  160. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  161. }
  162. loading.value = true;
  163. proxy.post("/applyBuy/page", sourceList.value.pagination).then((res) => {
  164. sourceList.value.data = res.rows;
  165. sourceList.value.pagination.total = res.total;
  166. setTimeout(() => {
  167. loading.value = false;
  168. }, 200);
  169. });
  170. };
  171. getList();
  172. const clickReset = () => {
  173. getList("", true);
  174. };
  175. const clickAdd = () => {
  176. proxy.$router.replace({
  177. path: "/platform_manage/process/processApproval",
  178. query: {
  179. flowKey: "apply_buy",
  180. flowName: "申购流程",
  181. random: proxy.random(),
  182. },
  183. });
  184. };
  185. const clickCode = (item) => {
  186. proxy.$router.replace({
  187. path: "/platform_manage/process/processApproval",
  188. query: {
  189. flowKey: "apply_buy",
  190. flowName: "申购流程",
  191. processType: '20',
  192. id: item.id,
  193. flowId: item.flowId,
  194. random: proxy.random(),
  195. },
  196. });
  197. };
  198. const clickUpdate = (item) => {
  199. proxy.$router.replace({
  200. path: "/platform_manage/process/processApproval",
  201. query: {
  202. flowKey: "apply_buy",
  203. flowName: "申购流程",
  204. processType: '40',
  205. id: item.id,
  206. random: proxy.random(),
  207. },
  208. });
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. ::v-deep(.el-input-number .el-input__inner) {
  213. text-align: left;
  214. }
  215. </style>