瀏覽代碼

选中个人单位后调用0024接口应用;再次加载初始化;下拉选项增加laoding

lichunyang 1 月之前
父節點
當前提交
ac869929ba
共有 2 個文件被更改,包括 37 次插入6 次删除
  1. 37 3
      src/components/PersonUnitDialog.vue
  2. 0 3
      src/views/model/vueflow/index.vue

+ 37 - 3
src/components/PersonUnitDialog.vue

@@ -70,6 +70,8 @@
                 style="width: 100%"
                 @focus="fetchUnitsForRow(row)"
                 @change="saveSelectedUnit(row)"
+                :disabled="selectedGroupId == '1'"
+                :loading="moreOptionsLoading"
               >
                 <el-option
                   v-for="unit in row.unitOptions"
@@ -269,6 +271,9 @@ const unitOptionsCache = ref({})
 // 新增单位组弹窗的显示状态
 const addUnitGroupVisible = ref(false)
 
+// 更多选项加载状态
+const moreOptionsLoading = ref(false);
+
 // 显示新增单位组弹窗
 const showAddUnitGroupDialog = () => {
   addUnitGroupVisible.value = true
@@ -281,9 +286,11 @@ const fetchUnitGroups = async () => {
   }
   try {
     const res = await request(params)
+    selectedGroupId.value = res.sutId;
+    
     return (res.rows || []).map(row => ({
       ...row,
-      isEditable: row.sutId !== '1' // 不可编辑和删除
+      isEditable: row.sutId !== '1', // 不可编辑和删除
     }))
   } catch (err) {
     ElMessage.error(err.returnMsg || t("error.fetchFailed"))
@@ -322,6 +329,7 @@ const fetchUnitsForRow = async (row) => {
     }
     return
   }
+  moreOptionsLoading.value = true;
 
   const params = {
     transCode: "ES0019",
@@ -334,7 +342,9 @@ const fetchUnitsForRow = async (row) => {
     if (!row.selectedUnitId && row.unitOptions.length > 0) {
       row.selectedUnitId = row.unitOptions[0].value
     }
+    moreOptionsLoading.value = false;
   } catch (err) {
+    moreOptionsLoading.value = false;
     ElMessage.error(err.returnMsg || t("error.fetchFailed"))
     row.unitOptions = []
     unitOptionsCache.value[row.gutId] = []
@@ -412,6 +422,7 @@ const handleDeleteUnitGroup = async (row) => {
   }
 }
 
+// 保存中英文名称
 const handleSaveName = async () => {
   try {
     const params = {
@@ -427,6 +438,24 @@ const handleSaveName = async () => {
   }
 }
 
+// 应用个人已选择的单位系统
+const fetchApplyUnitsSystem = async (sutId) => {
+  const params = {
+    transCode: "ES0023",
+    sutId: sutId
+  }
+  try {
+    const res = await request(params)
+    if (res.rows && res.rows.length > 0) {
+      selectedGroup.value = res.rows[0].nameEn
+    } else {
+      selectedGroup.value = ""
+    }
+  } catch (err) {
+    ElMessage.error(err.returnMsg || t("error.fetchFailed"))
+  }
+}
+
 // footer 确认按钮
 const handleConfirm = () => {
   emit("confirm", {
@@ -436,6 +465,7 @@ const handleConfirm = () => {
   emit("update:visible", false)
 }
 
+// 初始化数据
 watch(
   () => props.visible,
   async (newVisible) => {
@@ -444,8 +474,8 @@ watch(
       const groups = await fetchUnitGroups()
       unitGroups.value = groups
       if (groups.length > 0) {
-        selectedGroupId.value = groups[0].sutId
-        await fetchUnitTableData(groups[0].sutId)
+        
+        await fetchUnitTableData(selectedGroupId.value)
       } else {
         loading.value = false
       }
@@ -454,11 +484,15 @@ watch(
   { immediate: true }
 )
 
+// 监听选中的单位系统变化
 watch(
   selectedGroupId,
   async (newId) => {
     if (newId) {
+      // 重新加载表格数据
       await fetchUnitTableData(newId)
+      // 应用选中的单位系统
+      await fetchApplyUnitsSystem(newId)
     } else {
       tableData.value = []
     }

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

@@ -245,7 +245,6 @@ watch(
       })
     }
     if (addedEdges.length > 0) {
-      console.log("Added Edges:", addedEdges)
     }
 
     // 更新快照
@@ -418,7 +417,6 @@ const onEdgeClick = (e) => {
 }
 
 const onNodeClick = (event) => {
-  console.log("节点被单击:", event)
   noid.value = event.node
 }
 
@@ -719,7 +717,6 @@ const flowInit = () => {
     projectStore.projectInfo.flow || '{"nodes":[],"edges":[]}'
   )
 
-  console.log("初始化流程数据:", nodesflow)
   nodes.value = nodesflow.nodes
   edges.value = nodesflow.edges
 }