data_inventory.ts 6.92 KB
import type { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'


/**
 *  {
      "children": [
        {
          "parentGuids": [
            "string"
          ]
        }
      ],
      "parentGuids": [
        "string"
      ],
      "guid": "string",
      "tenantGuid": "string",
      "cgDirName": "string",
      "classifyName": "string",
      "orderNum": 0,
      "level": 0,
      "levelCode": "string",
      "parentGuid": "string"
    }
 */
export const getCgDirTreeList = {
  url: '/mock/cg-dir/tree-list',
  method: 'post',
  response: ({body}:{body:any}) => {

    return {
      code: '00000',
      message: '成功',
      'data|10-30': [{
      guid: '@guid',
      tenantGuid: '@guid',
      cgDirName: '@cword(3, 10)',
      classifyName: '@cword(3, 5)',
      orderNum: '@integer(1, 100)',
      level: '@integer(1, 3)',
      levelCode: '@string("number", 6)',
      parentGuid: '@guid',
      'parentGuids|1-2': ['@guid'],
      'children|0-3': [{
        guid: '@guid',
        tenantGuid: '@guid',
        cgDirName: '@cword(3, 5)',
        classifyName: '@cword(3, 5)',
        orderNum: '@integer(1, 100)',
        level: '@integer(1, 3)',
        levelCode: '@string("number", 6)',
        parentGuid: '@guid',
        'parentGuids|1-2': ['@guid']
      }]
    }]
    }
  }
}

/**
 *  "data": {
    "totalRows": 0,
    "totalPages": 0,
    "pageSize": 0,
    "pageIndex": 0,
    "records": [
      {
        "guid": "string",
        "tenantGuid": "string",
        "cgDirName": "string",
        "dirGuid": "string",
        "classifyName": "string",
        "gradeDetailName": "string",
        "label": "string",
        "fieldName": "string",
        "fieldChName": "string",
        "tableName": "string",
        "tableChName": "string",
        "database": "string",
        "databaseChName": "string"
      }
    ],
    export const getCgDirFieldPageList = (data) => request({
  url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/field/page-list`,
  method: 'post',
  data
})
 */

export const getCgDirFieldPageList = {
  url: '/mock/cg-dir/field/page-list',
  method: 'post',
  response: ({body}:{body:any}) => {
    return {
      code: '00000',
      message: '成功',
      'data': {
        totalRows: '@integer(50, 100)',
        totalPages: '@integer(1, 10)',
        pageSize: 10,
        pageIndex: 1,
        'records|20-30': [{
          guid: '@guid',
          tenantGuid: '@guid',
          cgDirName: '@cword(3, 5)',
          dirGuid: '@guid',
          classifyName: '@cword(3, 5)',
          gradeDetailName: '@cword(3, 5)',
          label: '@cword(3, 5)',
          fieldName: '@cword(3, 5)',
          fieldChName: '@cword(3, 5)',
          tableName: '@cword(3, 5)',
          tableChName: '@cword(3, 5)',
          database: '@cword(3, 5)',
          databaseChName: '@cword(3, 5)'
        }]
      }
    }
  }
}

/**
 *
 * export const getDictionary = (params) => request({
  url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all?state=1`,
  method: 'post'
})
*/

export const getDictionary = {
  url: '/mock/data-dictionary-general/list-all',
  method: 'post',
  response: ({body}:{body:any}) => {
    return {
      code: '00000',
      message: '成功',
      'data|10-30': [{
        guid: '@guid',
        tenantGuid: '@guid',
        chName: '@cword(3, 5)',
        classifyName: '@cword(3, 5)',
        orderNum: '@integer(1, 100)',
        level: '@integer(1, 3)',
        levelCode: '@string("number", 6)',
        parentGuid: '@guid',
        'parentGuids|1-2': ['@guid'],
        'children|0-3': [{
          guid: '@guid',
          tenantGuid: '@guid',
          chName: '@cword(3, 5)',
          classifyName: '@cword(3, 5)',
          orderNum: '@integer(1, 100)',
          level: '@integer(1, 3)',
          levelCode: '@string("number", 6)',
          parentGuid: '@guid',
          'parentGuids|1-2': ['@guid']
        }]
      }]
    }
  }
}

export const saveBizRuleConfig = {
  url: '/mock/biz-rule-config/save',
  method: 'post',
  response: ({body}:{body:any}) => {
    return {
      code: '00000',
      message: '成功'
    }
  }
}

/**
 *  "data": [
    {
      "cgDirName": "string",
      "childList": [
        {
          "databaseGuid": "string",
          "database": "string",
          "databaseChName": "string",
          "childList": [
            {
              "tableGuid": "string",
              "tableName": "string",
              "tableChName": "string"
            }
          ]
        }
      ]
    }
  ],
  export const getDbDirTreeList = (data) => request({
  url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`,
  method: 'post',
  data
})
 */

export const getDbDirTreeList = {
  url: '/mock/db-dir/tree-list',
  method: 'post',
  response: ({body}:{body:any}) => {
    return {
      code: '00000',
      message: '成功',
      'data|10-30': [{
        cgDirName: '@cword(3, 5)',
        'children|1-3': [{
          databaseGuid: '@guid',
          database: '@cword(3, 5)',
          databaseChName: '@cword(3, 5)',
          'children|1-3': [{
            tableGuid: '@guid',
            tableName: '@cword(3, 5)',
            tableChName: '@cword(3, 5)'
          }]
        }]
      }]
    }
  }
}

/**
 * /**
 * 数据库目录-表数据列表查询
 * @param {Object}
 * @path /db-dir/table/page-list
 * export const getDbDirTablePageList = (data) => request({
  url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/page-list`,
  method: 'post',
  data
})
   "data": {
    "totalRows": 0,
    "totalPages": 0,
    "pageSize": 0,
    "pageIndex": 0,
    "records": [
      {
        "guid": "string",
        "tenantGuid": "string",
        "cgDirName": "string",
        "dirGuid": "string",
        "tableGuid": "string",
        "tableName": "string",
        "tableChName": "string",
        "databaseGuid": "string",
        "database": "string",
        "databaseChName": "string",
        "foundMode": 0,
        "state": 0,
        "isDataAsset": "string"
      }
    ],
}
 */

export const getDbDirTablePageList = {
  url: '/mock/db-dir/table/page-list',
  method: 'post',
  response: ({body}:{body:any}) => {
    const {pageIndex, pageSize} = body
    return {
      code: '00000',
      message: '成功',
      'data': {
        totalRows: '@integer(50, 100)',
        totalPages: '@integer(1, 10)',
        pageSize,
        pageIndex,
        'records|20-30': [{
          guid: '@guid',
          tenantGuid: '@guid',
          cgDirName: '@cword(3, 5)',
          dirGuid: '@guid',
          tableGuid: '@guid',
          tableName: '@cword(3, 5)',
          tableChName: '@cword(3, 5)',
          databaseGuid: '@guid',
          database: '@cword(3, 5)',
          databaseChName: '@cword(3, 5)',
          foundMode: '@integer(1, 3)',
          state: '@integer(0,2)',
          isDataAsset: 'Y'
        }]
      }
    }
  }
}




export default [getCgDirTreeList,getCgDirFieldPageList, getDictionary,saveBizRuleConfig, getDbDirTreeList, getDbDirTablePageList] as MockMethod[]