1.1.32 • Published 5 months ago

nti-datasource v1.1.32

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

nti-datasource

nti-datasource 设计器数据源请求包含SQL、事务流、微服务、通用API、OT等请求方式

初始化

npm i nti-datasource

全局注册

import { ntiDatasourceInstall } from 'nti-datasource'
Vue.use(ntiDatasourceInstall);

组件注册

import Vue from 'vue'
import { ntiDatasource } from 'nti-datasource'
Vue.component(ntiDatasource.name, ntiDatasource)

配置信息

  • 使用插件时需要从缓存获取sessionKeyengineeringIdspaceIdbucketId等信息
  • 代理配置
  // vue.config.js -> devServer -> proxy
  '/nti-datasource': {
    //开发环境
    target: 'https://it-test.nti56.com',
    changeOrigin: true,
    pathRewrite: {
      '^/nti-datasource': ''
    }
  },

参数说明

入参

入参说明类型默认值
showOtherSourceList显示类型(1-sql,2-事务流,3-微服务,4-通用API,5-OT,6-外部API)[]'1','2','3','4','5'
type展示类型tab/selecttab
plugin初始化数据{}见详细参数说明
pluginId---
categoryLabel模块名称string模块
projectAndCategoryVisible是否显示工程模块booleantrue
moreSqlVisible是否执行多条booleanfalse
paginationVisible是否分页booleanfalse
isReceiveAll是否全部参数返回booleanfalse
msgVisible---
showOtherSource是否显示除sql外的其他数据源booleantrue

回调事件

事件名说明类型返参
autoLoadParams参数变化params见详细参数说明
apiResParamsUpDateapi参数更新--
onChangeDataSource数据源变化--

插槽

插槽名说明
header头部
footer尾部

请求调用

this.$ntiDatasource(params) // params参数见详细参数说明 ↓
  .then(res => {
    // 成功的回调
  })
  .catch(err => {
    // 失败的回调
  })

详细参数说明

字段说明类型默认值
type数据源类型(1-sql/2-事务流/3-微服务/4-通用API/5-OT/6-外部API)string'1'
childProjectId子工程idstring
categoryId分类id-
datasourceId数据源id-
datasourceIdList数据源列表(执行多条sql)-
isMoreSql是否执行多条sqlbooleanfalse
isPagination是否分页booleanfalse
isReceiveAll是否全部参数返回booleanfalse
apiType---
apiId---
apiInterface---
hasOTServer---
otInterfaceUrl---
otUrlDetailUrl---
otConfigot配置项(serverName-服务名、uri-服务地址、httpType-请求类型、otEngineeringId-ot工程id){}-
params请求的参数,例如分页参数 { rows: 10 }{}-
_$requestParams请求参数格式--
_$responseParams返回参数格式--

返参 type 类型 1-字符串/2-整数/3-小数/4-日期/5-对象/6-对象数组/7-其他数组/8-密文

使用示例

// 组件引用
<nti-datasource
  ref="datasource"
  type="select"
  :showOtherSourceList="[1, 2, 3, 4, 5]"
  @autoLoadParams="autoLoadParams"
  @onChangeDataSource="onChangeDataSource"
/>

// 发起请求
let params = {
  apiId: '',
  apiInterface: '',
  apiType: '',
  categoryId: '1554703794118631426',
  childProjectId: '1554703000589869057',
  datasourceId: '1601155287944343554',
  datasourceIdList: Array(0),
  hasOTServer: false,
  isMoreSql: false,
  isPagination: true,
  isReceiveAll: false,
  otInterfaceUrl: '',
  otUrlDetailUrl: '',
  type: '1',
  _$categoryName: 'sql',
  params: {
    rows: 12, // 分页参数
  },
}
this.$refs.datasource.ntiDatasource(params)
  .then(res => {
    console.log('数据源调用成功', res)
  })
  .catch(err => {
    console.log('数据源调用失败', err)
  })
1.1.32

5 months ago

1.1.29

12 months ago

1.1.28

12 months ago

1.1.30

11 months ago

1.1.31

11 months ago

1.1.27

12 months ago

1.1.23

1 year ago

1.1.21

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.21-beta.0

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.20-beta.0

1 year ago

1.1.13

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago