Procházet zdrojové kódy

组件参数单位默认值字段修改

lichunyang před 4 týdny
rodič
revize
b6f75309bf
1 změnil soubory, kde provedl 37 přidání a 3 odebrání
  1. 37 3
      src/views/model/vueflow/aside/asideData.vue

+ 37 - 3
src/views/model/vueflow/aside/asideData.vue

@@ -51,7 +51,7 @@
                   <template #default="{ row }">
                     <el-select
                       v-if="row.unitType !== '无'"
-                      v-model="row.unitDef"
+                      v-model="row.unit"
                       placeholder="请选择"
                       @focus="fetchUnitsForRow(row)"
                       :loading="moreOptionsLoading"
@@ -158,6 +158,7 @@
                   v-model="col.unitDef"
                   size="small"
                   @focus="fetchUnitsForRow(col)"
+                  @change="saveSelectedUnit(col)"
                 >
                   <el-option
                     v-for="opt in col.unitoptions"
@@ -464,6 +465,10 @@ const getbtnvalue = async (pcaId, dataType) => {
 
   try {
     const res = await request(params)
+    console.log("fffffffffffff", pcaId,   dataType);
+    
+    console.log("获取到的值:", res);
+    
 
     if (dataType === 1) {
       // 处理 headers - 使用 Promise.all 确保所有异步操作完成
@@ -640,11 +645,13 @@ const handleClick = async (row) => {
 const savecomvalue = () => {
   // dataType 为 -1 的数据
   const validItems = comdata.value.filter((item) => item.dataType === -1)
+  console.log("validItemsssssssssaaaaaaaaaa", validItems);
+  
   const pcavals = validItems
     .map((item) => {
       const pcaId = item.pcaId ?? ""
       const value = item.value ?? ""
-      const unit = item.unitDef  != '' ? item.unitDef : "无"
+      const unit = item.unit  != '' ? item.unit : "无"
       return `${pcaId},${value},${unit}`
     })
     .join(";");
@@ -672,10 +679,12 @@ const currentRow = ref(null) // 当前选中行
 // 创建新行的辅助函数
 const createNewRow = () => {
   const newRow = {}
+  console.log("tableColumns.value", tableColumns.value);
+  
   tableColumns.value.forEach((col) => {
     newRow[col.code] = {
       value: col.valueType === 1 ? col.options?.[0]?.val || "" : "",
-      unit: col.unit || "无",
+      unit: col.unitDef || "无",
       options: col.valueType === 1 ? col.options : [],
       pcadgId: "", // 初始化为空字符串
       pcadId: "",
@@ -827,6 +836,8 @@ const saveTabelDialog = () => {
     const rowFields = tableColumns.value.map((col) => {
       const cellData = row[col.code]
       if (!cellData) return ""
+      console.log("cellDataqqqqqqqq", cellData);
+      
 
       // 组装 cdvId-pcadgId-pcadId-value-unit 格式
       return [
@@ -988,6 +999,29 @@ const fetchUnitsForRow = async (row) => {
   }
 }
 
+// 保存选中的单位
+const saveSelectedUnit = async (col) => {
+  console.log("保存选中的单位111111111111:", col);
+  
+  try {
+    const selectedUnit = col.unitOptions.find(
+      (unit) => unit.value === col.selectedUnitId
+    )
+    const params = {
+      transCode: "ES0022",
+      gutId: col.gutId,
+      utId: selectedUnit.utId || "",
+      sutId: selectedGroupId.value || "",
+      gsutId: col.gsutId || "",
+      value: selectedUnit.value
+    }
+    const res = await request(params)
+    ElMessage.success(t("message.settingSuccess"))
+  } catch (err) {
+    ElMessage.error(err.returnMsg || t("message.settingFailed"))
+  }
+}
+
 defineExpose({
   getcomdata,
   getresultData