Преглед изворни кода

默认单位修改;单位获取BES001接口注释;

lichunyang пре 4 недеља
родитељ
комит
00009718ca
2 измењених фајлова са 24 додато и 16 уклоњено
  1. 24 15
      src/views/model/vueflow/aside/asideData.vue
  2. 0 1
      src/views/model/vueflow/index.vue

+ 24 - 15
src/views/model/vueflow/aside/asideData.vue

@@ -51,7 +51,7 @@
                   <template #default="{ row }">
                     <el-select
                       v-if="row.unitType !== '无'"
-                      v-model="row.unit"
+                      v-model="row.unitDef"
                       placeholder="请选择"
                       @focus="fetchUnitsForRow(row)"
                       :loading="moreOptionsLoading"
@@ -418,6 +418,13 @@ const getcomdata = async (onpcId) => {
     }))
     console.log("comdata.value", comdata.value)
 
+    // 处理 unit 和 unitDef 的关系
+    comdata.value.forEach(row => {
+      // 如果有 unit 字段,则将其值赋给 unitDef(用于下拉框显示)
+      if (row.unit && row.unitType !== '无') {
+        row.unitDef = row.unit;
+      }
+    });
     // 使用 for...of 循环以便使用 await
     for (const item of comdata.value) {
       if (!item.pcaId) continue
@@ -432,7 +439,7 @@ const getcomdata = async (onpcId) => {
       }
 
       if (item.unitType !== "无") {
-        promises.push(getlistopt(item, "unit"))
+        // promises.push(getlistopt(item, "unit"))
       } else {
         item.unit = "无"
       }
@@ -464,18 +471,14 @@ const getbtnvalue = async (pcaId, dataType) => {
   }
 
   try {
-    const res = await request(params)
-    console.log("fffffffffffff", pcaId,   dataType);
-    
-    console.log("获取到的值:", res);
-    
+    const res = await request(params) 
 
     if (dataType === 1) {
       // 处理 headers - 使用 Promise.all 确保所有异步操作完成
       await Promise.all(
         res.headers?.map(async (header) => {
           if (header?.unitType !== "无") {
-            await getlistopt(header, "unit")
+            // await getlistopt(header, "unit")
           } else {
             header.unit = "无"
             header.unitoptions = []
@@ -510,17 +513,21 @@ const getbtnvalue = async (pcaId, dataType) => {
 
           const row = rowMap.get(rowId)
 
-          // 为表头的下拉框赋值
-          if (header.unitType !== "无") {
-            header.unit = item.unit
+          if (item.unit) {
+            header.unitDef = item.unit
           }
 
+          // 为表头的下拉框赋值
+          // if (header.unitType !== "无") {
+          //   header.unit = item.unit
+          // }
+
           // 处理下拉类型
           if (header?.valueType === 1) {
             await getlistopt(header, "value")
             row[header.code] = {
               value: item?.value || header?.value || "",
-              unit: item?.unit || "无",
+              unit: item?.unit || header?.unitDef || "无",
               options: header?.options || [],
               pcadgId: item.pcadgId,
               pcadId: item.pcadId,
@@ -530,7 +537,7 @@ const getbtnvalue = async (pcaId, dataType) => {
             // 非下拉类型
             row[header.code] = {
               value: item?.value || "",
-              unit: item?.unit || "无",
+              unit: item?.unit || header?.unitDef || "无",
               pcadgId: item.pcadgId,
               pcadId: item.pcadId,
               cdvId: item.cdvId
@@ -576,6 +583,7 @@ const getbtnvalue = async (pcaId, dataType) => {
 }
 
 const getlistopt = async (item, gettype) => {
+  
   let params = {}
   if (gettype === "value") {
     params = {
@@ -651,7 +659,7 @@ const savecomvalue = () => {
     .map((item) => {
       const pcaId = item.pcaId ?? ""
       const value = item.value ?? ""
-      const unit = item.unit  != '' ? item.unit : "无"
+      const unit = item.unitDef  != '' ? item.unitDef : "无"
       return `${pcaId},${value},${unit}`
     })
     .join(";");
@@ -821,7 +829,8 @@ const saveTabelDialog = () => {
       if (newRow[col.code] && typeof newRow[col.code] === "object") {
         newRow[col.code] = {
           ...newRow[col.code],
-          pcadgId: rowIndex + 1 // 行号从1开始
+          pcadgId: rowIndex + 1, // 行号从1开始
+          unit: col.unitDef
         }
       }
     })

+ 0 - 1
src/views/model/vueflow/index.vue

@@ -172,7 +172,6 @@ onNodeDrag(({ node }) => {
     console.error('onNodeDrag 未收到节点数据');
     return;
   }
-  console.log('拖动节点:', node.id, node.type, node.position);
   const step = node.type === 'point-only' ? 1 : GRID_SIZE;
   const newPosition = {
     x: Math.round(node.position.x / step) * step,