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.
Files changed (180) hide show
  1. package/README.md +2 -0
  2. package/bin/index.js +20 -0
  3. package/package.json +42 -0
  4. package/src/commands/create.js +171 -0
  5. package/src/commands/mcp.js +157 -0
  6. package/src/mcp/CURSOR_SETUP.md +259 -0
  7. package/src/mcp/README.md +134 -0
  8. package/src/mcp/USAGE_EXAMPLES.md +181 -0
  9. package/src/mcp/get-cursor-config.js +58 -0
  10. package/src/mcp/package.json +23 -0
  11. package/src/mcp/pnpm-lock.yaml +2441 -0
  12. package/src/mcp/src/handlers.js +211 -0
  13. package/src/mcp/src/http-server.js +332 -0
  14. package/src/mcp/src/index.js +195 -0
  15. package/src/mcp/src/schemas.js +54 -0
  16. package/src/mcp/test-create-project.js +49 -0
  17. package/src/mcp/test-mcp.js +89 -0
  18. package/src/mcp/test-show-tree.js +66 -0
  19. package/src/template/Uni-app/README.md +19 -0
  20. package/src/template/Uni-app/babel.config.js +81 -0
  21. package/src/template/Uni-app/package.json +107 -0
  22. package/src/template/Uni-app/postcss.config.js +27 -0
  23. package/src/template/Uni-app/public/index.html +25 -0
  24. package/src/template/Uni-app/shims-uni.d.ts +11 -0
  25. package/src/template/Uni-app/shims-vue.d.ts +4 -0
  26. package/src/template/Uni-app/src/App.vue +17 -0
  27. package/src/template/Uni-app/src/main.js +12 -0
  28. package/src/template/Uni-app/src/manifest.json +75 -0
  29. package/src/template/Uni-app/src/pages/index/index.vue +49 -0
  30. package/src/template/Uni-app/src/pages.json +16 -0
  31. package/src/template/Uni-app/src/static/logo.png +0 -0
  32. package/src/template/Uni-app/src/uni.promisify.adaptor.js +13 -0
  33. package/src/template/Uni-app/src/uni.scss +76 -0
  34. package/src/template/Uni-app/yarn.lock +11466 -0
  35. package/src/template/Vue2/.editorconfig +14 -0
  36. package/src/template/Vue2/.env +2 -0
  37. package/src/template/Vue2/.env.development +2 -0
  38. package/src/template/Vue2/.env.site +2 -0
  39. package/src/template/Vue2/.prettierrc.js +39 -0
  40. package/src/template/Vue2/.stylelintignore +8 -0
  41. package/src/template/Vue2/README-zh_CN.md +115 -0
  42. package/src/template/Vue2/commitlint.config.js +1 -0
  43. package/src/template/Vue2/docs/docs-starter.png +0 -0
  44. package/src/template/Vue2/docs/docs-startup.png +0 -0
  45. package/src/template/Vue2/docs/docs-structure.png +0 -0
  46. package/src/template/Vue2/globals.d.ts +13 -0
  47. package/src/template/Vue2/index.html +27 -0
  48. package/src/template/Vue2/jsx.d.ts +13 -0
  49. package/src/template/Vue2/mock/index.ts +147 -0
  50. package/src/template/Vue2/package.json +91 -0
  51. package/src/template/Vue2/package.json.ejs +91 -0
  52. package/src/template/Vue2/public/favicon.ico +0 -0
  53. package/src/template/Vue2/shims-vue.d.ts +5 -0
  54. package/src/template/Vue2/src/App.vue +19 -0
  55. package/src/template/Vue2/src/assets/assets-login-bg-black.png +0 -0
  56. package/src/template/Vue2/src/assets/assets-login-bg-white.png +0 -0
  57. package/src/template/Vue2/src/assets/assets-logo-full.svg +39 -0
  58. package/src/template/Vue2/src/assets/assets-product-1.svg +5 -0
  59. package/src/template/Vue2/src/assets/assets-product-2.svg +5 -0
  60. package/src/template/Vue2/src/assets/assets-product-3.svg +5 -0
  61. package/src/template/Vue2/src/assets/assets-product-4.svg +5 -0
  62. package/src/template/Vue2/src/assets/assets-result-403.svg +32 -0
  63. package/src/template/Vue2/src/assets/assets-result-404.svg +36 -0
  64. package/src/template/Vue2/src/assets/assets-result-500.svg +32 -0
  65. package/src/template/Vue2/src/assets/assets-result-ie.svg +33 -0
  66. package/src/template/Vue2/src/assets/assets-result-maintenance.svg +49 -0
  67. package/src/template/Vue2/src/assets/assets-result-wifi.svg +23 -0
  68. package/src/template/Vue2/src/assets/assets-setting-auto.svg +13 -0
  69. package/src/template/Vue2/src/assets/assets-setting-dark.svg +5 -0
  70. package/src/template/Vue2/src/assets/assets-setting-light.svg +13 -0
  71. package/src/template/Vue2/src/assets/assets-t-logo.svg +41 -0
  72. package/src/template/Vue2/src/assets/assets-tencent-logo.png +0 -0
  73. package/src/template/Vue2/src/components/color/index.vue +35 -0
  74. package/src/template/Vue2/src/components/product-card/index.vue +121 -0
  75. package/src/template/Vue2/src/components/result/index.vue +118 -0
  76. package/src/template/Vue2/src/components/thumbnail/index.vue +49 -0
  77. package/src/template/Vue2/src/components/trend/index.vue +105 -0
  78. package/src/template/Vue2/src/config/color.ts +30 -0
  79. package/src/template/Vue2/src/config/global.ts +2 -0
  80. package/src/template/Vue2/src/config/host.ts +26 -0
  81. package/src/template/Vue2/src/config/style.ts +14 -0
  82. package/src/template/Vue2/src/constants/index.ts +46 -0
  83. package/src/template/Vue2/src/interface.ts +39 -0
  84. package/src/template/Vue2/src/layouts/blank.vue +12 -0
  85. package/src/template/Vue2/src/layouts/components/Breadcrumb.vue +39 -0
  86. package/src/template/Vue2/src/layouts/components/Content.vue +43 -0
  87. package/src/template/Vue2/src/layouts/components/Footer.vue +27 -0
  88. package/src/template/Vue2/src/layouts/components/Header.vue +321 -0
  89. package/src/template/Vue2/src/layouts/components/LayoutContent.vue +168 -0
  90. package/src/template/Vue2/src/layouts/components/LayoutHeader.vue +52 -0
  91. package/src/template/Vue2/src/layouts/components/LayoutSidebar.vue +51 -0
  92. package/src/template/Vue2/src/layouts/components/MenuContent.vue +108 -0
  93. package/src/template/Vue2/src/layouts/components/Notice.vue +221 -0
  94. package/src/template/Vue2/src/layouts/components/Search.vue +134 -0
  95. package/src/template/Vue2/src/layouts/components/SideNav.vue +150 -0
  96. package/src/template/Vue2/src/layouts/index.vue +100 -0
  97. package/src/template/Vue2/src/layouts/setting.vue +404 -0
  98. package/src/template/Vue2/src/main.js +9 -0
  99. package/src/template/Vue2/src/main.jsx +51 -0
  100. package/src/template/Vue2/src/pages/dashboard/base/components/MiddleChart.vue +158 -0
  101. package/src/template/Vue2/src/pages/dashboard/base/components/OutputOverview.vue +189 -0
  102. package/src/template/Vue2/src/pages/dashboard/base/components/RankList.vue +111 -0
  103. package/src/template/Vue2/src/pages/dashboard/base/components/TopPanel.vue +246 -0
  104. package/src/template/Vue2/src/pages/dashboard/base/index.ts +702 -0
  105. package/src/template/Vue2/src/pages/dashboard/base/index.vue +44 -0
  106. package/src/template/Vue2/src/pages/dashboard/detail/index.ts +267 -0
  107. package/src/template/Vue2/src/pages/dashboard/detail/index.vue +242 -0
  108. package/src/template/Vue2/src/pages/detail/advanced/components/Product.vue +167 -0
  109. package/src/template/Vue2/src/pages/detail/advanced/index.less +74 -0
  110. package/src/template/Vue2/src/pages/detail/advanced/index.vue +219 -0
  111. package/src/template/Vue2/src/pages/detail/base/index.less +105 -0
  112. package/src/template/Vue2/src/pages/detail/base/index.vue +46 -0
  113. package/src/template/Vue2/src/pages/detail/deploy/index.ts +204 -0
  114. package/src/template/Vue2/src/pages/detail/deploy/index.vue +224 -0
  115. package/src/template/Vue2/src/pages/detail/secondary/index.less +71 -0
  116. package/src/template/Vue2/src/pages/detail/secondary/index.vue +131 -0
  117. package/src/template/Vue2/src/pages/form/base/index.less +57 -0
  118. package/src/template/Vue2/src/pages/form/base/index.vue +254 -0
  119. package/src/template/Vue2/src/pages/form/step/index.less +37 -0
  120. package/src/template/Vue2/src/pages/form/step/index.vue +259 -0
  121. package/src/template/Vue2/src/pages/frame/doc/index.vue +86 -0
  122. package/src/template/Vue2/src/pages/frame/tdesign/index.vue +86 -0
  123. package/src/template/Vue2/src/pages/list/base/index.vue +267 -0
  124. package/src/template/Vue2/src/pages/list/card/index.vue +221 -0
  125. package/src/template/Vue2/src/pages/list/components/CommonTable.vue +313 -0
  126. package/src/template/Vue2/src/pages/list/filter/index.vue +15 -0
  127. package/src/template/Vue2/src/pages/list/tree/index.vue +174 -0
  128. package/src/template/Vue2/src/pages/login/components/components-header.vue +74 -0
  129. package/src/template/Vue2/src/pages/login/components/components-login.vue +154 -0
  130. package/src/template/Vue2/src/pages/login/components/components-register.vue +144 -0
  131. package/src/template/Vue2/src/pages/login/index.less +202 -0
  132. package/src/template/Vue2/src/pages/login/index.vue +53 -0
  133. package/src/template/Vue2/src/pages/nest-menu/Index.vue +10 -0
  134. package/src/template/Vue2/src/pages/result/403/index.vue +14 -0
  135. package/src/template/Vue2/src/pages/result/404/index.vue +14 -0
  136. package/src/template/Vue2/src/pages/result/500/index.vue +14 -0
  137. package/src/template/Vue2/src/pages/result/browser-incompatible/index.vue +77 -0
  138. package/src/template/Vue2/src/pages/result/fail/index.vue +57 -0
  139. package/src/template/Vue2/src/pages/result/maintenance/index.vue +14 -0
  140. package/src/template/Vue2/src/pages/result/network-error/index.vue +24 -0
  141. package/src/template/Vue2/src/pages/result/success/index.vue +59 -0
  142. package/src/template/Vue2/src/pages/user/index.less +148 -0
  143. package/src/template/Vue2/src/pages/user/index.ts +157 -0
  144. package/src/template/Vue2/src/pages/user/index.vue +204 -0
  145. package/src/template/Vue2/src/permission.js +56 -0
  146. package/src/template/Vue2/src/router/index.js +43 -0
  147. package/src/template/Vue2/src/router/modules/base.ts +29 -0
  148. package/src/template/Vue2/src/router/modules/components.ts +175 -0
  149. package/src/template/Vue2/src/router/modules/others.ts +55 -0
  150. package/src/template/Vue2/src/service/service-advance.ts +233 -0
  151. package/src/template/Vue2/src/service/service-base.ts +205 -0
  152. package/src/template/Vue2/src/service/service-detail-base.ts +84 -0
  153. package/src/template/Vue2/src/service/service-detail-deploy.ts +234 -0
  154. package/src/template/Vue2/src/service/service-detail.ts +57 -0
  155. package/src/template/Vue2/src/service/service-user.ts +64 -0
  156. package/src/template/Vue2/src/store/index.ts +22 -0
  157. package/src/template/Vue2/src/store/modules/notification.ts +90 -0
  158. package/src/template/Vue2/src/store/modules/permission.ts +66 -0
  159. package/src/template/Vue2/src/store/modules/setting.ts +122 -0
  160. package/src/template/Vue2/src/store/modules/tab-router.ts +83 -0
  161. package/src/template/Vue2/src/store/modules/user.ts +98 -0
  162. package/src/template/Vue2/src/style/font-family.less +6 -0
  163. package/src/template/Vue2/src/style/index.less +5 -0
  164. package/src/template/Vue2/src/style/layout.less +201 -0
  165. package/src/template/Vue2/src/style/reset.less +78 -0
  166. package/src/template/Vue2/src/style/variables.less +27 -0
  167. package/src/template/Vue2/src/utils/charts.ts +38 -0
  168. package/src/template/Vue2/src/utils/color.ts +118 -0
  169. package/src/template/Vue2/src/utils/date.ts +12 -0
  170. package/src/template/Vue2/src/utils/request.ts +60 -0
  171. package/src/template/Vue2/stylelint.config.js +5 -0
  172. package/src/template/Vue2/tsconfig.json +26 -0
  173. package/src/template/Vue2/vite.config.js +58 -0
  174. package/src/template/Vue3/package.json.ejs +8 -0
  175. package/src/template/Vue3/pages.json +10 -0
  176. package/src/template/Vue3/src/main.js +7 -0
  177. package/src/utils/copy.js +17 -0
  178. package/src/utils/eslint.js +205 -0
  179. package/src/utils/logo.js +18 -0
  180. package/src/utils/render.js +20 -0
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <t-card :bordered="false">
3
+ <t-row>
4
+ <t-col :xs="12" :xl="9">
5
+ <t-card
6
+ :bordered="false"
7
+ title="出入库概览"
8
+ subtitle="(件)"
9
+ :class="{ 'dashboard-overview-card': true, 'overview-panel': true }"
10
+ >
11
+ <template #actions>
12
+ <t-date-range-picker
13
+ class="card-date-picker-container"
14
+ theme="primary"
15
+ mode="date"
16
+ :default-value="LAST_7_DAYS"
17
+ @change="onStokeDataChange"
18
+ />
19
+ </template>
20
+ <div
21
+ id="stokeContainer"
22
+ style="width: 100%; height: 351px"
23
+ ref="stokeContainer"
24
+ class="dashboard-chart-container"
25
+ ></div>
26
+ </t-card>
27
+ </t-col>
28
+ <t-col :xs="12" :xl="3">
29
+ <t-card :bordered="false" :class="{ 'dashboard-overview-card': true, 'export-panel': true }">
30
+ <template #actions>
31
+ <t-button>导出数据</t-button>
32
+ </template>
33
+ <t-row>
34
+ <t-col :xs="6" :xl="12">
35
+ <t-card :bordered="false" subtitle="本月出库总计(件)" class="inner-card">
36
+ <div class="inner-card__content">
37
+ <div class="inner-card__content-title">1726</div>
38
+ <div class="inner-card__content-footer">
39
+ 自从上周以来
40
+ <trend class="trend-tag" type="down" :is-reverse-color="false" describe="20.3%" />
41
+ </div>
42
+ </div>
43
+ </t-card>
44
+ </t-col>
45
+ <t-col :xs="6" :xl="12">
46
+ <t-card :bordered="false" subtitle="本月入库总计(件)" class="inner-card">
47
+ <div class="inner-card__content">
48
+ <div class="inner-card__content-title">226</div>
49
+ <div class="inner-card__content-footer">
50
+ 自从上周以来
51
+ <trend class="trend-tag" type="down" :is-reverse-color="false" describe="20.3%" />
52
+ </div>
53
+ </div>
54
+ </t-card>
55
+ </t-col>
56
+ </t-row>
57
+ </t-card>
58
+ </t-col>
59
+ </t-row>
60
+ </t-card>
61
+ </template>
62
+ <script>
63
+ import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
64
+ import { BarChart } from 'echarts/charts';
65
+ import { CanvasRenderer } from 'echarts/renderers';
66
+ import * as echarts from 'echarts/core';
67
+ import { mapState } from 'vuex';
68
+
69
+ import { constructInitDataset } from '../index';
70
+ import { changeChartsTheme } from '@/utils/color';
71
+ import { LAST_7_DAYS } from '@/utils/date';
72
+ import Trend from '@/components/trend/index.vue';
73
+
74
+ import { PANE_LIST, SALE_TEND_LIST, BUY_TEND_LIST, SALE_COLUMNS, BUY_COLUMNS } from '@/service/service-base';
75
+
76
+ echarts.use([TooltipComponent, LegendComponent, GridComponent, BarChart, CanvasRenderer]);
77
+
78
+ export default {
79
+ name: 'Overview',
80
+ components: {
81
+ Trend,
82
+ },
83
+ data() {
84
+ return {
85
+ panelList: PANE_LIST,
86
+ buyTendList: BUY_TEND_LIST,
87
+ saleTendList: SALE_TEND_LIST,
88
+ saleColumns: SALE_COLUMNS,
89
+ buyColumns: BUY_COLUMNS,
90
+ LAST_7_DAYS,
91
+ };
92
+ },
93
+ computed: {
94
+ ...mapState('setting', ['brandTheme', 'mode']), // 这里需要用到主题色和主题模式的全局配置
95
+ },
96
+ watch: {
97
+ brandTheme() {
98
+ changeChartsTheme([this.stokeChart]);
99
+ },
100
+ mode() {
101
+ [this.stokeChart].forEach((item) => {
102
+ item.dispose();
103
+ });
104
+ this.renderCharts();
105
+ },
106
+ },
107
+ mounted() {
108
+ this.$nextTick(() => {
109
+ this.updateContainer();
110
+ });
111
+
112
+ window.addEventListener('resize', this.updateContainer, false);
113
+ this.renderCharts();
114
+ },
115
+
116
+ methods: {
117
+ /** 出入库概览日期更新 */
118
+ onStokeDataChange(checkedValues) {
119
+ const { chartColors } = this.$store.state.setting;
120
+
121
+ this.stokeChart.setOption(constructInitDataset({ dateTime: checkedValues, ...chartColors }));
122
+ },
123
+ updateContainer() {
124
+ this.stokeChart.resize({
125
+ // 根据父容器的大小设置大小
126
+ width: this.stokeContainer.clientWidth,
127
+ height: this.stokeContainer.clientHeight,
128
+ });
129
+ },
130
+ renderCharts() {
131
+ const { chartColors } = this.$store.state.setting;
132
+ // 出入库概览
133
+ if (!this.stokeContainer) this.stokeContainer = document.getElementById('stokeContainer');
134
+
135
+ this.stokeChart = echarts.init(this.stokeContainer);
136
+ this.stokeChart.setOption(constructInitDataset({ dateTime: LAST_7_DAYS, ...chartColors }));
137
+ },
138
+ },
139
+ };
140
+ </script>
141
+
142
+ <style lang="less" scoped>
143
+ @import '@/style/variables.less';
144
+
145
+ .dashboard-overview-card {
146
+ /deep/ .t-card__header {
147
+ padding-bottom: 24px;
148
+ }
149
+
150
+ /deep/ .t-card__title {
151
+ font-size: 20px;
152
+ font-weight: 500;
153
+ }
154
+
155
+ &.overview-panel {
156
+ border-right: none;
157
+ }
158
+
159
+ &.export-panel {
160
+ border-left: none;
161
+ }
162
+ }
163
+
164
+ .inner-card {
165
+ padding: 24px 0;
166
+
167
+ /deep/ .t-card__header {
168
+ padding-bottom: 0;
169
+ }
170
+
171
+ &__content {
172
+ &-title {
173
+ font-size: 36px;
174
+ line-height: 44px;
175
+ }
176
+
177
+ &-footer {
178
+ display: flex;
179
+ align-items: center;
180
+ line-height: 22px;
181
+ color: var(--td-text-color-placeholder);
182
+
183
+ .trend-tag {
184
+ margin-left: 4px;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <t-row :gutter="[16, 16]">
3
+ <t-col :xs="12" :xl="6">
4
+ <t-card title="销售订单排名" class="dashboard-rank-card" :bordered="false">
5
+ <template #actions>
6
+ <t-radio-group default-value="dateVal">
7
+ <t-radio-button value="dateVal">本周</t-radio-button>
8
+ <t-radio-button value="monthVal">近三个月</t-radio-button>
9
+ </t-radio-group>
10
+ </template>
11
+ <t-table :data="saleTendList" :columns="saleColumns" rowKey="productName">
12
+ <template #index="{ rowIndex }">
13
+ <span :class="getRankClass(rowIndex)">
14
+ {{ rowIndex + 1 }}
15
+ </span>
16
+ </template>
17
+ <span slot="growUp" slot-scope="{ row }">
18
+ <trend :type="row.growUp > 0 ? 'up' : 'down'" :describe="Math.abs(row.growUp)" />
19
+ </span>
20
+ <template #operation="slotProps">
21
+ <a class="link" @click="rehandleClickOp(slotProps)">详情</a>
22
+ </template>
23
+ </t-table>
24
+ </t-card>
25
+ </t-col>
26
+ <t-col :xs="12" :xl="6">
27
+ <t-card title="采购订单排名" class="dashboard-rank-card" :bordered="false">
28
+ <template #actions>
29
+ <t-radio-group default-value="dateVal">
30
+ <t-radio-button value="dateVal">本周</t-radio-button>
31
+ <t-radio-button value="monthVal">近三个月</t-radio-button>
32
+ </t-radio-group>
33
+ </template>
34
+ <t-table :data="buyTendList" :columns="buyColumns" rowKey="productName">
35
+ <template #index="{ rowIndex }">
36
+ <span :class="getRankClass(rowIndex)">
37
+ {{ rowIndex + 1 }}
38
+ </span>
39
+ </template>
40
+ <span slot="growUp" slot-scope="{ row }">
41
+ <trend :type="row.growUp > 0 ? 'up' : 'down'" :describe="Math.abs(row.growUp)" />
42
+ </span>
43
+ <template #operation="slotProps">
44
+ <a class="link" @click="rehandleClickOp(slotProps)">详情</a>
45
+ </template>
46
+ </t-table>
47
+ </t-card>
48
+ </t-col>
49
+ </t-row>
50
+ </template>
51
+ <script>
52
+ import Trend from '@/components/trend/index.vue';
53
+ import { SALE_TEND_LIST, BUY_TEND_LIST, SALE_COLUMNS, BUY_COLUMNS } from '@/service/service-base';
54
+
55
+ export default {
56
+ name: 'RankList',
57
+ components: {
58
+ Trend,
59
+ },
60
+ data() {
61
+ return {
62
+ buyTendList: BUY_TEND_LIST,
63
+ saleTendList: SALE_TEND_LIST,
64
+ saleColumns: SALE_COLUMNS,
65
+ buyColumns: BUY_COLUMNS,
66
+ };
67
+ },
68
+ methods: {
69
+ rehandleClickOp(val) {
70
+ console.log(val);
71
+ },
72
+ getRankClass(index) {
73
+ return ['dashboard-rank__cell', { 'dashboard-rank__cell--top': index < 3 }];
74
+ },
75
+ },
76
+ };
77
+ </script>
78
+
79
+ <style lang="less" scoped>
80
+ @import '@/style/variables.less';
81
+
82
+ .dashboard-rank-card {
83
+ padding: 8px;
84
+
85
+ /deep/ .t-card__header {
86
+ padding-bottom: 24px;
87
+ }
88
+
89
+ /deep/ .t-card__title {
90
+ font-size: 20px;
91
+ font-weight: 500;
92
+ }
93
+ }
94
+
95
+ .dashboard-rank__cell {
96
+ display: inline-flex;
97
+ width: 24px;
98
+ height: 24px;
99
+ border-radius: 50%;
100
+ color: white;
101
+ font-size: 14px;
102
+ background-color: var(--td-gray-color-5);
103
+ align-items: center;
104
+ justify-content: center;
105
+ font-weight: 700;
106
+
107
+ &--top {
108
+ background: var(--td-brand-color);
109
+ }
110
+ }
111
+ </style>
@@ -0,0 +1,246 @@
1
+ <template>
2
+ <t-row :gutter="[16, 16]">
3
+ <t-col :xs="6" :xl="3" v-for="(item, index) in panelList" :key="item.title">
4
+ <t-card
5
+ :bordered="false"
6
+ :title="item.title"
7
+ :style="{ height: '168px' }"
8
+ :class="{ 'dashboard-item': true, 'dashboard-item--main-color': index == 0 }"
9
+ >
10
+ <div class="dashboard-item-top">
11
+ <span :style="{ fontSize: `${resizeTime * 36}px` }">{{ item.number }}</span>
12
+ </div>
13
+ <div class="dashboard-item-left">
14
+ <div
15
+ v-if="index === 0"
16
+ id="moneyContainer"
17
+ class="dashboard-chart-container"
18
+ :style="{ width: `${resizeTime * 120}px`, height: `${resizeTime * 66}px` }"
19
+ ></div>
20
+ <div
21
+ v-else-if="index === 1"
22
+ id="refundContainer"
23
+ class="dashboard-chart-container"
24
+ :style="{ width: `${resizeTime * 120}px`, height: `${resizeTime * 42}px` }"
25
+ ></div>
26
+ <span v-else-if="index === 2" :style="{ marginTop: `-24px` }">
27
+ <usergroup-icon />
28
+ </span>
29
+ <span v-else :style="{ marginTop: '-24px' }">
30
+ <file-icon />
31
+ </span>
32
+ </div>
33
+ <template #footer>
34
+ <div class="dashboard-item-bottom">
35
+ <div class="dashboard-item-block">
36
+ 自从上周以来
37
+ <trend
38
+ class="dashboard-item-trend"
39
+ :type="item.upTrend ? 'up' : 'down'"
40
+ :is-reverse-color="index === 0"
41
+ :describe="item.upTrend || item.downTrend"
42
+ />
43
+ </div>
44
+ <chevron-right-icon />
45
+ </div>
46
+ </template>
47
+ </t-card>
48
+ </t-col>
49
+ </t-row>
50
+ </template>
51
+ <script>
52
+ import { LineChart, BarChart } from 'echarts/charts';
53
+ import * as echarts from 'echarts/core';
54
+ import { CanvasRenderer } from 'echarts/renderers';
55
+ import { UsergroupIcon, FileIcon, ChevronRightIcon } from 'tdesign-icons-vue';
56
+ import { mapState } from 'vuex';
57
+
58
+ import Trend from '@/components/trend/index.vue';
59
+
60
+ import { constructInitDashboardDataset } from '../index';
61
+ import { changeChartsTheme } from '@/utils/color';
62
+ import { PANE_LIST } from '@/service/service-base';
63
+
64
+ echarts.use([LineChart, BarChart, CanvasRenderer]);
65
+
66
+ export default {
67
+ name: 'TopPanel',
68
+ components: {
69
+ Trend,
70
+ UsergroupIcon,
71
+ FileIcon,
72
+ ChevronRightIcon,
73
+ },
74
+ data() {
75
+ return {
76
+ resizeTime: 1,
77
+ panelList: PANE_LIST,
78
+ };
79
+ },
80
+ computed: {
81
+ ...mapState('setting', ['brandTheme', 'mode']), // 这里需要用到主题色和主题模式的全局配置
82
+ },
83
+ watch: {
84
+ brandTheme() {
85
+ changeChartsTheme([this.refundChart]);
86
+ },
87
+ mode() {
88
+ [this.moneyCharts, this.refundChart].forEach((item) => {
89
+ item.dispose();
90
+ });
91
+ this.renderCharts();
92
+ },
93
+ },
94
+ mounted() {
95
+ this.$nextTick(() => {
96
+ this.updateContainer();
97
+ });
98
+
99
+ window.addEventListener('resize', this.updateContainer, false);
100
+ this.renderCharts();
101
+ },
102
+
103
+ methods: {
104
+ updateContainer() {
105
+ if (document.documentElement.clientWidth >= 1400 && document.documentElement.clientWidth < 1920) {
106
+ this.resizeTime = (document.documentElement.clientWidth / 2080).toFixed(2);
107
+ } else if (document.documentElement.clientWidth < 1080) {
108
+ this.resizeTime = (document.documentElement.clientWidth / 1080).toFixed(2);
109
+ } else {
110
+ this.resizeTime = 1;
111
+ }
112
+ this.moneyCharts.resize({
113
+ // 根据父容器的大小设置大小
114
+ width: `${this.resizeTime * 120}px`,
115
+ height: `${this.resizeTime * 66}px`,
116
+ });
117
+
118
+ this.refundChart.resize({
119
+ // 根据父容器的大小设置大小
120
+ width: `${this.resizeTime * 120}px`,
121
+ height: `${this.resizeTime * 42}px`,
122
+ });
123
+ },
124
+
125
+ renderCharts() {
126
+ const { chartColors } = this.$store.state.setting;
127
+ // 收入汇总图
128
+ if (!this.moneyContainer) this.moneyContainer = document.getElementById('moneyContainer');
129
+ this.moneyCharts = echarts.init(this.moneyContainer);
130
+ this.moneyCharts.setOption(constructInitDashboardDataset('line'));
131
+
132
+ // 退款图
133
+ if (!this.refundContainer) this.refundContainer = document.getElementById('refundContainer');
134
+ this.refundChart = echarts.init(this.refundContainer);
135
+ this.refundChart.setOption(constructInitDashboardDataset('bar', chartColors));
136
+ },
137
+ },
138
+ };
139
+ </script>
140
+
141
+ <style lang="less" scoped>
142
+ @import '@/style/variables.less';
143
+
144
+ .dashboard-item {
145
+ padding: 8px;
146
+
147
+ /deep/ .t-card__footer {
148
+ padding-top: 0;
149
+ }
150
+
151
+ /deep/ .t-card__title {
152
+ font-size: 14px;
153
+ font-weight: 500;
154
+ }
155
+
156
+ /deep/ .t-card__body {
157
+ display: flex;
158
+ flex-direction: column;
159
+ justify-content: space-between;
160
+ flex: 1;
161
+ position: relative;
162
+ }
163
+
164
+ &:hover {
165
+ cursor: pointer;
166
+ }
167
+
168
+ &-top {
169
+ display: flex;
170
+ flex-direction: row;
171
+ align-items: flex-start;
172
+
173
+ > span {
174
+ display: inline-block;
175
+ color: var(--td-text-color-primary);
176
+ font-size: 36px;
177
+ line-height: 44px;
178
+ }
179
+ }
180
+
181
+ &-bottom {
182
+ display: flex;
183
+ flex-direction: row;
184
+ justify-content: space-between;
185
+ align-items: center;
186
+
187
+ > .t-icon {
188
+ cursor: pointer;
189
+ }
190
+ }
191
+
192
+ &-block {
193
+ display: flex;
194
+ align-items: center;
195
+ justify-content: center;
196
+ line-height: 22px;
197
+ color: var(--td-text-color-placeholder);
198
+ }
199
+
200
+ &-trend {
201
+ margin-left: 8px;
202
+ }
203
+
204
+ &-left {
205
+ position: absolute;
206
+ top: 0;
207
+ right: 32px;
208
+
209
+ > span {
210
+ display: inline-flex;
211
+ align-items: center;
212
+ justify-content: center;
213
+ width: 56px;
214
+ height: 56px;
215
+ background: var(--td-brand-color-1);
216
+ border-radius: 50%;
217
+
218
+ .t-icon {
219
+ font-size: 24px;
220
+ color: var(--td-brand-color);
221
+ }
222
+ }
223
+ }
224
+
225
+ // 针对第一个卡片需要反色处理
226
+ &--main-color {
227
+ background: var(--td-brand-color);
228
+ color: var(--td-text-color-primary);
229
+
230
+ /deep/ .t-card__title,
231
+ .dashboard-item-top span,
232
+ .dashboard-item-bottom {
233
+ color: var(--td-text-color-anti);
234
+ }
235
+
236
+ .dashboard-item-block {
237
+ color: var(--td-text-color-anti);
238
+ opacity: 0.6;
239
+ }
240
+
241
+ .dashboard-item-bottom {
242
+ color: var(--td-text-color-anti);
243
+ }
244
+ }
245
+ }
246
+ </style>