shipList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="full-container">
  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">查询</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="120"
  27. align="center"
  28. ></el-table-column>
  29. <el-table-column
  30. prop="mmsi"
  31. label="MMSI"
  32. min-width="160"
  33. align="center"
  34. ></el-table-column>
  35. <el-table-column
  36. prop="length"
  37. label="船长(米)"
  38. min-width="120"
  39. align="center"
  40. ></el-table-column>
  41. <el-table-column
  42. prop="breadth"
  43. label="船宽(米)"
  44. min-width="160"
  45. align="center"
  46. ></el-table-column>
  47. <el-table-column
  48. prop="draught"
  49. label="吃水(米)"
  50. min-width="120"
  51. align="center"
  52. ></el-table-column>
  53. <el-table-column
  54. prop="loadTons"
  55. label="载货吨位(吨)"
  56. min-width="160"
  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.shipId, tableData)"
  69. type="text"
  70. size="small"
  71. >
  72. 查看详情
  73. </el-button>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. <div style="width: 100%; text-align: right; margin-top: 43px">
  78. <el-pagination
  79. background
  80. layout="prev, pager, next"
  81. :total="total"
  82. @current-change="pageChange"
  83. ></el-pagination>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. import { ref, h, reactive, toRefs, onMounted } from "vue";
  90. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  91. import store from "../../store";
  92. import router from "../../router";
  93. import md5 from "md5";
  94. import api from "../../apis/fetch";
  95. export default {
  96. setup() {
  97. let currentPage = ref(1);
  98. let term = ref();
  99. let tableData = ref();
  100. let total = ref();
  101. async function getShipList() {
  102. tableData.value = [];
  103. let res = await api.getShipList({
  104. currentPage: currentPage.value,
  105. size: 10,
  106. term: term.value,
  107. });
  108. term.value = "";
  109. if (res.data.status == 0) {
  110. tableData.value = res.data.result;
  111. total.value = res.data.total;
  112. }
  113. }
  114. async function shipDetail(shipId) {
  115. router.push({
  116. path: "/shipInfo/shipDetail",
  117. query: {
  118. shipId,
  119. },
  120. });
  121. }
  122. function pageChange(e) {
  123. currentPage.value = e;
  124. getShipList();
  125. }
  126. getShipList();
  127. onMounted(() => {});
  128. return {
  129. currentPage,
  130. term,
  131. tableData,
  132. total,
  133. getShipList,
  134. shipDetail,
  135. pageChange,
  136. };
  137. },
  138. };
  139. </script>
  140. <style scoped>
  141. .seach-btn {
  142. display: inline-block;
  143. width: 60px;
  144. height: 38px;
  145. background: #0094fe;
  146. border-radius: 2px;
  147. font-size: 14px;
  148. font-family: PingFangSC-Regular, PingFang SC;
  149. font-weight: 400;
  150. color: #ffffff;
  151. text-align: center;
  152. line-height: 38px;
  153. margin-left: 10px;
  154. cursor: pointer;
  155. }
  156. .cargo-owner-add {
  157. width: 80px;
  158. height: 32px;
  159. border-radius: 2px;
  160. border: 1px solid #0094fe;
  161. font-size: 14px;
  162. font-family: PingFangSC-Regular, PingFang SC;
  163. font-weight: 400;
  164. color: #0094fe;
  165. line-height: 32px;
  166. text-align: center;
  167. cursor: pointer;
  168. }
  169. :deep().el-dialog {
  170. width: 560px;
  171. padding: 20px 50px;
  172. border-radius: 6px;
  173. }
  174. :deep() .el-dialog__title {
  175. font-size: 18px;
  176. font-family: PingFangSC-Regular, PingFang SC;
  177. font-weight: 400;
  178. color: #0094fe;
  179. }
  180. </style>