neo-cmp-cli 1.12.8 → 1.12.10

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 (161) hide show
  1. package/README.md +204 -6
  2. package/dist/index2.js +1 -1
  3. package/dist/module/neoInitByCopy.js +1 -1
  4. package/dist/neo/env.js +1 -1
  5. package/dist/package.json.js +1 -1
  6. package/package.json +4 -1
  7. package/template/antd-custom-cmp-template/package.json +1 -1
  8. package/template/asset-manage-template/README.md +154 -0
  9. package/template/asset-manage-template/docs/README.md +244 -0
  10. package/template/asset-manage-template/neo.config.js +60 -0
  11. package/template/asset-manage-template/package.json +74 -0
  12. package/template/asset-manage-template/src/assets/img/chart.svg +1 -0
  13. package/template/asset-manage-template/src/components/README.md +3 -0
  14. package/template/asset-manage-template/src/components/assetManage__c/assetApi.ts +70 -0
  15. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetCreateModal.tsx +260 -0
  16. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetGrid.tsx +48 -0
  17. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetSidebar.tsx +74 -0
  18. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetToolbar.tsx +79 -0
  19. package/template/asset-manage-template/src/components/assetManage__c/cmps/assetDisplay.tsx +72 -0
  20. package/template/asset-manage-template/src/components/assetManage__c/constants.ts +28 -0
  21. package/template/asset-manage-template/src/components/assetManage__c/index.tsx +258 -0
  22. package/template/asset-manage-template/src/components/assetManage__c/model.ts +75 -0
  23. package/template/asset-manage-template/src/components/assetManage__c/style.scss +425 -0
  24. package/template/asset-manage-template/src/components/assetManage__c/types.ts +60 -0
  25. package/template/asset-manage-template/src/components/bidList__c/cmps/BidCard.tsx +47 -0
  26. package/template/asset-manage-template/src/components/bidList__c/constants.ts +6 -0
  27. package/template/asset-manage-template/src/components/bidList__c/formatUtils.ts +14 -0
  28. package/template/asset-manage-template/src/components/bidList__c/index.tsx +194 -0
  29. package/template/asset-manage-template/src/components/bidList__c/model.ts +57 -0
  30. package/template/asset-manage-template/src/components/bidList__c/style.scss +179 -0
  31. package/template/asset-manage-template/src/components/bidList__c/types.ts +10 -0
  32. package/template/asset-manage-template/src/components/bidPackage__c/cmps/BidPackageHeader.tsx +140 -0
  33. package/template/asset-manage-template/src/components/bidPackage__c/cmps/PackageItemTable.tsx +148 -0
  34. package/template/asset-manage-template/src/components/bidPackage__c/index.tsx +394 -0
  35. package/template/asset-manage-template/src/components/bidPackage__c/mainTableColumns.tsx +57 -0
  36. package/template/asset-manage-template/src/components/bidPackage__c/model.ts +86 -0
  37. package/template/asset-manage-template/src/components/bidPackage__c/style.scss +256 -0
  38. package/template/asset-manage-template/src/components/bidPackage__c/types.ts +35 -0
  39. package/template/asset-manage-template/src/components/bidPackage__c/utils.ts +19 -0
  40. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/axiosFetcher.ts +0 -0
  41. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/queryObjectData.ts +36 -0
  42. package/template/asset-manage-template/src/utils/url.ts +82 -0
  43. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/xobjects.ts +0 -0
  44. package/template/asset-manage-template/tsconfig.json +40 -0
  45. package/template/echarts-custom-cmp-template/package.json +1 -1
  46. package/template/empty-custom-cmp-template/package.json +2 -2
  47. package/template/neo-custom-cmp-template/package.json +5 -2
  48. package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +62 -6
  49. package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +36 -0
  50. package/template/neo-custom-cmp-template/tsconfig.json +1 -2
  51. package/template/neo-h5-cmps/neo.config.js +1 -6
  52. package/template/neo-h5-cmps/package.json +7 -4
  53. package/template/neo-h5-cmps/src/utils/queryObjectData.ts +36 -0
  54. package/template/neo-h5-cmps/tsconfig.json +3 -4
  55. package/template/neo-order-cmps/package.json +2 -2
  56. package/template/neo-order-cmps/src/utils/queryObjectData.ts +36 -0
  57. package/template/neo-web-cmps/@types/neo-ui-common.d.ts +36 -0
  58. package/template/neo-web-cmps/neo.config.js +53 -0
  59. package/template/{neo-bi-cmps → neo-web-cmps}/package.json +10 -7
  60. package/template/neo-web-cmps/src/assets/img/AIBtn.gif +0 -0
  61. package/template/neo-web-cmps/src/assets/img/aiLogo.png +0 -0
  62. package/template/neo-web-cmps/src/assets/img/card-list.svg +1 -0
  63. package/template/neo-web-cmps/src/assets/img/contact-form.svg +1 -0
  64. package/template/neo-web-cmps/src/assets/img/custom-form.svg +1 -0
  65. package/template/neo-web-cmps/src/assets/img/data-list.svg +1 -0
  66. package/template/neo-web-cmps/src/assets/img/detail.svg +1 -0
  67. package/template/neo-web-cmps/src/assets/img/map.svg +1 -0
  68. package/template/neo-web-cmps/src/assets/img/search.svg +1 -0
  69. package/template/neo-web-cmps/src/components/entityGrid2__c/index.tsx +72 -0
  70. package/template/neo-web-cmps/src/components/entityGrid2__c/model.ts +195 -0
  71. package/template/neo-web-cmps/src/components/entityGrid2__c/style.scss +13 -0
  72. package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +52 -0
  73. package/template/neo-web-cmps/src/components/entityGrid__c/model.ts +195 -0
  74. package/template/neo-web-cmps/src/components/entityGrid__c/style.scss +13 -0
  75. package/template/neo-web-cmps/src/utils/axiosFetcher.ts +37 -0
  76. package/template/neo-web-cmps/src/utils/queryObjectData.ts +112 -0
  77. package/template/{develop/neo-custom-cmp-template → neo-web-cmps}/src/utils/xobjects.ts +28 -64
  78. package/template/{neo-bi-cmps → neo-web-cmps}/tsconfig.json +2 -3
  79. package/template/react-custom-cmp-template/package.json +1 -1
  80. package/template/react-ts-custom-cmp-template/package.json +1 -1
  81. package/template/vue2-custom-cmp-template/package.json +1 -1
  82. package/template/develop/BI /351/241/271/347/233/256/345/210/206/346/236/220/346/212/245/345/221/212.md" +0 -562
  83. package/template/develop/ChatPage /347/273/204/344/273/266/344/275/277/347/224/250/350/257/264/346/230/216/346/226/207/346/241/243.md" +0 -507
  84. package/template/develop/EntityGrid Web /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -868
  85. package/template/develop/EntityList H5 /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -1386
  86. package/template/develop/GlobalSearch/347/273/204/344/273/266/345/257/271/346/257/224/345/210/206/346/236/220.md +0 -866
  87. package/template/develop/Neo /344/270/255/345/217/257/347/224/250 amis /347/273/204/344/273/266.md" +0 -1490
  88. package/template/develop/cmpEventFunctions.ts +0 -257
  89. package/template/develop/cmpEvents.ts +0 -864
  90. package/template/develop/comTree/347/224/237/346/210/220/350/277/207/347/250/213/345/210/206/346/236/220.md +0 -469
  91. package/template/develop/commonModules.js +0 -55
  92. package/template/develop/components-table.md +0 -50
  93. package/template/develop/neo-custom-cmp-template/README.md +0 -48
  94. package/template/develop/neo-custom-cmp-template/docs/README.md +0 -13
  95. package/template/develop/neo-custom-cmp-template/neo.config.js +0 -121
  96. package/template/develop/neo-custom-cmp-template/package.json +0 -63
  97. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +0 -65
  98. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +0 -180
  99. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +0 -50
  100. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +0 -260
  101. package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +0 -94
  102. package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +0 -252
  103. package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +0 -56
  104. package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +0 -120
  105. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +0 -115
  106. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +0 -304
  107. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +0 -87
  108. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +0 -127
  109. package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -29
  110. package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -39
  111. package/template/develop/neo-custom-cmp-template/tsconfig.json +0 -68
  112. package/template/develop/neo-ui-component-h5.md +0 -105
  113. package/template/develop/neo-ui-component-web-xregister.md +0 -31
  114. package/template/develop/neo-ui-component-web.md +0 -292
  115. package/template/develop/neoCmps.ts +0 -7508
  116. package/template/develop/neoGlobalSearchInput /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -497
  117. package/template/develop/pageSchema1.json +0 -744
  118. package/template/develop//344/272/213/344/273/266/345/212/250/344/275/234/344/277/235/345/255/230/346/265/201/347/250/213/345/210/206/346/236/220.md +0 -390
  119. package/template/develop//345/215/225/345/205/203/346/265/213/350/257/225/344/275/277/347/224/250/350/257/264/346/230/216.md +0 -1139
  120. package/template/develop//345/261/236/346/200/247/351/205/215/347/275/256/351/241/271/347/261/273/345/236/213/346/261/207/346/200/273.md +0 -558
  121. package/template/neo-bi-cmps/neo.config.js +0 -124
  122. package/template/neo-bi-cmps/src/components/targetNumber__c/README.md +0 -100
  123. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/configSchema.ts +0 -253
  124. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.scss +0 -76
  125. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +0 -148
  126. package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +0 -440
  127. package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +0 -128
  128. package/template/neo-bi-cmps/src/components/targetNumber__c/style.scss +0 -173
  129. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/.prettierrc.js +0 -0
  130. /package/template/{neo-bi-cmps → asset-manage-template}/@types/neo-ui-common.d.ts +0 -0
  131. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/commitlint.config.js +0 -0
  132. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/css/base.css +0 -0
  133. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/scripts/app/bluebird.js +0 -0
  134. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/template.html +0 -0
  135. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/common.scss +0 -0
  136. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/mixin.scss +0 -0
  137. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/AIBtn.gif +0 -0
  138. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/NeoCRM.jpg +0 -0
  139. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/aiLogo.png +0 -0
  140. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/card-list.svg +0 -0
  141. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/contact-form.svg +0 -0
  142. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/custom-form.svg +0 -0
  143. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/custom-widget.svg +0 -0
  144. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/data-list.svg +0 -0
  145. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/detail.svg +0 -0
  146. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/favicon.png +0 -0
  147. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/map.svg +0 -0
  148. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/search.svg +0 -0
  149. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/table.svg +0 -0
  150. /package/template/{neo-bi-cmps → neo-web-cmps}/.prettierrc.js +0 -0
  151. /package/template/{neo-bi-cmps → neo-web-cmps}/README.md +0 -0
  152. /package/template/{neo-bi-cmps → neo-web-cmps}/commitlint.config.js +0 -0
  153. /package/template/{neo-bi-cmps → neo-web-cmps}/public/css/base.css +0 -0
  154. /package/template/{neo-bi-cmps → neo-web-cmps}/public/scripts/app/bluebird.js +0 -0
  155. /package/template/{neo-bi-cmps → neo-web-cmps}/public/template.html +0 -0
  156. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/css/common.scss +0 -0
  157. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/css/mixin.scss +0 -0
  158. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/NeoCRM.jpg +0 -0
  159. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/custom-widget.svg +0 -0
  160. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/favicon.png +0 -0
  161. /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/table.svg +0 -0
@@ -0,0 +1,256 @@
1
+ .bidPackage__c {
2
+ padding: 0px 16px;
3
+ background: #f5f7fa;
4
+ min-height: 400px;
5
+
6
+ /* ========== 顶部概览卡片 ========== */
7
+ .bid-header-card {
8
+ margin-bottom: 16px;
9
+ border-radius: 8px;
10
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
11
+
12
+ .header-row {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ align-items: flex-start;
16
+ gap: 24px;
17
+ flex-wrap: wrap;
18
+ }
19
+
20
+ .header-info {
21
+ flex: 1;
22
+ min-width: 200px;
23
+
24
+ .header-title {
25
+ margin: 0 0 4px;
26
+ font-size: 18px;
27
+ font-weight: 600;
28
+ color: #262626;
29
+ }
30
+
31
+ .bid-detail-bar {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 14px;
35
+ flex-wrap: wrap;
36
+ margin-top: 4px;
37
+
38
+ .detail-item {
39
+ font-size: 13px;
40
+ color: #8c8c8c;
41
+ white-space: nowrap;
42
+
43
+ .anticon {
44
+ margin-right: 4px;
45
+ font-size: 12px;
46
+ }
47
+ }
48
+
49
+ .ant-tag {
50
+ margin: 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ .header-stats {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 24px;
59
+ flex-shrink: 0;
60
+
61
+ .stat-item {
62
+ text-align: right;
63
+
64
+ .stat-label {
65
+ display: block;
66
+ font-size: 12px;
67
+ color: #8c8c8c;
68
+ margin-bottom: 2px;
69
+ }
70
+
71
+ .stat-value {
72
+ font-size: 24px;
73
+ font-weight: 700;
74
+ line-height: 1.2;
75
+
76
+ &.normal {
77
+ color: #1890ff;
78
+ }
79
+
80
+ &.budget {
81
+ color: #8c8c8c;
82
+ font-size: 18px;
83
+ font-weight: 500;
84
+ }
85
+
86
+ &.over {
87
+ color: #ff4d4f;
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ .header-actions {
94
+ margin-top: 12px;
95
+ padding-top: 12px;
96
+ border-top: 1px solid #f0f0f0;
97
+ display: flex;
98
+ justify-content: flex-end;
99
+ }
100
+ }
101
+
102
+ /* ========== 主表格 ========== */
103
+ .bid-table-wrapper {
104
+ background: #fff;
105
+ border-radius: 8px;
106
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
107
+ overflow: hidden;
108
+
109
+ .ant-table {
110
+ .ant-table-thead > tr > th {
111
+ background: #fafafa;
112
+ font-weight: 600;
113
+ color: #262626;
114
+ font-size: 14px;
115
+ }
116
+
117
+ .ant-table-tbody > tr > td {
118
+ padding: 14px 16px;
119
+ }
120
+
121
+ // 展开按钮列
122
+ .ant-table-row-expand-icon-cell {
123
+ width: 48px;
124
+ }
125
+
126
+ .ant-table-expand-icon-th {
127
+ width: 48px;
128
+ }
129
+ }
130
+
131
+ // 超支行高亮
132
+ .row-over-budget {
133
+ background: #fff2f0 !important;
134
+
135
+ &:hover > td {
136
+ background: #ffece8 !important;
137
+ }
138
+ }
139
+ }
140
+
141
+ /* ========== 明细子表格 ========== */
142
+ .item-table-wrapper {
143
+ padding: 12px 16px;
144
+ background: #f8f9fc;
145
+ border-radius: 6px;
146
+ border: 1px dashed #d9d9d9;
147
+
148
+ &.item-empty-wrapper {
149
+ padding: 24px 16px;
150
+ text-align: center;
151
+ }
152
+
153
+ .item-table-footer {
154
+ margin-top: 10px;
155
+ text-align: center;
156
+ }
157
+
158
+ .ant-table {
159
+ .ant-table-thead > tr > th {
160
+ background: #eef1f6;
161
+ font-size: 13px;
162
+ padding: 8px 12px;
163
+ }
164
+
165
+ .ant-table-tbody > tr > td {
166
+ padding: 8px 12px;
167
+ }
168
+ }
169
+
170
+ .ant-input-number {
171
+ width: 100%;
172
+ border-radius: 4px;
173
+
174
+ &:hover {
175
+ border-color: #40a9ff;
176
+ }
177
+
178
+ &:focus,
179
+ &.ant-input-number-focused {
180
+ border-color: #40a9ff;
181
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.15);
182
+ }
183
+ }
184
+ }
185
+
186
+ /* ========== 脏数据标记圆点 ========== */
187
+ .dirty-dot {
188
+ display: inline-block;
189
+ width: 6px;
190
+ height: 6px;
191
+ border-radius: 50%;
192
+ background: #faad14;
193
+ margin-right: 6px;
194
+ vertical-align: middle;
195
+ }
196
+
197
+ /* ========== 超支预警标签脉冲动画 ========== */
198
+ .over-budget-tag {
199
+ animation: pulse 2s infinite;
200
+ }
201
+
202
+ @keyframes pulse {
203
+ 0% {
204
+ opacity: 1;
205
+ }
206
+ 50% {
207
+ opacity: 0.55;
208
+ }
209
+ 100% {
210
+ opacity: 1;
211
+ }
212
+ }
213
+
214
+ /* ========== 响应式 ========== */
215
+ @media (max-width: 768px) {
216
+ padding: 8px;
217
+
218
+ .bid-header-card {
219
+ .header-row {
220
+ flex-direction: column;
221
+ gap: 12px;
222
+ }
223
+
224
+ .header-stats {
225
+ flex-wrap: wrap;
226
+ gap: 16px;
227
+
228
+ .stat-item {
229
+ text-align: left;
230
+
231
+ .stat-value {
232
+ font-size: 20px;
233
+ }
234
+ }
235
+ }
236
+ }
237
+
238
+ .bid-table-wrapper {
239
+ .ant-table {
240
+ .ant-table-tbody > tr > td {
241
+ padding: 10px 8px;
242
+ font-size: 13px;
243
+ }
244
+ }
245
+ }
246
+
247
+ .item-table-wrapper {
248
+ padding: 8px;
249
+ overflow-x: auto;
250
+
251
+ .ant-table-wrapper {
252
+ min-width: 500px;
253
+ }
254
+ }
255
+ }
256
+ }
@@ -0,0 +1,35 @@
1
+ export interface PackageItemData {
2
+ id: string;
3
+ key: string;
4
+ name: string;
5
+ spec__c?: string;
6
+ unit__c?: string;
7
+ price__c: number;
8
+ quantity__c: number;
9
+ isDirty__c?: boolean;
10
+ [k: string]: any;
11
+ }
12
+
13
+ export interface PackageData {
14
+ id: string;
15
+ key: string;
16
+ name: string;
17
+ limitPrice: number;
18
+ sortOrder?: number;
19
+ items: PackageItemData[];
20
+ }
21
+
22
+ export interface BidPackageHeaderProps {
23
+ displayTitle: string;
24
+ totalBudget: number | null | undefined;
25
+ propsBudget: number | undefined;
26
+ packages: PackageData[];
27
+ saving: boolean;
28
+ loading: boolean;
29
+ currentBidNo: string | null;
30
+ currentStatus: string | null;
31
+ currentPurchaser: string | null;
32
+ currentDeadline: string | null;
33
+ onReload: () => void;
34
+ onSave: () => void;
35
+ }
@@ -0,0 +1,19 @@
1
+ import type { PackageItemData } from './types';
2
+
3
+ export function calcPackageTotal(items: PackageItemData[]): number {
4
+ return items.reduce((sum, it) => sum + it.price__c * it.quantity__c, 0);
5
+ }
6
+
7
+ export function formatMoney(val: number): string {
8
+ return `¥ ${val.toLocaleString('zh-CN', { minimumFractionDigits: 0 })}`;
9
+ }
10
+
11
+ export function formatDate(val: string | number | undefined): string {
12
+ if (!val) return '-';
13
+ const d = new Date(typeof val === 'string' ? val : Number(val));
14
+ if (isNaN(d.getTime())) return '-';
15
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(
16
+ 2,
17
+ '0',
18
+ )}-${String(d.getDate()).padStart(2, '0')}`;
19
+ }
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
4
4
  * 这里存放通用查询类 Open API
5
5
  */
6
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
+
7
24
  // 获取业务对象数据列表
8
25
  export const queryXObjectData = async (options?: any) => {
9
26
  const apiUrl = '/rest/data/v2/query';
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
29
46
  querySql += ` order by ${curOptions.orderBy}`;
30
47
  }
31
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
+
32
68
  if (curOptions.page || curOptions.pageSize) {
33
69
  // 添加分页限制
34
70
  querySql += ` limit ${pageSize} offset ${offset}`;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * 获取URL参数
3
+ * @returns
4
+ */
5
+ export function getUrlParams() {
6
+ const urlParams: { [key: string]: string } = {};
7
+ let url = window.location.href;
8
+ if (url.indexOf('?') !== -1) {
9
+ url = url.substring(url.indexOf('?') + 1, url.length);
10
+ const urlArr = url.split('&');
11
+ for (let i = 0, size = urlArr.length; i < size; i++) {
12
+ const urlArrItem = urlArr[i].split('=');
13
+ // 对参数值进行 URL 解码,避免中文字符串乱码
14
+ urlParams[urlArrItem[0]] = urlArrItem[1]
15
+ ? decodeURIComponent(urlArrItem[1])
16
+ : '';
17
+ }
18
+ }
19
+ return urlParams;
20
+ }
21
+
22
+ /**
23
+ * 从URL参数中提取指定的字段数值
24
+ * @param paramName 参数名称
25
+ * @param defaultValue 默认值
26
+ * @returns 参数值或默认值
27
+ *
28
+ * @example
29
+ * // 从当前页面URL提取debug参数
30
+ * const debug = getUrlParam('debug', false)
31
+ *
32
+ * // 提取数字参数
33
+ * const page = getUrlParam('page', 1)
34
+ *
35
+ * // 提取字符串参数
36
+ * const mode = getUrlParam('mode', 'production')
37
+ */
38
+ export function getUrlParam(paramName: string, defaultValue: any = null): any {
39
+ const urlParams = getUrlParams();
40
+ const paramValue = urlParams[paramName];
41
+
42
+ // 尝试转换数据类型
43
+ if (paramValue === 'true') return true;
44
+ if (paramValue === 'false') return false;
45
+ if (paramValue === 'null') return null;
46
+ if (paramValue === 'undefined') return undefined;
47
+
48
+ // 尝试转换为数字
49
+ const numValue = Number(paramValue);
50
+ if (!isNaN(numValue) && isFinite(numValue)) {
51
+ return numValue;
52
+ }
53
+
54
+ return paramValue ?? defaultValue;
55
+ }
56
+
57
+ /**
58
+ * 从URL参数中提取多个字段数值
59
+ * @param params 参数配置对象,键为参数名,值为默认值
60
+ * @param url 可选的URL字符串,默认使用当前页面URL
61
+ * @returns 包含所有参数值的对象
62
+ *
63
+ * @example
64
+ * const params = getUrlParams({
65
+ * debug: false,
66
+ * mode: 'production',
67
+ * page: 1,
68
+ * theme: 'light'
69
+ * })
70
+ */
71
+ export function getUrlParamsByKeys(
72
+ params: Record<string, any>,
73
+ url?: string,
74
+ ): Record<string, any> {
75
+ const result: Record<string, any> = {};
76
+
77
+ for (const [paramName, defaultValue] of Object.entries(params)) {
78
+ result[paramName] = getUrlParam(paramName, defaultValue);
79
+ }
80
+
81
+ return result;
82
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true,
4
+ "target": "esnext",
5
+ "module": "esnext",
6
+ "allowJs": false,
7
+ "jsx": "preserve",
8
+ "declaration": false,
9
+ "noEmit": false,
10
+ "importHelpers": true,
11
+ "isolatedModules": false,
12
+ "strict": false,
13
+ "noImplicitAny": true,
14
+ "strictNullChecks": true,
15
+ "noImplicitThis": true,
16
+ "noUnusedLocals": false,
17
+ "noImplicitReturns": true,
18
+ "moduleResolution": "node",
19
+ "baseUrl": "./",
20
+ "paths": {
21
+ "@": [
22
+ "./src"
23
+ ]
24
+ },
25
+ "typeRoots": [
26
+ "./@types",
27
+ "./node_modules/@types"
28
+ ],
29
+ "allowSyntheticDefaultImports": true,
30
+ "esModuleInterop": true,
31
+ "forceConsistentCasingInFileNames": true
32
+ },
33
+ "include": [
34
+ "src",
35
+ "test"
36
+ ],
37
+ "exclude": [
38
+ "node_modules"
39
+ ]
40
+ }
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^18.0.0",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.12.8",
51
+ "neo-cmp-cli": "^1.12.10",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5",
@@ -34,14 +34,14 @@
34
34
  "react": "^16.9.0",
35
35
  "react-dom": "^16.9.0",
36
36
  "antd": "4.9.4",
37
- "neo-open-api": "^1.2.1"
37
+ "neo-open-api": "^1.2.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@commitlint/cli": "^18.0.0",
41
41
  "@commitlint/config-conventional": "^18.0.0",
42
42
  "@types/react": "^16.9.11",
43
43
  "@types/react-dom": "^16.9.15",
44
- "neo-cmp-cli": "^1.12.8",
44
+ "neo-cmp-cli": "^1.12.10",
45
45
  "husky": "^4.2.5",
46
46
  "lint-staged": "^10.2.9",
47
47
  "prettier": "^2.0.5"
@@ -47,7 +47,7 @@
47
47
  "axios": "^1.7.0",
48
48
  "antd": "^4.9.4",
49
49
  "lodash": "^4.17.23",
50
- "neo-open-api": "^1.2.1"
50
+ "neo-open-api": "^1.2.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@commitlint/cli": "^18.0.0",
@@ -55,11 +55,14 @@
55
55
  "@types/react": "^16.9.11",
56
56
  "@types/react-dom": "^16.9.15",
57
57
  "@types/axios": "^0.14.0",
58
- "neo-cmp-cli": "^1.12.8",
58
+ "neo-cmp-cli": "^1.12.10",
59
59
  "husky": "^4.2.5",
60
60
  "lint-staged": "^10.2.9",
61
61
  "prettier": "^2.0.5"
62
62
  },
63
+ "overrides": {
64
+ "typescript": "<6"
65
+ },
63
66
  "engines": {
64
67
  "node": ">= 16.0.0",
65
68
  "npm": ">= 8.0.0"
@@ -46,6 +46,50 @@ import './style.scss';
46
46
 
47
47
  const { Option } = Select;
48
48
 
49
+ /**
50
+ * 将对象类型字段值转换为可展示的字符串
51
+ * 兼容 lookup/reference 等对象类型字段,如 { id, label } 或 { id, name }
52
+ * @param value 字段值,可能是对象、数组或基本类型
53
+ * @returns 可展示的字符串
54
+ */
55
+ function objectValueToString(value: any): string {
56
+ if (value === null || value === undefined) {
57
+ return '-';
58
+ }
59
+ if (Array.isArray(value)) {
60
+ return value
61
+ .map((item) => objectValueToString(item))
62
+ .filter(Boolean)
63
+ .join(', ');
64
+ }
65
+ if (typeof value === 'object') {
66
+ // 优先使用 label(Neo 常用展示字段)
67
+ if (value.label != null && value.label !== '') {
68
+ return String(value.label);
69
+ }
70
+ // 其次使用 name
71
+ if (value.name != null && value.name !== '') {
72
+ return String(value.name);
73
+ }
74
+ // 再次使用 title
75
+ if (value.title != null && value.title !== '') {
76
+ return String(value.title);
77
+ }
78
+ // 若为简单 id 对象,返回 id
79
+ if (value.id != null && Object.keys(value).length <= 2) {
80
+ return String(value.id);
81
+ }
82
+ // 兜底:取第一个有值的字符串属性
83
+ for (const key of ['label', 'name', 'title', 'value', 'text']) {
84
+ if (value[key] != null && value[key] !== '') {
85
+ return String(value[key]);
86
+ }
87
+ }
88
+ return JSON.stringify(value);
89
+ }
90
+ return String(value);
91
+ }
92
+
49
93
  /**
50
94
  * 组件属性接口
51
95
  */
@@ -286,12 +330,24 @@ export default class EntityTable extends BaseCmp<
286
330
  }
287
331
 
288
332
  // 根据字段列表生成基础列配置
289
- const columns: any[] = curFieldList.map((field) => ({
290
- title: field.label,
291
- dataIndex: field.apiKey,
292
- key: field.apiKey,
293
- ellipsis: true,
294
- }));
333
+ const columns: any[] = curFieldList.map((field) => {
334
+ const column: any = {
335
+ title: field.label,
336
+ dataIndex: field.apiKey,
337
+ key: field.apiKey,
338
+ ellipsis: true,
339
+ };
340
+
341
+ // 对象类型字段或实际值为对象时:转为字符串展示
342
+ column.render = (value: any) => {
343
+ if (value !== null && value !== undefined && typeof value === 'object') {
344
+ return objectValueToString(value);
345
+ }
346
+ return value;
347
+ };
348
+
349
+ return column;
350
+ });
295
351
 
296
352
  // 添加操作列(编辑和删除按钮)
297
353
  if (showEditButton || showDeleteButton) {
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
4
4
  * 这里存放通用查询类 Open API
5
5
  */
6
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
+
7
24
  // 获取业务对象数据列表
8
25
  export const queryXObjectData = async (options?: any) => {
9
26
  const apiUrl = '/rest/data/v2/query';
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
29
46
  querySql += ` order by ${curOptions.orderBy}`;
30
47
  }
31
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
+
32
68
  if (curOptions.page || curOptions.pageSize) {
33
69
  // 添加分页限制
34
70
  querySql += ` limit ${pageSize} offset ${offset}`;
@@ -31,8 +31,7 @@
31
31
  "forceConsistentCasingInFileNames": true
32
32
  },
33
33
  "include": [
34
- "src",
35
- "test"
34
+ "src"
36
35
  ],
37
36
  "exclude": [
38
37
  "node_modules"