import type { RouteRecordRaw } from 'vue-router'

/** 默认布局 */
const Layout = () => import('@/layout/index.vue')

/** 系统路由 */
export const systemRoutes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: { hidden: true },
  },
  {
    path: '/company',
    name: 'Company',
    component: Layout,
    redirect: '/company/overview',
    meta: { title: '企业概览', icon: 'company', hidden: false, sort: 1 },
    children: [
      {
        path: '/company/overview',
        name: 'CompanyOverview',
        component: () => import('@/views/company/overview/index.vue'),
        meta: { title: '企业概览', icon: 'overview', hidden: false },
      }
    ],
  },
  {
    path: '/organization',
    name: 'Organization',
    component: Layout,
    redirect: '/organization/hr/member',
    meta: { title: '组织架构', icon: 'organization', hidden: false, sort: 2 },
    children: [
      {
        path: '/organization/hr',
        name: 'HRManagement',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/organization/hr/member',
        meta: { title: '人员管理', icon: 'user', hidden: false },
        children: [
          {
            path: '/organization/hr/member',
            name: 'HRMember',
            component: () => import('@/views/system/user/index.vue'),
            meta: { title: '成员', icon: 'user', hidden: false },
          },
          {
            path: '/organization/hr/dept',
            name: 'HRDept',
            component: () => import('@/views/system/dept/index.vue'),
            meta: { title: '部门', icon: 'dept', hidden: false },
          },
          {
            path: '/organization/hr/workload',
            name: 'HRWorkload',
            component: () => import('@/views/hr/workload/index.vue'),
            meta: { title: '工作量', icon: 'workload', hidden: false },
          },
          {
            path: '/organization/hr/attendance',
            name: 'HRAttendance',
            component: () => import('@/views/hr/attendance/index.vue'),
            meta: { title: '考勤', icon: 'attendance', hidden: false },
          },
          {
            path: '/organization/hr/performance',
            name: 'HRPerformance',
            component: () => import('@/views/hr/performance/index.vue'),
            meta: { title: '绩效', icon: 'performance', hidden: false },
          },
          {
            path: '/organization/hr/salary',
            name: 'HRSalary',
            component: () => import('@/views/hr/salary/index.vue'),
            meta: { title: '工资', icon: 'salary', hidden: false },
          },
          {
            path: '/organization/hr/contribution',
            name: 'HRContribution',
            component: () => import('@/views/hr/contribution/index.vue'),
            meta: { title: '责献积分制度、与企业共同发展', icon: 'contribution', hidden: false },
          }
        ]
      },
      {
        path: '/organization/role',
        name: 'OrganizationRole',
        component: () => import('@/views/system/role/index.vue'),
        meta: { title: '角色管理', icon: 'role', hidden: false },
      },
      {
        path: '/organization/log',
        name: 'OrganizationLog',
        component: () => import('@/views/monitor/log/index.vue'),
        meta: { title: '操作日志', icon: 'log', hidden: false },
      }
    ],
  },
  {
    path: '/products-services',
    name: 'ProductsServices',
    component: Layout,
    redirect: '/products-services/products/hardware/tower-monitoring',
    meta: { title: '产品与服务', icon: 'products', hidden: false, sort: 3 },
    children: [
      {
        path: '/products-services/products',
        name: 'Products',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/products-services/products/hardware/tower-monitoring',
        meta: { title: '产品', icon: 'product', hidden: false },
        children: [
          {
            path: '/products-services/products/hardware',
            name: 'SmartHardware',
            component: () => import('@/components/ParentView/index.vue'),
            redirect: '/products-services/products/hardware/tower-monitoring',
            meta: { title: '智能硬件', icon: 'hardware', hidden: false },
            children: [
              {
                path: '/products-services/products/hardware/tower-monitoring',
                name: 'TowerMonitoring',
                component: () => import('@/views/product/hardware/tower-monitoring/index.vue'),
                meta: { title: '风电塔下监测系统', icon: 'monitor', hidden: false },
              },
              {
                path: '/products-services/products/hardware/custom-drone',
                name: 'CustomDrone',
                component: () => import('@/views/product/hardware/custom-drone/index.vue'),
                meta: { title: '定制无人机', icon: 'drone', hidden: false },
              },
              {
                path: '/products-services/products/hardware/drone-basket',
                name: 'DroneBasket',
                component: () => import('@/views/service/lightning-detection/index.vue'),
                meta: { title: '无人吊篮', icon: 'basket', hidden: false },
              },
              {
                path: '/products-services/products/hardware/blade-robot',
                name: 'BladeRobot',
                component: () => import('@/views/service/lightning-detection/index.vue'),
                meta: { title: '叶片维修机器人', icon: 'robot', hidden: false },
              }
            ]
          },
          {
            path: '/products-services/products/software',
            name: 'SmartSoftware',
            component: () => import('@/components/ParentView/index.vue'),
            redirect: '/products-services/products/software/field-assistant',
            meta: { title: '智能软件', icon: 'software', hidden: false },
            children: [
              {
                path: '/products-services/products/software/field-assistant',
                name: 'FieldAssistant',
                component: () => import('@/views/service/lightning-detection/index.vue'),
                meta: { title: '风电外业智能助手（外业数据实时处理）', icon: 'assistant', hidden: false },
              },
              {
                path: '/products-services/products/software/blade-report',
                name: 'BladeReportSystem',
                component: () => import('@/views/service/lightning-detection/index.vue'),
                meta: { title: '叶片检查报告生成系统', icon: 'report', hidden: false },
              },
              {
                path: '/products-services/products/software/ground-station',
                name: 'GroundStation',
                component: () => import('@/views/service/lightning-detection/index.vue'),
                meta: { title: '无人机地面站软件', icon: 'station', hidden: false },
              }
            ]
          }
        ]
      },
      {
        path: '/products-services/services',
        name: 'Services',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/products-services/services/lightning-detection',
        meta: { title: '服务', icon: 'service', hidden: false },
        children: [
          {
            path: '/products-services/services/lightning-detection',
            name: 'LightningDetection',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '防雷检测', icon: 'lightning', hidden: false },
          },
          {
            path: '/products-services/services/blade-internal-detection',
            name: 'BladeInternalDetection',
            component: () => import('@/views/service/blade-internal-detection/index.vue'),
            meta: { title: '叶片内部检测', icon: 'internal', hidden: false },
          },
          {
            path: '/products-services/services/blade-external-detection',
            name: 'BladeExternalDetection',
            component: () => import('@/views/service/blade-internal-detection/index.vue'),
            meta: { title: '叶片外部检测', icon: 'external', hidden: false },
          },
          {
            path: '/products-services/services/solar-inspection',
            name: 'SolarInspection',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '太阳能光伏巡检', icon: 'solar', hidden: false },
          },
          {
            path: '/products-services/services/cleaning',
            name: 'CleaningService',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '清洗', icon: 'cleaning', hidden: false },
          },
          {
            path: '/products-services/services/coating',
            name: 'CoatingService',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '喷涂', icon: 'coating', hidden: false },
          },
          {
            path: '/products-services/services/dam-crack-detection',
            name: 'DamCrackDetection',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '大坝裂缝检测', icon: 'dam', hidden: false },
          },
          {
            path: '/products-services/services/bridge-crack-detection',
            name: 'BridgeCrackDetection',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '桥梁裂缝检测', icon: 'bridge', hidden: false },
          },
          {
            path: '/products-services/services/blade-maintenance',
            name: 'BladeMaintenance',
            component: () => import('@/views/service/lightning-detection/index.vue'),
            meta: { title: '叶片维修', icon: 'maintenance', hidden: false },
          }
        ]
      }
    ],
  },
  {
    path: '/project-management',
    name: 'ProjectManagement',
    component: Layout,
    redirect: '/project-management/bidding/tender-documents',
    meta: { title: '项目管理', icon: 'project', hidden: false, sort: 4 },
    children: [
      {
        path: '/project-management/bidding',
        name: 'ProjectBidding',
        meta: {
          title: '项目投标',
          icon: 'gavel'
        },
        children: [
          {
            path: '/project-management/bidding/tender-documents',
            name: 'TenderDocuments',
            component: () => import('@/views/project-management/bidding/tender-documents/index.vue'),
            meta: {
              title: '招标文件管理',
              icon: 'file-text'
            }
          },
          {
            path: '/project-management/bidding/bid-documents',
            name: 'BidDocuments',
            component: () => import('@/views/project-management/bidding/bid-documents/index.vue'),
            meta: {
              title: '投标文件管理',
              icon: 'file-text'
            }
          },
          {
            path: '/project-management/bidding/award-notice',
            name: 'AwardNotice',
            component: () => import('@/views/project-management/bidding/award-notice/index.vue'),
            meta: {
              title: '中标通知书管理',
              icon: 'trophy'
            }
          }
        ]
      },
      {
        path: '/project-management/contract',
        name: 'ProjectContract',
        meta: {
          title: '合同管理',
          icon: 'file-text'
        },
        children: [
          {
            path: '/project-management/contract/revenue-contract',
            name: 'RevenueContract',
            component: () => import('@/views/project-management/contract/revenue-contract/index.vue'),
            meta: {
              title: '收入合同管理',
              icon: 'dollar'
            }
          },
          {
            path: '/project-management/contract/expense-contract',
            name: 'ExpenseContract',
            component: () => import('@/views/project-management/contract/expense-contract/index.vue'),
            meta: {
              title: '支出合同管理',
              icon: 'credit-card'
            }
          },
          {
            path: '/project-management/contract/cost-management',
            name: 'CostManagement',
            component: () => import('@/views/project-management/contract/cost-management/index.vue'),
            meta: {
              title: '成本管理',
              icon: 'bar-chart'
            }
          }
        ]
      },
      {
        path: '/project-management/projects',
        name: 'ProjectsManagement',
        meta: {
          title: '项目管理',
          icon: 'briefcase'
        },
        children: [
          {
            path: '/project-management/projects/initiation',
            name: 'ProjectInitiation',
            component: () => import('@/views/project-management/projects/initiation/index.vue'),
            meta: {
              title: '立项管理',
              icon: 'plus-circle'
            }
          },
          {
            path: '/project-management/projects/management',
            name: 'ProjectDetailManagement',
            component: () => import('@/views/project-management/projects/management/index.vue'),
            meta: {
              title: '项目详细管理',
              icon: 'settings'
            }
          }
        ]
      }
    ],
  },
  {
    path: '/',
    name: 'Project',
    component: Layout,
    redirect: '/project',
    meta: { title: '项目管理（旧）', icon: 'project-old', hidden: true, sort: 5 },
    children: [
      {
        path: '/project',
        name: 'ProjectList',
        component: () => import('@/views/project/index.vue'),
        meta: { title: '项目列表', icon: 'list', hidden: false },
      },
      {
        path: '/project/detail/:id',
        name: 'ProjectDetail',
        component: () => import('@/views/project/detail/index.vue'),
        meta: { title: '项目详情', icon: 'detail', hidden: true },
      },
      {
        path: '/project/task',
        name: 'TaskBoard',
        component: () => import('@/views/project/task/index.vue'),
        meta: { title: '任务看板', icon: 'table', hidden: false },
      },
      {
        path: '/project/kanban',
        name: 'ProjectKanban',
        component: () => import('@/views/project/kanban/index.vue'),
        meta: { title: '项目进度', icon: 'kanban', hidden: false },
      },
      {
        path: '/project/budget',
        name: 'ProjectBudget',
        component: () => import('@/views/project/budget/index.vue'),
        meta: { title: '项目预算', icon: 'budget', hidden: false },
      }
    ],
  },

  {
    path: '/pwdExpired',
    component: () => import('@/views/login/pwdExpired/index.vue'),
    meta: { hidden: true },
  },
  {
    path: '/enterprise-settings',
    name: 'EnterpriseSettings',
    meta: {
      title: '企业设置',
      icon: 'building'
    },
    children: [
      {
        path: '/enterprise-settings/company-info',
        name: 'CompanyInfo',
        component: () => import('@/views/enterprise-settings/company-info/index.vue'),
        meta: {
          title: '企业信息',
          icon: 'info-circle'
        }
      },
      {
        path: '/enterprise-settings/admin-permissions',
        name: 'AdminPermissions',
        component: () => import('@/views/enterprise-settings/admin-permissions/index.vue'),
        meta: {
          title: '管理员权限',
          icon: 'user-switch'
        }
      },
      {
        path: '/enterprise-settings/data-migration',
        name: 'DataMigration',
        component: () => import('@/views/enterprise-settings/data-migration/index.vue'),
        meta: {
          title: '数据迁移',
          icon: 'swap'
        }
      },
      {
        path: '/enterprise-settings/version-upgrade',
        name: 'VersionUpgrade',
        component: () => import('@/views/enterprise-settings/version-upgrade/index.vue'),
        meta: {
          title: '版本升级提醒',
          icon: 'arrow-up'
        }
      }
    ]
  },
  {
    path: '/system-resource',
    name: 'SystemResource',
    meta: {
      title: '系统资源管理',
      icon: 'cluster'
    },
    children: [
      {
        path: '/system-resource/device-management',
        name: 'DeviceManagement',
        component: () => import('@/views/system-resource/device-management/index.vue'),
        meta: {
          title: '设备管理',
          icon: 'desktop'
        }
      },
      {
        path: '/system-resource/information-system',
        name: 'InformationSystem',
        meta: {
          title: '信息化系统管理',
          icon: 'code'
        },
        children: [
          {
            path: '/system-resource/information-system/software-management',
            name: 'SoftwareManagement',
            component: () => import('@/views/system-resource/information-system/software-management/index.vue'),
            meta: {
              title: '软件管理',
              icon: 'appstore'
            }
          },
          {
            path: '/system-resource/information-system/system-backup',
            name: 'SystemBackup',
            component: () => import('@/views/system-resource/information-system/system-backup/index.vue'),
            meta: {
              title: '系统备份管理',
              icon: 'save'
            }
          }
        ]
      }
    ]
  }
]

// 固定路由（默认路由）
export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/redirect',
    component: Layout,
    meta: { hidden: true },
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/default/redirect/index.vue'),
      },
    ],
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/default/error/404.vue'),
    meta: { hidden: true },
  },
  {
    path: '/403',
    component: () => import('@/views/default/error/403.vue'),
    meta: { hidden: true },
  },
]

