neo-cmp-cli 1.13.16 → 1.13.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index2.js +1 -1
- package/dist/main2.js +1 -1
- package/dist/neo/env.js +1 -1
- package/dist/neo/neoLogin.js +1 -1
- package/dist/neo/pushCmp.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +3 -2
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/docs/README.md +1 -232
- package/template/asset-manage-template/package.json +2 -2
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +2 -2
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/neo.config.js +7 -1
- package/template/neo-bi-cmps/package.json +8 -7
- package/template/neo-bi-cmps/public/403.html +77 -0
- package/template/neo-bi-cmps/public/demo.html +2453 -0
- package/template/neo-bi-cmps/src/assets/icon/barChart.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/card.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/filter.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/funnel.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/tab.svg +1 -0
- package/template/neo-bi-cmps/src/components/filterBar__c/README.md +3 -14
- package/template/neo-bi-cmps/src/components/filterBar__c/common.scss +29 -0
- package/template/neo-bi-cmps/src/components/filterBar__c/index.tsx +668 -146
- package/template/neo-bi-cmps/src/components/filterBar__c/model.ts +26 -48
- package/template/neo-bi-cmps/src/components/filterBar__c/style.scss +46 -139
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +11 -10
- package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +9 -16
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +1 -1
- package/template/neo-bi-cmps/src/utils/common.ts +231 -0
- package/template/neo-bi-cmps/src/utils/filter2chartFilter.ts +268 -0
- package/template/neo-bi-cmps/src/utils/filterBar.ts +140 -0
- package/template/neo-bi-cmps/src/utils/pipelineFunnel.ts +341 -0
- package/template/{neo-h5-cmps/src/utils/queryObjectData.ts → neo-bi-cmps/src/utils/queryByCustomSQL.ts} +18 -13
- package/template/neo-bi-cmps/src/utils/requestDebounce.ts +22 -0
- package/template/neo-bi-cmps/src/utils/simpleTable.tsx +344 -0
- package/template/neo-bi-cmps/src/utils/stageSwitch.ts +15 -0
- package/template/neo-bi-cmps/src/utils/stageTimeChart.ts +90 -0
- package/template/neo-bi-cmps/src/utils/targetNumber.ts +12 -0
- package/template/neo-custom-cmp-template/docs/README.md +0 -231
- package/template/neo-custom-cmp-template/package.json +2 -2
- package/template/neo-h5-cmps/package.json +2 -2
- package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +1 -2
- package/template/neo-h5-cmps/src/components/entityTabs__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/globalSearchInput__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/openChatPageBtn__c/index.tsx +1 -2
- package/template/neo-order-cmps/package.json +2 -2
- package/template/neo-pipeline-cmps/.prettierrc.js +12 -0
- package/template/neo-pipeline-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-pipeline-cmps/README.md +99 -0
- package/template/neo-pipeline-cmps/commitlint.config.js +59 -0
- package/template/neo-pipeline-cmps/neo.config.js +135 -0
- package/template/neo-pipeline-cmps/package.json +66 -0
- package/template/neo-pipeline-cmps/public/403.html +77 -0
- package/template/neo-pipeline-cmps/public/css/base.css +283 -0
- package/template/neo-pipeline-cmps/public/demo.html +2453 -0
- package/template/neo-pipeline-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-pipeline-cmps/public/template.html +13 -0
- package/template/neo-pipeline-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-pipeline-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-pipeline-cmps/src/assets/icon/barChart.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/card.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/filter.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/funnel.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/tab.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/README.md +24 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/common.scss +29 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/index.tsx +731 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/model.ts +52 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/style.scss +119 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/README.md +39 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/index.tsx +416 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/model.ts +80 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/style.scss +83 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/index.tsx +470 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/model.ts +45 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/style.scss +137 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/README.md +89 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/common.scss +195 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/index.tsx +667 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/model.ts +124 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/style.scss +192 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/README.md +36 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/index.tsx +513 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/model.ts +71 -0
- package/template/{neo-bi-cmps → neo-pipeline-cmps}/src/components/stageSwitch__c/style.scss +4 -2
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/README.md +37 -0
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/index.tsx +455 -0
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/model.ts +106 -0
- package/template/{neo-bi-cmps → neo-pipeline-cmps}/src/components/stageTimeChart__c/style.scss +3 -2
- package/template/neo-pipeline-cmps/src/utils/common.ts +229 -0
- package/template/neo-pipeline-cmps/src/utils/filter2chartFilter.ts +266 -0
- package/template/neo-pipeline-cmps/src/utils/filterBar.ts +140 -0
- package/template/neo-pipeline-cmps/src/utils/pipelineFunnel.ts +343 -0
- package/template/neo-pipeline-cmps/src/utils/queryByCustomSQL.ts +121 -0
- package/template/neo-pipeline-cmps/src/utils/requestDebounce.ts +22 -0
- package/template/neo-pipeline-cmps/src/utils/simpleTable.tsx +349 -0
- package/template/neo-pipeline-cmps/src/utils/stageSwitch.ts +15 -0
- package/template/neo-pipeline-cmps/src/utils/stageTimeChart.ts +90 -0
- package/template/neo-pipeline-cmps/src/utils/targetNumber.ts +12 -0
- package/template/neo-pipeline-cmps/tsconfig.json +40 -0
- package/template/neo-web-entity-grid/package.json +2 -2
- package/template/neo-web-form/package.json +2 -2
- package/template/neo-web-form/src/components/batchAddTable__c/index.tsx +161 -41
- package/template/neo-web-form/src/components/batchAddTable__c/model.ts +4 -2
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/react-ts-custom-cmp-template/package.json +1 -1
- package/template/vue2-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/src/utils/axiosFetcher.ts +0 -37
- package/template/asset-manage-template/src/utils/queryObjectData.ts +0 -112
- package/template/asset-manage-template/src/utils/xobjects.ts +0 -162
- package/template/neo-bi-cmps/.npmrc copy +0 -1
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/README.md +0 -52
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/index.tsx +0 -183
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/model.ts +0 -90
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/style.scss +0 -218
- package/template/neo-bi-cmps/src/components/forecastChart__c/README.md +0 -31
- package/template/neo-bi-cmps/src/components/forecastChart__c/index.tsx +0 -158
- package/template/neo-bi-cmps/src/components/forecastChart__c/model.ts +0 -40
- package/template/neo-bi-cmps/src/components/forecastChart__c/style.scss +0 -154
- package/template/neo-bi-cmps/src/components/forecastGrid__c/README.md +0 -36
- package/template/neo-bi-cmps/src/components/forecastGrid__c/index.tsx +0 -86
- package/template/neo-bi-cmps/src/components/forecastGrid__c/model.ts +0 -62
- package/template/neo-bi-cmps/src/components/forecastGrid__c/style.scss +0 -48
- package/template/neo-bi-cmps/src/components/gapCloser__c/README.md +0 -24
- package/template/neo-bi-cmps/src/components/gapCloser__c/index.tsx +0 -100
- package/template/neo-bi-cmps/src/components/gapCloser__c/model.ts +0 -46
- package/template/neo-bi-cmps/src/components/gapCloser__c/style.scss +0 -60
- package/template/neo-bi-cmps/src/components/kpiCards__c/README.md +0 -35
- package/template/neo-bi-cmps/src/components/kpiCards__c/index.tsx +0 -70
- package/template/neo-bi-cmps/src/components/kpiCards__c/model.ts +0 -50
- package/template/neo-bi-cmps/src/components/kpiCards__c/style.scss +0 -33
- package/template/neo-bi-cmps/src/components/oppList__c/README.md +0 -52
- package/template/neo-bi-cmps/src/components/oppList__c/index.tsx +0 -285
- package/template/neo-bi-cmps/src/components/oppList__c/model.ts +0 -86
- package/template/neo-bi-cmps/src/components/oppList__c/style.scss +0 -133
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/README.md +0 -39
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/index.tsx +0 -130
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/model.ts +0 -66
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/style.scss +0 -133
- package/template/neo-bi-cmps/src/components/stageSwitch__c/README.md +0 -36
- package/template/neo-bi-cmps/src/components/stageSwitch__c/index.tsx +0 -118
- package/template/neo-bi-cmps/src/components/stageSwitch__c/model.ts +0 -92
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/README.md +0 -37
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/index.tsx +0 -126
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/model.ts +0 -57
- package/template/neo-bi-cmps/src/components/tabSwitch__c/README.md +0 -37
- package/template/neo-bi-cmps/src/components/tabSwitch__c/index.tsx +0 -80
- package/template/neo-bi-cmps/src/components/tabSwitch__c/model.ts +0 -45
- package/template/neo-bi-cmps/src/components/tabSwitch__c/style.scss +0 -37
- package/template/neo-bi-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-bi-cmps/src/utils/queryObjectData.ts +0 -76
- package/template/neo-bi-cmps/src/utils/xobjects.ts +0 -162
- package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -112
- package/template/neo-custom-cmp-template/src/utils/xobjects.ts +0 -162
- package/template/neo-h5-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-h5-cmps/src/utils/xobjects.ts +0 -167
- package/template/neo-order-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +0 -112
- package/template/neo-order-cmps/src/utils/xobjects.ts +0 -162
- package/template/neo-web-entity-grid/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-entity-grid/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-entity-grid/src/utils/xobjects.ts +0 -167
- package/template/neo-web-form/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-form/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-form/src/utils/xobjects.ts +0 -167
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Tab切换组件
|
|
3
|
-
* @description 支持Pipeline/Forecast等Tab切换功能
|
|
4
|
-
*/
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import { BaseCmp, StatusHoc, NeoEvent } from 'neo-ui-common';
|
|
8
|
-
|
|
9
|
-
import './style.scss';
|
|
10
|
-
|
|
11
|
-
interface TabItem {
|
|
12
|
-
key: string;
|
|
13
|
-
label: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface TabSwitchProps {
|
|
18
|
-
tabs: TabItem[];
|
|
19
|
-
activeTab?: string;
|
|
20
|
-
onTabChange?: (key: string) => void;
|
|
21
|
-
className?: string;
|
|
22
|
-
style?: React.CSSProperties;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface TabSwitchState {
|
|
26
|
-
activeTab: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
class TabSwitch extends BaseCmp<TabSwitchProps, TabSwitchState> {
|
|
30
|
-
constructor(props: TabSwitchProps) {
|
|
31
|
-
super(props);
|
|
32
|
-
this.state = {
|
|
33
|
-
activeTab: props.activeTab || (props.tabs?.[0]?.key ?? ''),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
this.handleTabClick = this.handleTabClick.bind(this);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
componentDidMount() {
|
|
40
|
-
console.log('TabSwitch 组件挂载');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
componentWillReceiveProps(nextProps: TabSwitchProps) {
|
|
44
|
-
if (nextProps.activeTab && nextProps.activeTab !== this.props.activeTab) {
|
|
45
|
-
this.setState({ activeTab: nextProps.activeTab });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
handleTabClick(key: string) {
|
|
50
|
-
this.setState({ activeTab: key });
|
|
51
|
-
const { onTabChange } = this.props;
|
|
52
|
-
if (onTabChange) {
|
|
53
|
-
onTabChange(key);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
const { tabs = [], className, style } = this.props;
|
|
59
|
-
const { activeTab } = this.state;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className={`tab-switch__c ${className || ''}`} style={style}>
|
|
63
|
-
<div className="tab-bar">
|
|
64
|
-
{tabs.map((tab) => (
|
|
65
|
-
<button
|
|
66
|
-
key={tab.key}
|
|
67
|
-
className={`tab-btn ${activeTab === tab.key ? 'active' : ''}`}
|
|
68
|
-
onClick={() => this.handleTabClick(tab.key)}
|
|
69
|
-
>
|
|
70
|
-
{tab.icon && <span className="tab-icon">{tab.icon}</span>}
|
|
71
|
-
{tab.label}
|
|
72
|
-
</button>
|
|
73
|
-
))}
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default StatusHoc(TabSwitch);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export class TabSwitchModel {
|
|
2
|
-
label: string = 'Tab切换';
|
|
3
|
-
description: string = '支持Pipeline/Forecast等Tab切换功能';
|
|
4
|
-
iconUrl: string = 'https://custom-widgets.bj.bcebos.com/tabSwitch.svg';
|
|
5
|
-
targetPage: string[] = ['all'];
|
|
6
|
-
targetDevice: string = 'all';
|
|
7
|
-
|
|
8
|
-
defaultComProps = {
|
|
9
|
-
tabs: [
|
|
10
|
-
{ key: 'pipeline', label: 'Pipeline', icon: '' },
|
|
11
|
-
{ key: 'forecast', label: 'Forecast', icon: '' },
|
|
12
|
-
],
|
|
13
|
-
activeTab: 'pipeline',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
functions = [
|
|
17
|
-
{
|
|
18
|
-
apiKey: 'setActiveTab',
|
|
19
|
-
label: '设置当前Tab',
|
|
20
|
-
helpTextKey: '设置当前激活的Tab页',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
propsSchema = [
|
|
25
|
-
{
|
|
26
|
-
type: 'object',
|
|
27
|
-
name: 'tabs',
|
|
28
|
-
label: 'Tab配置',
|
|
29
|
-
schema: [
|
|
30
|
-
{
|
|
31
|
-
type: 'string',
|
|
32
|
-
name: 'tabLabel',
|
|
33
|
-
label: 'Tab标签',
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: 'string',
|
|
39
|
-
name: 'activeTab',
|
|
40
|
-
label: '当前激活Tab',
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default TabSwitchModel;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
.tab-switch__c {
|
|
2
|
-
.tab-bar {
|
|
3
|
-
display: flex;
|
|
4
|
-
gap: 0;
|
|
5
|
-
margin-bottom: 20px;
|
|
6
|
-
border-bottom: 2px solid #e5e7eb;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.tab-btn {
|
|
10
|
-
padding: 10px 24px;
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
font-weight: 600;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
border: none;
|
|
15
|
-
background: none;
|
|
16
|
-
color: #999;
|
|
17
|
-
border-bottom: 2px solid transparent;
|
|
18
|
-
margin-bottom: -2px;
|
|
19
|
-
transition: all 0.2s;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: 6px;
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
color: #6366f1;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.active {
|
|
29
|
-
color: #6366f1;
|
|
30
|
-
border-bottom-color: #6366f1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.tab-icon {
|
|
34
|
-
font-size: 14px;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import axios from 'axios'; // https://www.axios-http.cn/docs/intro
|
|
2
|
-
|
|
3
|
-
// 创建基于 axios 的 fetcher 函数
|
|
4
|
-
const axiosFetcher = async (options: any) => {
|
|
5
|
-
try {
|
|
6
|
-
const config = {
|
|
7
|
-
...options,
|
|
8
|
-
method: options?.method || 'GET',
|
|
9
|
-
data: options?.data || {},
|
|
10
|
-
headers: {
|
|
11
|
-
'Content-Type': 'application/json',
|
|
12
|
-
...options?.headers,
|
|
13
|
-
},
|
|
14
|
-
timeout: options?.timeout || 30000,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
if (config?.method === 'GET') {
|
|
18
|
-
config.params = options?.data || {};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const response = await axios(config);
|
|
22
|
-
return response?.data || {};
|
|
23
|
-
} catch (error) {
|
|
24
|
-
if (error.response) {
|
|
25
|
-
// 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
|
|
26
|
-
console.error('接口请求报错 / 接口服务异常:', error.message);
|
|
27
|
-
} else if (error.request) {
|
|
28
|
-
// 请求已经成功发起,但没有收到响应
|
|
29
|
-
console.error('接口请求报错 / 接口未正常响应:', error.message);
|
|
30
|
-
} else {
|
|
31
|
-
console.error('接口请求报错:', error, ',请求参数:', options);
|
|
32
|
-
}
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default axiosFetcher;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import axiosFetcher from '$utils/axiosFetcher';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 这里存放通用查询类 Open API
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// 获取业务对象数据列表
|
|
8
|
-
export const queryXObjectData = async (options?: any) => {
|
|
9
|
-
const apiUrl = '/rest/data/v2/query';
|
|
10
|
-
const curOptions = options || {};
|
|
11
|
-
const xObjectApiKey = curOptions.xObjectApiKey || '';
|
|
12
|
-
const fields = curOptions.fields || [];
|
|
13
|
-
const page = curOptions.page || 1;
|
|
14
|
-
const pageSize = curOptions.pageSize || 10;
|
|
15
|
-
|
|
16
|
-
// 自动添加 objectId 字段
|
|
17
|
-
if (!fields.includes('id')) {
|
|
18
|
-
fields.push('id');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// 计算分页偏移量
|
|
22
|
-
const offset = (page - 1) * pageSize;
|
|
23
|
-
|
|
24
|
-
// 构建 SQL 查询
|
|
25
|
-
let querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
|
|
26
|
-
|
|
27
|
-
// 添加排序条件(如果有的话)
|
|
28
|
-
if (curOptions.orderBy) {
|
|
29
|
-
querySql += ` order by ${curOptions.orderBy}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (curOptions.page || curOptions.pageSize) {
|
|
33
|
-
// 添加分页限制
|
|
34
|
-
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const config = {
|
|
39
|
-
url: apiUrl,
|
|
40
|
-
method: 'GET',
|
|
41
|
-
data: {
|
|
42
|
-
q: querySql,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const resultData = await axiosFetcher(config);
|
|
47
|
-
|
|
48
|
-
if (resultData.code === 200) {
|
|
49
|
-
const { records, totalSize } = resultData.result || {};
|
|
50
|
-
return {
|
|
51
|
-
status: true,
|
|
52
|
-
code: resultData.code,
|
|
53
|
-
msg: resultData.msg || '获取业务对象数据列表成功',
|
|
54
|
-
totalSize,
|
|
55
|
-
data: records || [],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
status: false,
|
|
61
|
-
code: resultData.code,
|
|
62
|
-
msg: resultData.msg || '获取业务对象数据列表失败',
|
|
63
|
-
data: [],
|
|
64
|
-
};
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error('获取业务对象数据列表失败:', error);
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
status: false,
|
|
70
|
-
msg: error.msg || error.message || '获取业务对象数据列表失败',
|
|
71
|
-
data: [],
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default queryXObjectData;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { message } from 'antd';
|
|
2
|
-
import axiosFetcher from './axiosFetcher';
|
|
3
|
-
|
|
4
|
-
// 获取业务类型列表
|
|
5
|
-
export const getEntityTypeList = async (
|
|
6
|
-
xObjectApiKey: string,
|
|
7
|
-
options?: any,
|
|
8
|
-
) => {
|
|
9
|
-
const curOptions = options || {};
|
|
10
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/busiType`;
|
|
11
|
-
try {
|
|
12
|
-
const config = {
|
|
13
|
-
...curOptions,
|
|
14
|
-
url: apiUrl,
|
|
15
|
-
method: 'GET',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const result = await axiosFetcher(config);
|
|
19
|
-
return result;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error('获取业务类型失败:', error);
|
|
22
|
-
message.error('获取业务类型失败。');
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// 获取对象列表
|
|
28
|
-
export const getEntityList = async (options?: any) => {
|
|
29
|
-
const curOptions = options || {};
|
|
30
|
-
const custom = curOptions.custom || false; // 默认获取标准对象列表
|
|
31
|
-
const active = curOptions.active || true; // 仅获取有权限的对象
|
|
32
|
-
const apiUrl = `/rest/metadata/v2.0/xobjects/filter?custom=${custom}&active=${active}`;
|
|
33
|
-
try {
|
|
34
|
-
const config = {
|
|
35
|
-
...curOptions,
|
|
36
|
-
url: apiUrl,
|
|
37
|
-
method: 'GET',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const result = await axiosFetcher(config);
|
|
41
|
-
return result;
|
|
42
|
-
} catch (error) {
|
|
43
|
-
console.error('获取对象列表失败:', error);
|
|
44
|
-
message.error('获取对象列表失败。');
|
|
45
|
-
return {};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// 创建业务数据
|
|
50
|
-
export const createXObject = async (xObjectApiKey: string, options: any) => {
|
|
51
|
-
const curOptions = options || {};
|
|
52
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}`;
|
|
53
|
-
const formData = curOptions.data || {};
|
|
54
|
-
try {
|
|
55
|
-
const config = {
|
|
56
|
-
...options,
|
|
57
|
-
url: apiUrl,
|
|
58
|
-
method: curOptions.method || 'GET',
|
|
59
|
-
data: {
|
|
60
|
-
data: formData,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const result = await axiosFetcher(config);
|
|
65
|
-
return result;
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error('创建业务数据失败:', error);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// 获取业务对象描述
|
|
73
|
-
export const getXObjectDesc = async (xObjectApiKey: string, options?: any) => {
|
|
74
|
-
const curOptions = options || {};
|
|
75
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
|
|
76
|
-
try {
|
|
77
|
-
const config = {
|
|
78
|
-
...options,
|
|
79
|
-
url: apiUrl,
|
|
80
|
-
method: curOptions.method || 'GET',
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const result = await axiosFetcher(config);
|
|
84
|
-
return result;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.error('获取业务对象描述:', error);
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// 更新业务数据
|
|
92
|
-
export const updateXObject = async (
|
|
93
|
-
xObjectApiKey: string,
|
|
94
|
-
objectId: string,
|
|
95
|
-
options: any,
|
|
96
|
-
) => {
|
|
97
|
-
const curOptions = options || {};
|
|
98
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
99
|
-
const formData = curOptions.data || {};
|
|
100
|
-
try {
|
|
101
|
-
const config = {
|
|
102
|
-
...curOptions,
|
|
103
|
-
url: apiUrl,
|
|
104
|
-
method: curOptions.method || 'PATCH',
|
|
105
|
-
data: {
|
|
106
|
-
data: formData,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const result = await axiosFetcher(config);
|
|
111
|
-
return result;
|
|
112
|
-
} catch (error) {
|
|
113
|
-
console.error('更新业务数据失败:', error);
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// 获取业务数据信息
|
|
119
|
-
export const getXObject = async (
|
|
120
|
-
xObjectApiKey: string,
|
|
121
|
-
objectId: string,
|
|
122
|
-
options?: any,
|
|
123
|
-
) => {
|
|
124
|
-
const curOptions = options || {};
|
|
125
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
126
|
-
try {
|
|
127
|
-
const config = {
|
|
128
|
-
...curOptions,
|
|
129
|
-
url: apiUrl,
|
|
130
|
-
method: curOptions.method || 'GET',
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const result = await axiosFetcher(config);
|
|
134
|
-
return result;
|
|
135
|
-
} catch (error) {
|
|
136
|
-
console.error('获取业务数据信息失败:', error);
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// 删除业务数据
|
|
142
|
-
export const deleteXObject = async (
|
|
143
|
-
xObjectApiKey: string,
|
|
144
|
-
objectId: string,
|
|
145
|
-
options?: any,
|
|
146
|
-
) => {
|
|
147
|
-
const curOptions = options || {};
|
|
148
|
-
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
149
|
-
try {
|
|
150
|
-
const config = {
|
|
151
|
-
...curOptions,
|
|
152
|
-
url: apiUrl,
|
|
153
|
-
method: curOptions.method || 'DELETE',
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const result = await axiosFetcher(config);
|
|
157
|
-
return result;
|
|
158
|
-
} catch (error) {
|
|
159
|
-
console.error('删除业务数据:', error);
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import axios from 'axios'; // https://www.axios-http.cn/docs/intro
|
|
2
|
-
|
|
3
|
-
// 创建基于 axios 的 fetcher 函数
|
|
4
|
-
const axiosFetcher = async (options: any) => {
|
|
5
|
-
try {
|
|
6
|
-
const config = {
|
|
7
|
-
...options,
|
|
8
|
-
method: options?.method || 'GET',
|
|
9
|
-
data: options?.data || {},
|
|
10
|
-
headers: {
|
|
11
|
-
'Content-Type': 'application/json',
|
|
12
|
-
...options?.headers,
|
|
13
|
-
},
|
|
14
|
-
timeout: options?.timeout || 30000,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
if (config?.method === 'GET') {
|
|
18
|
-
config.params = options?.data || {};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const response = await axios(config);
|
|
22
|
-
return response?.data || {};
|
|
23
|
-
} catch (error) {
|
|
24
|
-
if (error.response) {
|
|
25
|
-
// 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
|
|
26
|
-
console.error('接口请求报错 / 接口服务异常:', error.message);
|
|
27
|
-
} else if (error.request) {
|
|
28
|
-
// 请求已经成功发起,但没有收到响应
|
|
29
|
-
console.error('接口请求报错 / 接口未正常响应:', error.message);
|
|
30
|
-
} else {
|
|
31
|
-
console.error('接口请求报错:', error, ',请求参数:', options);
|
|
32
|
-
}
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default axiosFetcher;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import axiosFetcher from '$utils/axiosFetcher';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 这里存放通用查询类 Open API
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
-
function normalizeWhere(where: unknown): string {
|
|
9
|
-
if (where == null || where === '') {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
if (typeof where === 'string') {
|
|
13
|
-
return where.trim();
|
|
14
|
-
}
|
|
15
|
-
if (Array.isArray(where)) {
|
|
16
|
-
return where
|
|
17
|
-
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
-
.filter(Boolean)
|
|
19
|
-
.join(' and ');
|
|
20
|
-
}
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 获取业务对象数据列表
|
|
25
|
-
export const queryXObjectData = async (options?: any) => {
|
|
26
|
-
const apiUrl = '/rest/data/v2/query';
|
|
27
|
-
const curOptions = options || {};
|
|
28
|
-
const xObjectApiKey = curOptions.xObjectApiKey || '';
|
|
29
|
-
const fields = curOptions.fields || [];
|
|
30
|
-
const page = curOptions.page || 1;
|
|
31
|
-
const pageSize = curOptions.pageSize || 10;
|
|
32
|
-
|
|
33
|
-
// 自动添加 objectId 字段
|
|
34
|
-
if (!fields.includes('id')) {
|
|
35
|
-
fields.push('id');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 计算分页偏移量
|
|
39
|
-
const offset = (page - 1) * pageSize;
|
|
40
|
-
|
|
41
|
-
// 构建 SQL 查询
|
|
42
|
-
let querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
|
|
43
|
-
|
|
44
|
-
// 添加排序条件(如果有的话)
|
|
45
|
-
if (curOptions.orderBy) {
|
|
46
|
-
querySql += ` order by ${curOptions.orderBy}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 添加过滤条件(如果有的话)
|
|
51
|
-
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
-
* 对于 =、like 和 in 有以下说明:
|
|
53
|
-
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
-
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
-
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
-
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
-
* 支持"in",但不包括子查询。
|
|
58
|
-
* 支持的逻辑运算符包括:and、or。
|
|
59
|
-
*
|
|
60
|
-
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
-
*/
|
|
62
|
-
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
-
console.log('whereClause:', whereClause);
|
|
64
|
-
if (whereClause) {
|
|
65
|
-
querySql += ` where ${whereClause}`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (curOptions.page || curOptions.pageSize) {
|
|
69
|
-
// 添加分页限制
|
|
70
|
-
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const config = {
|
|
75
|
-
url: apiUrl,
|
|
76
|
-
method: 'GET',
|
|
77
|
-
data: {
|
|
78
|
-
q: querySql,
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const resultData = await axiosFetcher(config);
|
|
83
|
-
|
|
84
|
-
if (resultData.code === 200) {
|
|
85
|
-
const { records, totalSize } = resultData.result || {};
|
|
86
|
-
return {
|
|
87
|
-
status: true,
|
|
88
|
-
code: resultData.code,
|
|
89
|
-
msg: resultData.msg || '获取业务对象数据列表成功',
|
|
90
|
-
totalSize,
|
|
91
|
-
data: records || [],
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
status: false,
|
|
97
|
-
code: resultData.code,
|
|
98
|
-
msg: resultData.msg || '获取业务对象数据列表失败',
|
|
99
|
-
data: [],
|
|
100
|
-
};
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error('获取业务对象数据列表失败:', error);
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
status: false,
|
|
106
|
-
msg: error.msg || error.message || '获取业务对象数据列表失败',
|
|
107
|
-
data: [],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export default queryXObjectData;
|