import type { Route } from '@/global'

const Layout = () => import('@/layouts/index.vue')

const routes: Route.recordRaw[] = [
  {
    path: '/manager',
    component: Layout,
    redirect: '/manager/orderList',
    name: 'Manager',
    meta: {
      title: '业务管理',
      icon: 'ep:key',
      auth: '/business/manager',
    },
    children: [
      {
        path: 'orderList',
        name: 'BusinessManagerOderList',
        component: () => import('@/views/business/manager/order/list.vue'),
        meta: {
          title: '任务单管理',
          auth: '/business/manager/order',
          icon: 'ep:key',
        },
      },
      {
        path: ':type/:id?',
        name: 'BusinessManagerOderDetail',
        component: () => import('@/views/business/manager/order/detail.vue'),
        meta: {
          title: '任务单管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/manager/orderList',
        },
      },
      {
        path: 'sendReceive',
        name: 'SendReceive',
        component: () => import('@/views/business/manager/sendReceive/list.vue'),
        meta: {
          title: '设备收发管理列表',
          auth: '/business/manager/sendReceive',
          icon: 'ep:key',
        },
      },
      {
        path: '/sendReceive/:type/:id?',
        name: 'BusinessManagerSendReceiveDetail',
        component: () => import('@/views/business/manager/sendReceive/detail.vue'),
        meta: {
          title: '设备收发管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/manager/sendReceive',
        },
      },
      {
        path: 'interchangeReceipt',
        name: 'InterchangeReceiptList',
        component: () => import('@/views/business/manager/interchangeReceipt/list.vue'),
        meta: {
          title: '交接单管理',
          auth: '/business/manager/interchangeReceipt',
          icon: 'ep:key',
        },
      },
      {
        path: '/interchangeReceipt/:type/:id?',
        name: 'InterchangeReceiptDetail',
        component: () => import('@/views/business/manager/interchangeReceipt/detail.vue'),
        meta: {
          title: '交接单管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/manager/interchangeReceipt',
        },
      },
      {
        path: 'task',
        name: 'taskList',
        component: () => import('@/views/business/manager/task/list.vue'),
        meta: {
          title: '任务分发管理',
          auth: '/business/manager/task',
          icon: 'ep:key',
        },
      },
      {
        path: '/task/:type/:id?',
        name: 'taskDetail',
        component: () => import('@/views/business/manager/task/detail.vue'),
        meta: {
          title: '任务分发管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/manager/task',
        },
      },
    ],
  },
  {
    path: '/taskMeasure',
    component: Layout,
    redirect: '/taskMeasure/orderList',
    name: 'taskMeasure',
    meta: {
      title: '任务计量管理',
      icon: 'ep:key',
      auth: '/business/taskMeasure',
    },
    children: [
      {
        path: 'myTaskList',
        name: 'TaskMeasureMyTaskList',
        component: () => import('@/views/business/taskMeasure/myTask/list.vue'),
        meta: {
          title: '我的任务',
          auth: '/business/taskMeasure/myTask',
          icon: 'ep:key',
        },
      },
      {
        path: '/myTask/:type/:id?',
        name: 'TaskMeasureMyTaskDetail',
        component: () => import('@/views/business/taskMeasure/myTask/detail.vue'),
        meta: {
          title: '我的任务',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/taskMeasure/myTaskList',
        },
      },
      {
        path: 'labTaskList',
        name: 'LabMeasureMyTaskList',
        component: () => import('@/views/business/taskMeasure/labTask/list.vue'),
        meta: {
          title: '实验室任务',
          auth: '/business/taskMeasure/labTask',
          icon: 'ep:key',
        },
      },
      {
        path: '/labTask/:type/:id?',
        name: 'LabMeasureMyTaskDetail',
        component: () => import('@/views/business/taskMeasure/labTask/detail.vue'),
        meta: {
          title: '实验室任务',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/taskMeasure/labTaskList',
        },
      },
      {
        path: 'certificateList',
        name: 'certificateList',
        component: () => import('@/views/business/taskMeasure/certificate/list.vue'),
        meta: {
          title: '证书审批管理',
          auth: '/business/taskMeasure/certificate',
          icon: 'ep:key',
        },
      },
      {
        path: '/certificate/:type/:id?',
        name: 'certificateDetail',
        component: () => import('@/views/business/taskMeasure/certificate/detail.vue'),
        meta: {
          title: '证书审批管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/taskMeasure/certificateList',
        },
      },
    ],
  },
  {
    path: '/certManage',
    component: Layout,
    redirect: '/certManage/list',
    name: 'CertManage',
    meta: {
      title: '证书管理',
      icon: 'ep:key',
      auth: '/business/certManage',
    },
    children: [
      {
        path: 'list',
        name: 'CertManageList',
        component: () => import('@/views/business/certManage/cert/list.vue'),
        meta: {
          title: '证书管理',
          auth: '/business/certManage/list',
          icon: 'ep:key',
        },
      },
      {
        path: '/cert/:type/:id?',
        name: 'CertManageDetail',
        component: () => import('@/views/business/certManage/cert/detail.vue'),
        meta: {
          title: '证书管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/certManage/list',
        },
      },
      {
        path: 'applyList',
        name: 'CertManageApplyList',
        component: () => import('@/views/business/certManage/apply/list.vue'),
        meta: {
          title: '证书/报告补充或更换申请单',
          auth: '/business/certManage/apply',
          icon: 'ep:key',
        },
      },
      {
        path: '/apply/:type/:id?',
        name: 'CertManageApplyDetail',
        component: () => import('@/views/business/certManage/apply/detail.vue'),
        meta: {
          title: '证书/报告补充或更换申请单',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/certManage/applyList',
        },
      },
    ],
  },
  {
    path: '/subpackage',
    component: Layout,
    redirect: '/subpackage/directoriesList',
    name: 'Subpackage',
    meta: {
      title: '分包管理',
      icon: 'ep:key',
      auth: '/business/subpackage',
    },
    children: [
      {
        path: 'directoriesList',
        name: 'DirectoriesList',
        component: () => import('@/views/business/subpackage/directories/list.vue'),
        meta: {
          title: '测试、校准或检定合格分包方名录',
          auth: '/business/subpackage/directories',
          icon: 'ep:key',
        },
      },
      {
        path: '/directories/:type/:id?',
        name: 'DirectoriesDetail',
        component: () => import('@/views/business/subpackage/directories/edit.vue'),
        meta: {
          title: '测试、校准或检定合格分包方名录',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/directoriesList',
        },
      },
      {
        path: '/directoriesDoc/detail/:id?',
        name: 'DirectoriesDetailDoc',
        component: () => import('@/views/business/subpackage/directories/detail.vue'),
        meta: {
          title: '测试、校准或检定合格分包方名录',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/directoriesList',
        },
      },
      {
        path: 'reviewList',
        name: 'ReviewList',
        component: () => import('@/views/business/subpackage/review/list.vue'),
        meta: {
          title: '测试、校准或检定工作分包评审表',
          auth: '/business/subpackage/review',
          icon: 'ep:key',
        },
      },
      {
        path: '/review/:type/:id?',
        name: 'ReviewEdit',
        component: () => import('@/views/business/subpackage/review/edit.vue'),
        meta: {
          title: '测试、校准或检定工作分包评审表',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/reviewList',
        },
      },
      {
        path: '/reviewDoc/:type/:id?',
        name: 'ReviewDetail',
        component: () => import('@/views/business/subpackage/review/detail.vue'),
        meta: {
          title: '测试、校准或检定工作分包评审表',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/reviewList',
        },
      },
      {
        path: 'agreementList',
        name: 'AgreementList',
        component: () => import('@/views/business/subpackage/agreement/list.vue'),
        meta: {
          title: '测试、校准或检定工作分包协议书',
          auth: '/business/subpackage/agreement',
          icon: 'ep:key',
        },
      },
      {
        path: '/agreement/:type/:id?',
        name: 'AgreementEdit',
        component: () => import('@/views/business/subpackage/agreement/edit.vue'),
        meta: {
          title: '测试、校准或检定工作分包协议书',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/agreementList',
        },
      },
      {
        path: '/agreementDoc/:type/:id?',
        name: 'AgreementDetail',
        component: () => import('@/views/business/subpackage/agreement/detail.vue'),
        meta: {
          title: '测试、校准或检定工作分包协议书',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/agreementList',
        },
      },
      {
        path: 'informList',
        name: 'InformList',
        component: () => import('@/views/business/subpackage/inform/list.vue'),
        meta: {
          title: '测试、校准或检定工作分包通知书',
          auth: '/business/subpackage/inform',
          icon: 'ep:key',
        },
      },
      {
        path: '/inform/:type/:id?',
        name: 'InformEdit',
        component: () => import('@/views/business/subpackage/inform/edit.vue'),
        meta: {
          title: '测试、校准或检定工作分包通知书',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/informList',
        },
      },
      {
        path: '/informDoc/:type/:id?',
        name: 'InformDetail',
        component: () => import('@/views/business/subpackage/inform/detail.vue'),
        meta: {
          title: '测试、校准或检定工作分包通知书',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/informList',
        },
      },
      {
        path: 'certificateList',
        name: 'SubpackageCertificateList',
        component: () => import('@/views/business/subpackage/certificate/list.vue'),
        meta: {
          title: '分包证书管理',
          auth: '/business/subpackage/certificate',
          icon: 'ep:key',
        },
      },
      {
        path: 'certificate/:type/:id?',
        name: 'SubpackageCertificateDetail',
        component: () => import('@/views/business/subpackage/certificate/detail.vue'),
        meta: {
          title: '分包证书管理',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/subpackage/certificateList',
        },
      },
    ],
  },
  {
    path: '/fieldTest',
    component: Layout,
    redirect: '/fieldTest/record', // 子路由
    name: 'FieldTest',
    meta: {
      title: '现场计量质量保证',
      icon: 'ep:key',
      auth: '/business/fieldTest',
    },
    children: [
      {
        path: 'approve',
        name: 'FieldTestApprove',
        component: () => import('@/views/business/fieldTest/approve/list.vue'),
        meta: {
          title: '现场测试、校准或检定审批',
          icon: 'ep:key',
          auth: '/business/fieldTest/approve',
        },
      },
      {
        path: 'approve/:type/:id?',
        name: 'FieldTestApproveDetail',
        component: () => import('@/views/business/fieldTest/approve/edit.vue'),
        meta: {
          title: '现场测试、校准或检定审批',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/fieldTest/approve',
        },
      },
      {
        path: '/fieldTest/approveDoc/detail/:id?',
        name: 'FieldTestApproveDetailDoc',
        component: () => import('@/views/business/fieldTest/approve/detail.vue'),
        meta: {
          title: '现场测试、校准或检定审批',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/fieldTest/approve',
        },
      },
      {
        path: 'record',
        name: 'FieldTestRecord',
        component: () => import('@/views/business/fieldTest/record/list.vue'),
        meta: {
          title: '现场测试、校准或检定工作记录表',
          icon: 'ep:key',
          auth: '/business/fieldTest/record',
        },
      },
      {
        path: 'record/:type/:id?',
        name: 'FieldTestRecordDetail',
        component: () => import('@/views/business/fieldTest/record/edit.vue'),
        meta: {
          title: '现场测试、校准或检定工作记录表',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/business/fieldTest/record',
        },
      },
      {
        path: 'recordDoc/detail/:id?',
        name: 'FieldTestRecordDetailDic',
        component: () => import('@/views/business/fieldTest/record/detail.vue'),
        meta: {
          title: '现场测试、校准或检定工作记录表',
          icon: 'ep:key',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/business/fieldTest/record',
        },
      },
    ],
  },
]

export default routes
