Prechádzať zdrojové kódy

新增 进入页面初始化表格数据

wangzhihui 4 rokov pred
rodič
commit
76530b06f8

+ 7 - 6
src/views/cargoOwnerManage/cargoOwnerDetail.vue

@@ -152,12 +152,12 @@ export default {
       }
     }
     getUserDetail();
-
-    async function getVoyageList(status) {
+    getVoyageList();
+    async function getVoyageList() {
       let res = await api.getVoyageList({
         cargoOwnerId: route.query.userId,
         shipId: 0,
-        status,
+        status: status.value,
         term: term.value,
         currentPage: currentPage.value,
         size: 10,
@@ -165,9 +165,10 @@ export default {
 
       console.log(res);
     }
-    function changeVoyageType(status) {
-      currentbtn.value = status == 1;
-      getVoyageList(status);
+    function changeVoyageType(s) {
+      currentbtn.value = s == 1;
+      status.value = s;
+      getVoyageList();
     }
 
     function pageChange(e) {

+ 1 - 0
src/views/cargoOwnerManage/cargoOwnerList.vue

@@ -211,6 +211,7 @@ export default {
       currentPage.value = e;
       getCargoOwnerList();
     }
+    getCargoOwnerList();
     onMounted(() => {});
     return {
       currentPage,

+ 1 - 0
src/views/shipOwnerManage/shipOwnerList.vue

@@ -99,6 +99,7 @@ export default {
       currentPage.value = e;
       getShipOwnerList();
     }
+    getShipOwnerList();
     onMounted(() => {});
     return {
       currentPage,

+ 53 - 30
src/views/voyage/voyageList.vue

@@ -1,36 +1,38 @@
 <template>
   <div class="full-container-p24">
-    <div class="df aic">
-      <div
-        @click="changeVoyageType(1)"
-        :class="
-          currentbtn
-            ? 'currentbtn radio-btns left-radius'
-            : 'radio-btns left-radius'
-        "
-      >
-        执行中航次
+    <div style="display: flex; justify-content: space-between">
+      <div class="df aic">
+        <div
+          @click="changeVoyageType(1)"
+          :class="
+            currentbtn
+              ? 'currentbtn radio-btns left-radius'
+              : 'radio-btns left-radius'
+          "
+        >
+          执行中航次
+        </div>
+        <div
+          @click="changeVoyageType(2)"
+          :class="
+            currentbtn
+              ? ' radio-btns right-radius'
+              : 'radio-btns right-radius currentbtn'
+          "
+          style="margin-right: 40px"
+        >
+          历史航次
+        </div>
+        <el-input
+          placeholder="请输入货主名称/联系人/联系人手机号"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          style="height: 32px; width: 330px; line-height: 32px"
+        ></el-input>
+        <div class="seach-btn" @click="getVoyageList()">查询</div>
       </div>
-      <div
-        @click="changeVoyageType(2)"
-        :class="
-          currentbtn
-            ? ' radio-btns right-radius'
-            : 'radio-btns right-radius currentbtn'
-        "
-        style="margin-right: 40px"
-      >
-        历史航次
-      </div>
-      <el-input
-        placeholder="请输入货主名称/联系人/联系人手机号"
-        prefix-icon="el-icon-search"
-        v-model="term"
-        style="height: 32px; width: 330px; line-height: 32px"
-      ></el-input>
-      <div class="seach-btn" @click="getVoyageList()">查询</div>
+      <div class="voyage-add" @click="goToVoyageAdd">添加航次</div>
     </div>
-
     <el-table :data="tableData" stripe style="width: 100%; margin-top: 24px">
       <el-table-column
         type="index"
@@ -149,7 +151,13 @@ export default {
     }
     function pageChange(e) {
       currentPage.value = e;
-      getVoyageList(status.value);
+      getVoyageList();
+    }
+
+    function goToVoyageAdd() {
+      router.push({
+        path: "/voyage/voyageAdd",
+      });
     }
     onMounted(() => {});
     return {
@@ -162,6 +170,7 @@ export default {
       getVoyageList,
       voyageDetail,
       pageChange,
+      goToVoyageAdd,
     };
   },
 };
@@ -282,4 +291,18 @@ export default {
 :deep().el-input__icon {
   line-height: 100% !important;
 }
+
+.voyage-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
 </style>