Quellcode durchsuchen

更新 优化分页,数据显示

wzh vor 3 Jahren
Ursprung
Commit
55385f66dd

+ 13 - 6
src/views/agencyManage/agencyCompanyDetail.vue

@@ -28,7 +28,7 @@
           clearable
           style="height: 32px; width: 330px; line-height: 32px"
         ></el-input>
-        <div class="seach-btn" @click="getAgencySubAccountList">查询</div>
+        <div class="seach-btn" @click="getAgencySubAccountList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加代理子账户
@@ -92,6 +92,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -181,6 +182,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage2"
           :total="total2"
           @current-change="pageChange2"
         ></el-pagination>
@@ -250,8 +252,8 @@ let currentPage = ref(1);
 let term = ref("");
 let tableData = ref([]);
 let total = ref(0);
-async function getAgencySubAccountList() {
-  tableData.value = [];
+async function getAgencySubAccountList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getAgencySubAccountList({
     currentPage: currentPage.value,
     size: 10,
@@ -261,6 +263,9 @@ async function getAgencySubAccountList() {
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 
@@ -291,18 +296,20 @@ let total2 = ref(0);
 let dialogFormVisible2 = ref(false);
 let form2 = ref(null);
 
-async function getCargoOwnerCompanyByAgencyCompany() {
-  tableData2.value = [];
+async function getCargoOwnerCompanyByAgencyCompany(page) {
+  currentPage2.value = page || currentPage2.value;
   let res = await api.getCargoOwnerCompanyByAgencyCompany({
     proxyId: route.query.id,
     currentPage: currentPage2.value,
     size: 10,
     term: term2.value,
   });
-  term2.value = "";
   if (res.data.status == 0) {
     tableData2.value = res.data.result;
     total2.value = res.data.total;
+  } else {
+    tableData2.value = [];
+    total2.value = 0;
   }
 }
 let cargoOwnerCompanyStr = ref("");

+ 8 - 4
src/views/agencyManage/agencyCompanyList.vue

@@ -9,7 +9,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getAgencyCompanyList">查询</div>
+        <div class="seach-btn" @click="getAgencyCompanyList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加代理公司
@@ -105,6 +105,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -142,17 +143,20 @@ const rules = ref({
     { min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
   ],
 });
-async function getAgencyCompanyList() {
-  tableData.value = [];
+async function getAgencyCompanyList(page) {
+  currentPage.value = page || currentPage.value;
+
   let res = await api.getAgencyCompanyList({
     currentPage: currentPage.value,
     size: 10,
     term: term.value,
   });
-  term.value = "";
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 function resetForm() {

+ 13 - 7
src/views/cargoOwnerManage/cargoOwnerCompanyDetail.vue

@@ -28,7 +28,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getCargoOwnerAccountList">查询</div>
+        <div class="seach-btn" @click="getCargoOwnerAccountList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加账号
@@ -144,6 +144,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -232,6 +233,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage2"
           :total="total2"
           @current-change="pageChange2"
         ></el-pagination>
@@ -272,18 +274,20 @@ let total = ref(0);
 let dialogFormVisible = ref(false);
 let form = ref(null);
 
-async function getCargoOwnerAccountList() {
-  tableData.value = [];
+async function getCargoOwnerAccountList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getCargoOwnerAccountList({
     cargoOwnerId: route.query.id,
     currentPage: currentPage.value,
     size: 10,
     term: term.value,
   });
-  term.value = "";
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 
@@ -365,18 +369,20 @@ let total2 = ref(0);
 let dialogFormVisible2 = ref(false);
 let form2 = ref(null);
 
-async function getAgencyCompanyByCargoOwnerCompany() {
-  tableData2.value = [];
+async function getAgencyCompanyByCargoOwnerCompany(page) {
+  currentPage2.value = page || currentPage2.value;
   let res = await api.getAgencyCompanyByCargoOwnerCompany({
     cargoOwnerId: route.query.id,
     currentPage: currentPage2.value,
     size: 10,
     term: term2.value,
   });
-  term2.value = "";
   if (res.data.status == 0) {
     tableData2.value = res.data.result;
     total2.value = res.data.total;
+  } else {
+    tableData2.value = [];
+    total2.value = 0;
   }
 }
 let agencyStr = ref("");

+ 7 - 4
src/views/cargoOwnerManage/cargoOwnerCompanyList.vue

@@ -9,7 +9,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getCargoOwnerCompanyList">查询</div>
+        <div class="seach-btn" @click="getCargoOwnerCompanyList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加货主公司
@@ -105,6 +105,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -142,17 +143,19 @@ const rules = ref({
     { min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
   ],
 });
-async function getCargoOwnerCompanyList() {
-  tableData.value = [];
+async function getCargoOwnerCompanyList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getCargoOwnerCompanyList({
     currentPage: currentPage.value,
     size: 10,
     term: term.value,
   });
-  term.value = "";
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 function resetForm() {

+ 8 - 4
src/views/cargoOwnerManageOld/cargoOwnerDetail.vue

@@ -50,7 +50,7 @@
         style="width: 330px"
         clearable
       ></el-input>
-      <div class="seach-btn" @click="getVoyageList">查询</div>
+      <div class="seach-btn" @click="getVoyageList(1)">查询</div>
     </div>
 
     <el-table :data="tableData" stripe style="width: 100%; margin-top: 20px">
@@ -121,6 +121,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="currentPage"
         :total="total"
         @current-change="pageChange"
       ></el-pagination>
@@ -145,6 +146,7 @@ export default {
     let status = ref(1);
     let term = ref("");
     let currentPage = ref(1);
+    let total = ref(0);
     const tableData = ref();
     async function getUserDetail() {
       let res = await api.getUserDetail({
@@ -159,8 +161,8 @@ export default {
       }
     }
 
-    async function getVoyageList() {
-      tableData.value = [];
+    async function getVoyageList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getVoyageList({
         cargoOwnerId: route.query.userId,
         shipId: 0,
@@ -171,8 +173,10 @@ export default {
       });
       if (res.data.status == 0) {
         tableData.value = res.data.result;
+        total.value = res.data.total;
       } else {
-        console.log(res);
+        tableData.value = [];
+        total.value = 0;
       }
     }
     function changeVoyageType(s) {

+ 7 - 3
src/views/cargoOwnerManageOld/cargoOwnerList.vue

@@ -9,7 +9,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getCargoOwnerList">查询</div>
+        <div class="seach-btn" @click="getCargoOwnerList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加货主
@@ -111,6 +111,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -156,8 +157,8 @@ export default {
         ],
       },
     });
-    async function getCargoOwnerList() {
-      tableData.value = [];
+    async function getCargoOwnerList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getUserList({
         identity: 2,
         currentPage: currentPage.value,
@@ -167,6 +168,9 @@ export default {
       if (res.data.status == 0) {
         tableData.value = res.data.result;
         total.value = res.data.total;
+      } else {
+        tableData.value = [];
+        total.value = 0;
       }
     }
     function resetForm() {

+ 7 - 3
src/views/index/AgencyList.vue

@@ -9,7 +9,7 @@
           clearable
           style="height: 32px; width: 330px; line-height: 32px"
         ></el-input>
-        <div class="seach-btn" @click="getAgencyList">查询</div>
+        <div class="seach-btn" @click="getAgencyList(1)">查询</div>
       </div>
     </div>
     <div style="margin-top: 24px">
@@ -54,6 +54,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -75,8 +76,8 @@ export default {
     let term = ref("");
     let tableData = ref([]);
     let total = ref(0);
-    async function getAgencyList() {
-      tableData.value = [];
+    async function getAgencyList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getAgencyList({
         currentPage: currentPage.value,
         size: 10,
@@ -85,6 +86,9 @@ export default {
       if (res.data.status == 0) {
         tableData.value = res.data.result;
         total.value = res.data.total;
+      } else {
+        tableData.value = [];
+        total.value = 0;
       }
     }
 

+ 7 - 3
src/views/index/AgencySubAccountList.vue

@@ -9,7 +9,7 @@
           clearable
           style="height: 32px; width: 330px; line-height: 32px"
         ></el-input>
-        <div class="seach-btn" @click="getAgencySubAccountList">查询</div>
+        <div class="seach-btn" @click="getAgencySubAccountList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加代理子账户
@@ -73,6 +73,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -150,8 +151,8 @@ export default {
     let term = ref("");
     let tableData = ref([]);
     let total = ref(0);
-    async function getAgencySubAccountList() {
-      tableData.value = [];
+    async function getAgencySubAccountList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getAgencySubAccountList({
         currentPage: currentPage.value,
         size: 10,
@@ -161,6 +162,9 @@ export default {
       if (res.data.status == 0) {
         tableData.value = res.data.result;
         total.value = res.data.total;
+      } else {
+        tableData.value = [];
+        total.value = 0;
       }
     }
 

+ 7 - 3
src/views/portsManage/portsList.vue

@@ -9,7 +9,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getPortsList">查询</div>
+        <div class="seach-btn" @click="getPortsList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加港口
@@ -104,6 +104,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -136,8 +137,8 @@ const rules = ref({
   longitude: [{ required: true, message: "请填写港口经度", trigger: "blur" }],
   latitude: [{ required: true, message: "请填写港口纬度", trigger: "blur" }],
 });
-async function getPortsList() {
-  tableData.value = [];
+async function getPortsList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getPortsList({
     currentPage: currentPage.value,
     size: 10,
@@ -146,6 +147,9 @@ async function getPortsList() {
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 function resetForm() {

+ 7 - 3
src/views/portsManage/sailingSchedule.vue

@@ -9,7 +9,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="seach-btn" @click="getTransPortsList">查询</div>
+        <div class="seach-btn" @click="getTransPortsList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加航期
@@ -124,6 +124,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -164,8 +165,8 @@ const rules = ref({
   ],
   sailingPeriod: [{ required: true, message: "请填写航期", trigger: "blur" }],
 });
-async function getTransPortsList() {
-  tableData.value = [];
+async function getTransPortsList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getTransPortsList({
     currentPage: currentPage.value,
     size: 10,
@@ -174,6 +175,9 @@ async function getTransPortsList() {
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 function resetForm() {

+ 9 - 4
src/views/shipManage/shipDetail.vue

@@ -128,6 +128,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="shipOwnerTotal"
           @current-change="shipOwnerPageChange"
         ></el-pagination>
@@ -166,7 +167,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="search-btn" @click="getVoyageList()">查询</div>
+        <div class="search-btn" @click="getVoyageList(1)">查询</div>
       </div>
       <!-- <div class="cargo-owner-add" @click="voyageAddDialogVisible = true">
         添加航次
@@ -330,6 +331,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="currentPage"
         :total="total"
         @current-change="pageChange"
       ></el-pagination>
@@ -415,9 +417,8 @@ export default {
     let tableData = ref();
     let total = ref(0);
     let status = ref(1);
-    async function getVoyageList() {
-      tableData.value = [];
-
+    async function getVoyageList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getVoyageList({
         cargoOwnerId: 0,
         shipId: route.query.shipId,
@@ -428,6 +429,10 @@ export default {
       });
       if (res.data.status == 0) {
         tableData.value = res.data.result;
+        total.value = res.data.total;
+      } else {
+        tableData.value = [];
+        total.value = 0;
       }
     }
     function changeVoyageType(s) {

+ 3 - 6
src/views/shipManage/shipList.vue

@@ -78,8 +78,8 @@
         <el-pagination
           background
           layout="prev, pager, next"
-          :total="total"
           :current-page="currentPage"
+          :total="total"
           @current-change="pageChange"
         ></el-pagination>
       </div>
@@ -100,11 +100,8 @@ export default {
     let term = ref("");
     let tableData = ref([]);
     let total = ref(0);
-    async function getShipList(type) {
-      tableData.value = [];
-      if (type == 1) {
-        currentPage.value = 1;
-      }
+    async function getShipList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getShipList({
         currentPage: currentPage.value,
         size: 10,

+ 5 - 7
src/views/shipOwnerManage/shipOwnerList.vue

@@ -9,7 +9,7 @@
           clearable
           style="height: 32px; width: 330px; line-height: 32px"
         ></el-input>
-        <div class="seach-btn" @click="getShipOwnerList">查询</div>
+        <div class="seach-btn" @click="getShipOwnerList(1)">查询</div>
       </div>
       <div class="cargo-owner-add" @click="dialogFormVisible = true">
         添加船东
@@ -98,6 +98,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -178,11 +179,8 @@ export default {
     let term = ref("");
     let tableData = ref([]);
     let total = ref(0);
-    async function getShipOwnerList(type) {
-      tableData.value = [];
-      if (type == 1) {
-        currentPage.value = 1;
-      }
+    async function getShipOwnerList(page) {
+      currentPage.value = page || currentPage.value;
       let res = await api.getShipOwnerList({
         currentPage: currentPage.value,
         size: 10,
@@ -207,7 +205,7 @@ export default {
     }
     function pageChange(e) {
       currentPage.value = e;
-      getShipOwnerList(1);
+      getShipOwnerList();
     }
     getShipOwnerList();
     onMounted(() => {});

+ 7 - 3
src/views/toolManage/blockChain.vue

@@ -9,7 +9,7 @@
           clearable
           style="height: 32px; width: 330px; line-height: 32px"
         ></el-input>
-        <div class="seach-btn" @click="getBlockChainList">查询</div>
+        <div class="seach-btn" @click="getBlockChainList(1)">查询</div>
       </div>
     </div>
     <div style="margin-top: 24px">
@@ -81,6 +81,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
+          :current-page="currentPage"
           :total="total"
           @current-change="pageChange"
         ></el-pagination>
@@ -100,8 +101,8 @@ let currentPage = ref(1);
 let term = ref("");
 let tableData = ref([]);
 let total = ref(0);
-async function getBlockChainList() {
-  tableData.value = [];
+async function getBlockChainList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getBlockChainList({
     currentPage: currentPage.value,
     size: 10,
@@ -110,6 +111,9 @@ async function getBlockChainList() {
   if (res.data.status == 0) {
     tableData.value = res.data.result;
     total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
   }
 }
 

+ 27 - 7
src/views/voyage/voyageDetail.vue

@@ -478,6 +478,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="weatherCurrentPage"
         :total="weatherTotal"
         @current-change="weatherPageChange"
       ></el-pagination>
@@ -545,6 +546,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="labCurrentPage"
         :total="labTotal"
         @current-change="labPageChange"
       ></el-pagination>
@@ -689,6 +691,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="currentPage"
         :total="total"
         @current-change="pageChange"
       ></el-pagination>
@@ -917,6 +920,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="truckCurrentPage"
         :total="truckTotal"
         @current-change="truckPageChange"
       ></el-pagination>
@@ -1710,7 +1714,8 @@ async function getDischargeList() {
     dischargeList.value = res.data.result;
     total.value = res.data.total;
   } else {
-    console.log(res);
+    dischargeList.value = [];
+    total.value = 0;
   }
 }
 let updateForm = ref({});
@@ -2266,8 +2271,13 @@ async function getTruckLoadRecord() {
     currentPage: truckCurrentPage.value,
     size: 10,
   });
-  truckTableData.value = res.data.result;
-  truckTotal.value = res.data.total;
+  if (res.data.status == 0) {
+    truckTableData.value = res.data.result;
+    truckTotal.value = res.data.total;
+  } else {
+    truckTableData.value = [];
+    truckTotal.value = 0;
+  }
 }
 function truckPageChange(e) {
   truckCurrentPage.value = e;
@@ -2520,8 +2530,13 @@ async function getLabList() {
     currentPage: labCurrentPage.value,
     size: 10,
   });
-  labTableData.value = res.data.result;
-  labTotal.value = res.data.total;
+  if (res.data.status == 0) {
+    labTableData.value = res.data.result;
+    labTotal.value = res.data.total;
+  } else {
+    labTableData.value = [];
+    labTotal.value = 0;
+  }
 }
 function labPageChange(e) {
   labCurrentPage.value = e;
@@ -2579,8 +2594,13 @@ async function getPortWeatherList() {
     currentPage: weatherCurrentPage.value,
     size: 10,
   });
-  weatherTableData.value = res.data.result;
-  weatherTotal.value = res.data.total;
+  if (res.data.status == 0) {
+    weatherTableData.value = res.data.result;
+    weatherTotal.value = res.data.total;
+  } else {
+    weatherTableData.value = [];
+    weatherTotal.value = 0;
+  }
 }
 
 function weatherPageChange(e) {

+ 6 - 4
src/views/voyage/voyageList.vue

@@ -60,7 +60,7 @@
           clearable
           style="width: 330px"
         ></el-input>
-        <div class="search-btn" @click="getVoyageList()">查询</div>
+        <div class="search-btn" @click="getVoyageList(1)">查询</div>
       </div>
       <!-- <div class="df aic">
         <el-button
@@ -380,6 +380,7 @@
       <el-pagination
         background
         layout="prev, pager, next"
+        :current-page="currentPage"
         :total="total"
         :page-size="pageSize"
         @current-change="pageChange"
@@ -402,9 +403,8 @@ let term = ref("");
 let tableData = ref([]);
 let total = ref(0);
 let status = ref(0);
-async function getVoyageList() {
-  tableData.value = [];
-
+async function getVoyageList(page) {
+  currentPage.value = page || currentPage.value;
   let res = await api.getVoyageList({
     cargoOwnerId: 0,
     shipId: 0,
@@ -417,6 +417,8 @@ async function getVoyageList() {
     tableData.value = res.data.result;
     total.value = res.data.total;
   } else {
+    tableData.value = [];
+    total.value = 0;
     ElNotification({
       type: "error",
       title: res.data.msg,