Parcourir la source

测试数据和执行日志

jxq il y a 1 mois
Parent
commit
7a5c370aea
2 fichiers modifiés avec 82 ajouts et 20 suppressions
  1. 9 0
      src/api/device/index.ts
  2. 73 20
      src/views/device/test/index.vue

+ 9 - 0
src/api/device/index.ts

@@ -154,3 +154,12 @@ export function disableAudit(params: any) {
     data: params,
   });
 }
+
+// 查看执行日志
+export function queryExcutedLogList(data: object) {
+  return request({
+    url: "/api/v1/test/engrExecuteLog/list",
+    method: "post",
+    data: data,
+  });
+}

+ 73 - 20
src/views/device/test/index.vue

@@ -16,13 +16,42 @@
       @current-change="dataList"
       @selection-change="selectionChange"
     >
+      <template #menu="{ row }">
+        <el-button
+          @click="viewStock(row)"
+          icon="el-icon-view"
+          text
+          type="primary"
+          >查看</el-button
+        >
+      </template>
     </avue-crud>
+
+    <el-dialog
+      v-model="centerDialogVisible"
+      title="执行日志"
+      width="800"
+      align-center
+      append-to-body
+    >
+      <el-scrollbar class="content-log">
+        <el-table :data="logDataList" show-overflow-tooltip>
+          <el-table-column type="index" width="55" />
+          <el-table-column label="测试工程名称" prop="engineeringProductName" />
+          <el-table-column label="产品名称" prop="engineeringProductName" />
+          <el-table-column label="测试项" prop="dataItem" />
+          <el-table-column label="测试值" prop="dataContent" />
+        </el-table>
+      </el-scrollbar>
+    </el-dialog>
   </div>
 </template>
 <script setup>
 import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
 import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import { queryExcutedLogList } from "@/api/device/index";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const test = () => {
   isShowTable.value = true;
@@ -32,7 +61,7 @@ const loading = ref(false); //  加载状态
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
-    src: "/api/v1/test/engrExecuteLog",
+    src: "/api/v1/test/engrExecute",
   });
 const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
   Methords; //增删改查
@@ -46,41 +75,55 @@ option.value = Object.assign(option.value, {
   editBtn: false,
   selection: false,
   addBtn: false,
+  viewBtn: false,
   column: [
     {
-      label: "产品编号",
-      prop: "productCode",
+      label: "工程名称",
+
+      prop: "engineeringProductName",
       search: true,
     },
     {
-      label: "工程产品名称",
+      label: "产品名称",
+
       prop: "engineeringProductName",
       search: true,
     },
     {
-      label: "工程项目名称",
-      prop: "engineeringProjectName",
+      label: "产品编号",
+      prop: "productCode",
       search: true,
     },
+
     {
-      label: "执行状态",
-      prop: "executionStatus",
-      html: true,
-      formatter: (val) => {
-        if (val.executionStatus == "1") {
-          return "<span style='color:green'>成功</span>";
-        } else {
-          return "<span style='color:red'>失败</b>";
-        }
-      },
+      label: "测试类型",
+      prop: "testType",
+      search: true,
+      filterable: true,
+      type: "select",
+      overHidden: true,
+      dicUrl: dictDataUtil.request_url + "test_type",
+      props: { label: "dictLabel", value: "dictValue" },
     },
+    // {
+    //   label: "执行状态",
+    //   prop: "executionStatus",
+    //   html: true,
+    //   formatter: (val) => {
+    //     if (val.executionStatus == "1") {
+    //       return "<span style='color:green'>成功</span>";
+    //     } else {
+    //       return "<span style='color:red'>失败</b>";
+    //     }
+    //   },
+    // },
     {
-      label: "测试单元",
-      prop: "dataItem",
+      label: "执行终端",
+      prop: "instrumentName",
     },
     {
-      label: "测试内容",
-      prop: "dataContent",
+      label: "测试地点",
+      prop: "testLocation",
     },
     {
       label: "创建时间",
@@ -96,4 +139,14 @@ onMounted(() => {
   search.value.dataSource = "3";
   dataList();
 });
+
+const centerDialogVisible = ref(false); // 弹窗状态
+const logDataList = ref([]);
+const viewStock = async (row) => {
+  let res = await queryExcutedLogList({ executeId: row.id });
+
+  logDataList.value = res.data;
+
+  centerDialogVisible.value = true;
+};
 </script>