dengrui пре 8 месеци
родитељ
комит
6a3a7f57af

+ 8 - 1
src/api/prosteps/screwdriver.ts

@@ -2,9 +2,16 @@ import request from "@/utils/request";
 import { AxiosPromise } from "axios";
 import { DeviceContainer, ResData } from "./screwdriverTypes";
 //获取数据采集data
-export function getScrewdriverData(): AxiosPromise<ResData> {
+export function getScrewdriverData(): Promise<ResData> {
   return request({
     url: `/api/v1/process/data/acquisition/device/list`,
     method: "get",
   });
 }
+export function getAcquisitionData(data: any): Promise<ResData> {
+  return request({
+    url: `/api/v1/process/data/acquisition/page`,
+    method: "post",
+    data,
+  });
+}

+ 2 - 1
src/api/prosteps/screwdriverTypes.ts

@@ -31,11 +31,12 @@ export interface DeviceContainer {
   creator?: string; // 创建者
   deptId?: string; // 部门ID
   deviceInfoList?: DeviceInfo[]; // 设备信息列表
-  deviceType?: string; // 设备类型标识
+  deviceType: string; // 设备类型标识
   id?: string; // 主键ID,可能是UUID或其他唯一标识符
   orgId?: string; // 组织ID
   updated?: string; // 更新时间(可能是日期字符串)
   updator?: string; // 更新者
+  state?: null | number;
 }
 export interface ResData {
   code: string;

+ 75 - 40
src/views/pro-steps/components/screwdriver.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="containerBox">
-    <el-collapse accordion v-model="activeNames">
+    <el-collapse>
       <el-collapse-item
         v-for="(item, index) in materialsData"
         :key="index"
@@ -18,49 +18,50 @@
             class="opear"
             style="font-size: 18px; color: rgb(10, 89, 247); font-weight: 600"
             >新增数据</span
-          ></template
-        >
-        <el-table :data="item.children" border>
-          <el-table-column prop="a" label="设备编号">
+          >
+        </template>
+        <el-table :data="tableData[index]" border>
+          <el-table-column prop="deviceNo" label="设备编号">
             <template #default="scope" v-if="!item.updateStatus">
-              {{ scope.row.a }}
+              {{ scope.row.deviceNo }}
             </template>
             <template #default v-else>
-              <el-input v-model="item.equitType" />
+              <el-input v-model="tableData[index].deviceNo" />
             </template>
           </el-table-column>
-          <el-table-column prop="b" label="设备名称">
+          <el-table-column prop="deviceName" label="设备名称">
             <template #default="scope" v-if="!item.updateStatus">
-              {{ scope.row.b }}
+              {{ scope.row.deviceName }}
             </template>
             <template #default v-else>
-              <el-input v-model="item.equitType" />
+              <el-input v-model="tableData[index].deviceName" />
             </template>
           </el-table-column>
-          <el-table-column prop="equitType" label="高度">
+          <el-table-column prop="created" label="采集时间">
             <template #default="scope" v-if="!item.updateStatus">
-              {{ scope.row.c }}
+              {{ scope.row.created }}
             </template>
             <template #default v-else>
-              <el-input v-model="item.equitType" />
+              <el-input v-model="tableData[index].created" />
             </template>
           </el-table-column>
-          <el-table-column prop="equitType" label="宽度">
-            <template #default="scope" v-if="!item.updateStatus">
-              {{ scope.row.d }}
-            </template>
-            <template #default v-else>
-              <el-input v-model="item.equitType" />
-            </template>
-          </el-table-column>
-          <el-table-column prop="equitType" label="采集时间">
-            <template #default="scope" v-if="!item.updateStatus">
-              {{ scope.row.e }}
-            </template>
-            <template #default v-else>
-              <el-input v-model="item.equitType" />
+          <!-- <template v-if="tableData[index][0].length > 0">
+            <template v-if="tableData[index][0].data != null">
+              <template
+                v-for="(value, key) in tableData[index][0].data"
+                :key="key"
+              >
+                <el-table-column :prop="key" :label="key">
+                  <template #default v-if="!item.updateStatus">
+                    {{ value }}
+                  </template>
+                  <template #default v-else>
+                    <el-input v-model="tableData[index].created" />
+                  </template>
+                </el-table-column>
+              </template>
             </template>
-          </el-table-column>
+          </template> -->
           <el-table-column label="操作">
             <template #default="scope">
               <!-- <span class="opear">完成</span> -->
@@ -69,41 +70,74 @@
             </template>
           </el-table-column>
         </el-table>
+        <Pagination
+          v-model:limit="pageS[index].pageSize"
+          v-model:page="pageS[index].pageNo"
+          :total="pageS[index].total"
+          @pagination="paginationChange(index)"
+          position="right"
+        />
       </el-collapse-item>
     </el-collapse>
   </div>
 </template>
 
-<script setup lang="ts">
-import { getScrewdriverData } from "@/api/prosteps/screwdriver";
+<script setup>
+import {
+  getScrewdriverData,
+  getAcquisitionData,
+} from "@/api/prosteps/screwdriver";
 import { useProcessStore } from "@/store";
 import { useDictionaryStore } from "@/store";
-import { DeviceContainer, ResData } from "@/api/prosteps/screwdriverTypes";
 const dictS = useDictionaryStore();
 const store = useProcessStore();
-const activeNames = ref([0]);
-const materialsData = ref<DeviceContainer[]>([]);
+const tableData = ref([]);
+const materialsData = ref([]);
+
 const getData = async () => {
-  const res: ResData = await getScrewdriverData();
+  const res = await getScrewdriverData();
   materialsData.value = res.data;
+  materialsData.value.forEach((item, index) => {
+    pageS.value.push({ ...page });
+    getAcquisitionDatas(item.deviceNo, index);
+  });
+};
+const paginationChange = (index) => {};
+const getAcquisitionDatas = async (No, index) => {
+  const res = await getAcquisitionData({
+    deviceNo: No,
+    operationId: store.odersData.operationId,
+    pageNo: pageS.value[index].pageNo,
+    pageSize: pageS.value[index].pageSize,
+    processId: store.scanInfo.id,
+  });
+  pageS.value[index].total = res.data.totalCount;
+  // res.data.records.forEach((item) => {
+  //   item.data = JSON.parse(item.data);
+  // });
+  tableData.value.push(res.data.records);
 };
 const aa = () => {
   console.log("111");
 };
-const page = reactive({
+const pageS = ref([]);
+const page = {
   pageSize: 10,
   pageNo: 1,
   total: 0,
-});
-onMounted(() => {
-  getData();
+};
+onMounted(async () => {
+  await getData();
 });
 </script>
 
 <style lang="scss" scoped>
-//生产履历表格公共样式
+.containerBox {
+  background-color: white;
+  padding: 20px;
+}
 :deep(.el-collapse-item__header) {
-  background-color: white !important;
+  background-color: rgb(241, 243, 245) !important;
   padding: 0 20px;
   height: 80px;
 }
@@ -120,6 +154,7 @@ onMounted(() => {
 }
 :deep(.el-collapse-item__wrap) {
   padding: 20px;
+  border: 1px solid rgb(241, 243, 245);
 }
 .opear {
   font-size: 16px;