@hw-component/table 1.3.8 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@ant-design/icons": "4.6.2",
33
33
  "@ant-design/pro-table": "2.70.0",
34
- "@hw-component/form": "1.6.1",
34
+ "@hw-component/form": "1.6.2",
35
35
  "ahooks": "2.10.9",
36
36
  "antd": "4.20.7",
37
37
  "copy-to-clipboard": "3.3.1",
@@ -1,126 +1,79 @@
1
1
  import { HTable, useHTable, HTableConfig } from "@/components";
2
- import { Button, Card, Tooltip } from "antd";
2
+ import { Button, Card, Tooltip ,Typography,Tag,Row} from "antd";
3
3
  import { HFormConfigProvider } from "@hw-component/form";
4
4
  import { SettingOutlined } from "@ant-design/icons";
5
+ import ProTable from "@ant-design/pro-table";
6
+ import {useRequest} from "ahooks";
5
7
 
6
- const configData = [
7
- {
8
- title: "座位21321",
9
- showSearch: true,
10
- searchType: "rangePicker",
11
- dataIndex: "id",
12
- sorter: true,
13
- itemProps: {
14
- options: [{ label: "1", value: 1 }],
15
- placeholder: ["测试", "测试"],
16
- valueMap: {
17
- start: "start",
18
- end: "end",
19
- },
20
- },
21
- },
22
- {
23
- title: "座位断开",
24
- dataIndex: "name1",
25
- childrenDataIndex: [
26
- {
27
- dataIndex: "name2",
28
- title: "座位断开2",
29
- },
30
- {
31
- dataIndex: "name3",
32
- title: "座位断开3",
33
- },
34
- ],
35
- itemProps: {
36
- options: [{ label: "1", value: 1 }],
37
- },
38
- valueType: "date",
39
- },
40
- {
41
- title: <div>座位fff</div>,
42
- titleStr: "座位",
43
- dataIndex: "name2",
44
- searchType: "select",
45
- itemProps: {
46
- options: [{ label: "name2", value: 1 }],
47
- },
48
- },
8
+ const TagsComponent=({data,labelKey})=>{
9
+ const len=data?.length;
10
+ if (!len){
11
+ return <>-</>
12
+ }
13
+ console.log(data)
14
+ return <>
15
+ {data?.map((item, index) => {
16
+ const label="483607ad55fc115ae45219f661248a42b6c40a487f95469b39ee49420a2dc";
17
+ console.log(label.length)
18
+ return (
19
+ <Tag key={index} style={{width:120}}>
20
+ <Typography.Text ellipsis copyable>
21
+ {label}
22
+ </Typography.Text>
23
+ </Tag>
24
+ );
25
+ })}
26
+ </>
27
+ }
28
+
29
+ export const configData =[
49
30
  {
50
- title: <div>标签</div>,
51
- dataIndex: "tag",
52
- sorter: true,
53
- valueType: "tags",
54
- width: 200,
55
- valueTypeProps: {
56
- closable: true,
57
- tooltip: true,
58
- onClose: (key) => {
59
- console.log(key);
60
- },
61
- maxLen: 2,
62
- },
31
+ title: '报警联系人名称',
32
+ width: 120,
33
+ dataIndex: 'name',
63
34
  },
64
35
  {
65
- title: "可以复制",
66
- dataIndex: "copy",
67
- sorter: true,
68
- valueType: "copy",
69
- width: 100,
70
- valueTypeProps: {
71
- text: () => {
72
- return "你大爷";
73
- },
74
- },
36
+ title:"短信接收手机号",
37
+ dataIndex: 'mobileList',
38
+ width: 120,
39
+ valueType:"tags",
75
40
  },
76
41
  {
77
- title: "link",
78
- dataIndex: "link",
79
- sorter: true,
80
- valueType: "link",
81
- width: 100,
82
- valueTypeProps: {
83
- href: () => {
84
- return "https://ant-design.antgroup.com/docs/react/i18n-cn";
85
- },
86
- },
42
+ title:"邮箱",
43
+ dataIndex: 'mailList',
44
+ valueType:"tags",
45
+ width: 120,
87
46
  },
88
47
  {
89
- title: "text",
90
- dataIndex: "text",
91
- sorter: true,
92
- valueType: "text",
93
- width: 80,
94
- valueTypeProps: {
95
- type: "secondary",
96
- ellipsis: {
97
- tooltip: true,
98
- },
48
+ title: '悠哉公众号openid',
49
+ dataIndex: 'openidList',
50
+ width: 300,
51
+ render: (_: any, data) => {
52
+ const { openidList } = data;
53
+ return <TagsComponent data={openidList}/>
99
54
  },
100
55
  },
101
56
  {
102
- title: "userInfo",
103
- dataIndex: "userInfo",
104
- sorter: true,
105
- valueType: "userInfo",
106
- width: 80,
107
- },
108
- {
109
- title: "avatar",
110
- dataIndex: "avatar",
111
- sorter: true,
112
- valueType: "avatar",
113
- width: 80,
57
+ title: '钉钉机器人',
58
+ dataIndex: 'dingdingList',
59
+ width: 300,
60
+ render:(_: any, data)=>{
61
+ const { dingdingList } = data;
62
+ const newList=dingdingList?.filter((item)=>{
63
+ return typeof item !== 'string'
64
+ });
65
+ return <TagsComponent data={newList} labelKey="webhook"/>
66
+ }
114
67
  },
115
68
  {
116
- title: "操作",
117
- name: "aaa",
118
- fixed: "right",
119
- width: 200,
120
- render: () => {
121
- return <Card>fff</Card>;
122
- },
69
+ title:"操作",
70
+ width:120,
71
+ align: 'center',
72
+ dataIndex:"op",
73
+ render: (_: any, data: TableItemModal,index:number,tableInstance:HTableInstance) => {
74
+ return <div></div>
123
75
  },
76
+ }
124
77
  ];
125
78
  const Test = ({ name, selectedRowData }) => {
126
79
  console.log(selectedRowData);
@@ -128,6 +81,33 @@ const Test = ({ name, selectedRowData }) => {
128
81
  };
129
82
  export default () => {
130
83
  const hTable = useHTable();
84
+ const {loading,data}=useRequest(()=>{
85
+ const arrayData:any[] = [];
86
+ for (let i = 0; i < 1; i = i + 1) {
87
+ arrayData.push({
88
+ "id": i,
89
+ "name": "仙人",
90
+ "mobileList": null,
91
+ "mailList": null,
92
+ "openidList": [
93
+ "okSMy58P_PE9sQkAG03gkpiTk-hs"
94
+ ],
95
+ "dingdingList": [
96
+ {
97
+ "webhook": "https://oapi.dingtalk.com/robot/send?access_token=fa1483607ad55fc115ae45219f661248a42b6c40a487f95469b39ee49420a2dc",
98
+ "secretkey": "SEC1603b7a13fec76f6ec9e1eedbd44279f61b4298142d42616a4a672c245a37f3d"
99
+ }
100
+ ],
101
+ "notifyAll": 0
102
+ });
103
+ }
104
+ return new Promise((resolve, reject) => {
105
+ setTimeout(() => {
106
+ // reject(new Error("错误"));
107
+ resolve(arrayData);
108
+ }, 2000);
109
+ });
110
+ });
131
111
  return (
132
112
  <HFormConfigProvider>
133
113
  <div>
@@ -138,15 +118,15 @@ export default () => {
138
118
  >
139
119
  获取
140
120
  </div>
141
- <HTableConfig
142
- valueTypeConfig={{
143
- userInfo: () => {
144
- return <div>userInfo</div>;
145
- },
146
- }}
147
- >
121
+ <ProTable
122
+ columns={configData}
123
+ scroll={{x:1000}}
124
+ loading={loading}
125
+ dataSource={data}
126
+ />
148
127
  <HTable
149
128
  configData={configData}
129
+
150
130
  rowKey={(data, index) => {
151
131
  return index;
152
132
  }}
@@ -163,9 +143,7 @@ export default () => {
163
143
  console.log(params, "lllll");
164
144
  },
165
145
  }}
166
- rowSelection={{
167
- allPageCheck: false,
168
- }}
146
+ rowSelection={false}
169
147
  affixProps={{
170
148
  target: () => document.querySelector(".body"),
171
149
  }}
@@ -192,27 +170,25 @@ export default () => {
192
170
  操作
193
171
  </Button>
194
172
  }
195
- paginationActionRender={() => {
196
- return <div>你大爷</div>;
197
- }}
198
173
  request={(params) => {
199
174
  const { current = 1, size = "10" } = params;
200
- const arrayData = [];
201
- for (let i = 0; i < 100; i = i + 1) {
175
+ const arrayData:any[] = [];
176
+ for (let i = 0; i < 1; i = i + 1) {
202
177
  arrayData.push({
203
- id: i,
204
- name: "11",
205
- name1: "1721730221",
206
- tag: [
207
- { value: "1", label: "你好" },
208
- { value: "2", label: "你好1" },
209
- { value: "3", label: "你好2" },
178
+ "id": i,
179
+ "name": "仙人",
180
+ "mobileList": null,
181
+ "mailList": null,
182
+ "openidList": [
183
+ "okSMy58P_PE9sQkAG03gkpiTk-hs"
184
+ ],
185
+ "dingdingList": [
186
+ {
187
+ "webhook": "https://oapi.dingtalk.com/robot/send?access_token=fa1483607ad55fc115ae45219f661248a42b6c40a487f95469b39ee49420a2dc",
188
+ "secretkey": "SEC1603b7a13fec76f6ec9e1eedbd44279f61b4298142d42616a4a672c245a37f3d"
189
+ }
210
190
  ],
211
- copy: "复制复制复制复制复制复制复制复制",
212
- link: "https://www.baidu.com/",
213
- text: "文本文本文本文本",
214
- avatar:
215
- "https://img-1304033052.cos.ap-chengdu.myqcloud.com/b75979ace44aed0928f4e359709f60e6",
191
+ "notifyAll": 0
216
192
  });
217
193
  }
218
194
  return new Promise((resolve, reject) => {
@@ -237,7 +213,6 @@ export default () => {
237
213
  },
238
214
  }}
239
215
  />
240
- </HTableConfig>
241
216
  </div>
242
217
  </HFormConfigProvider>
243
218
  );