capital-modal.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <script setup lang="ts">
  2. import { ref, unref } from "vue";
  3. import { ElTable } from "element-plus";
  4. import { useAsync } from "/@/hooks";
  5. import { httpTradeList } from "/@/api/InvoiceSales/refund";
  6. import { CAPITAL_COLUMNS, tableColumns } from "/@/utils/details/tragelog";
  7. const visible = ref(false);
  8. const selectOrder = ref<Array<Record<string, string>>>([]);
  9. const columns = CAPITAL_COLUMNS.filter(({ field }) => field !== "status");
  10. const emit = defineEmits(["on-add-order"]);
  11. const tableRef = ref<InstanceType<typeof ElTable>>(null);
  12. const { run, data, loading, pagination } = useAsync({
  13. initalData: [],
  14. isList: true,
  15. initalPagination: {
  16. currentPage: 1,
  17. pageSize: 15,
  18. total: 0
  19. }
  20. });
  21. const params = ref({
  22. tradNo: "",
  23. logNo: ""
  24. });
  25. const requestPaymentlist = () => {
  26. const { pageSize: size, currentPage: page } = pagination;
  27. run(httpTradeList({ status: "2", ...params.value, page, size }));
  28. };
  29. function handleConfirm() {
  30. visible.value = false;
  31. emit("on-add-order", unref(selectOrder.value[0]));
  32. }
  33. function handleSelectionChange(values) {
  34. if (values.length > 1) {
  35. const value = values.pop();
  36. tableRef.value.clearSelection();
  37. tableRef.value.toggleRowSelection(value, true);
  38. selectOrder.value = [value];
  39. } else {
  40. selectOrder.value = [values[0]];
  41. }
  42. }
  43. function onSearch(_isReset = false) {
  44. if (_isReset) {
  45. params.value = {
  46. tradNo: "",
  47. logNo: ""
  48. };
  49. }
  50. pagination.currentPage = 1;
  51. requestPaymentlist();
  52. }
  53. function handleSizeChange() {
  54. pagination.currentPage = 1;
  55. requestPaymentlist();
  56. }
  57. defineExpose({
  58. onDisplay: () => (visible.value = true)
  59. });
  60. </script>
  61. <template>
  62. <el-dialog
  63. :close-on-click-modal="false"
  64. v-model="visible"
  65. title="资金认领"
  66. center
  67. @open="() => requestPaymentlist()"
  68. >
  69. <div flex mb-2>
  70. <div flex flex-1 gap="5" pr="20px">
  71. <el-input placeholder="资金编码" size="small" v-model="params.tradNo" />
  72. <el-input placeholder="认领编码" size="small" v-model="params.logNo" />
  73. </div>
  74. <div flex width="120px">
  75. <el-button size="small" type="primary" @click="() => onSearch()"
  76. >搜索</el-button
  77. >
  78. <el-button size="small" @click="() => onSearch(true)">重置</el-button>
  79. </div>
  80. </div>
  81. <el-table
  82. border
  83. ref="tableRef"
  84. :data="data"
  85. size="small"
  86. row-key="id"
  87. @selection-change="handleSelectionChange"
  88. v-loading="loading"
  89. max-height="520px"
  90. >
  91. <el-table-column type="selection" align="center" width="40" />
  92. <el-table-column
  93. v-for="{ field, label, width } in tableColumns"
  94. :key="field"
  95. :prop="field"
  96. :label="label"
  97. :width="width"
  98. show-overflow-tooltip
  99. />
  100. </el-table>
  101. <div flex justify-between mt-2>
  102. <el-pagination
  103. :total="pagination.total"
  104. v-model:current-page="pagination.currentPage"
  105. v-model:page-size="pagination.pageSize"
  106. @current-change="requestPaymentlist"
  107. @size-change="handleSizeChange"
  108. layout="sizes, prev, pager, next"
  109. :page-sizes="[15, 50, 100]"
  110. />
  111. <el-button type="primary" size="small" @click="handleConfirm"
  112. >确定</el-button
  113. >
  114. </div>
  115. </el-dialog>
  116. </template>
  117. <style lang="scss" scoped>
  118. :deep(.el-table__header) {
  119. .el-checkbox {
  120. display: none;
  121. }
  122. }
  123. </style>