index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div>
  3. <div style="margin: 10px 0; display: flex; align-items: center">
  4. <el-input
  5. class="input_content"
  6. placeholder="请输入内容"
  7. v-model="sourceList.pagination.keyword"
  8. style="width: 90%"
  9. clearable
  10. size="small"
  11. ></el-input>
  12. <div style="text-align: center; width: 10%">
  13. <el-icon style="cursor: pointer" @click="getData"><Search /></el-icon>
  14. </div>
  15. </div>
  16. <el-table
  17. :data="sourceList.data"
  18. style="width: 100%; margin-top: 10px"
  19. v-loading="loading"
  20. :height="tableHeight"
  21. >
  22. <el-table-column
  23. prop="buyCorporationName"
  24. label="客户"
  25. min-width="120"
  26. fixed="left"
  27. />
  28. <el-table-column prop="code" label="主合同号" width="100" />
  29. <el-table-column prop="amount" label="货运" min-width="150">
  30. <template #default="{ row }">
  31. <div style="color: #409eff" v-if="row.acceptCode">
  32. {{ row.acceptCarriage }} ({{ row.acceptCode }})
  33. </div>
  34. </template>
  35. </el-table-column>
  36. <!-- <el-table-column label="操作" width="60" fixed="right" align="center">
  37. <template #default="{ row }">
  38. <el-button type="primary" text
  39. ><i class="iconfont icon-iconm_wofqd"></i
  40. ></el-button>
  41. </template>
  42. </el-table-column> -->
  43. </el-table>
  44. <el-pagination
  45. style="margin-top: 10px"
  46. v-model:current-page="sourceList.pagination.pageNum"
  47. :page-size="10"
  48. layout="total, prev, pager, next"
  49. :total="sourceList.pagination.total"
  50. prev-text="上一页"
  51. next-text="下一页"
  52. @current-change="handleCurrentChange"
  53. />
  54. </div>
  55. </template>
  56. <script setup>
  57. const tableHeight = window.innerHeight - 209;
  58. const loading = ref(false);
  59. const sourceList = ref({
  60. data: [],
  61. pagination: {
  62. total: 300,
  63. pageNum: 1,
  64. pageSize: 10,
  65. },
  66. });
  67. const { proxy } = getCurrentInstance();
  68. const getData = () => {
  69. loading.value = true;
  70. proxy.post("/documents/page", sourceList.value.pagination).then((res) => {
  71. sourceList.value.data = res.rows;
  72. sourceList.value.pagination.total = res.total;
  73. setTimeout(() => {
  74. loading.value = false;
  75. }, 200);
  76. });
  77. };
  78. const handleCurrentChange = (val) => {
  79. sourceList.value.pagination.pageNum = val;
  80. getData();
  81. };
  82. getData();
  83. onMounted(() => {});
  84. </script>
  85. <style lang="scss" scoped>
  86. * {
  87. font-size: 12px;
  88. }
  89. .el-button {
  90. padding: 0px;
  91. }
  92. .btn {
  93. width: 100%;
  94. border-radius: 10px;
  95. padding: 6px 10px;
  96. height: 24px;
  97. }
  98. .el-pagination {
  99. padding-left: 30px;
  100. }
  101. :deep(.el-pagination button, .el-pager li) {
  102. font-size: 12px;
  103. }
  104. :deep(.el-table .el-table__cell) {
  105. padding: 2px 0px;
  106. }
  107. </style>