Explorar o código

fix:数采增加分页

lupeng hai 2 meses
pai
achega
feededf108

+ 2 - 2
src/api/prosteps/ceshishuju.ts

@@ -1,9 +1,9 @@
 import request from "@/utils/request";
 
 //获取当前列表
-export function dataArrayList(processId: string,deviceNo :string) {
+export function dataArrayList(processId: string,deviceNo :string,pageNo :string) {
   return request({
-    url: `/api/v1/testData/get/${processId}/${deviceNo}`,
+    url: `/api/v1/testData/get/${processId}/${deviceNo}/${pageNo}`,
     method: "get",
   });
 }

+ 24 - 3
src/views/pro-steps/components/ceshishuju.vue

@@ -55,8 +55,8 @@
           </el-table-column>
         </el-table>
       </el-scrollbar>
-
-      <el-table :data="tableData" class="tableView-cssj">
+     <div class="tableView-cssj">
+      <el-table :data="tableData">
         <el-table-column
           fixed
           prop="parameterName"
@@ -115,7 +115,19 @@
         <!--                    </el-popconfirm>-->
         <!--        </template>-->
         <!--      </el-table-column>-->
+
       </el-table>
+       <div style="margin-top:25px">
+       <el-pagination
+         background
+         :page-size="20"
+         :pager-count="8"
+         layout="->,prev, pager, next"
+         :total="pageTotal"
+         @current-change="handlePageChange"
+       />
+       </div>
+     </div>
     </div>
 
     <el-dialog title="编辑测试项" v-model="dialogVisible">
@@ -227,21 +239,28 @@ const startCreat = () => {
     });
 
 };
+const currentPage = ref(1);
+const handlePageChange =(val: number)=>{
+  currentPage.value=val;
+  getList();
+}
 const tableData = ref<any[]>([]);
 
 const currentRow = ref<any>(null);
 const handleCurrentChange = (val: any) => {
   currentRow.value = val;
 };
+const pageTotal = ref(0);
 const deviceList = ref<any[]>([]);
 const getList = () => {
   if(!currentToStartRow||!currentToStartRow.deviceNo){
     tableData.value=[];
     return;
   }
-  dataArrayList(store.scanInfo.id,currentToStartRow.deviceNo).then((res: any) => {
+  dataArrayList(store.scanInfo.id,currentToStartRow.deviceNo,currentPage.value.toString()).then((res: any) => {
     csObj.value = res.data;
     tableData.value = JSON.parse(res.data.testData);
+    pageTotal.value=res.data.total;
     console.log(tableData.value, "返回的列表数据");
   });
 };
@@ -413,11 +432,13 @@ const afterTimeCancel = () => {
   margin-right: 10px;
 }
 .tableView-cssj {
+  width: 550px;
   flex: 1;
   height: calc(100vh - 300px);
   padding: 20px 0px;
   border-radius: 16px;
   margin-top: 10px;
+  background-color: #fff;
 }
 .btn {
   width: 180px;