吉安感知网项目-前端
张含笑
2026-01-27 ee56f9c54ec788c8a483af59a8c4d88e0dd5443c
feat:修改传参
2 files modified
83 ■■■■ changed files
applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue 42 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue 41 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue
@@ -245,8 +245,10 @@
// 懒加载获取区域节点数据
async function loadRegionNode(node, resolve) {
  try {
    const parentCode = node.data?.id  || '360800000000'
    const res = await regionLazyTreeApi({ parentCode })
    // 初始化加载时传递 code 参数,加载子节点时传递 parentCode 参数
    const params = node.data?.id ? { parentCode: node.data.id } : { code: '360800000000' }
    const parentCode = node.data?.id || '360800000000'
    const res = await regionLazyTreeApi(params)
    const nodes = res?.data?.data || []
    
    // 处理返回的节点数据
@@ -274,28 +276,28 @@
  }
}
// 获取初始区域数据(根节点)
async function getRegionList() {
  try {
    // 懒加载模式下,只需要初始化根节点
    const res = await regionLazyTreeApi({ parentCode: '360800000000' })
    const nodes = res?.data?.data || []
// async function getRegionList() {
//   try {
//     // 懒加载模式下,只需要初始化根节点
//     const res = await regionLazyTreeApi({ parentCode: '360800000000' })
//     const nodes = res?.data?.data || []
    
    // 处理根节点数据
    regionOptions.value = nodes.map(item => {
      return {
        id: item.id || item.value,
        name: item.name || item.title || item.label,
        hasChildren: item.hasChildren || false
      }
    })
  } catch (error) {
    console.error('获取区域数据失败:', error)
  }
}
//     // 处理根节点数据
//     regionOptions.value = nodes.map(item => {
//       return {
//         id: item.id || item.value,
//         name: item.name || item.title || item.label,
//         hasChildren: item.hasChildren || false
//       }
//     })
//   } catch (error) {
//     console.error('获取区域数据失败:', error)
//   }
// }
defineExpose({ open })
onMounted(() => {
  getRegionList()
  // getRegionList()
})
</script>
applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
@@ -197,8 +197,9 @@
async function loadRegionNode(node, resolve) {
  try {
    const parentCode = node.data?.id || '360800000000'
    const res = await regionLazyTreeApi({ parentCode })
    // 初始化加载时传递 code 参数,加载子节点时传递 parentCode 参数
    const params = node.data?.id ? { parentCode: node.data.id } : { code: '360800000000' }
    const res = await regionLazyTreeApi(params)
    const nodes = res?.data?.data || []
    
    // 处理返回的节点数据
@@ -218,24 +219,24 @@
}
// 获取初始区域数据(根节点)
async function getRegionList() {
  try {
    // 懒加载模式下,只需要初始化根节点
    const res = await regionLazyTreeApi({ parentCode: '360800000000' })
    const nodes = res?.data?.data || []
// async function getRegionList() {
//   try {
//     // 懒加载模式下,只需要初始化根节点
//     const res = await regionLazyTreeApi({ parentCode: '360800000000' })
//     const nodes = res?.data?.data || []
    
    // 处理根节点数据
    regionOptions.value = nodes.map(item => {
      return {
        id: item.id || item.value,
        name: item.name || item.title || item.label,
        hasChildren: item.hasChildren || false
      }
    })
  } catch (error) {
    console.error('获取区域数据失败:', error)
  }
}
//     // 处理根节点数据
//     regionOptions.value = nodes.map(item => {
//       return {
//         id: item.id || item.value,
//         name: item.name || item.title || item.label,
//         hasChildren: item.hasChildren || false
//       }
//     })
//   } catch (error) {
//     console.error('获取区域数据失败:', error)
//   }
// }
// 获取列表
async function getList() {
@@ -384,7 +385,7 @@
onMounted(() => {
  getDictList()
  getRegionList()
  // getRegionList()
  getList()
})
</script>