فهرست منبع

测试数据修改

dengrui 8 ماه پیش
والد
کامیت
b9dd8d42fd
2فایلهای تغییر یافته به همراه99 افزوده شده و 34 حذف شده
  1. 7 0
      src/api/prosteps/screwdriver.ts
  2. 92 34
      src/views/pro-steps/components/screwdriver.vue

+ 7 - 0
src/api/prosteps/screwdriver.ts

@@ -51,3 +51,10 @@ export function startData(data: any): Promise<ResData> {
     data,
   });
 }
+export function setUpData(data: any): Promise<ResData> {
+  return request({
+    url: `/api/v1/process/data/acquisition/setUp`,
+    method: "post",
+    data,
+  });
+}

+ 92 - 34
src/views/pro-steps/components/screwdriver.vue

@@ -29,7 +29,7 @@
             v-if="item.deviceType == 'DDLSD'"
             placeholder="请选择任务"
             size="large"
-            style="position: absolute; right: 350px; z-index: 2; width: 140px"
+            style="position: absolute; right: 460px; z-index: 2; width: 140px"
           >
             <el-option
               v-for="item in options"
@@ -38,18 +38,31 @@
               :value="item.value"
             />
           </el-select>
+          <el-button
+            class="ces"
+            type="primary"
+            style="position: absolute; right: 340px; z-index: 2"
+            v-if="item.deviceType != 'FJDJC'"
+            @click.stop="
+              startTest1(item.deviceName, item.deviceNo, item.deviceType)
+            "
+            :disabled="
+              (item.deviceType == 'DDLSD' && !taskValue) || btnDisabled
+            "
+            >设置参数</el-button
+          >
           <el-select
-              v-model="taskId"
-              v-if="item.deviceType == 'DDLSD'"
-              placeholder="请选择任务"
-              size="large"
-              style="position: absolute; right: 200px; z-index: 2; width: 140px"
+            v-model="taskId"
+            v-if="item.deviceType == 'DDLSD'"
+            placeholder="选择任务"
+            size="large"
+            style="position: absolute; right: 180px; z-index: 2; width: 140px"
           >
             <el-option
-                v-for="item in options2"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+              v-for="item in options2"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
             />
           </el-select>
           <el-button
@@ -60,21 +73,13 @@
             @click.stop="
               startTest(item.deviceName, item.deviceNo, item.deviceType)
             "
-            :disabled="item.deviceType == 'DDLSD' && !taskValue"
+            :disabled="
+              (item.deviceType == 'DDLSD' && !taskValue) || btnDisabled
+            "
             >开始检测</el-button
           >
         </template>
-        <!-- <el-table
-          :data="DDLSDTableData"
-          v-if="item.deviceType == 'DDLSD'"
-          border
-        >
-          <el-table-column prop="deviceNo" label="任务号" />
-          <el-table-column prop="deviceNo" label="圈数(r)" />
-          <el-table-column prop="deviceNo" label="扭力(mN.m)" />
-          <el-table-column prop="deviceNo" label="拧紧结果" />
-          <el-table-column prop="deviceNo" label="警报" />
-        </el-table> -->
+    
         <el-table
           :data="tableData[index]"
           v-if="item.deviceType != 'FJDJC'"
@@ -85,7 +90,7 @@
             :key="str"
             :prop="str"
             :label="showLable(str)"
-            width="230px"
+      
           >
             <template #default="{ row }">
               <div v-if="!row.updateStatus">
@@ -150,6 +155,7 @@ import {
   delAcquisitionData,
   getTaskList,
   startData,
+  setUpData,
 } from "@/api/prosteps/screwdriver";
 import { useProcessStore } from "@/store";
 import { useDictionaryStore } from "@/store";
@@ -160,15 +166,41 @@ const tableData = ref([]);
 const materialsData = ref([]);
 const router = useRouter();
 const taskValue = ref("");
-const taskId = ref("1")
+const taskId = ref("1");
+const btnDisabled = ref(false);
 const toStartData = async (data) => {
-  const { code } = await startData(data);
-  if (code == "200") {
-    ElMessage.success("开始检测成功");
+  try {
+    btnDisabled.value = true;
+    const { code } = await startData(data);
+    if (code == "200") {
+      ElMessage.success("开始检测....");
+    }
+  } catch (e) {
+  } finally {
+    setTimeout(() => {
+      btnDisabled.value = false;
+    }, 3000);
+  }
+};
+const toStartData1 = async (data) => {
+  try {
+    btnDisabled.value = true;
+    const { code } = await setUpData(data);
+    if (code == "200") {
+      ElMessage.success("设置成功!");
+    }
+  } catch (e) {
+  } finally {
+    setTimeout(() => {
+      btnDisabled.value = false;
+    }, 3000);
   }
 };
 const getTask = async () => {
-  let params = {operationCode: store.processInfo.operationCode,materialNo: store.scanInfo.materialCode}
+  let params = {
+    operationCode: store.processInfo.operationCode,
+    materialNo: store.scanInfo.materialCode,
+  };
   const { data } = await getTaskList(params);
   options.value = [];
   data.forEach((item) => {
@@ -179,8 +211,16 @@ const getTask = async () => {
   });
 };
 const options = ref([]);
-const options2 = ref([{value: '1',label: '任务1'},{value: '2',label: '任务2'},{value: '3',label: '任务3'},
-  {value: '4',label: '任务4'},{value: '5',label: '任务5'},{value: '6',label: '任务6'},{value: '7',label: '任务7'},{value: '8',label: '任务8'},]);
+const options2 = ref([
+  { value: "1", label: "任务1" },
+  { value: "2", label: "任务2" },
+  { value: "3", label: "任务3" },
+  { value: "4", label: "任务4" },
+  { value: "5", label: "任务5" },
+  { value: "6", label: "任务6" },
+  { value: "7", label: "任务7" },
+  { value: "8", label: "任务8" },
+]);
 const startTest = (a, b, c) => {
   let obj = {
     deviceName: a,
@@ -192,10 +232,25 @@ const startTest = (a, b, c) => {
     seqNo: store.useSeqNo,
     workOrderCode: store.odersData.workOrderCode,
     taskId: taskValue.value,
-    smallTaskId: taskId.value
+    smallTaskId: taskId.value,
   };
   toStartData(obj);
 };
+const startTest1 = (a, b, c) => {
+  let obj = {
+    deviceName: a,
+    deviceNo: b,
+    deviceType: c,
+    operationId: store.scanInfo.operationId,
+    operationName: store.processInfo.operationName,
+    processId: store.scanInfo.id,
+    seqNo: store.useSeqNo,
+    workOrderCode: store.odersData.workOrderCode,
+    taskId: taskValue.value,
+    smallTaskId: taskId.value,
+  };
+  toStartData1(obj);
+};
 const showLable = (key) => {
   switch (key) {
     case "CH5Val":
@@ -210,6 +265,8 @@ const showLable = (key) => {
       return "拧紧过程中最大扭力值";
     case "taskNo":
       return "当前任务号";
+    case "taskName":
+      return "任务名";
     case "warning":
       return "警报";
     case "tightenResult":
@@ -360,12 +417,13 @@ const configeObj = (type) => {
     //电动螺丝刀
     case "DDLSD":
       return [
+        "taskName",
         "taskNo",
+        "tightenResult",
+        "totalCycles",
         "torquetarget",
         "tightenTorqueMax",
         "warning",
-        "tightenResult",
-        "totalCycles",
       ];
     default:
       return ["数据1", "数据2", "数据3"];
@@ -381,7 +439,7 @@ const addItem = (no, name, type, index) => {
       data = { CH5Val: "", CH6Val: "", DataTimes: "" };
       break;
     case "WKDLT":
-      data = {temperature:""};
+      data = { temperature: "" };
       break;
     case "GDC":
       data = { CH5Val: "", CH6Val: "", DataTimes: "" };