|
@@ -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>
|