certsManage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="full-container-p24">
  3. <div class="mb20" style="margin-left: 200px">
  4. <el-button-group class="mr30">
  5. <el-button
  6. :type="type == 0 ? 'primary' : ''"
  7. @click="(currentPage = 1), (type = 0), getCertList()"
  8. >
  9. 已过期
  10. </el-button>
  11. <el-button
  12. :type="type == 1 ? 'primary' : ''"
  13. @click="(currentPage = 1), (type = 1), getCertList()"
  14. >
  15. 当月
  16. </el-button>
  17. <el-button
  18. :type="type == 2 ? 'primary' : ''"
  19. @click="(currentPage = 1), (type = 2), getCertList()"
  20. >
  21. 下月
  22. </el-button>
  23. </el-button-group>
  24. </div>
  25. <div class="df">
  26. <div class="btns mr20 mt50">
  27. <div v-for="(item, index) in certTypes" :key="item.id">
  28. <el-button
  29. :type="certType == item.type ? 'primary' : ''"
  30. @click="
  31. (currentPage = 1),
  32. (certType = item.type),
  33. (currentTypeIndex = index),
  34. (validType = 1);
  35. getCertList();
  36. "
  37. class="btn"
  38. >
  39. {{ item.typeName }}
  40. </el-button>
  41. </div>
  42. </div>
  43. <div>
  44. <el-select
  45. style="width: 240px"
  46. v-if="currentTypeIndex == 1"
  47. v-model="validType"
  48. @change="changeSelect"
  49. class="mb10 tac"
  50. placeholder="有效期类型"
  51. >
  52. <el-option
  53. v-for="item in certTypes[currentTypeIndex].validTypes"
  54. :key="item.type"
  55. :label="item.typeName"
  56. :value="item.type"
  57. />
  58. </el-select>
  59. <el-table border :data="tableData" stripe style="width: 1000px">
  60. <el-table-column
  61. align="center"
  62. type="index"
  63. label="序号"
  64. width="80"
  65. />
  66. <el-table-column
  67. align="center"
  68. prop="shipname"
  69. label="船名"
  70. min-width="120"
  71. />
  72. <el-table-column
  73. v-if="certType == 6"
  74. align="center"
  75. prop="crewName"
  76. label="船员姓名"
  77. min-width="120"
  78. />
  79. <el-table-column
  80. v-if="certType != 6"
  81. align="center"
  82. prop="shipOwnerName"
  83. label="船东姓名"
  84. min-width="120"
  85. />
  86. <el-table-column
  87. v-if="certType != 6"
  88. align="center"
  89. prop="shipOwnerPhone"
  90. label="手机号"
  91. min-width="140"
  92. />
  93. <el-table-column
  94. align="center"
  95. prop="endValidTime"
  96. label="有效期"
  97. min-width="120"
  98. >
  99. <template v-slot="scope">
  100. {{ subTimeStr(scope.row.endValidTime) }}
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" label="详情" min-width="120">
  104. <template #default="scope">
  105. <CrewInfo
  106. v-if="certType == 6"
  107. class="mr10"
  108. :shipCode="route.query.shipCode"
  109. :shipname="scope.row.shipname"
  110. :crewId="scope.row.id"
  111. :crewInfo="scope.row"
  112. btnText="查看"
  113. :isText="true"
  114. disabled
  115. ></CrewInfo>
  116. <el-button
  117. v-else
  118. type="primary"
  119. text
  120. @click="
  121. goToDetail(
  122. scope.row.shipCode,
  123. scope.row.crewName,
  124. scope.row.id
  125. )
  126. "
  127. >
  128. 详情
  129. </el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <div class="df aic jcfe mt40 mr20">
  134. <el-pagination
  135. :current-page="currentPage"
  136. @current-change="pageChange"
  137. background
  138. layout="prev, pager, next"
  139. :total="total"
  140. />
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </template>
  146. <script setup>
  147. import { ref, h, reactive, toRefs, onMounted } from "vue";
  148. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  149. import store from "../../store";
  150. import router from "../../router";
  151. import md5 from "md5";
  152. import api from "../../apis/fetch";
  153. import { useRoute } from "vue-router";
  154. import _ from "lodash";
  155. import { subTimeStr } from "../../utils/utils";
  156. const route = useRoute();
  157. let type = ref(0);
  158. let certType = ref(1);
  159. let tableData = ref([]);
  160. let total = ref(0);
  161. let currentPage = ref(1);
  162. async function getCertList() {
  163. let { data } = await api.getCertList({
  164. type: type.value,
  165. certType: certType.value,
  166. validType: validType.value,
  167. currentPage: currentPage.value,
  168. size: 10,
  169. });
  170. if (data.status == 0) {
  171. total.value = data.total;
  172. tableData.value = data.result;
  173. } else {
  174. total.value = 0;
  175. tableData.value = [];
  176. }
  177. }
  178. function pageChange(e) {
  179. currentPage.value = e;
  180. getCertList();
  181. }
  182. function goToDetail(shipCode, crewName, shipCrewId) {
  183. if (certType.value === 6 && crewName) {
  184. router.push({
  185. path: "/crewManage/crewDetail",
  186. query: {
  187. shipCode,
  188. shipCrewId,
  189. },
  190. });
  191. } else {
  192. router.push({
  193. path: "/shipManage/shipDetail",
  194. query: {
  195. shipCode,
  196. },
  197. });
  198. }
  199. }
  200. let certTypes = ref([
  201. {
  202. validTypes: [],
  203. },
  204. ]);
  205. async function getCertListType() {
  206. let { data } = await api.getCertListType({});
  207. certTypes.value = data.result.filter((item) => {
  208. return item.typeName != "船舶保险";
  209. });
  210. }
  211. let currentTypeIndex = ref(0);
  212. let validType = ref(1);
  213. function changeSelect(e) {
  214. validType.value = e;
  215. getCertList();
  216. }
  217. onMounted(() => {
  218. getCertList();
  219. getCertListType();
  220. });
  221. </script>
  222. <style scoped>
  223. .btn {
  224. height: 50px;
  225. width: 180px;
  226. border-radius: 0;
  227. }
  228. </style>