Pārlūkot izejas kodu

fix:修改测试数据的设备选择

lupeng 3 mēneši atpakaļ
vecāks
revīzija
41fcdffa64

+ 1 - 1
src/api/process/reportBreak.ts

@@ -65,7 +65,7 @@ export function drawingList(data: object) {
 // 报工的签章人列表查询
 export function signList(data: object) {
   return request({
-    url: `/api/v1/base/signature/page`,
+    url: `/api/v1/base/signature/list`,
     method: "post",
     data: data,
   });

+ 10 - 2
src/api/prosteps/ceshishuju.ts

@@ -8,9 +8,9 @@ export function dataArrayList(processId: string) {
   });
 }
 
-export function startCSSJTesting(processId: string) {
+export function startCSSJTesting(processId: string,deviceNo: string) {
   return request({
-    url: `/api/v1/testData/startTest/${processId}`,
+    url: `/api/v1/testData/startTest/${processId}/${deviceNo}`,
     method: "get",
   });
 }
@@ -32,3 +32,11 @@ export function addCSSJ(data: any) {
     data: data,
   });
 }
+
+export function getDeviceList(data: any) {
+  return request({
+    url: `/api/v1/device/list`,
+    method: "post",
+    data: data,
+  });
+}

+ 47 - 2
src/views/pro-steps/components/ceshishuju.vue

@@ -90,6 +90,18 @@
         <el-button type="primary" @click="handleDialogConfirm">确 定</el-button>
       </template>
     </el-dialog>
+    <el-dialog title="设备列表" v-model="dialogDevice">
+      <el-table :data="deviceList" style="width: 100%" ref="singleTableRef" highlight-current-row @current-change="handleCurrentChange">
+        <el-table-column type="index" width="50" />
+        <el-table-column prop="id" label="id" width="180" v-if="false" />
+        <el-table-column prop="deviceNo" label="设备编号"  />
+        <el-table-column prop="deviceName" label="设备名称"  />
+      </el-table>
+      <template #footer>
+        <el-button @click="dialogDevice=false">取 消</el-button>
+        <el-button type="primary" @click="dialogConfirm">确 定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -99,6 +111,7 @@ import {
   dataArrayList,
   deleteCSSJ,
   startCSSJTesting,
+  getDeviceList
 } from "@/api/prosteps/ceshishuju";
 import { useProcessStore } from "@/store";
 import { emitter, EventsNames } from "@/utils/common";
@@ -109,6 +122,11 @@ const csObj = ref<any>(null);
 
 const tableData = ref<any[]>([]);
 
+const currentRow = ref<any>(null);
+const handleCurrentChange = (val: any) => {
+  currentRow.value = val
+}
+const deviceList = ref<any[]>([]);
 const getList = () => {
   dataArrayList(store.scanInfo.id).then((res: any) => {
     csObj.value = res.data;
@@ -116,20 +134,46 @@ const getList = () => {
     console.log(tableData.value, "返回的列表数据");
   });
 };
+const deviceSearch = ref<any>({});
 
+const dialogConfirm = () => {
+  console.log(currentRow);
+  if(!currentRow||!currentRow.value||!currentRow.value.deviceNo){
+     ElMessage.error("未选择设备!");
+     return;
+  }
+  startCSSJTesting(store.scanInfo.id,currentRow.value.deviceNo).then((data) => {
+    if(data.code==='200'){
+      dialogDevice.value=false;
+    }
+    if (!emitter.all.has(EventsNames.TEST_DATA)) {
+      emitter.on(EventsNames.TEST_DATA, (mesaage: any) => {
+        console.log("测试数据获取成功");
+        getList();
+      });
+    }
+  });
+}
 onMounted(() => {
   getList();
+  deviceSearch.value.deviceType="DDS";
+  getDeviceList(deviceSearch.value).then(
+    (res: any)=>{
+      deviceList.value=res.data;
+    }
+  )
 });
 
 const startTesting = () => {
-  startCSSJTesting(store.scanInfo.id).then(() => {
+  /*startCSSJTesting(store.scanInfo.id).then(() => {
     if (!emitter.all.has(EventsNames.TEST_DATA)) {
       emitter.on(EventsNames.TEST_DATA, (mesaage: any) => {
         console.log("测试数据获取成功");
         getList();
       });
     }
-  });
+  });*/
+  dialogDevice.value=true;
 };
 
 onUnmounted(() => {
@@ -147,6 +191,7 @@ const handleDelete = (row: any) => {
 
 // 编辑相关代码
 const dialogVisible = ref(false);
+const dialogDevice = ref(false);
 const editRow = ref<any>(null);
 const handleEdit = (row: any) => {
   editRow.value = row;