From 2a69cb9907a7c53520b47563c689f2a7aa6d5702 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 20 Mar 2023 16:54:28 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-10281=20docs:=E5=AE=8C=E5=96=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cca899a..50cd82d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## 开始 安装依赖 ``` -yarn +yarn install ``` 开始开发 @@ -15,6 +15,104 @@ yarn yarn dev ``` +## 决策平台开发: + +### A.项目运行 + +#### 1. 工程`decision-webui-dev`添加代理(可跳过) +```js + webpack/webpack.config + "/plugin/dcm": { + pathRewrite: { "^/plugin/dcm": "" }, + target: "http://localhost:10002", + }, +``` +#### 2. 工程`decision-webui-dev`引入 + fr环境:`templates/bundle.report.html` bi环境:`templates/bundle.bi.html` + +```html + // css 文件: +
+ + + + + // js 文件 + +``` + 若未设1,将`/plugin/dcm`替换成`http://localhost:10002`亦可 +#### 3. 启动工程[decision-webui-dev]以及数据连接[desicion-webui-dcm]工程 + +#### 4. 此时工程`decision-webui-dev`的`http://localhost:9002/#management/connnection`数据连接模块已替换成该工程 + +### B.插件形式添加数据连接-数据库 + +#### 1. 以多版本的tdsql为例 单一版本数据库不需drivers,versions,hasSchemas + +```js +BI.config("dec.connection.provider.datebase", function (provider) { + BI.isFunction(provider.registerJdbcDatabase) && provider.registerJdbcDatabase({ + text: 'TDSQL', // 数据库名称 + databaseType: 'tdsql', // 数据库key + driver: 'org.postgresql.Driver', // 默认驱动 + drivers: { + "pgsql": ["org.postgresql.Driver"], + "mysql": ["com.mysql.jdbc.Driver"] + }, // 驱动可选项,version: array[driver],[0]为该版本的默认驱动 + versions: ["pgsql", "mysql"], // array[version] + urls: { + "org.postgresql.Driver": "jdbc:postgresql://hostname:port/database?finedbType=tdsql-pgsql", + "com.mysql.jdbc.Driver": "jdbc:mysql://hostname:port/database?finedbType=tdsql-mysql" + }, // urlkey : url 一个驱动对应一个url + url: 'jdbc:postgresql://hostname:port/database?finedbType=tdsql-pgsql', + commonly: false, + internal: true, + type: 'jdbc', 数据库类型 + hasSchema: true, // 默认是否支持模式 + hasSchemas: { + "pgsql": true, + "mysql": false, + },是否支持模式 version: boolean + kerberos: false, // 是否添加kerberos认证方式 + }, function (url) { + var result = url.match(/^jdbc:(mysql|postgresql):\/\/([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?\/([0-9a-zA-Z_\\.]+)(.*)finedbType=([^&]+)(|(&.*))/i); // 匹配正则 + if (result) { + return { + host: result[2], //主机 + port: result[4] === "port" ? "" : result[4], // 端口 + databaseName: result[5], // 数据库名称 + version: result[7].split('-')[1] ?? "pgsql", // 版本 单版本不要返回这个 + }; + } +//适配原先tbase的url + result = url.match(/^jdbc:postgresql:\/\/([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?\/([0-9a-zA-Z_\\.]+)(.*)/i); + if (result) { + return { + host: result[1], + port: result[3] === "port" ? "" : result[3], + databaseName: result[4], + version: "pgsql", + }; + } + + }); + }); +``` + +### C 工程开发 + +#### 1. 图片资源添加 + 工程`decision-webui-dev` + decision-webui/dist/images/1x/icon/database + decision-webui/dist/images/2x/icon/database + +#### 2. 国际化添加 + 工程`decision-webui-dev` + decision-i18n/decision-main-i18n/src/main/resources/com/fr/decision/web/i18n + +#### 3. 版本控制 + 版本和平台保持一致 + ## 接口文档: ### 增加数据连接类型 使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.types`,值为连接的名称