neo-cmp-cli 1.12.7 → 1.12.9

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 (144) hide show
  1. package/README.md +204 -6
  2. package/dist/index2.js +1 -1
  3. package/dist/neo/env.js +1 -1
  4. package/dist/package.json.js +1 -1
  5. package/package.json +1 -1
  6. package/template/antd-custom-cmp-template/package.json +1 -1
  7. package/template/{neo-bi-cmps → asset-manage-template}/README.md +65 -10
  8. package/template/asset-manage-template/docs/README.md +244 -0
  9. package/template/asset-manage-template/neo.config.js +60 -0
  10. package/template/{neo-bi-cmps → asset-manage-template}/package.json +28 -16
  11. package/template/asset-manage-template/src/assets/img/chart.svg +1 -0
  12. package/template/asset-manage-template/src/components/README.md +3 -0
  13. package/template/asset-manage-template/src/components/assetManage__c/assetApi.ts +70 -0
  14. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetCreateModal.tsx +260 -0
  15. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetGrid.tsx +48 -0
  16. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetSidebar.tsx +74 -0
  17. package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetToolbar.tsx +79 -0
  18. package/template/asset-manage-template/src/components/assetManage__c/cmps/assetDisplay.tsx +72 -0
  19. package/template/asset-manage-template/src/components/assetManage__c/constants.ts +28 -0
  20. package/template/asset-manage-template/src/components/assetManage__c/index.tsx +258 -0
  21. package/template/asset-manage-template/src/components/assetManage__c/model.ts +75 -0
  22. package/template/asset-manage-template/src/components/assetManage__c/style.scss +425 -0
  23. package/template/asset-manage-template/src/components/assetManage__c/types.ts +60 -0
  24. package/template/asset-manage-template/src/components/bidList__c/cmps/BidCard.tsx +47 -0
  25. package/template/asset-manage-template/src/components/bidList__c/constants.ts +6 -0
  26. package/template/asset-manage-template/src/components/bidList__c/formatUtils.ts +14 -0
  27. package/template/asset-manage-template/src/components/bidList__c/index.tsx +194 -0
  28. package/template/asset-manage-template/src/components/bidList__c/model.ts +57 -0
  29. package/template/asset-manage-template/src/components/bidList__c/style.scss +179 -0
  30. package/template/asset-manage-template/src/components/bidList__c/types.ts +10 -0
  31. package/template/asset-manage-template/src/components/bidPackage__c/cmps/BidPackageHeader.tsx +140 -0
  32. package/template/asset-manage-template/src/components/bidPackage__c/cmps/PackageItemTable.tsx +148 -0
  33. package/template/asset-manage-template/src/components/bidPackage__c/index.tsx +394 -0
  34. package/template/asset-manage-template/src/components/bidPackage__c/mainTableColumns.tsx +57 -0
  35. package/template/asset-manage-template/src/components/bidPackage__c/model.ts +86 -0
  36. package/template/asset-manage-template/src/components/bidPackage__c/style.scss +256 -0
  37. package/template/asset-manage-template/src/components/bidPackage__c/types.ts +35 -0
  38. package/template/asset-manage-template/src/components/bidPackage__c/utils.ts +19 -0
  39. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/axiosFetcher.ts +0 -0
  40. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/queryObjectData.ts +0 -0
  41. package/template/asset-manage-template/src/utils/url.ts +82 -0
  42. package/template/{neo-bi-cmps → asset-manage-template}/src/utils/xobjects.ts +0 -0
  43. package/template/{neo-bi-cmps → asset-manage-template}/tsconfig.json +1 -1
  44. package/template/echarts-custom-cmp-template/package.json +1 -1
  45. package/template/empty-custom-cmp-template/package.json +2 -2
  46. package/template/neo-custom-cmp-template/package.json +2 -2
  47. package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +62 -6
  48. package/template/neo-h5-cmps/neo.config.js +34 -76
  49. package/template/neo-h5-cmps/package.json +7 -3
  50. package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +0 -4
  51. package/template/neo-h5-cmps/src/components/entityList__c/model.ts +10 -5
  52. package/template/neo-h5-cmps/src/components/entityTabs__c/index.tsx +29 -17
  53. package/template/neo-h5-cmps/src/components/entityTabs__c/model.ts +25 -5
  54. package/template/neo-h5-cmps/src/components/entityTabs__c/style.scss +11 -22
  55. package/template/neo-h5-cmps/src/components/openChatPageBtn__c/index.tsx +3 -1
  56. package/template/neo-h5-cmps/src/utils/xobjects.ts +8 -3
  57. package/template/neo-h5-cmps/tsconfig.json +1 -1
  58. package/template/neo-order-cmps/package.json +2 -2
  59. package/template/react-custom-cmp-template/package.json +1 -1
  60. package/template/react-ts-custom-cmp-template/package.json +1 -1
  61. package/template/vue2-custom-cmp-template/package.json +1 -1
  62. 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
  63. 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
  64. 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
  65. 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
  66. 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
  67. package/template/develop/Neo /344/270/255/345/217/257/347/224/250 amis /347/273/204/344/273/266.md" +0 -1490
  68. package/template/develop/cmpEventFunctions.ts +0 -257
  69. package/template/develop/cmpEvents.ts +0 -864
  70. 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
  71. package/template/develop/commonModules.js +0 -55
  72. package/template/develop/components-table.md +0 -50
  73. package/template/develop/neo-custom-cmp-template/README.md +0 -48
  74. package/template/develop/neo-custom-cmp-template/docs/README.md +0 -13
  75. package/template/develop/neo-custom-cmp-template/neo.config.js +0 -121
  76. package/template/develop/neo-custom-cmp-template/package.json +0 -63
  77. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +0 -65
  78. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +0 -180
  79. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +0 -50
  80. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +0 -260
  81. package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +0 -94
  82. package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +0 -252
  83. package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +0 -56
  84. package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +0 -120
  85. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +0 -115
  86. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +0 -304
  87. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +0 -87
  88. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +0 -127
  89. package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -29
  90. package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -39
  91. package/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +0 -203
  92. package/template/develop/neo-custom-cmp-template/tsconfig.json +0 -68
  93. package/template/develop/neo-ui-component-h5.md +0 -105
  94. package/template/develop/neo-ui-component-web-xregister.md +0 -31
  95. package/template/develop/neo-ui-component-web.md +0 -292
  96. package/template/develop/neoCmps.ts +0 -7508
  97. 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
  98. package/template/develop/pageSchema1.json +0 -744
  99. 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
  100. 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
  101. package/template/neo-bi-cmps/.prettierrc.js +0 -12
  102. package/template/neo-bi-cmps/commitlint.config.js +0 -59
  103. package/template/neo-bi-cmps/neo.config.js +0 -124
  104. package/template/neo-bi-cmps/public/css/base.css +0 -283
  105. package/template/neo-bi-cmps/public/scripts/app/bluebird.js +0 -6679
  106. package/template/neo-bi-cmps/public/template.html +0 -13
  107. package/template/neo-bi-cmps/src/assets/css/common.scss +0 -127
  108. package/template/neo-bi-cmps/src/assets/css/mixin.scss +0 -47
  109. package/template/neo-bi-cmps/src/assets/img/NeoCRM.jpg +0 -0
  110. package/template/neo-bi-cmps/src/assets/img/custom-widget.svg +0 -1
  111. package/template/neo-bi-cmps/src/assets/img/favicon.png +0 -0
  112. package/template/neo-bi-cmps/src/assets/img/table.svg +0 -1
  113. package/template/neo-bi-cmps/src/components/targetNumber__c/README.md +0 -100
  114. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/configSchema.ts +0 -253
  115. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.scss +0 -76
  116. package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +0 -148
  117. package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +0 -440
  118. package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +0 -128
  119. package/template/neo-bi-cmps/src/components/targetNumber__c/style.scss +0 -173
  120. package/template/neo-h5-cmps/src/components/simpleTable__c/README.md +0 -90
  121. package/template/neo-h5-cmps/src/components/simpleTable__c/index.tsx +0 -277
  122. package/template/neo-h5-cmps/src/components/simpleTable__c/model.ts +0 -91
  123. package/template/neo-h5-cmps/src/components/simpleTable__c/style.scss +0 -116
  124. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/.prettierrc.js +0 -0
  125. /package/template/{neo-bi-cmps → asset-manage-template}/@types/neo-ui-common.d.ts +0 -0
  126. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/commitlint.config.js +0 -0
  127. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/css/base.css +0 -0
  128. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/scripts/app/bluebird.js +0 -0
  129. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/template.html +0 -0
  130. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/common.scss +0 -0
  131. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/mixin.scss +0 -0
  132. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/AIBtn.gif +0 -0
  133. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/NeoCRM.jpg +0 -0
  134. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/aiLogo.png +0 -0
  135. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/card-list.svg +0 -0
  136. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/contact-form.svg +0 -0
  137. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/custom-form.svg +0 -0
  138. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/custom-widget.svg +0 -0
  139. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/data-list.svg +0 -0
  140. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/detail.svg +0 -0
  141. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/favicon.png +0 -0
  142. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/map.svg +0 -0
  143. /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/search.svg +0 -0
  144. /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/table.svg +0 -0
@@ -1,121 +0,0 @@
1
- 'use strict';
2
- const path = require('path');
3
-
4
- // 统一路径解析
5
- function resolve(dir) {
6
- return path.resolve(__dirname, dir);
7
- }
8
-
9
- // 包括生产和开发的环境配置信息
10
- module.exports = {
11
- settings: {
12
- enableESLint: true, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
13
- enableESLintFix: true, // 是否自动修正代码格式,默认不自动修正
14
- enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
- enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
16
- },
17
- webpack: {
18
- target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
19
- resolve: {
20
- // webpack的resolve配置
21
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
22
- alias: {
23
- '@': resolve('src'),
24
- $assets: resolve('src/assets'),
25
- $public: resolve('public'),
26
- },
27
- },
28
- // sassResources中的sass文件会自动注入每一个sass文件中
29
- sassResources: [
30
- resolve('./src/assets/css/common.scss'),
31
- resolve('./src/assets/css/mixin.scss'),
32
- ],
33
- // createDeclaration: true, // 打包时是否创建ts声明文件
34
- ignoreNodeModules: false, // 打包时是否忽略 node_modules
35
- // allowList: [], // ignoreNodeModules为true时生效
36
- // projectDir: ['src'],
37
- // template: resolve('./public/template.html'), // 自定义html模板
38
- // plugins: [],
39
- // babelPlugins: [],
40
- },
41
- // 用于添加 Neo 共享依赖模块的配置信息
42
- /*
43
- neoCommonModule: {
44
- // exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
45
- exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
46
- 'chart-widget': path.resolve('./src/components/chart-widget'), // 导出图表自定义组件
47
- 'neo-register': 'neo-register', // 导出 Neo 注册模块
48
- },
49
- // remoteDeps: ['xxModule'], // 远程依赖组件,表示当前自定义组件会用到的远程依赖组件,需要和 externals 配合使用
50
- // externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
51
- },
52
- */
53
- preview: {
54
- // 用于开启本地预览模式的相关配置信息
55
- /*
56
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
57
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
58
- // 本地预览自定义组件内容
59
- index: './src/preview.jsx',
60
- },
61
- NODE_ENV: 'development',
62
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
63
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
64
- assetsSubDirectory: '',
65
- hostname: 'localhost',
66
- proxyTable: {
67
- '/apiTest': {
68
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
69
- ws: true,
70
- changeOrigin: true,
71
- },
72
- },
73
- */
74
- },
75
- linkDebug: {
76
- // 用于开启本地调试模式的相关配置信息
77
- /*
78
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
79
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
80
- // 外链调试(在线上页面设计器端预览自定义组件)
81
- index: [
82
- './src/components/info-card/register.ts',
83
- './src/components/info-card/model.ts',
84
- ],
85
- },
86
- NODE_ENV: 'development',
87
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
88
- closeHotReload: true, // 是否关闭热更新
89
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
90
- assetsSubDirectory: '',
91
- hostname: 'localhost',
92
- proxyTable: {
93
- '/apiTest': {
94
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
95
- ws: true,
96
- changeOrigin: true,
97
- },
98
- }
99
- */
100
- },
101
- publish2oss: {
102
- // 用于构建并发布至 OSS 的相关配置
103
- /*
104
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
105
- NODE_ENV: 'production',
106
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
107
- InfoCardModel: './src/components/info-card/model.ts',
108
- infoCard: './src/components/info-card/register.ts'
109
- },
110
- cssExtract: false, // 不额外提取css文件
111
- ossType: 'ali', // oss类型:ali、baidu
112
- ossConfig: {
113
- endpoint: 'https://oss-cn-beijing.aliyuncs.com',
114
- AccessKeyId: 'xxx',
115
- AccessKeySecret: 'xx',
116
- bucket: 'neo-widgets' // 存储桶名称
117
- },
118
- assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
119
- */
120
- },
121
- };
@@ -1,63 +0,0 @@
1
- {
2
- "name": "neo-custom-cmp-template",
3
- "version": "1.1.0",
4
- "description": "neo自定义组件模板(react&ts技术栈)",
5
- "keywords": [
6
- "自定义组件模板",
7
- "react&ts技术栈",
8
- "neo自定义组件"
9
- ],
10
- "author": "wibetter",
11
- "license": "MIT",
12
- "scripts": {
13
- "preview": "neo preview --cmpType=contact-form",
14
- "preview2": "neo preview --cmpType=contact-card-list",
15
- "linkDebug": "neo linkDebug",
16
- "publish2oss": "neo publish2oss",
17
- "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
18
- },
19
- "files": [
20
- "dist/*"
21
- ],
22
- "husky": {
23
- "hooks": {
24
- "pre-commit": "lint-staged",
25
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
26
- }
27
- },
28
- "lint-staged": {
29
- "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
30
- "prettier --write"
31
- ]
32
- },
33
- "repository": {
34
- "type": "git",
35
- "url": "https://git@github.com:wibetter/neo-custom-cmp-template.git"
36
- },
37
- "bugs": {
38
- "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
39
- },
40
- "dependencies": {
41
- "neo-register": "^1.0.3",
42
- "react": "^16.9.0",
43
- "react-dom": "^16.9.0",
44
- "axios": "^1.7.0",
45
- "antd": "^4.9.4",
46
- "lodash": "^4.17.23"
47
- },
48
- "devDependencies": {
49
- "@commitlint/cli": "^18.0.0",
50
- "@commitlint/config-conventional": "^18.0.0",
51
- "@types/react": "^16.9.11",
52
- "@types/react-dom": "^16.9.15",
53
- "@types/axios": "^0.14.0",
54
- "neo-cmp-cli": "^1.2.23",
55
- "husky": "^4.2.5",
56
- "lint-staged": "^10.2.9",
57
- "prettier": "^2.0.5"
58
- },
59
- "engines": {
60
- "node": ">= 10.13.0",
61
- "npm": ">= 6.4.1"
62
- }
63
- }
@@ -1,65 +0,0 @@
1
- # ContactCardList 联系人卡片列表组件
2
-
3
- ## 组件描述
4
-
5
- 联系人卡片列表组件用于展示联系人信息,以卡片形式展示每个联系人的姓名和手机号。组件使用 Ant Design 的 Card 组件,具有良好的视觉效果和交互体验。
6
-
7
- ## 功能特性
8
-
9
- - 📱 响应式设计,支持多种屏幕尺寸
10
- - 🎨 美观的卡片布局,支持悬停效果
11
- - 🔄 自动加载数据,支持错误重试
12
- - 📊 使用 queryXObjectData 获取 customContact__c 数据
13
- - 🎯 展示联系人姓名和手机号信息
14
- - 💫 加载状态和空状态处理
15
-
16
- ## 组件属性
17
-
18
- | 属性名 | 类型 | 默认值 | 描述 |
19
- |--------|------|--------|------|
20
- | title | string | '联系人卡片列表' | 组件标题 |
21
- | data | any | - | 组件数据,包含用户信息和系统信息 |
22
-
23
- ## 数据源
24
-
25
- 组件通过 `queryXObjectData` 工具函数获取数据:
26
-
27
- - **数据表**: `customContact__c`
28
- - **字段**: `id`, `name`, `phone__c`
29
- - **API**: `/rest/data/v2/query`
30
-
31
- ## 样式特性
32
-
33
- - 使用 Flexbox 布局,支持响应式设计
34
- - 卡片悬停效果,提升用户体验
35
- - 渐变色头像,美观大方
36
- - 支持移动端适配
37
-
38
- ## 使用示例
39
-
40
- ```tsx
41
- import ContactCardList from './components/contact-card-list';
42
-
43
- // 在页面中使用
44
- <ContactCardList
45
- title="我的联系人"
46
- data={amisData}
47
- />
48
- ```
49
-
50
- ## 技术栈
51
-
52
- - React 16.9+
53
- - TypeScript
54
- - Ant Design 4.9+
55
- - SCSS
56
-
57
- ## 文件结构
58
-
59
- ```
60
- contact-card-list/
61
- ├── index.tsx # 主组件文件
62
- ├── model.ts # 组件配置和编辑器属性定义
63
- ├── style.scss # 组件样式文件
64
- └── README.md # 组件说明文档
65
- ```
@@ -1,180 +0,0 @@
1
- import * as React from 'react';
2
- import { Card, Row, Col, Spin, Empty, Avatar, Button } from 'antd';
3
- import { UserOutlined, PhoneOutlined, ReloadOutlined } from '@ant-design/icons';
4
- import {queryXObjectData} from '../../utils/queryObjectData';
5
- import './style.scss';
6
-
7
- interface ContactCardListProps {
8
- title: string;
9
- data?: any;
10
- }
11
-
12
- interface ContactData {
13
- id: string;
14
- name: string;
15
- phone__c: string;
16
- }
17
-
18
- interface ContactCardListState {
19
- contactList: ContactData[];
20
- totalSize: number;
21
- loading: boolean;
22
- error: string | null;
23
- }
24
-
25
- export default class ContactCardList extends React.PureComponent<
26
- ContactCardListProps,
27
- ContactCardListState
28
- > {
29
- constructor(props: ContactCardListProps) {
30
- super(props);
31
-
32
- this.state = {
33
- contactList: [],
34
- totalSize: 0,
35
- loading: false,
36
- error: null,
37
- };
38
-
39
- this.loadContactData = this.loadContactData.bind(this);
40
- }
41
-
42
- componentDidMount() {
43
- this.loadContactData();
44
- }
45
-
46
- async loadContactData() {
47
- this.setState({ loading: true, error: null });
48
-
49
- try {
50
- // 使用 queryXObjectData 获取 customContact__c 数据
51
- const response = await queryXObjectData({
52
- xObjectApiKey: 'customContact__c',
53
- fields: ['id', 'name', 'phone__c'],
54
- });
55
-
56
- if (response && response.code === 200) {
57
- const curResult = response.result || {};
58
- const records = curResult.records || [];
59
- const totalSize = curResult.totalSize || 0;
60
- this.setState({
61
- contactList: records,
62
- totalSize,
63
- loading: false,
64
- });
65
- } else {
66
- this.setState({
67
- error: response?.message || '获取联系人数据失败',
68
- loading: false,
69
- });
70
- }
71
- } catch (error: any) {
72
- console.error('获取联系人数据失败:', error);
73
- this.setState({
74
- error: error.message || '获取联系人数据失败',
75
- loading: false,
76
- });
77
- }
78
- }
79
-
80
- renderContactCard(contact: ContactData, index: number) {
81
- return (
82
- <Col xs={24} sm={12} md={8} lg={6} xl={6} key={contact.id || index}>
83
- <Card
84
- className="contact-card"
85
- hoverable
86
- size="small"
87
- style={{ marginBottom: 16 }}
88
- >
89
- <div className="contact-card-content">
90
- <div className="contact-avatar">
91
- <Avatar
92
- size={48}
93
- icon={<UserOutlined />}
94
- className="avatar-icon"
95
- />
96
- </div>
97
- <div className="contact-info">
98
- <div className="contact-name">
99
- <UserOutlined className="info-icon" />
100
- <span className="name-text">{contact.name || '未知姓名'}</span>
101
- </div>
102
- <div className="contact-phone">
103
- <PhoneOutlined className="info-icon" />
104
- <span className="phone-text">
105
- {contact.phone__c || '未填写手机号'}
106
- </span>
107
- </div>
108
- </div>
109
- </div>
110
- </Card>
111
- </Col>
112
- );
113
- }
114
-
115
- render() {
116
- const { title } = this.props;
117
- const { contactList, loading, error } = this.state;
118
- const curAmisData = this.props.data || {};
119
- const systemInfo = curAmisData.__NeoSystemInfo || {};
120
-
121
- return (
122
- <div className="contact-card-list-container">
123
- <div className="card-list-header">
124
- <div className="header-content">
125
- <h3 className="header-title">
126
- {title || '联系人卡片列表'}
127
- {systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
128
- </h3>
129
- <Button
130
- type="primary"
131
- icon={<ReloadOutlined />}
132
- onClick={this.loadContactData}
133
- loading={loading}
134
- className="refresh-button"
135
- size="small"
136
- >
137
- 刷新
138
- </Button>
139
- </div>
140
- </div>
141
-
142
- <div className="card-list-content">
143
- <Spin spinning={loading} tip="加载联系人数据中...">
144
- {error ? (
145
- <div className="error-container">
146
- <Empty
147
- image={Empty.PRESENTED_IMAGE_SIMPLE}
148
- description={
149
- <div>
150
- <div style={{ color: '#ff4d4f', marginBottom: 8 }}>
151
- {error}
152
- </div>
153
- <button
154
- className="retry-button"
155
- onClick={this.loadContactData}
156
- >
157
- 重新加载
158
- </button>
159
- </div>
160
- }
161
- />
162
- </div>
163
- ) : contactList.length === 0 ? (
164
- <Empty
165
- image={Empty.PRESENTED_IMAGE_SIMPLE}
166
- description="暂无联系人数据"
167
- />
168
- ) : (
169
- <Row gutter={[16, 16]}>
170
- {contactList.map((contact, index) =>
171
- this.renderContactCard(contact, index),
172
- )}
173
- </Row>
174
- )}
175
- </Spin>
176
- </div>
177
- </div>
178
- );
179
- }
180
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * @file 联系人卡片列表组件对接编辑器的描述文件
3
- */
4
- export class ContactCardListModel {
5
- /**
6
- * cmpType 为自定义组件名称,用于标识组件的唯一性
7
- * 在构建时根据当前组件目录名称自动生成
8
- */
9
- // cmpType: string = 'contact-card-list';
10
-
11
- // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
- label: string = '联系人卡片列表';
13
-
14
- // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
- description: string = '展示联系人信息的卡片列表组件,支持姓名和手机号展示';
16
-
17
- // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
18
- // tags: string[] = ['自定义组件'];
19
-
20
- // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
21
- iconUrl: string = 'https://custom-widgets.bj.bcebos.com/card-list.svg';
22
-
23
- // 初次插入页面的默认属性数据
24
- defaultComProps = {
25
- title: '联系人卡片列表',
26
- label: '联系人卡片列表',
27
- };
28
-
29
- /**
30
- * 组件面板配置,用于生成编辑器右侧属性配置面板内容
31
- */
32
- propsSchema = [
33
- {
34
- type: 'textarea',
35
- name: 'title',
36
- label: '组件标题',
37
- value: '联系人卡片列表',
38
- placeholder: '请输入组件标题',
39
- },
40
- ];
41
-
42
- // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
43
- /*
44
- propsSchemaCreator = (com: any) => {
45
- return [];
46
- };
47
- */
48
- }
49
-
50
- export default ContactCardListModel;