Browse Source

fix:设备数据查看修改接口

luoxiao 1 month ago
parent
commit
cf2715112f
1 changed files with 38 additions and 19 deletions
  1. 38 19
      src/views/pro/traceability/components/testData.vue

+ 38 - 19
src/views/pro/traceability/components/testData.vue

@@ -14,7 +14,12 @@
       @current-change="dataList"
     >
       <template #menu="{ size, row, index }">
-        <el-button type="text" size="mini" @click="lookData(row)" v-if="!row.operationIds">
+        <el-button
+          type="text"
+          size="mini"
+          @click="lookData(row)"
+          v-if="!row.operationIds"
+        >
           查看
         </el-button>
         <el-button
@@ -23,7 +28,7 @@
           link
           size="small"
           @click="doEdit(row, index)"
-        ><i-ep-edit />编辑
+          ><i-ep-edit />编辑
         </el-button>
       </template>
     </avue-crud>
@@ -46,6 +51,14 @@
         </template>
       </el-table-column>
     </el-table>
+    <el-pagination
+      background
+      :page-size="20"
+      :pager-count="8"
+      layout="->,prev, pager, next"
+      :total="pageTotal"
+      @current-change="handlePageChange"
+    />
   </el-dialog>
 </template>
 <script setup>
@@ -58,7 +71,7 @@ import {
   useDictionaryStore,
   useUserStoreHook,
 } from "@/store";
-import {testData} from "@/api/process/index";
+import { testData } from "@/api/process/index";
 
 // 数据字典相关
 const { dicts } = useDictionaryStore();
@@ -78,7 +91,7 @@ const {
 } = useCrud({
   src: "/api/v1/testData/testData",
 });
-const crudRefJSSJ=ref(null);
+const crudRefJSSJ = ref(null);
 const doEdit = (row, index) => {
   crudRefJSSJ.value && crudRefJSSJ.value.rowEdit(row, index);
 };
@@ -149,27 +162,33 @@ option.value = Object.assign(option.value, {
   ],
 });
 
+const pageTotal = ref(0);
+const currentPage = ref(1);
+const selectRow = ref(null);
+
+const handlePageChange = (val) => {
+  currentPage.value = val;
+  lookData(selectRow.value);
+};
 // 查看相关代码
 const dialogVisible = ref(false);
 const tableData = ref([]);
 const lookData = (row) => {
-  if(row.testData&&"[]"!==row.testData){
-      tableData.value = JSON.parse(row.testData);
-      console.log(tableData.value);
-      dialogVisible.value = true;
-      return;
+  selectRow.value = row;
+  if (row.testData && "[]" !== row.testData) {
+    tableData.value = JSON.parse(row.testData);
+    dialogVisible.value = true;
+    return;
   }
-  testData(row.processId,row.deviceNo).then(
-    (res)=>{
-        if(res.code==='200'){
-            tableData.value = JSON.parse(res.testData);
-            console.log(tableData.value);
-            dialogVisible.value = true;
-        }
+  testData(row.processId, row.deviceNo, currentPage.value.toString()).then(
+    (res) => {
+      if (res.code === "200") {
+        tableData.value = JSON.parse(res.testData);
+        pageTotal.value = res.data.total;
+        dialogVisible.value = true;
+      }
     }
-
-  )
-
+  );
 };
 
 const handleDialogCancel = () => {