diff --git a/assets/scripts/dec.js b/assets/scripts/dec.js index 7e9ad92..8757f3e 100644 --- a/assets/scripts/dec.js +++ b/assets/scripts/dec.js @@ -16,6 +16,11 @@ window.DecCst = { OPEN: 'getConnectionStatus', SHUTDOWN: 'shutdownConnectionStatus', } + }, + Hyperlink: { + Database: {}, + DECISION_HYPERLINK_CONFIG: "hyperlink", + WEBSOCKET_CONNECT: "websocket" } }; @@ -25,6 +30,11 @@ window.Dec = { connected: false, }, personal: { - username: '' + username: '', + }, + system: { + hyperlink: { + websocket: "http://help.finebi.com/doc-view-183.html", + }, } } \ No newline at end of file diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 2010d77..30f185f 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -302,4 +302,5 @@ BI-Basic_Quarter= 季度 BI-Basic_No_Select= 不选 BI-Basic_Now= 此刻 Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB -Dec-Dcm_Connection_Value_Out_Range=数值超出范围 \ No newline at end of file +Dec-Dcm_Connection_Value_Out_Range=数值超出范围 +Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 \ No newline at end of file diff --git a/package.json b/package.json index e0abeca..90f559f 100644 --- a/package.json +++ b/package.json @@ -72,4 +72,4 @@ "pre-push": "npm run eslint && npm run test" } } -} \ No newline at end of file +} diff --git a/private/i18n.ts b/private/i18n.ts index 369845f..d105961 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -302,4 +302,5 @@ export default { 'BI-Basic_Now': '此刻', 'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB', 'Dec-Dcm_Connection_Value_Out_Range': '数值超出范围', + 'Dec-Dcm_Socket_Unable_Connect_Tip': '可能出现编辑冲突', }; diff --git a/src/modules/components/link_button/link.ts b/src/modules/components/link_button/link.ts new file mode 100644 index 0000000..f3e1135 --- /dev/null +++ b/src/modules/components/link_button/link.ts @@ -0,0 +1,41 @@ +import { CenterAdapt, Label } from 'ui'; +import { shortcut } from '@core/core'; + +export const LinkXtype = 'dec.dcm.components.link.button'; +const DEFAULT_LINK = '/'; +@shortcut(LinkXtype) +export class LinkButton extends BI.BasicButton { + props = { + text: '', + cls: 'cursor-pointer', + $testId: 'dec-dcm-link-button', + } + + render() { + return { + type: CenterAdapt, + cls: 'bi-high-light', + items: [ + { + type: Label, + cls: 'bi-high-light-border-bottom', + text: this.options.text, + }, + ], + }; + } + + getLink() { + const link = this.options.link; + + return (BI.isFunction(link) ? link() : link) || DEFAULT_LINK; + } + + setText(v: string) { + this.text.setText(v); + } + + doClick() { + window.open(this.getLink()); + } +} diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index c29aa3e..8757a7f 100644 --- a/src/modules/crud/api.ts +++ b/src/modules/crud/api.ts @@ -66,4 +66,9 @@ export interface Api { * 获取加密后文本 */ getCipher(password: string): string; + + /** + * 获取外链 + */ + getHyperlink(name: string): string; } diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 3c51680..a39c2f7 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -97,6 +97,10 @@ export class DecisionApi implements Api { return BI.Providers.getProvider('dec.provider.cipher').getCipher(password); } + getHyperlink(name: string) { + return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name]; + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/crud/design.api.ts b/src/modules/crud/design.api.ts index f7863e6..ee983e8 100644 --- a/src/modules/crud/design.api.ts +++ b/src/modules/crud/design.api.ts @@ -71,4 +71,9 @@ export class DesignApi implements Api { // 设计器加密方法 return password; } + + getHyperlink(name: string) { + // 设计器获取超链 + return ''; + } } diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index 5090ace..fc33685 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -2,6 +2,7 @@ import { Vtape, Label, VerticalAdapt, ListView, IconButton } from 'ui'; import { shortcut, store } from '@core/core'; import { MaintainModel, MaintainModelXtype } from './maintain.model'; import { MaintainFormXtype } from './forms/form'; +import { LinkXtype } from 'src/modules/components/link_button/link'; import { PAGE_INDEX } from '@constants/constant'; import { ApiFactory } from 'src/modules/crud/apiFactory'; const api = new ApiFactory().create(); @@ -48,6 +49,16 @@ export class Maintain extends BI.Widget { text: titleText, height: 15, }, + { + type: LinkXtype, + invisible: true, + lgap: 10, + text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'), + link: api.getHyperlink(DecCst.Hyperlink.WEBSOCKET_CONNECT), + ref: (_ref: any) => { + this.socketTip = _ref; + }, + }, ], }, { @@ -66,6 +77,7 @@ export class Maintain extends BI.Widget { BI.Msg.toast(BI.i18nText('Dec-Dcm_Socket_Unable_Connect'), { level: 'warning', }); + this.socketTip.setVisible(true); } } diff --git a/types/globals.d.ts b/types/globals.d.ts index e761929..c1a7afe 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -9,10 +9,14 @@ declare const Dec: { fineServletURL: string; socket: { connected: boolean; + }; + system: { + }; personal: { - username: string; + username: string; }; + socketEmit: (type: string, name: string, callback: (re: any) => void) => void; reqGet: (url: string, data: any, callback: (re: any) => void) => void; reqPost: (url: string, data: any, callback: (re: any) => void) => void; reqPut: (url: string, data: any, callback: (re: any) => void) => void;