shipList.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="full-container-p24">
  3. <div style="display: flex; justify-content: space-between">
  4. <div style="display: flex">
  5. <el-input
  6. placeholder="请输入船名/MMSI/手机号"
  7. prefix-icon="el-icon-search"
  8. v-model="term"
  9. clearable
  10. style="height: 32px; width: 330px; line-height: 32px"
  11. ></el-input>
  12. <div class="seach-btn" @click="getShipList(1)">查询</div>
  13. </div>
  14. </div>
  15. <div style="margin-top: 24px">
  16. <el-table :data="tableData" stripe style="width: 100%">
  17. <el-table-column
  18. type="index"
  19. label="序号"
  20. min-width="80"
  21. align="center"
  22. ></el-table-column>
  23. <el-table-column
  24. prop="shipname"
  25. label="船舶名称"
  26. min-width="100"
  27. align="center"
  28. ></el-table-column>
  29. <el-table-column
  30. prop="mmsi"
  31. label="MMSI"
  32. min-width="100"
  33. align="center"
  34. ></el-table-column>
  35. <el-table-column
  36. prop="length"
  37. label="船长(米)"
  38. min-width="100"
  39. align="center"
  40. ></el-table-column>
  41. <el-table-column
  42. prop="breadth"
  43. label="船宽(米)"
  44. min-width="100"
  45. align="center"
  46. ></el-table-column>
  47. <el-table-column
  48. prop="draught"
  49. label="吃水(米)"
  50. min-width="100"
  51. align="center"
  52. ></el-table-column>
  53. <el-table-column
  54. prop="loadTons"
  55. label="载货吨位(吨)"
  56. min-width="100"
  57. align="center"
  58. ></el-table-column>
  59. <el-table-column
  60. prop="createTime"
  61. label="入驻时间"
  62. min-width="200"
  63. align="center"
  64. ></el-table-column>
  65. <el-table-column label="操作" min-width="80" align="center">
  66. <template v-slot="scope">
  67. <el-button
  68. @click="shipDetail(scope.row.code)"
  69. type="primary"
  70. text
  71. size="small"
  72. >
  73. 查看详情
  74. </el-button>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <div style="width: 100%; text-align: right; margin-top: 43px">
  79. <el-pagination
  80. background
  81. layout="prev, pager, next"
  82. :current-page="currentPage"
  83. :total="total"
  84. @current-change="pageChange"
  85. ></el-pagination>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script setup>
  91. import { ref, h, reactive, toRefs, onMounted } from "vue";
  92. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  93. import store from "../../store";
  94. import router from "../../router";
  95. import md5 from "md5";
  96. import api from "../../apis/fetch";
  97. let currentPage = ref(1);
  98. let term = ref("");
  99. let tableData = ref([]);
  100. let total = ref(0);
  101. async function getShipList(page) {
  102. currentPage.value = page || currentPage.value;
  103. let res = await api.getShipList({
  104. currentPage: currentPage.value,
  105. size: 10,
  106. term: term.value,
  107. });
  108. if (res.data.status == 0) {
  109. tableData.value = res.data.result;
  110. total.value = res.data.total;
  111. } else {
  112. tableData.value = [];
  113. total.value = 0;
  114. }
  115. }
  116. async function shipDetail(shipCode) {
  117. router.push({
  118. path: "/shipManage/shipDetail",
  119. query: {
  120. shipCode,
  121. },
  122. });
  123. }
  124. function pageChange(e) {
  125. currentPage.value = e;
  126. getShipList();
  127. }
  128. onMounted(() => {
  129. getShipList();
  130. });
  131. </script>
  132. <style scoped>
  133. .seach-btn {
  134. display: inline-block;
  135. width: 60px;
  136. height: 38px;
  137. background: #0094fe;
  138. border-radius: 2px;
  139. font-size: 14px;
  140. font-family: PingFangSC-Regular, PingFang SC;
  141. font-weight: 400;
  142. color: #ffffff;
  143. text-align: center;
  144. line-height: 38px;
  145. margin-left: 10px;
  146. cursor: pointer;
  147. }
  148. .cargo-owner-add {
  149. width: 80px;
  150. height: 32px;
  151. border-radius: 2px;
  152. border: 1px solid #0094fe;
  153. font-size: 14px;
  154. font-family: PingFangSC-Regular, PingFang SC;
  155. font-weight: 400;
  156. color: #0094fe;
  157. line-height: 32px;
  158. text-align: center;
  159. cursor: pointer;
  160. }
  161. :deep().el-dialog {
  162. width: 560px;
  163. padding: 20px 50px;
  164. border-radius: 6px;
  165. }
  166. :deep() .el-dialog__title {
  167. font-size: 18px;
  168. font-family: PingFangSC-Regular, PingFang SC;
  169. font-weight: 400;
  170. color: #0094fe;
  171. }
  172. </style>