neo-cmp-cli 1.8.3 → 1.8.6-beta.1
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/{src → bin}/index.js +18 -13
- package/bin/neo.js +1 -1
- package/package.json +4 -3
- package/src/main.js +15 -0
- package/src/utils/cmpUtils/createCmpByTemplate.js +1 -1
- package/src/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
- package/template/antd-custom-cmp-template/.prettierrc.js +12 -0
- package/template/antd-custom-cmp-template/README.md +153 -0
- package/template/antd-custom-cmp-template/commitlint.config.js +59 -0
- package/template/antd-custom-cmp-template/neo.config.js +144 -0
- package/template/antd-custom-cmp-template/package.json +60 -0
- package/template/antd-custom-cmp-template/public/css/base.css +283 -0
- package/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/antd-custom-cmp-template/public/template.html +13 -0
- package/template/antd-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/antd-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/README.md +39 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/index.tsx +462 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +75 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/style.scss +1667 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/index.tsx +87 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/model.ts +80 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/style.scss +105 -0
- package/template/antd-custom-cmp-template/tsconfig.json +68 -0
- package/template/develop/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/template/develop/neo-custom-cmp-template/README.md +48 -0
- package/template/develop/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/template/develop/neo-custom-cmp-template/docs/README.md +13 -0
- package/template/develop/neo-custom-cmp-template/neo.config.js +121 -0
- package/template/develop/neo-custom-cmp-template/package.json +63 -0
- package/template/develop/neo-custom-cmp-template/public/css/base.css +283 -0
- package/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/develop/neo-custom-cmp-template/public/template.html +13 -0
- package/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +65 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +180 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +50 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +260 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +94 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +251 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +56 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +120 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +115 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +304 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +87 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +127 -0
- package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +29 -0
- package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +39 -0
- package/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +203 -0
- package/template/develop/neo-custom-cmp-template/tsconfig.json +68 -0
- package/template/echarts-custom-cmp-template/.prettierrc.js +12 -0
- package/template/echarts-custom-cmp-template/README.md +198 -0
- package/template/echarts-custom-cmp-template/commitlint.config.js +59 -0
- package/template/echarts-custom-cmp-template/neo.config.js +140 -0
- package/template/echarts-custom-cmp-template/package.json +61 -0
- package/template/echarts-custom-cmp-template/public/css/base.css +283 -0
- package/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/echarts-custom-cmp-template/public/template.html +13 -0
- package/template/echarts-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/echarts-custom-cmp-template/src/assets/img/chart.svg +1 -0
- package/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/README.md +186 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/index.tsx +724 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +151 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/style.scss +209 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/README.md +125 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/USAGE.md +190 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/index.tsx +385 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +107 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/style.scss +192 -0
- package/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
- package/template/echarts-custom-cmp-template/tsconfig.json +68 -0
- package/template/empty-cmp/index.tsx +58 -0
- package/template/empty-cmp/model.ts +79 -0
- package/template/empty-cmp/style.scss +72 -0
- package/template/empty-custom-cmp-template/.prettierrc.js +12 -0
- package/template/empty-custom-cmp-template/README.md +154 -0
- package/template/empty-custom-cmp-template/commitlint.config.js +59 -0
- package/template/empty-custom-cmp-template/neo.config.js +138 -0
- package/template/empty-custom-cmp-template/package.json +58 -0
- package/template/empty-custom-cmp-template/public/css/base.css +283 -0
- package/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/empty-custom-cmp-template/public/template.html +13 -0
- package/template/empty-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/empty-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/empty-custom-cmp-template/src/assets/img/map.svg +1 -0
- package/template/empty-custom-cmp-template/src/components/README.md +3 -0
- package/template/empty-custom-cmp-template/tsconfig.json +68 -0
- package/template/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/template/neo-custom-cmp-template/README.md +155 -0
- package/template/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/template/neo-custom-cmp-template/docs/README.md +244 -0
- package/template/neo-custom-cmp-template/neo.config.js +140 -0
- package/template/neo-custom-cmp-template/package.json +66 -0
- package/template/neo-custom-cmp-template/public/css/base.css +283 -0
- package/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-custom-cmp-template/public/template.html +13 -0
- package/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-custom-cmp-template/src/assets/img/card-list.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/data-list.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/detail.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/README.md +61 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/index.tsx +202 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +74 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/style.scss +260 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/README.md +176 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/index.tsx +334 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +123 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/style.scss +292 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/README.md +176 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/index.tsx +615 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/model.ts +107 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/style.scss +370 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/README.md +92 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/index.tsx +784 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/model.ts +134 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/style.scss +304 -0
- package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +76 -0
- package/template/neo-custom-cmp-template/src/utils/xobjects.ts +162 -0
- package/template/neo-custom-cmp-template/tsconfig.json +49 -0
- package/template/react-custom-cmp-template/.prettierrc.js +12 -0
- package/template/react-custom-cmp-template/README.md +154 -0
- package/template/react-custom-cmp-template/commitlint.config.js +59 -0
- package/template/react-custom-cmp-template/neo.config.js +137 -0
- package/template/react-custom-cmp-template/package.json +57 -0
- package/template/react-custom-cmp-template/public/css/base.css +283 -0
- package/template/react-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/react-custom-cmp-template/public/template.html +13 -0
- package/template/react-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/react-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/react-custom-cmp-template/src/components/infoCard/index.jsx +45 -0
- package/template/react-custom-cmp-template/src/components/infoCard/model.js +81 -0
- package/template/react-custom-cmp-template/src/components/infoCard/style.scss +67 -0
- package/template/react-ts-custom-cmp-template/.prettierrc.js +12 -0
- package/template/react-ts-custom-cmp-template/README.md +154 -0
- package/template/react-ts-custom-cmp-template/commitlint.config.js +59 -0
- package/template/react-ts-custom-cmp-template/neo.config.js +138 -0
- package/template/react-ts-custom-cmp-template/package.json +59 -0
- package/template/react-ts-custom-cmp-template/public/css/base.css +283 -0
- package/template/react-ts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/react-ts-custom-cmp-template/public/template.html +13 -0
- package/template/react-ts-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/react-ts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/map.svg +1 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/README.md +2 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/index.tsx +208 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +92 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/style.scss +350 -0
- package/template/react-ts-custom-cmp-template/tsconfig.json +68 -0
- package/template/vue2-custom-cmp-template/.prettierrc.js +12 -0
- package/template/vue2-custom-cmp-template/README.md +154 -0
- package/template/vue2-custom-cmp-template/commitlint.config.js +59 -0
- package/template/vue2-custom-cmp-template/neo.config.js +146 -0
- package/template/vue2-custom-cmp-template/package.json +59 -0
- package/template/vue2-custom-cmp-template/public/css/base.css +283 -0
- package/template/vue2-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/vue2-custom-cmp-template/public/template.html +13 -0
- package/template/vue2-custom-cmp-template/src/assets/css/common.scss +126 -0
- package/template/vue2-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/vue2-custom-cmp-template/src/components/vueInfoCard/index.vue +131 -0
- package/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +81 -0
- package/test/demo.js +2 -2
- package/test/deprecate-versions.js +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 图表组件对接编辑器的描述文件
|
|
3
|
+
*/
|
|
4
|
+
export class ChartWidgetModel {
|
|
5
|
+
/**
|
|
6
|
+
* cmpType 为自定义组件名称,用于标识组件的唯一性
|
|
7
|
+
* 在构建时根据当前组件目录名称自动生成
|
|
8
|
+
*/
|
|
9
|
+
// cmpType: string = 'chart-widget';
|
|
10
|
+
|
|
11
|
+
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
+
label: string = '酷炫图表组件';
|
|
13
|
+
|
|
14
|
+
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
+
description: string =
|
|
16
|
+
'支持多种图表类型切换的专业图表组件,支持丰富的配置选项';
|
|
17
|
+
|
|
18
|
+
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
19
|
+
// tags: string[] = ['自定义组件'];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 用于设置组件支持的页面类型
|
|
23
|
+
*
|
|
24
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
25
|
+
* all: 1 全页面
|
|
26
|
+
* indexPage: 2 首页
|
|
27
|
+
* entityListPage: 3 实体列表页
|
|
28
|
+
* entityFormPage: 4 实体表单页
|
|
29
|
+
* entityDetailPage: 5 实体详情页
|
|
30
|
+
* customPage: 6 自定义页面
|
|
31
|
+
* bizPage: 7 业务页面
|
|
32
|
+
*/
|
|
33
|
+
// targetPage: string[] = ['customPage'];
|
|
34
|
+
|
|
35
|
+
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
36
|
+
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/chart.svg';
|
|
37
|
+
|
|
38
|
+
// 初次插入页面的默认属性数据
|
|
39
|
+
defaultComProps = {
|
|
40
|
+
chartType: 'line',
|
|
41
|
+
title: '销售趋势分析',
|
|
42
|
+
subtitle: '2025年数据统计',
|
|
43
|
+
width: 800,
|
|
44
|
+
height: 400,
|
|
45
|
+
theme: 'default',
|
|
46
|
+
showLegend: true,
|
|
47
|
+
showTooltip: true,
|
|
48
|
+
showDataZoom: false,
|
|
49
|
+
showGrid: true,
|
|
50
|
+
backgroundColor: 'transparent',
|
|
51
|
+
textColor: '#333',
|
|
52
|
+
mockData: {
|
|
53
|
+
xAxis: ['1月', '2月', '3月', '4月', '5月', '6月'],
|
|
54
|
+
series: [
|
|
55
|
+
{
|
|
56
|
+
name: '销售额',
|
|
57
|
+
data: [120, 200, 150, 80, 70, 110],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
dataConfig: {
|
|
62
|
+
enableMock: true,
|
|
63
|
+
dataSource: 'mock',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
69
|
+
* 使用 JSON AMIS 表单配置
|
|
70
|
+
*/
|
|
71
|
+
propsSchema = [
|
|
72
|
+
{
|
|
73
|
+
type: 'select',
|
|
74
|
+
name: 'chartType',
|
|
75
|
+
label: '图表类型',
|
|
76
|
+
value: 'line',
|
|
77
|
+
options: [
|
|
78
|
+
{ label: '折线图', value: 'line' },
|
|
79
|
+
{ label: '柱状图', value: 'bar' },
|
|
80
|
+
{ label: '饼图', value: 'pie' },
|
|
81
|
+
{ label: '散点图', value: 'scatter' },
|
|
82
|
+
{ label: '雷达图', value: 'radar' },
|
|
83
|
+
{ label: '仪表盘', value: 'gauge' },
|
|
84
|
+
{ label: '漏斗图', value: 'funnel' },
|
|
85
|
+
{ label: '桑基图', value: 'sankey' },
|
|
86
|
+
],
|
|
87
|
+
clearable: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'text',
|
|
91
|
+
name: 'title',
|
|
92
|
+
label: '主标题',
|
|
93
|
+
value: '销售趋势分析',
|
|
94
|
+
placeholder: '请输入图表标题',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'text',
|
|
98
|
+
name: 'subtitle',
|
|
99
|
+
label: '副标题',
|
|
100
|
+
value: '2025年数据统计',
|
|
101
|
+
placeholder: '请输入图表副标题',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'number',
|
|
105
|
+
name: 'width',
|
|
106
|
+
label: '宽度',
|
|
107
|
+
value: 800,
|
|
108
|
+
min: 200,
|
|
109
|
+
max: 2000,
|
|
110
|
+
step: 10,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: 'number',
|
|
114
|
+
name: 'height',
|
|
115
|
+
label: '高度',
|
|
116
|
+
value: 400,
|
|
117
|
+
min: 200,
|
|
118
|
+
max: 1000,
|
|
119
|
+
step: 10,
|
|
120
|
+
},
|
|
121
|
+
/*
|
|
122
|
+
// 注释掉未生效的配置项
|
|
123
|
+
{
|
|
124
|
+
type: 'color',
|
|
125
|
+
name: 'backgroundColor',
|
|
126
|
+
label: '背景颜色',
|
|
127
|
+
value: 'transparent',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: 'color',
|
|
131
|
+
name: 'textColor',
|
|
132
|
+
label: '文字颜色',
|
|
133
|
+
value: '#333',
|
|
134
|
+
},
|
|
135
|
+
*/
|
|
136
|
+
{
|
|
137
|
+
type: 'switch',
|
|
138
|
+
name: 'showLegend',
|
|
139
|
+
label: '显示图例',
|
|
140
|
+
value: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'switch',
|
|
144
|
+
name: 'showTooltip',
|
|
145
|
+
label: '显示提示框',
|
|
146
|
+
value: true,
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default ChartWidgetModel;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
.chart-widget-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
padding: 20px;
|
|
8
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
|
9
|
+
backdrop-filter: blur(10px);
|
|
10
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
|
|
13
|
+
&::before {
|
|
14
|
+
content: '';
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
background: linear-gradient(45deg,
|
|
21
|
+
rgba(255, 255, 255, 0.1) 0%,
|
|
22
|
+
rgba(255, 255, 255, 0.05) 50%,
|
|
23
|
+
rgba(255, 255, 255, 0.1) 100%);
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.user-info {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 10px;
|
|
30
|
+
right: 20px;
|
|
31
|
+
z-index: 10;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: flex-end;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
|
|
37
|
+
.user-name,
|
|
38
|
+
.tenant-name {
|
|
39
|
+
background: rgba(255, 255, 255, 0.9);
|
|
40
|
+
color: #333;
|
|
41
|
+
padding: 4px 8px;
|
|
42
|
+
border-radius: 12px;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
backdrop-filter: blur(10px);
|
|
46
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.user-name {
|
|
50
|
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
51
|
+
color: white;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.chart-container {
|
|
56
|
+
position: relative;
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
background: rgba(255, 255, 255, 0.95);
|
|
60
|
+
border-radius: 8px;
|
|
61
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
|
62
|
+
backdrop-filter: blur(10px);
|
|
63
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
transition: all 0.3s ease;
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
transform: translateY(-2px);
|
|
69
|
+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ECharts 容器样式增强
|
|
73
|
+
.echarts-for-react {
|
|
74
|
+
width: 100% !important;
|
|
75
|
+
height: 100% !important;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 响应式设计
|
|
80
|
+
@media (max-width: 768px) {
|
|
81
|
+
padding: 15px;
|
|
82
|
+
|
|
83
|
+
.user-info {
|
|
84
|
+
top: 8px;
|
|
85
|
+
right: 15px;
|
|
86
|
+
|
|
87
|
+
.user-name,
|
|
88
|
+
.tenant-name {
|
|
89
|
+
font-size: 11px;
|
|
90
|
+
padding: 3px 6px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 深色主题适配
|
|
96
|
+
&.dark-theme {
|
|
97
|
+
background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
|
|
98
|
+
|
|
99
|
+
.chart-container {
|
|
100
|
+
background: rgba(44, 62, 80, 0.95);
|
|
101
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 动画效果
|
|
106
|
+
&.loading {
|
|
107
|
+
.chart-container {
|
|
108
|
+
position: relative;
|
|
109
|
+
|
|
110
|
+
&::after {
|
|
111
|
+
content: '';
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: 50%;
|
|
114
|
+
left: 50%;
|
|
115
|
+
width: 40px;
|
|
116
|
+
height: 40px;
|
|
117
|
+
margin: -20px 0 0 -20px;
|
|
118
|
+
border: 3px solid #f3f3f3;
|
|
119
|
+
border-top: 3px solid #667eea;
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
animation: spin 1s linear infinite;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@keyframes spin {
|
|
128
|
+
0% { transform: rotate(0deg); }
|
|
129
|
+
100% { transform: rotate(360deg); }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 图表类型特定样式
|
|
133
|
+
.chart-widget-container {
|
|
134
|
+
&.line-chart {
|
|
135
|
+
.chart-container {
|
|
136
|
+
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.bar-chart {
|
|
141
|
+
.chart-container {
|
|
142
|
+
background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&.pie-chart {
|
|
147
|
+
.chart-container {
|
|
148
|
+
background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&.scatter-chart {
|
|
153
|
+
.chart-container {
|
|
154
|
+
background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(233, 30, 99, 0.1));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&.radar-chart {
|
|
159
|
+
.chart-container {
|
|
160
|
+
background: linear-gradient(135deg, rgba(0, 150, 136, 0.1), rgba(0, 188, 212, 0.1));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&.gauge-chart {
|
|
165
|
+
.chart-container {
|
|
166
|
+
background: linear-gradient(135deg, rgba(255, 87, 34, 0.1), rgba(255, 152, 0, 0.1));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&.funnel-chart {
|
|
171
|
+
.chart-container {
|
|
172
|
+
background: linear-gradient(135deg, rgba(63, 81, 181, 0.1), rgba(103, 58, 183, 0.1));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&.sankey-chart {
|
|
177
|
+
.chart-container {
|
|
178
|
+
background: linear-gradient(135deg, rgba(121, 85, 72, 0.1), rgba(96, 125, 139, 0.1));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 全局图表样式覆盖
|
|
184
|
+
.chart-widget-container {
|
|
185
|
+
.chart-container {
|
|
186
|
+
// 确保 ECharts 图表在容器内正确显示
|
|
187
|
+
canvas {
|
|
188
|
+
border-radius: 8px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 图表标题样式
|
|
192
|
+
.echarts-title {
|
|
193
|
+
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
194
|
+
font-weight: 600;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 图例样式
|
|
198
|
+
.echarts-legend {
|
|
199
|
+
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 工具提示样式
|
|
203
|
+
.echarts-tooltip {
|
|
204
|
+
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
205
|
+
border-radius: 8px;
|
|
206
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# 地图展示组件
|
|
2
|
+
|
|
3
|
+
地图展示组件,支持传入地理坐标或位置名称来展示地图区域,并标注当前位置。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- ✅ 支持通过经纬度坐标定位
|
|
8
|
+
- ✅ 支持通过地址名称定位(自动地理编码)
|
|
9
|
+
- ✅ 支持自定义缩放级别
|
|
10
|
+
- ✅ 支持自定义标记点标题
|
|
11
|
+
- ✅ 支持点击标记查看详细地址
|
|
12
|
+
- ✅ 支持自定义地图高度
|
|
13
|
+
- ✅ 响应式设计,适配移动端
|
|
14
|
+
- ✅ 优雅的加载和错误状态提示
|
|
15
|
+
|
|
16
|
+
## 使用方式
|
|
17
|
+
|
|
18
|
+
### 1. 通过经纬度定位
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<MapWidget
|
|
22
|
+
longitude={116.397428}
|
|
23
|
+
latitude={39.90923}
|
|
24
|
+
markerTitle="北京天安门"
|
|
25
|
+
zoom={15}
|
|
26
|
+
height={400}
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. 通过地址名称定位
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<MapWidget
|
|
34
|
+
locationName="北京市天安门广场"
|
|
35
|
+
markerTitle="天安门广场"
|
|
36
|
+
zoom={15}
|
|
37
|
+
height={400}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 属性说明
|
|
42
|
+
|
|
43
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
44
|
+
|--------|------|--------|------|
|
|
45
|
+
| longitude | number | 116.397428 | 经度(-180 到 180)|
|
|
46
|
+
| latitude | number | 39.90923 | 纬度(-90 到 90)|
|
|
47
|
+
| locationName | string | - | 位置名称(优先级高于经纬度)|
|
|
48
|
+
| zoom | number | 14 | 地图缩放级别(3-18)|
|
|
49
|
+
| markerTitle | string | '当前位置' | 标记点标题 |
|
|
50
|
+
| height | number | 400 | 地图容器高度(像素)|
|
|
51
|
+
|
|
52
|
+
## 注意事项
|
|
53
|
+
|
|
54
|
+
1. **地图脚本配置**:
|
|
55
|
+
- 当前使用的是企业内部部署的高德地图脚本:`https://neors.ingageapp.com/base/js/amap_2.0.5.21.js`
|
|
56
|
+
- 参考了 `neo-ui-component-web` 项目的实现方式
|
|
57
|
+
- 如需使用高德官方 API,可以:
|
|
58
|
+
- 前往[高德开放平台](https://lbs.amap.com/)申请 Web 端 API Key
|
|
59
|
+
- 在 `index.tsx` 的 `loadAMapScript` 方法中取消注释备用方案代码
|
|
60
|
+
- 替换 `amapKey` 为你的 API Key
|
|
61
|
+
|
|
62
|
+
2. **定位方式优先级**:
|
|
63
|
+
- 如果同时提供了 `locationName` 和经纬度,优先使用 `locationName`
|
|
64
|
+
- 如果都未提供,默认显示北京天安门位置
|
|
65
|
+
|
|
66
|
+
3. **地理编码说明**:
|
|
67
|
+
- 使用 `locationName` 时,会自动调用高德地图的地理编码服务
|
|
68
|
+
- 建议提供完整的地址信息以提高解析准确度
|
|
69
|
+
- 地理编码仅支持中国大陆地区
|
|
70
|
+
|
|
71
|
+
4. **性能优化**:
|
|
72
|
+
- 地图脚本采用动态加载方式,不会影响页面初始加载速度
|
|
73
|
+
- 地图实例在组件销毁时会自动清理,避免内存泄漏
|
|
74
|
+
- 已加载的脚本会被缓存,重复使用不会重复加载
|
|
75
|
+
|
|
76
|
+
## 示例场景
|
|
77
|
+
|
|
78
|
+
### 场景1:展示公司地址
|
|
79
|
+
```tsx
|
|
80
|
+
<MapWidget
|
|
81
|
+
locationName="上海市浦东新区世纪大道XXX号"
|
|
82
|
+
markerTitle="公司总部"
|
|
83
|
+
zoom={16}
|
|
84
|
+
height={500}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 场景2:展示多个城市坐标
|
|
89
|
+
```tsx
|
|
90
|
+
// 北京
|
|
91
|
+
<MapWidget longitude={116.397428} latitude={39.90923} markerTitle="北京" />
|
|
92
|
+
|
|
93
|
+
// 上海
|
|
94
|
+
<MapWidget longitude={121.473701} latitude={31.230416} markerTitle="上海" />
|
|
95
|
+
|
|
96
|
+
// 深圳
|
|
97
|
+
<MapWidget longitude={114.057868} latitude={22.543099} markerTitle="深圳" />
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 场景3:移动端展示
|
|
101
|
+
组件已自动适配移动端,会根据屏幕尺寸调整样式和布局。
|
|
102
|
+
|
|
103
|
+
## 技术实现
|
|
104
|
+
|
|
105
|
+
- 基于高德地图 Web API 2.0
|
|
106
|
+
- 使用 React Class Component
|
|
107
|
+
- TypeScript 类型支持
|
|
108
|
+
- SCSS 样式预处理
|
|
109
|
+
- 动态脚本加载
|
|
110
|
+
|
|
111
|
+
## 浏览器兼容性
|
|
112
|
+
|
|
113
|
+
- Chrome >= 60
|
|
114
|
+
- Firefox >= 60
|
|
115
|
+
- Safari >= 11
|
|
116
|
+
- Edge >= 79
|
|
117
|
+
|
|
118
|
+
## 更新日志
|
|
119
|
+
|
|
120
|
+
### v1.0.0 (2025-10-17)
|
|
121
|
+
- ✨ 初始版本发布
|
|
122
|
+
- ✨ 支持经纬度和地址名称定位
|
|
123
|
+
- ✨ 支持标记点和信息窗体
|
|
124
|
+
- ✨ 响应式设计
|
|
125
|
+
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# 地图组件快速使用指南
|
|
2
|
+
|
|
3
|
+
## 快速开始
|
|
4
|
+
|
|
5
|
+
### 1. 基本使用(经纬度定位)
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import MapWidget from './components/map-widget';
|
|
9
|
+
|
|
10
|
+
// 在你的页面或组件中使用
|
|
11
|
+
<MapWidget
|
|
12
|
+
longitude={116.397428}
|
|
13
|
+
latitude={39.90923}
|
|
14
|
+
markerTitle="北京天安门"
|
|
15
|
+
zoom={15}
|
|
16
|
+
height={400}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. 使用地址名称定位
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<MapWidget
|
|
24
|
+
locationName="北京市天安门广场"
|
|
25
|
+
markerTitle="天安门广场"
|
|
26
|
+
zoom={15}
|
|
27
|
+
height={500}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 3. 在 Neo 平台中使用
|
|
32
|
+
|
|
33
|
+
在 Neo 低代码平台的页面编辑器中:
|
|
34
|
+
|
|
35
|
+
1. 从左侧组件面板找到「地图组件」
|
|
36
|
+
2. 拖拽到页面中
|
|
37
|
+
3. 在右侧属性面板配置:
|
|
38
|
+
- **位置名称**:输入地址(如"上海市浦东新区世纪大道")
|
|
39
|
+
- **或使用经纬度**:
|
|
40
|
+
- 经度:如 121.473701
|
|
41
|
+
- 纬度:如 31.230416
|
|
42
|
+
- **标记点标题**:设置标记点显示的文字
|
|
43
|
+
- **缩放级别**:3-18,推荐 14-16
|
|
44
|
+
- **地图高度**:默认 400px,可自定义
|
|
45
|
+
|
|
46
|
+
## 常用城市坐标
|
|
47
|
+
|
|
48
|
+
| 城市 | 经度 | 纬度 |
|
|
49
|
+
|------|------|------|
|
|
50
|
+
| 北京 | 116.397428 | 39.90923 |
|
|
51
|
+
| 上海 | 121.473701 | 31.230416 |
|
|
52
|
+
| 广州 | 113.264385 | 23.129112 |
|
|
53
|
+
| 深圳 | 114.057868 | 22.543099 |
|
|
54
|
+
| 杭州 | 120.155070 | 30.274084 |
|
|
55
|
+
| 成都 | 104.065735 | 30.659462 |
|
|
56
|
+
| 西安 | 108.948024 | 34.263161 |
|
|
57
|
+
| 武汉 | 114.298572 | 30.584355 |
|
|
58
|
+
| 南京 | 118.767413 | 32.041544 |
|
|
59
|
+
| 重庆 | 106.504962 | 29.533155 |
|
|
60
|
+
|
|
61
|
+
## 配置说明
|
|
62
|
+
|
|
63
|
+
### 优先级规则
|
|
64
|
+
|
|
65
|
+
1. 如果同时设置了「位置名称」和「经纬度」,优先使用「位置名称」
|
|
66
|
+
2. 如果都未设置,默认显示北京天安门
|
|
67
|
+
|
|
68
|
+
### 地址搜索提示
|
|
69
|
+
|
|
70
|
+
使用「位置名称」进行定位时,建议提供完整地址以提高准确度:
|
|
71
|
+
|
|
72
|
+
✅ **好的示例**:
|
|
73
|
+
- "北京市朝阳区建国门外大街1号"
|
|
74
|
+
- "上海市浦东新区世纪大道88号"
|
|
75
|
+
- "广州市天河区珠江新城花城大道"
|
|
76
|
+
|
|
77
|
+
❌ **不好的示例**:
|
|
78
|
+
- "建国门" (太模糊)
|
|
79
|
+
- "天河" (太宽泛)
|
|
80
|
+
- "世纪大道" (没有城市信息)
|
|
81
|
+
|
|
82
|
+
### 缩放级别参考
|
|
83
|
+
|
|
84
|
+
- **3-7**:省级/国家级视图
|
|
85
|
+
- **8-11**:城市级视图
|
|
86
|
+
- **12-14**:区县级视图(默认)
|
|
87
|
+
- **15-16**:街道级视图
|
|
88
|
+
- **17-18**:建筑物级视图
|
|
89
|
+
|
|
90
|
+
## 常见问题
|
|
91
|
+
|
|
92
|
+
### Q1: 地图无法显示?
|
|
93
|
+
|
|
94
|
+
**可能原因**:
|
|
95
|
+
1. 网络连接问题
|
|
96
|
+
2. 地图脚本加载失败
|
|
97
|
+
3. 提供的地址无法解析
|
|
98
|
+
|
|
99
|
+
**解决方案**:
|
|
100
|
+
- 检查网络连接
|
|
101
|
+
- 查看浏览器控制台错误信息
|
|
102
|
+
- 尝试使用经纬度而不是地址名称
|
|
103
|
+
- 确认地址格式正确
|
|
104
|
+
|
|
105
|
+
### Q2: 地址定位不准确?
|
|
106
|
+
|
|
107
|
+
**解决方案**:
|
|
108
|
+
- 提供更完整的地址信息
|
|
109
|
+
- 包含省市区县信息
|
|
110
|
+
- 使用标准地址格式
|
|
111
|
+
- 或直接使用经纬度坐标
|
|
112
|
+
|
|
113
|
+
### Q3: 如何获取某个地点的经纬度?
|
|
114
|
+
|
|
115
|
+
**方法**:
|
|
116
|
+
1. 访问 [高德地图坐标拾取器](https://lbs.amap.com/tools/picker)
|
|
117
|
+
2. 搜索或点击地图上的位置
|
|
118
|
+
3. 复制显示的经纬度坐标
|
|
119
|
+
4. 注意:高德地图的顺序是 [经度, 纬度]
|
|
120
|
+
|
|
121
|
+
### Q4: 支持国外地址吗?
|
|
122
|
+
|
|
123
|
+
**说明**:
|
|
124
|
+
- 当前使用高德地图,主要支持中国大陆地区
|
|
125
|
+
- 国外地址可能无法准确定位
|
|
126
|
+
- 如需支持国外地址,需要切换到谷歌地图或其他国际地图服务
|
|
127
|
+
|
|
128
|
+
## 进阶使用
|
|
129
|
+
|
|
130
|
+
### 动态更新位置
|
|
131
|
+
|
|
132
|
+
如果需要根据用户输入或数据动态更新地图位置,可以通过修改组件的 props 来实现:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
class MyPage extends React.Component {
|
|
136
|
+
state = {
|
|
137
|
+
longitude: 116.397428,
|
|
138
|
+
latitude: 39.90923,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
updateLocation = (lng, lat) => {
|
|
142
|
+
this.setState({
|
|
143
|
+
longitude: lng,
|
|
144
|
+
latitude: lat,
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
render() {
|
|
149
|
+
return (
|
|
150
|
+
<div>
|
|
151
|
+
<button onClick={() => this.updateLocation(121.473701, 31.230416)}>
|
|
152
|
+
定位到上海
|
|
153
|
+
</button>
|
|
154
|
+
<MapWidget
|
|
155
|
+
longitude={this.state.longitude}
|
|
156
|
+
latitude={this.state.latitude}
|
|
157
|
+
markerTitle="当前位置"
|
|
158
|
+
zoom={15}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 自定义地图样式
|
|
167
|
+
|
|
168
|
+
如果需要自定义地图的外观,可以修改 `style.scss` 文件:
|
|
169
|
+
|
|
170
|
+
```scss
|
|
171
|
+
// 修改标题栏颜色
|
|
172
|
+
.map-widget-header {
|
|
173
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
174
|
+
// 改为你喜欢的颜色
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 修改信息窗体样式
|
|
178
|
+
.map-info-window {
|
|
179
|
+
padding: 12px;
|
|
180
|
+
// 自定义样式
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 技术支持
|
|
185
|
+
|
|
186
|
+
如有问题,请参考:
|
|
187
|
+
- [高德地图 Web API 文档](https://lbs.amap.com/api/javascript-api/summary)
|
|
188
|
+
- [React 组件开发文档](https://react.docschina.org/)
|
|
189
|
+
- [TypeScript 手册](https://www.typescriptlang.org/docs/)
|
|
190
|
+
|