congmao-cli 1.0.0
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 -0
- package/bin/index.js +20 -0
- package/package.json +42 -0
- package/src/commands/create.js +171 -0
- package/src/commands/mcp.js +157 -0
- package/src/mcp/CURSOR_SETUP.md +259 -0
- package/src/mcp/README.md +134 -0
- package/src/mcp/USAGE_EXAMPLES.md +181 -0
- package/src/mcp/get-cursor-config.js +58 -0
- package/src/mcp/package.json +23 -0
- package/src/mcp/pnpm-lock.yaml +2441 -0
- package/src/mcp/src/handlers.js +211 -0
- package/src/mcp/src/http-server.js +332 -0
- package/src/mcp/src/index.js +195 -0
- package/src/mcp/src/schemas.js +54 -0
- package/src/mcp/test-create-project.js +49 -0
- package/src/mcp/test-mcp.js +89 -0
- package/src/mcp/test-show-tree.js +66 -0
- package/src/template/Uni-app/README.md +19 -0
- package/src/template/Uni-app/babel.config.js +81 -0
- package/src/template/Uni-app/package.json +107 -0
- package/src/template/Uni-app/postcss.config.js +27 -0
- package/src/template/Uni-app/public/index.html +25 -0
- package/src/template/Uni-app/shims-uni.d.ts +11 -0
- package/src/template/Uni-app/shims-vue.d.ts +4 -0
- package/src/template/Uni-app/src/App.vue +17 -0
- package/src/template/Uni-app/src/main.js +12 -0
- package/src/template/Uni-app/src/manifest.json +75 -0
- package/src/template/Uni-app/src/pages/index/index.vue +49 -0
- package/src/template/Uni-app/src/pages.json +16 -0
- package/src/template/Uni-app/src/static/logo.png +0 -0
- package/src/template/Uni-app/src/uni.promisify.adaptor.js +13 -0
- package/src/template/Uni-app/src/uni.scss +76 -0
- package/src/template/Uni-app/yarn.lock +11466 -0
- package/src/template/Vue2/.editorconfig +14 -0
- package/src/template/Vue2/.env +2 -0
- package/src/template/Vue2/.env.development +2 -0
- package/src/template/Vue2/.env.site +2 -0
- package/src/template/Vue2/.prettierrc.js +39 -0
- package/src/template/Vue2/.stylelintignore +8 -0
- package/src/template/Vue2/README-zh_CN.md +115 -0
- package/src/template/Vue2/commitlint.config.js +1 -0
- package/src/template/Vue2/docs/docs-starter.png +0 -0
- package/src/template/Vue2/docs/docs-startup.png +0 -0
- package/src/template/Vue2/docs/docs-structure.png +0 -0
- package/src/template/Vue2/globals.d.ts +13 -0
- package/src/template/Vue2/index.html +27 -0
- package/src/template/Vue2/jsx.d.ts +13 -0
- package/src/template/Vue2/mock/index.ts +147 -0
- package/src/template/Vue2/package.json +91 -0
- package/src/template/Vue2/package.json.ejs +91 -0
- package/src/template/Vue2/public/favicon.ico +0 -0
- package/src/template/Vue2/shims-vue.d.ts +5 -0
- package/src/template/Vue2/src/App.vue +19 -0
- package/src/template/Vue2/src/assets/assets-login-bg-black.png +0 -0
- package/src/template/Vue2/src/assets/assets-login-bg-white.png +0 -0
- package/src/template/Vue2/src/assets/assets-logo-full.svg +39 -0
- package/src/template/Vue2/src/assets/assets-product-1.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-2.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-3.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-4.svg +5 -0
- package/src/template/Vue2/src/assets/assets-result-403.svg +32 -0
- package/src/template/Vue2/src/assets/assets-result-404.svg +36 -0
- package/src/template/Vue2/src/assets/assets-result-500.svg +32 -0
- package/src/template/Vue2/src/assets/assets-result-ie.svg +33 -0
- package/src/template/Vue2/src/assets/assets-result-maintenance.svg +49 -0
- package/src/template/Vue2/src/assets/assets-result-wifi.svg +23 -0
- package/src/template/Vue2/src/assets/assets-setting-auto.svg +13 -0
- package/src/template/Vue2/src/assets/assets-setting-dark.svg +5 -0
- package/src/template/Vue2/src/assets/assets-setting-light.svg +13 -0
- package/src/template/Vue2/src/assets/assets-t-logo.svg +41 -0
- package/src/template/Vue2/src/assets/assets-tencent-logo.png +0 -0
- package/src/template/Vue2/src/components/color/index.vue +35 -0
- package/src/template/Vue2/src/components/product-card/index.vue +121 -0
- package/src/template/Vue2/src/components/result/index.vue +118 -0
- package/src/template/Vue2/src/components/thumbnail/index.vue +49 -0
- package/src/template/Vue2/src/components/trend/index.vue +105 -0
- package/src/template/Vue2/src/config/color.ts +30 -0
- package/src/template/Vue2/src/config/global.ts +2 -0
- package/src/template/Vue2/src/config/host.ts +26 -0
- package/src/template/Vue2/src/config/style.ts +14 -0
- package/src/template/Vue2/src/constants/index.ts +46 -0
- package/src/template/Vue2/src/interface.ts +39 -0
- package/src/template/Vue2/src/layouts/blank.vue +12 -0
- package/src/template/Vue2/src/layouts/components/Breadcrumb.vue +39 -0
- package/src/template/Vue2/src/layouts/components/Content.vue +43 -0
- package/src/template/Vue2/src/layouts/components/Footer.vue +27 -0
- package/src/template/Vue2/src/layouts/components/Header.vue +321 -0
- package/src/template/Vue2/src/layouts/components/LayoutContent.vue +168 -0
- package/src/template/Vue2/src/layouts/components/LayoutHeader.vue +52 -0
- package/src/template/Vue2/src/layouts/components/LayoutSidebar.vue +51 -0
- package/src/template/Vue2/src/layouts/components/MenuContent.vue +108 -0
- package/src/template/Vue2/src/layouts/components/Notice.vue +221 -0
- package/src/template/Vue2/src/layouts/components/Search.vue +134 -0
- package/src/template/Vue2/src/layouts/components/SideNav.vue +150 -0
- package/src/template/Vue2/src/layouts/index.vue +100 -0
- package/src/template/Vue2/src/layouts/setting.vue +404 -0
- package/src/template/Vue2/src/main.js +9 -0
- package/src/template/Vue2/src/main.jsx +51 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/MiddleChart.vue +158 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/OutputOverview.vue +189 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/RankList.vue +111 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/TopPanel.vue +246 -0
- package/src/template/Vue2/src/pages/dashboard/base/index.ts +702 -0
- package/src/template/Vue2/src/pages/dashboard/base/index.vue +44 -0
- package/src/template/Vue2/src/pages/dashboard/detail/index.ts +267 -0
- package/src/template/Vue2/src/pages/dashboard/detail/index.vue +242 -0
- package/src/template/Vue2/src/pages/detail/advanced/components/Product.vue +167 -0
- package/src/template/Vue2/src/pages/detail/advanced/index.less +74 -0
- package/src/template/Vue2/src/pages/detail/advanced/index.vue +219 -0
- package/src/template/Vue2/src/pages/detail/base/index.less +105 -0
- package/src/template/Vue2/src/pages/detail/base/index.vue +46 -0
- package/src/template/Vue2/src/pages/detail/deploy/index.ts +204 -0
- package/src/template/Vue2/src/pages/detail/deploy/index.vue +224 -0
- package/src/template/Vue2/src/pages/detail/secondary/index.less +71 -0
- package/src/template/Vue2/src/pages/detail/secondary/index.vue +131 -0
- package/src/template/Vue2/src/pages/form/base/index.less +57 -0
- package/src/template/Vue2/src/pages/form/base/index.vue +254 -0
- package/src/template/Vue2/src/pages/form/step/index.less +37 -0
- package/src/template/Vue2/src/pages/form/step/index.vue +259 -0
- package/src/template/Vue2/src/pages/frame/doc/index.vue +86 -0
- package/src/template/Vue2/src/pages/frame/tdesign/index.vue +86 -0
- package/src/template/Vue2/src/pages/list/base/index.vue +267 -0
- package/src/template/Vue2/src/pages/list/card/index.vue +221 -0
- package/src/template/Vue2/src/pages/list/components/CommonTable.vue +313 -0
- package/src/template/Vue2/src/pages/list/filter/index.vue +15 -0
- package/src/template/Vue2/src/pages/list/tree/index.vue +174 -0
- package/src/template/Vue2/src/pages/login/components/components-header.vue +74 -0
- package/src/template/Vue2/src/pages/login/components/components-login.vue +154 -0
- package/src/template/Vue2/src/pages/login/components/components-register.vue +144 -0
- package/src/template/Vue2/src/pages/login/index.less +202 -0
- package/src/template/Vue2/src/pages/login/index.vue +53 -0
- package/src/template/Vue2/src/pages/nest-menu/Index.vue +10 -0
- package/src/template/Vue2/src/pages/result/403/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/404/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/500/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/browser-incompatible/index.vue +77 -0
- package/src/template/Vue2/src/pages/result/fail/index.vue +57 -0
- package/src/template/Vue2/src/pages/result/maintenance/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/network-error/index.vue +24 -0
- package/src/template/Vue2/src/pages/result/success/index.vue +59 -0
- package/src/template/Vue2/src/pages/user/index.less +148 -0
- package/src/template/Vue2/src/pages/user/index.ts +157 -0
- package/src/template/Vue2/src/pages/user/index.vue +204 -0
- package/src/template/Vue2/src/permission.js +56 -0
- package/src/template/Vue2/src/router/index.js +43 -0
- package/src/template/Vue2/src/router/modules/base.ts +29 -0
- package/src/template/Vue2/src/router/modules/components.ts +175 -0
- package/src/template/Vue2/src/router/modules/others.ts +55 -0
- package/src/template/Vue2/src/service/service-advance.ts +233 -0
- package/src/template/Vue2/src/service/service-base.ts +205 -0
- package/src/template/Vue2/src/service/service-detail-base.ts +84 -0
- package/src/template/Vue2/src/service/service-detail-deploy.ts +234 -0
- package/src/template/Vue2/src/service/service-detail.ts +57 -0
- package/src/template/Vue2/src/service/service-user.ts +64 -0
- package/src/template/Vue2/src/store/index.ts +22 -0
- package/src/template/Vue2/src/store/modules/notification.ts +90 -0
- package/src/template/Vue2/src/store/modules/permission.ts +66 -0
- package/src/template/Vue2/src/store/modules/setting.ts +122 -0
- package/src/template/Vue2/src/store/modules/tab-router.ts +83 -0
- package/src/template/Vue2/src/store/modules/user.ts +98 -0
- package/src/template/Vue2/src/style/font-family.less +6 -0
- package/src/template/Vue2/src/style/index.less +5 -0
- package/src/template/Vue2/src/style/layout.less +201 -0
- package/src/template/Vue2/src/style/reset.less +78 -0
- package/src/template/Vue2/src/style/variables.less +27 -0
- package/src/template/Vue2/src/utils/charts.ts +38 -0
- package/src/template/Vue2/src/utils/color.ts +118 -0
- package/src/template/Vue2/src/utils/date.ts +12 -0
- package/src/template/Vue2/src/utils/request.ts +60 -0
- package/src/template/Vue2/stylelint.config.js +5 -0
- package/src/template/Vue2/tsconfig.json +26 -0
- package/src/template/Vue2/vite.config.js +58 -0
- package/src/template/Vue3/package.json.ejs +8 -0
- package/src/template/Vue3/pages.json +10 -0
- package/src/template/Vue3/src/main.js +7 -0
- package/src/utils/copy.js +17 -0
- package/src/utils/eslint.js +205 -0
- package/src/utils/logo.js +18 -0
- package/src/utils/render.js +20 -0
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { getChartListColor } from '@/utils/color';
|
|
3
|
+
import { getRandomArray } from '@/utils/charts';
|
|
4
|
+
|
|
5
|
+
/** 首页 dashboard 折线图 */
|
|
6
|
+
export function constructInitDashboardDataset(type: string) {
|
|
7
|
+
const dateArray: Array<string> = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
|
|
8
|
+
const datasetAxis = {
|
|
9
|
+
xAxis: {
|
|
10
|
+
type: 'category',
|
|
11
|
+
show: false,
|
|
12
|
+
data: dateArray,
|
|
13
|
+
},
|
|
14
|
+
yAxis: {
|
|
15
|
+
show: false,
|
|
16
|
+
type: 'value',
|
|
17
|
+
},
|
|
18
|
+
grid: {
|
|
19
|
+
top: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
bottom: 0,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (type === 'line') {
|
|
27
|
+
const lineDataset = {
|
|
28
|
+
...datasetAxis,
|
|
29
|
+
color: ['#fff'],
|
|
30
|
+
series: [
|
|
31
|
+
{
|
|
32
|
+
data: [150, 230, 224, 218, 135, 147, 260],
|
|
33
|
+
type,
|
|
34
|
+
showSymbol: true,
|
|
35
|
+
symbol: 'circle',
|
|
36
|
+
symbolSize: 0,
|
|
37
|
+
markPoint: {
|
|
38
|
+
data: [
|
|
39
|
+
{ type: 'max', name: '最大值' },
|
|
40
|
+
{ type: 'min', name: '最小值' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
itemStyle: {
|
|
44
|
+
normal: {
|
|
45
|
+
lineStyle: {
|
|
46
|
+
width: 2,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
return lineDataset;
|
|
54
|
+
}
|
|
55
|
+
if (type === 'bar') {
|
|
56
|
+
const barDataset = {
|
|
57
|
+
...datasetAxis,
|
|
58
|
+
color: getChartListColor(),
|
|
59
|
+
series: [
|
|
60
|
+
{
|
|
61
|
+
data: [
|
|
62
|
+
100,
|
|
63
|
+
130,
|
|
64
|
+
184,
|
|
65
|
+
218,
|
|
66
|
+
{
|
|
67
|
+
value: 135,
|
|
68
|
+
itemStyle: {
|
|
69
|
+
opacity: 0.2,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: 118,
|
|
74
|
+
itemStyle: {
|
|
75
|
+
opacity: 0.2,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: 60,
|
|
80
|
+
itemStyle: {
|
|
81
|
+
opacity: 0.2,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
type,
|
|
86
|
+
barWidth: 9,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
return barDataset;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** 柱状图数据源 */
|
|
95
|
+
export function constructInitDataset({
|
|
96
|
+
dateTime = [],
|
|
97
|
+
placeholderColor,
|
|
98
|
+
borderColor,
|
|
99
|
+
}: { dateTime: Array<string> } & Record<string, string>) {
|
|
100
|
+
const divideNum = 10;
|
|
101
|
+
const timeArray = [];
|
|
102
|
+
const inArray = [];
|
|
103
|
+
const outArray = [];
|
|
104
|
+
for (let i = 0; i < divideNum; i++) {
|
|
105
|
+
if (dateTime.length > 0) {
|
|
106
|
+
const dateAbsTime: number = (new Date(dateTime[1]).getTime() - new Date(dateTime[0]).getTime()) / divideNum;
|
|
107
|
+
const enhandTime: number = new Date(dateTime[0]).getTime() + dateAbsTime * i;
|
|
108
|
+
timeArray.push(dayjs(enhandTime).format('MM-DD'));
|
|
109
|
+
} else {
|
|
110
|
+
timeArray.push(
|
|
111
|
+
dayjs()
|
|
112
|
+
.subtract(divideNum - i, 'day')
|
|
113
|
+
.format('MM-DD'),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
inArray.push(getRandomArray().toString());
|
|
118
|
+
outArray.push(getRandomArray().toString());
|
|
119
|
+
}
|
|
120
|
+
const dataset = {
|
|
121
|
+
color: getChartListColor(),
|
|
122
|
+
tooltip: {
|
|
123
|
+
trigger: 'item',
|
|
124
|
+
},
|
|
125
|
+
xAxis: {
|
|
126
|
+
type: 'category',
|
|
127
|
+
data: timeArray,
|
|
128
|
+
axisLabel: {
|
|
129
|
+
color: placeholderColor,
|
|
130
|
+
},
|
|
131
|
+
axisLine: {
|
|
132
|
+
lineStyle: {
|
|
133
|
+
color: borderColor,
|
|
134
|
+
width: 1,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
yAxis: {
|
|
139
|
+
type: 'value',
|
|
140
|
+
axisLabel: {
|
|
141
|
+
color: placeholderColor,
|
|
142
|
+
},
|
|
143
|
+
splitLine: {
|
|
144
|
+
lineStyle: {
|
|
145
|
+
color: borderColor,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
grid: {
|
|
150
|
+
top: '5%',
|
|
151
|
+
left: '25px',
|
|
152
|
+
right: 0,
|
|
153
|
+
bottom: '60px',
|
|
154
|
+
},
|
|
155
|
+
legend: {
|
|
156
|
+
icon: 'rect',
|
|
157
|
+
itemWidth: 12,
|
|
158
|
+
itemHeight: 4,
|
|
159
|
+
itemGap: 48,
|
|
160
|
+
textStyle: {
|
|
161
|
+
fontSize: 12,
|
|
162
|
+
color: placeholderColor,
|
|
163
|
+
},
|
|
164
|
+
left: 'center',
|
|
165
|
+
bottom: '0',
|
|
166
|
+
orient: 'horizontal',
|
|
167
|
+
data: ['本月', '上月'],
|
|
168
|
+
},
|
|
169
|
+
series: [
|
|
170
|
+
{
|
|
171
|
+
name: '本月',
|
|
172
|
+
data: outArray,
|
|
173
|
+
type: 'bar',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: '上月',
|
|
177
|
+
data: inArray,
|
|
178
|
+
type: 'bar',
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return dataset;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function getLineChartDataSet({
|
|
187
|
+
dateTime = [],
|
|
188
|
+
placeholderColor,
|
|
189
|
+
borderColor,
|
|
190
|
+
}: { dateTime?: Array<string> } & Record<string, string>) {
|
|
191
|
+
const divideNum = 10;
|
|
192
|
+
const timeArray = [];
|
|
193
|
+
const inArray = [];
|
|
194
|
+
const outArray = [];
|
|
195
|
+
for (let i = 0; i < divideNum; i++) {
|
|
196
|
+
if (dateTime.length > 0) {
|
|
197
|
+
const dateAbsTime: number = (new Date(dateTime[1]).getTime() - new Date(dateTime[0]).getTime()) / divideNum;
|
|
198
|
+
const enhandTime: number = new Date(dateTime[0]).getTime() + dateAbsTime * i;
|
|
199
|
+
timeArray.push(dayjs(enhandTime).format('MM-DD'));
|
|
200
|
+
} else {
|
|
201
|
+
timeArray.push(
|
|
202
|
+
dayjs()
|
|
203
|
+
.subtract(divideNum - i, 'day')
|
|
204
|
+
.format('MM-DD'),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
inArray.push(getRandomArray().toString());
|
|
209
|
+
outArray.push(getRandomArray().toString());
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const dataSet = {
|
|
213
|
+
color: getChartListColor(),
|
|
214
|
+
tooltip: {
|
|
215
|
+
trigger: 'item',
|
|
216
|
+
},
|
|
217
|
+
grid: {
|
|
218
|
+
left: '0',
|
|
219
|
+
right: '20px',
|
|
220
|
+
top: '5px',
|
|
221
|
+
bottom: '36px',
|
|
222
|
+
containLabel: true,
|
|
223
|
+
},
|
|
224
|
+
legend: {
|
|
225
|
+
left: 'center',
|
|
226
|
+
bottom: '0',
|
|
227
|
+
orient: 'horizontal', // legend 横向布局。
|
|
228
|
+
data: ['本月', '上月'],
|
|
229
|
+
textStyle: {
|
|
230
|
+
fontSize: 12,
|
|
231
|
+
color: placeholderColor,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
xAxis: {
|
|
235
|
+
type: 'category',
|
|
236
|
+
data: timeArray,
|
|
237
|
+
boundaryGap: false,
|
|
238
|
+
axisLabel: {
|
|
239
|
+
color: placeholderColor,
|
|
240
|
+
},
|
|
241
|
+
axisLine: {
|
|
242
|
+
lineStyle: {
|
|
243
|
+
width: 1,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
yAxis: {
|
|
248
|
+
type: 'value',
|
|
249
|
+
axisLabel: {
|
|
250
|
+
color: placeholderColor,
|
|
251
|
+
},
|
|
252
|
+
splitLine: {
|
|
253
|
+
lineStyle: {
|
|
254
|
+
color: borderColor,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
series: [
|
|
259
|
+
{
|
|
260
|
+
name: '本月',
|
|
261
|
+
data: outArray,
|
|
262
|
+
type: 'line',
|
|
263
|
+
smooth: false,
|
|
264
|
+
showSymbol: true,
|
|
265
|
+
symbol: 'circle',
|
|
266
|
+
symbolSize: 8,
|
|
267
|
+
itemStyle: {
|
|
268
|
+
normal: {
|
|
269
|
+
borderColor,
|
|
270
|
+
borderWidth: 1,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
areaStyle: {
|
|
274
|
+
normal: {
|
|
275
|
+
opacity: 0.1,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: '上月',
|
|
281
|
+
data: inArray,
|
|
282
|
+
type: 'line',
|
|
283
|
+
smooth: false,
|
|
284
|
+
showSymbol: true,
|
|
285
|
+
symbol: 'circle',
|
|
286
|
+
symbolSize: 8,
|
|
287
|
+
itemStyle: {
|
|
288
|
+
normal: {
|
|
289
|
+
borderColor,
|
|
290
|
+
borderWidth: 1,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
};
|
|
296
|
+
return dataSet;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 获取表行数据
|
|
301
|
+
*
|
|
302
|
+
* @export
|
|
303
|
+
* @param {string} productName
|
|
304
|
+
* @param {number} divideNum
|
|
305
|
+
*/
|
|
306
|
+
export function getSelftItemList(productName: string, divideNum: number): string[] {
|
|
307
|
+
const productArray: string[] = [productName];
|
|
308
|
+
for (let i = 0; i < divideNum; i++) {
|
|
309
|
+
productArray.push(getRandomArray(100 * i).toString());
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return productArray;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* 散点图数据
|
|
317
|
+
*
|
|
318
|
+
* @export
|
|
319
|
+
* @returns {any[]}
|
|
320
|
+
*/
|
|
321
|
+
export function getScatterDataSet({
|
|
322
|
+
dateTime = [],
|
|
323
|
+
placeholderColor,
|
|
324
|
+
borderColor,
|
|
325
|
+
}: { dateTime?: Array<string> } & Record<string, string>): any {
|
|
326
|
+
const divideNum = 40;
|
|
327
|
+
const timeArray = [];
|
|
328
|
+
const inArray = [];
|
|
329
|
+
const outArray = [];
|
|
330
|
+
for (let i = 0; i < divideNum; i++) {
|
|
331
|
+
// const [timeArray, inArray, outArray] = dataset;
|
|
332
|
+
if (dateTime.length > 0) {
|
|
333
|
+
const dateAbsTime: number = (new Date(dateTime[1]).getTime() - new Date(dateTime[0]).getTime()) / divideNum;
|
|
334
|
+
const enhandTime: number = new Date(dateTime[0]).getTime() + dateAbsTime * i;
|
|
335
|
+
timeArray.push(dayjs(enhandTime).format('MM-DD'));
|
|
336
|
+
} else {
|
|
337
|
+
timeArray.push(
|
|
338
|
+
dayjs()
|
|
339
|
+
.subtract(divideNum - i, 'day')
|
|
340
|
+
.format('MM-DD'),
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
inArray.push(getRandomArray().toString());
|
|
345
|
+
outArray.push(getRandomArray().toString());
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return {
|
|
349
|
+
color: getChartListColor(),
|
|
350
|
+
xAxis: {
|
|
351
|
+
data: timeArray,
|
|
352
|
+
axisLabel: {
|
|
353
|
+
color: placeholderColor,
|
|
354
|
+
},
|
|
355
|
+
splitLine: { show: false },
|
|
356
|
+
axisLine: {
|
|
357
|
+
lineStyle: {
|
|
358
|
+
color: borderColor,
|
|
359
|
+
width: 1,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
yAxis: {
|
|
364
|
+
type: 'value',
|
|
365
|
+
// splitLine: { show: false},
|
|
366
|
+
axisLabel: {
|
|
367
|
+
color: placeholderColor,
|
|
368
|
+
},
|
|
369
|
+
nameTextStyle: {
|
|
370
|
+
padding: [0, 0, 0, 60],
|
|
371
|
+
},
|
|
372
|
+
axisTick: {
|
|
373
|
+
show: false,
|
|
374
|
+
axisLine: {
|
|
375
|
+
show: false,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
axisLine: {
|
|
379
|
+
show: false,
|
|
380
|
+
},
|
|
381
|
+
splitLine: {
|
|
382
|
+
lineStyle: {
|
|
383
|
+
color: borderColor,
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
tooltip: {
|
|
388
|
+
trigger: 'item',
|
|
389
|
+
},
|
|
390
|
+
grid: {
|
|
391
|
+
top: '5px',
|
|
392
|
+
left: '25px',
|
|
393
|
+
right: '5px',
|
|
394
|
+
bottom: '60px',
|
|
395
|
+
},
|
|
396
|
+
legend: {
|
|
397
|
+
left: 'center',
|
|
398
|
+
bottom: '0',
|
|
399
|
+
orient: 'horizontal', // legend 横向布局。
|
|
400
|
+
data: ['按摩仪', '咖啡机'],
|
|
401
|
+
itemHeight: 8,
|
|
402
|
+
itemWidth: 8,
|
|
403
|
+
textStyle: {
|
|
404
|
+
fontSize: 12,
|
|
405
|
+
color: placeholderColor,
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
series: [
|
|
409
|
+
{
|
|
410
|
+
name: '按摩仪',
|
|
411
|
+
symbolSize: 10,
|
|
412
|
+
data: outArray.reverse(),
|
|
413
|
+
type: 'scatter',
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: '咖啡机',
|
|
417
|
+
symbolSize: 10,
|
|
418
|
+
data: inArray.concat(inArray.reverse()),
|
|
419
|
+
type: 'scatter',
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 获域图数据结构
|
|
427
|
+
*
|
|
428
|
+
* @export
|
|
429
|
+
* @returns {any[]}
|
|
430
|
+
*/
|
|
431
|
+
export function getAreaChartDataSet(): any {
|
|
432
|
+
const xAxisData = [];
|
|
433
|
+
const data1 = [];
|
|
434
|
+
const data2 = [];
|
|
435
|
+
for (let i = 0; i < 50; i++) {
|
|
436
|
+
xAxisData.push(`${i}`);
|
|
437
|
+
data1.push((getRandomArray() * Math.sin(i / 5) * (i / 5 - 5) + i / 6) * 2);
|
|
438
|
+
data2.push((getRandomArray() * Math.cos(i / 5) * (i / 5 - 5) + i / 6) * 2);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
return {
|
|
442
|
+
color: getChartListColor(),
|
|
443
|
+
// title: {
|
|
444
|
+
// text: '柱状图动画延迟',
|
|
445
|
+
// },
|
|
446
|
+
legend: {
|
|
447
|
+
left: 'center',
|
|
448
|
+
bottom: '5%',
|
|
449
|
+
orient: 'horizontal',
|
|
450
|
+
data: ['测试', '上线'],
|
|
451
|
+
},
|
|
452
|
+
tooltip: {
|
|
453
|
+
trigger: 'item',
|
|
454
|
+
},
|
|
455
|
+
xAxis: {
|
|
456
|
+
data: xAxisData,
|
|
457
|
+
splitLine: {
|
|
458
|
+
show: false,
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
yAxis: {},
|
|
462
|
+
series: [
|
|
463
|
+
{
|
|
464
|
+
name: '测试',
|
|
465
|
+
type: 'bar',
|
|
466
|
+
data: data1,
|
|
467
|
+
emphasis: {
|
|
468
|
+
focus: 'series',
|
|
469
|
+
},
|
|
470
|
+
animationDelay(idx: number) {
|
|
471
|
+
return idx * 10;
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
name: '上线',
|
|
476
|
+
type: 'bar',
|
|
477
|
+
data: data2,
|
|
478
|
+
emphasis: {
|
|
479
|
+
focus: 'series',
|
|
480
|
+
},
|
|
481
|
+
animationDelay(idx: number) {
|
|
482
|
+
return idx * 10 + 100;
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
animationEasing: 'elasticOut',
|
|
487
|
+
animationDelayUpdate(idx: number) {
|
|
488
|
+
return idx * 5;
|
|
489
|
+
},
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* 柱状图数据结构
|
|
495
|
+
*
|
|
496
|
+
* @export
|
|
497
|
+
* @param {boolean} [isMonth=false]
|
|
498
|
+
* @returns {*}
|
|
499
|
+
*/
|
|
500
|
+
export function getColumnChartDataSet(isMonth = false) {
|
|
501
|
+
if (isMonth) {
|
|
502
|
+
return {
|
|
503
|
+
color: getChartListColor(),
|
|
504
|
+
legend: {
|
|
505
|
+
left: 'center',
|
|
506
|
+
top: '10%',
|
|
507
|
+
orient: 'horizontal', // legend 横向布局。
|
|
508
|
+
data: ['直接访问'],
|
|
509
|
+
},
|
|
510
|
+
tooltip: {
|
|
511
|
+
trigger: 'axis',
|
|
512
|
+
axisPointer: {
|
|
513
|
+
// 坐标轴指示器,坐标轴触发有效
|
|
514
|
+
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
grid: {
|
|
518
|
+
left: '3%',
|
|
519
|
+
right: '4%',
|
|
520
|
+
bottom: '3%',
|
|
521
|
+
containLabel: true,
|
|
522
|
+
},
|
|
523
|
+
xAxis: [
|
|
524
|
+
{
|
|
525
|
+
type: 'category',
|
|
526
|
+
data: ['1', '4', '8', '12', '16', '20', '24'],
|
|
527
|
+
axisTick: {
|
|
528
|
+
alignWithLabel: true,
|
|
529
|
+
},
|
|
530
|
+
},
|
|
531
|
+
],
|
|
532
|
+
yAxis: [
|
|
533
|
+
{
|
|
534
|
+
type: 'value',
|
|
535
|
+
},
|
|
536
|
+
],
|
|
537
|
+
series: [
|
|
538
|
+
{
|
|
539
|
+
name: '直接访问',
|
|
540
|
+
type: 'bar',
|
|
541
|
+
barWidth: '60%',
|
|
542
|
+
data: [
|
|
543
|
+
getRandomArray(Math.random() * 100),
|
|
544
|
+
getRandomArray(Math.random() * 200),
|
|
545
|
+
getRandomArray(Math.random() * 300),
|
|
546
|
+
getRandomArray(Math.random() * 400),
|
|
547
|
+
getRandomArray(Math.random() * 500),
|
|
548
|
+
getRandomArray(Math.random() * 600),
|
|
549
|
+
getRandomArray(Math.random() * 700),
|
|
550
|
+
],
|
|
551
|
+
},
|
|
552
|
+
],
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return {
|
|
557
|
+
color: getChartListColor(),
|
|
558
|
+
tooltip: {
|
|
559
|
+
trigger: 'axis',
|
|
560
|
+
axisPointer: {
|
|
561
|
+
// 坐标轴指示器,坐标轴触发有效
|
|
562
|
+
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
legend: {
|
|
566
|
+
left: 'center',
|
|
567
|
+
bottom: '0%',
|
|
568
|
+
orient: 'horizontal', // legend 横向布局。
|
|
569
|
+
data: ['直接访问'],
|
|
570
|
+
},
|
|
571
|
+
grid: {
|
|
572
|
+
left: '3%',
|
|
573
|
+
right: '4%',
|
|
574
|
+
bottom: '13%',
|
|
575
|
+
containLabel: true,
|
|
576
|
+
},
|
|
577
|
+
xAxis: [
|
|
578
|
+
{
|
|
579
|
+
type: 'category',
|
|
580
|
+
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
|
581
|
+
axisTick: {
|
|
582
|
+
alignWithLabel: true,
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
],
|
|
586
|
+
yAxis: [
|
|
587
|
+
{
|
|
588
|
+
type: 'value',
|
|
589
|
+
},
|
|
590
|
+
],
|
|
591
|
+
series: [
|
|
592
|
+
{
|
|
593
|
+
name: '直接访问',
|
|
594
|
+
type: 'bar',
|
|
595
|
+
barWidth: '20%',
|
|
596
|
+
data: [
|
|
597
|
+
getRandomArray(Math.random() * 100),
|
|
598
|
+
getRandomArray(Math.random() * 200),
|
|
599
|
+
getRandomArray(Math.random() * 300),
|
|
600
|
+
getRandomArray(Math.random() * 400),
|
|
601
|
+
getRandomArray(Math.random() * 500),
|
|
602
|
+
getRandomArray(Math.random() * 600),
|
|
603
|
+
getRandomArray(Math.random() * 700),
|
|
604
|
+
],
|
|
605
|
+
},
|
|
606
|
+
],
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export function getPieChartDataSet({
|
|
611
|
+
radius = 42,
|
|
612
|
+
textColor,
|
|
613
|
+
placeholderColor,
|
|
614
|
+
containerColor,
|
|
615
|
+
}: { radius: number } & Record<string, string>) {
|
|
616
|
+
return {
|
|
617
|
+
color: getChartListColor(),
|
|
618
|
+
tooltip: {
|
|
619
|
+
show: false,
|
|
620
|
+
trigger: 'axis',
|
|
621
|
+
position: null,
|
|
622
|
+
},
|
|
623
|
+
grid: {
|
|
624
|
+
top: '0',
|
|
625
|
+
right: '0',
|
|
626
|
+
},
|
|
627
|
+
legend: {
|
|
628
|
+
selectedMode: false,
|
|
629
|
+
itemWidth: 12,
|
|
630
|
+
itemHeight: 4,
|
|
631
|
+
textStyle: {
|
|
632
|
+
fontSize: 12,
|
|
633
|
+
color: placeholderColor,
|
|
634
|
+
},
|
|
635
|
+
left: 'center',
|
|
636
|
+
bottom: '0',
|
|
637
|
+
orient: 'horizontal', // legend 横向布局。
|
|
638
|
+
},
|
|
639
|
+
series: [
|
|
640
|
+
{
|
|
641
|
+
name: '销售渠道',
|
|
642
|
+
type: 'pie',
|
|
643
|
+
radius: ['48%', '60%'],
|
|
644
|
+
avoidLabelOverlap: true,
|
|
645
|
+
selectedMode: true,
|
|
646
|
+
hoverAnimation: true,
|
|
647
|
+
silent: true,
|
|
648
|
+
itemStyle: {
|
|
649
|
+
borderColor: containerColor,
|
|
650
|
+
borderWidth: 1,
|
|
651
|
+
},
|
|
652
|
+
label: {
|
|
653
|
+
show: true,
|
|
654
|
+
position: 'center',
|
|
655
|
+
formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'),
|
|
656
|
+
rich: {
|
|
657
|
+
value: {
|
|
658
|
+
color: textColor,
|
|
659
|
+
fontSize: 28,
|
|
660
|
+
fontWeight: 'normal',
|
|
661
|
+
lineHeight: 46,
|
|
662
|
+
},
|
|
663
|
+
name: {
|
|
664
|
+
color: '#909399',
|
|
665
|
+
fontSize: 12,
|
|
666
|
+
lineHeight: 14,
|
|
667
|
+
},
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
emphasis: {
|
|
671
|
+
label: {
|
|
672
|
+
show: true,
|
|
673
|
+
formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'),
|
|
674
|
+
rich: {
|
|
675
|
+
value: {
|
|
676
|
+
color: textColor,
|
|
677
|
+
fontSize: 28,
|
|
678
|
+
fontWeight: 'normal',
|
|
679
|
+
lineHeight: 46,
|
|
680
|
+
},
|
|
681
|
+
name: {
|
|
682
|
+
color: '#909399',
|
|
683
|
+
fontSize: 14,
|
|
684
|
+
lineHeight: 14,
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
labelLine: {
|
|
690
|
+
show: false,
|
|
691
|
+
},
|
|
692
|
+
data: [
|
|
693
|
+
{
|
|
694
|
+
value: 1048,
|
|
695
|
+
name: '线上',
|
|
696
|
+
},
|
|
697
|
+
{ value: radius * 7, name: '门店' },
|
|
698
|
+
],
|
|
699
|
+
},
|
|
700
|
+
],
|
|
701
|
+
};
|
|
702
|
+
}
|