dataProduct.ts 5.73 KB
import { tr } from 'element-plus/es/locale';
import type { RouteRecordRaw } from 'vue-router'

function Layout() {
  return import('@/layouts/index.vue')
}

const routes: RouteRecordRaw[] = [
  {
    path: '/data-product/product-listing',
    component: Layout,
    meta: {
      title: '数据产品上架',
      icon: 'sidebar-videos',
    },
    children: [
      {
        path: '',
        name: 'productListing',
        component: () => import('@/views/data_product/productListing.vue'),
        meta: {
          title: '数据产品上架',
          sidebar: false,
          breadcrumb: false,
          cache: true
        },
      },
      {
        path: 'listing-detail',
        name: 'productListingDetail',
        component: () => import('@/views/data_product/productListingDetail.vue'),
        meta: {
          title: '新建数据产品',
          sidebar: false,
          reuse: true,
          breadcrumb: false,
          cache: true
        },
        beforeEnter: (to, from) => {
          if(to.query.type){
            if (to.query.type == 'detail') {
              to.meta.title = `详情-${to.query.name}`;
            } else {
              to.meta.editPage = true;
              to.meta.title = to.query.type=='add'? '新建数据产品': to.query.type=='edit'? `编辑-${to.query.name}`: `详情-${to.query.name}`;
            }
          }
        }
      },
    ],
  },
  {
    path: '/data-product/listing-check',
    component: Layout,
    meta: {
      title: '数据产品审核',
      icon: 'sidebar-videos',
    },
    children: [
      {
        path: '',
        name: 'productListingCheck',
        component: () => import('@/views/data_product/productListingCheck.vue'),
        meta: {
          title: '数据产品审核',
          sidebar: false,
          breadcrumb: false,
          cache: true,
        },
      },
      {
        path: 'listing-detail',
        name: 'productListingCheckDetail',
        component: () => import('@/views/data_product/productListingDetail.vue'),
        meta: {
          title: '产品审核详情',
          sidebar: false,
          breadcrumb: false,
          cache: true,
          reuse: true,
        },
        beforeEnter: (to, from) => {
          if (to.query.type == 'check') {
            to.meta.editPage = true;
            to.meta.title = `详情-${to.query.name}`;
            return;
          }
        }
      },
    ],
  },
  {
    path: '/data-product/demands-publish',
    component: Layout,
    meta: {
      title: '数据需求发布',
      icon: 'sidebar-videos',
    },
    children: [
      {
        path: '',
        name: 'productDemandsPublish',
        component: () => import('@/views/data_product/productDemandsPublish.vue'),
        meta: {
          title: '数据需求发布',
          sidebar: false,
          breadcrumb: false,
          cache: true
        },
      },
      {
        path: 'demands-detail',
        name: 'productDemandsDetail',
        component: () => import('@/views/data_product/productDemandsDetail.vue'),
        meta: {
          title: '新建数据需求',
          sidebar: false,
          breadcrumb: false,
          cache: true,
          reuse: true,
        },
        beforeEnter: (to, from) => {
          if(to.query.type){
            if (to.query.type == 'detail') {
              to.meta.title = `详情-${to.query.name}`;
            } else {
              to.meta.editPage = true;
              to.meta.title = to.query.type=='add'? `新建数据需求${to.query.interfaceType == '2' ? '(算法竞赛)' : (to.query.interfaceType == '3' ? '(要素市场)' : '')}`: to.query.type=='edit'? `编辑-${to.query.name}`: `详情-${to.query.name}`;
            }
          }
        }
      },
    ],
  },
  {
    path: '/data-product/demands-check',
    component: Layout,
    meta: {
      title: '数据需求审核',
      icon: 'sidebar-videos',
    },
    children: [
      {
        path: '',
        name: 'productDemandsCheck',
        component: () => import('@/views/data_product/productDemandsCheck.vue'),
        meta: {
          title: '数据需求审核',
          sidebar: false,
          breadcrumb: false,
          cache: true
        },
      },
      {
        path: 'demands-detail',
        name: 'productDemandsCheckDetail',
        component: () => import('@/views/data_product/productDemandsDetail.vue'),
        meta: {
          title: '需求审核详情',
          sidebar: false,
          breadcrumb: false,
          cache: true,
          reuse: true,
        },
        beforeEnter: (to, from) => {
          if (to.query.type == 'check') {
            to.meta.editPage = true;
            to.meta.title = `详情-${to.query.name}`;
          }
        }
      },
    ],
  },
  // {
  //   path: '/data-guide/transaction-finance',
  //   component: Layout,
  //   meta: {
  //     title: '交易融资指南',
  //     icon: 'sidebar-videos',
  //   },
  //   children: [
  //     {
  //       path: '',
  //       name: 'transactionFinanceGuid',
  //       component: () => import('@/views/data_transaction/transactionFinanceGuide.vue'),
  //       meta: {
  //         title: '交易融资指南',
  //         sidebar: false,
  //         breadcrumb: false,
  //         cache: true
  //       },
  //     },
  //   ],
  // },
  {
    path: '/data-product/transaction-management',
    component: Layout,
    meta: {
      title: '资产交易管理',
      icon: 'sidebar-videos',
    },
    children: [
      {
        path: '',
        name: 'transactionManagement',
        component: () => import('@/views/data_transaction/transactionManagement.vue'),
        meta: {
          title: '资产交易管理',
          sidebar: false,
          breadcrumb: false,
          cache: true
        },
      },
    ],
  },
]

export default routes