浏览代码

演示修改

dengrui 1 周之前
父节点
当前提交
fa1f6a2791

+ 22 - 0
src/api/prosteps/zidongceshi.ts

@@ -0,0 +1,22 @@
+import request from "@/utils/request";
+
+export function toStart1() {
+  return request({
+    url: "/web/test/pushRod/extend",
+    method: "get",
+  });
+}
+
+export function toStart2() {
+  return request({
+    url: "/web/test/pushRod/withdraw",
+    method: "get",
+  });
+}
+
+export function getResult() {
+  return request({
+    url: "/web/test/pushRod/log",
+    method: "get",
+  });
+}

+ 9 - 1
src/components/Upload/CameraUpload.vue

@@ -1,13 +1,21 @@
 <template>
   <div class="camera-upload">
-    <div class="row">
+    <!-- <div class="row">
       <svg-icon icon-class="paizhao" size="80" @click="openMedia" />
       <svg-icon icon-class="bendishangchuan" size="80" @click="selectFile" />
     </div>
     <div class="row">
       <RefreshRight color="#0a59f7" size="70px" @click="clickReset" />
       <Delete color="#ff4d4f" size="60px" @click="clickDeleteAll" />
+    </div> -->
+    <div class="row">
+      <svg-icon icon-class="paizhao" size="120" @click="openMedia" />
+      <!-- <svg-icon icon-class="bendishangchuan" size="80" @click="selectFile" /> -->
     </div>
+    <!-- <div class="row">
+      <RefreshRight color="#0a59f7" size="70px" @click="clickReset" />
+      <Delete color="#ff4d4f" size="60px" @click="clickDeleteAll" />
+    </div> -->
 
     <input v-show="false" id="fileInput" accept="image/*" type="file" />
     <el-dialog

+ 10 - 0
src/router/modules/process.ts

@@ -122,6 +122,16 @@ export default {
           },
         },
         {
+          path: "zidongceshi",
+          component: () =>
+            import("@/views/pro-steps/components/zidongceshi.vue"),
+          name: "Zidongceshi",
+          meta: {
+            back: true,
+            keepAlive: true,
+          },
+        },
+        {
           path: "jianyan",
           component: () => import("@/views/pro-steps/components/jianyan.vue"),
           name: "Jianyan",

+ 8 - 4
src/views/pro-steps/components/duomeiticaiji.vue

@@ -4,9 +4,14 @@
       <el-scrollbar @click.stop style="height: calc(100vh - 260px)">
         <div
           :class="selectItem === true ? 'itembox itemSelect' : 'itembox'"
-          @click="toCamera"
+          @click.stop="toCamera"
         >
-          <svg-icon icon-class="paizhao" size="130" />
+          <!-- <svg-icon icon-class="paizhao" size="130" /> -->
+          <CameraUpload
+            @reset-select="clickReset"
+            @upload-finish="finish"
+            @delete-all="clickDeleteAll"
+          />
         </div>
         <div
           :class="selectItem === index ? 'itembox itemSelect' : 'itembox'"
@@ -22,7 +27,7 @@
         </div>
       </el-scrollbar>
     </div>
-    <div class="view" id="show">
+    <div class="view" id="show" style="overflow: hidden">
       <!-- 展示图片或者照相 -->
       <video
         id="video"
@@ -99,7 +104,6 @@ import { Check, Close } from "@element-plus/icons-vue";
 import { uploadFileApi } from "@/api/file";
 const proStore = useProcessStore();
 const toShowImg = (index) => {
-  console.log(index);
   selectItem.value = index;
 };
 //true为切换到视频流 其余则为切换展示图片

+ 404 - 0
src/views/pro-steps/components/zidongceshi.vue

@@ -0,0 +1,404 @@
+<template>
+  <div style="height: calc(100vh - 220px)">
+    <div class="scanCode"></div>
+    <div class="materialInfoBody">
+      <el-scrollbar @click.stop style="height: calc(100vh - 360px)">
+        <el-table
+          :data="tableData"
+          @cell-click="cellClick"
+          :cell-class-name="cellClassName"
+          border
+          style="width: 100%; height: calc(100vh - 360px); z-index: 1"
+        >
+          <el-table-column
+            label="序号"
+            type="index"
+            width="120"
+            align="center"
+          />
+          <el-table-column prop="name" label="测试项" align="center" />
+          <el-table-column
+            prop="test_position"
+            label="位置(mm)"
+            align="center"
+          >
+            <template #default="scope">
+              <div>
+                {{ Math.floor(scope.row.test_position) }}
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="test_speed"
+            label="平均速度(mm/s)"
+            align="center"
+          >
+            <template #default="scope">
+              <div>
+                {{ Math.floor(scope.row.test_speed) }}
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column prop="test_time" label="时间(ms)" align="center">
+            <template #default="scope">
+              <div>
+                {{ Math.floor(scope.row.test_time) }}
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="status"
+            label="状态"
+            width="160"
+            align="center"
+          >
+            <template #default="scope">
+              <div
+                :class="
+                  scope.row.status == '已完成'
+                    ? 'greenDate'
+                    : scope.row.status == '进行中'
+                      ? 'orDate'
+                      : scope.row.status == '失败'
+                        ? 'redDate'
+                        : ''
+                "
+              >
+                {{ scope.row.status }}
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-scrollbar>
+      <div class="btns">
+        <el-button
+          style="width: 80px; height: 40px; font-size: 16px"
+          type="primary"
+          @click="start"
+          :disabled="status"
+          >开始测试</el-button
+        >
+        <!-- <el-button
+          style="width: 80px; height: 40px; font-size: 16px"
+          type="primary"
+          >取消</el-button
+        > -->
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { toStart1, toStart2, getResult } from "@/api/prosteps/zidongceshi";
+import { useProcessStore } from "@/store";
+defineOptions({ name: "Zidongceshi" });
+const scanCode = ref("");
+const tableData = ref([
+  {
+    name: "电动推杆(伸出)",
+    test_time: 0,
+    test_position: 0,
+    test_speed: 0,
+    status: "未开始",
+  },
+  {
+    name: "电动推杆(缩回)",
+    test_time: 0,
+    test_position: 0,
+    test_speed: 0,
+    status: "未开始",
+  },
+]);
+const num = ref(0);
+
+let intervalId = null;
+const status = ref(false);
+const start = async () => {
+  status.value = true;
+  // if (num.value == 0) {
+  //   const { code } = await toStart1();
+  //   if (code == "200") {
+  //     ElMessage.success(`开始测试第${num.value + 1}项...`);
+  //     tableData.value[num.value].status = "进行中";
+  //     intervalId = setInterval(() => {
+  //       toResult();
+  //     }, 1000);
+  //   }
+  // } else {
+  //   const { code } = await toStart2();
+  //   if (code == "200") {
+  //     ElMessage.success(`开始测试第${num.value + 1}项...`);
+  //     tableData.value[num.value].status = "进行中";
+  //     intervalId = setInterval(() => {
+  //       toResult();
+  //     }, 1000);
+  //   }
+  // }
+  const { code } = await toStart1();
+  if (code == "200") {
+    ElMessage.success(`开始测试...`);
+    tableData.value[num.value].status = "进行中";
+    tableData.value[1].status = "进行中";
+    intervalId = setInterval(() => {
+      toResult();
+    }, 1000);
+  }
+};
+let timeOut = null;
+const toResult = async () => {
+  const { data, code } = await getResult();
+  if (code == "200" && data) {
+    if (timeOut == null && (data.taskstatus == -1 || data.taskstatus == 2)) {
+      if (data.taskstatus == -1) {
+        tableData.value[num.value] = {
+          ...tableData.value[num.value],
+          test_time: 0,
+          test_position: 0,
+          test_speed: 0,
+          status: "失败",
+        };
+        tableData.value[1] = {
+          ...tableData.value[1],
+          test_time: 0,
+          test_position: 0,
+          test_speed: 0,
+          status: "失败",
+        };
+      } else {
+        tableData.value[num.value] = {
+          ...tableData.value[num.value],
+          test_time: data.test_time,
+          test_position: data.test_position,
+          test_speed: data.test_speed,
+          status: "已完成",
+        };
+        tableData.value[1] = {
+          ...tableData.value[1],
+          test_time: data.test_time,
+          test_position: data.test_position,
+          test_speed: data.test_speed,
+          status: "已完成",
+        };
+      }
+      // num.value = num.value + 1;
+      clearInterval(intervalId);
+      intervalId = null;
+      ElMessage.success("测试完成");
+      status.value = false;
+      // if (num.value <= 1) {
+      //   start();
+      //   return;
+      // } else {
+      //   status.value = false;
+      //   num.value = 0;
+      // }
+    }
+  }
+
+  // if (data.length > 0) {
+  //   ElMessage.success("测试完成");
+  //   tableData.value[num.value] = { ...tableData.value[num.value], ...data[0] };
+  //   num.value = num.value + 1;
+  //   clearInterval(intervalId);
+  //   if (num.value <= 1) {
+  //     start();
+  //   }
+  // }
+};
+const getInfo = (index, code) => {
+  ElMessage.success("查询成功");
+  tableData.value[index].setStatus = false;
+};
+const cellClick = (row, column, cell, event) => {
+  console.log(row, column, cell, event);
+  if (column.label == "设备编号") {
+    tableData.value[row.index].setStatus =
+      !tableData.value[row.index].setStatus;
+  }
+};
+const enterfnc = () => {};
+const checkListData = ref([]);
+const store = useProcessStore();
+const getCheckList = async () => {
+  // const { data } = await checkList({
+  //   operationId: Number(store.odersData.operationId),
+  //   processId: Number(store.scanInfo.id),
+  //   pageSize: 9999,
+  //   pageNo: 1,
+  // });
+  const { data } = await checkList({
+    operationId: Number(store.odersData.operationId),
+    processId: Number(store.scanInfo.id),
+    seqNo: store.scanInfo.seqNo,
+    pageSize: 9999,
+    pageNo: 1,
+  });
+  checkListData.value = data;
+};
+const updateCheck = async (item, res) => {
+  // const {data} = await checkUpdate({
+  //   id: 2,
+  //   operationCheckId: 15,
+  //   operator: 9999,
+  //   processId: 1,
+  //   result:,
+  //   sortNum:,
+  //   stepInstanceId:''
+  // });
+  await checkUpdate({
+    id: item.id,
+    result: res,
+  }).then(() => {
+    ElMessage.success("操作成功");
+    item.result = res;
+  });
+};
+const setBoxStatus = (status) => {
+  let style = "";
+  switch (status) {
+    case "1":
+      style = "background-color: #64BB5C;color: white;";
+      break;
+    case "2":
+      style = "background-color: #E84026;color: white;";
+      break;
+    default:
+      style = "background-color: #00000015;color: white;";
+      break;
+  }
+  return style;
+};
+const hege = async (index) => {
+  updateCheck(checkListData.value[index], "1");
+};
+const buhege = async (index) => {
+  updateCheck(checkListData.value[index], "2");
+};
+// onMounted(() => {
+//   getCheckList();
+// });
+</script>
+
+<style lang="scss" scoped>
+.greenDate {
+  position: absolute;
+  top: 0;
+  left: 0;
+  background-color: green !important;
+  color: white;
+  width: 100%;
+  height: 100%;
+  line-height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.orDate {
+  position: absolute;
+  top: 0;
+  left: 0;
+  background-color: orange !important;
+  color: white;
+  width: 100%;
+  height: 100%;
+  line-height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.redDate {
+  position: absolute;
+  top: 0;
+  left: 0;
+  background-color: red !important;
+  color: white;
+  width: 100%;
+  height: 100%;
+  line-height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.materialInfoBody {
+  width: 100%;
+  height: calc(100vh - 360px);
+  margin-top: 10px;
+  .btns {
+    height: 50px;
+    display: flex;
+    align-items: center;
+    justify-content: end;
+  }
+}
+.scanCode {
+  width: 400px;
+  margin-top: $p5;
+  border-radius: 25px;
+  overflow: hidden;
+}
+.titleText {
+  font-size: $f24;
+  font-weight: $Medium;
+  color: var(--ohos-text);
+}
+
+.describeText {
+  font-size: $f20;
+  color: $font-default-60;
+  line-height: 25px;
+  color: var(--ohos-text);
+}
+
+.recordBox {
+  width: calc(100%);
+  background-color: var(--ohos-box-bg);
+  color: var(--ohos-text);
+  border-radius: 16px;
+  display: flex;
+  padding: $p20;
+  justify-content: space-between;
+  align-items: center;
+  position: relative;
+
+  .leftMsg {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+    height: 170px;
+  }
+
+  .rightOperate {
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    .operate {
+      .operateText {
+        margin-bottom: $p5;
+      }
+
+      .operateBox {
+        width: 290px;
+        height: 70px;
+
+        border-radius: 16px;
+        display: flex;
+        justify-content: space-between;
+
+        .operateBtn {
+          width: 130px;
+          height: 70px;
+          background-color: #00000015;
+          border-radius: 16px;
+          text-align: center;
+          line-height: 70px;
+          font-size: $f24;
+          font-weight: $Medium;
+        }
+      }
+    }
+  }
+}
+</style>

+ 2 - 3
src/views/pro-steps/index.vue

@@ -336,7 +336,6 @@
                       :class="getNameClass(index)"
                       class="typeBox"
                       style="cursor: pointer"
-                      @click="toCese"
                     >
                       <div class="svgIcon">
                         <svg-icon :icon-class="item.iconName" size="30" />
@@ -1765,8 +1764,8 @@ const defaultComponents = [
   {
     compentName: "自动测试",
     iconName: "shebeijilu",
-    path: "jianyan",
-    name: "自动测试",
+    path: "zidongceshi",
+    name: "Zidongceshi",
   },
   {
     compentName: "设备点检",