kts-components-document-access-point 2.0.0 → 2.0.1

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.
@@ -1,21 +1,22 @@
1
1
  import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
2
2
  import { Radio, Button, Dropdown, PageHeaderFoot } from 'kts-xui';
3
3
  import { Menu } from 'kts-components-antd-x4';
4
- import { KtsForm } from 'kts-components';
5
- import { LifeCycleTypes } from '@formily/antd';
4
+ import { Search as SearchXui, searchUnFormat, ISearchItemProps } from 'kts-xui';
5
+ import { Select as SearchSelect } from 'kts-xui';
6
+ import { Select, DatePicker, Radio as AntRadio, Checkbox } from 'antd';
6
7
  import Main from '../../';
7
8
  import ModalComfirm from '../ModalComfirm'
8
9
  import { DocumentsService } from "../../../";
9
10
  import _ from 'lodash';
10
11
  import { useHistory } from 'react-router-dom';
11
12
  import moment from 'moment';
12
- import { Search as SearchXui, searchFormat, searchUnFormat, ISearchItemProps } from 'kts-xui';
13
- import { Select as SearchSelect, DatePicker } from 'kts-xui';
14
- import { Select } from 'antd';
15
- const { SubMenu } = Menu;
13
+ import css from './index.less';
14
+
16
15
  const { Option } = Select;
17
16
  const { RangePicker } = DatePicker;
18
-
17
+ const { Group: RadioGroup } = AntRadio;
18
+ const { Group: CheckboxGroup } = Checkbox;
19
+ const { SubMenu } = Menu;
19
20
  export default () => {
20
21
  const history = useHistory();
21
22
  const controller = Main.useController();
@@ -24,17 +25,88 @@ export default () => {
24
25
  const selectedRowKey = controller.useMemo(s => s.selectedRowKey, [])
25
26
  const params = controller.useMemo(s => s.params, [])
26
27
  const visible = controller.useMemo(s => s.visible, []);
27
- const [profileEnum, setProfile] = useState([]);
28
+ const profileEnumRef = useRef<any[]>([]);
29
+ const [, forceUpdate] = useState({});
28
30
  const ktsRef = useRef(null);
29
31
  const [didlist, setDidList] = useState([]);//我司对应DID
32
+ useEffect(() => {
33
+ (async () => {
34
+ const res = await DocumentsService.instance.service?.call({ url: '/participant/listBySubjectId', data: {}, type: 'get' }) as any;
35
+ if(!res){
36
+ return false;
37
+ }
38
+ if (res.res) {
39
+ setDidList(res.res);
40
+ }
41
+ })()
42
+ }, []);
43
+ useEffect(() => {
44
+ (async () => {
45
+ const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
46
+ if(!res){
47
+ return false;
48
+ }
49
+ if (res.err) {
50
+ return false;
51
+ } else {
52
+ const list = res.res.map((item: any) => {
53
+ return { ...item, label: item.name, value: item.value }
54
+ })
55
+ setBill(list);
56
+ }
57
+ })()
58
+ }, []);
59
+ const onSearchFormSubmit = React.useCallback((value) => {
60
+ value = {
61
+ ...value,
62
+ typeList: value['typeList'] && [value['typeList']],
63
+ beginCreateTime: value['beginCreateTime'] && moment(value['beginCreateTime']).format('YYYY-MM-DD 00:00:00'),
64
+ endCreateTime: value['endCreateTime'] && moment(value['endCreateTime']).format('YYYY-MM-DD 23:59:59'),
65
+ beginSendTime: value['beginSendTime'] && moment(value['beginSendTime']).format('YYYY-MM-DD 00:00:00'),
66
+ endSendTime: value['endSendTime'] && moment(value['endSendTime']).format('YYYY-MM-DD 23:59:59'),
67
+ pageNum: 1,
68
+ pageSize: 10
69
+ }
70
+ controller.pipeline(async s => {
71
+ s.params = value;
72
+ })()
73
+ }, [controller])
30
74
 
75
+ // 处理单据大类变化
76
+ const handleTypeChange = useCallback((value: any) => {
77
+ const target: any = billEnum.find((item: any) => item.value === value);
78
+ profileEnumRef.current = target?.profileList?.map((item: any) => ({
79
+ label: item.name,
80
+ value: item.value,
81
+ })) || [];
82
+ forceUpdate({});
83
+ }, [billEnum]);
84
+
85
+ const switchType = React.useCallback((e) => {
86
+ controller.pipeline(async s => {
87
+ s.type = e.target.value;
88
+ s.params = { pageNum: 1, pageSize: 10 }
89
+ history.push({ pathname: '/rulelist', state: { type: e.target.value } })
90
+ })()
91
+ }, [])
92
+ const handleCancel = React.useCallback(() => {
93
+ controller.pipeline(async s => {
94
+ s.visible = false;
95
+ })()
96
+ }, []);
97
+ const batchSend = React.useCallback(() => {
98
+ controller.pipeline(async s => {
99
+ s.visible = true;
100
+ })()
101
+ }, [controller]);
31
102
  // 动态生成 formItems
32
103
  const formItems: ISearchItemProps[] = useMemo(() => {
33
- const items: ISearchItemProps[] = [];
34
104
  const didEnum = didlist.map((item: any) => {
35
105
  return { label: item.remarkName + ':' + item.participantId, value: item.participantId };
36
106
  });
37
107
 
108
+ const items: ISearchItemProps[] = [];
109
+
38
110
  if (type === 1) {
39
111
  // 配置名称
40
112
  items.push({
@@ -48,7 +120,7 @@ export default () => {
48
120
  name: "type",
49
121
  label: "单据大类",
50
122
  children: (
51
- <SearchSelect className="underline" allowClear={true}>
123
+ <SearchSelect className={css.underline} allowClear onChange={handleTypeChange}>
52
124
  {billEnum.map((item: any) => (
53
125
  <Option key={item.value} value={item.value}>
54
126
  {item.label}
@@ -60,13 +132,14 @@ export default () => {
60
132
 
61
133
  // 单据子类
62
134
  items.push({
63
- name: "profile",
64
- label: "单据子类",
135
+ name: 'profile',
136
+ label: '单据子类',
137
+ hidden: profileEnumRef.current.length === 0,
65
138
  children: (
66
- <SearchSelect className="underline" allowClear={true}>
67
- {profileEnum.map((item: any) => (
139
+ <SearchSelect className={css.underline} allowClear>
140
+ {profileEnumRef.current.map((item: any) => (
68
141
  <Option key={item.value} value={item.value}>
69
- {item.name}
142
+ {item.label}
70
143
  </Option>
71
144
  ))}
72
145
  </SearchSelect>
@@ -78,10 +151,12 @@ export default () => {
78
151
  name: "attributionList",
79
152
  label: "收发角色",
80
153
  children: (
81
- <SearchSelect className="underline" allowClear={true} mode="multiple">
82
- <Option value={1}>发送方</Option>
83
- <Option value={2}>接收方</Option>
84
- </SearchSelect>
154
+ <CheckboxGroup
155
+ options={[
156
+ { label: "发送方", value: 1 },
157
+ { label: "接收方", value: 2 }
158
+ ]}
159
+ />
85
160
  ),
86
161
  });
87
162
 
@@ -89,28 +164,14 @@ export default () => {
89
164
  items.push({
90
165
  name: "createTime",
91
166
  label: "创建时间",
92
- children: (
93
- <RangePicker
94
- style={{ width: "100%" }}
95
- format="YYYY-MM-DD"
96
- placeholder={["开始时间", "结束时间"]}
97
- className="underline-datepicker"
98
- />
99
- ),
167
+ children: <RangePicker className={css.underline} />,
100
168
  });
101
169
 
102
170
  // 更新时间
103
171
  items.push({
104
172
  name: "sendTime",
105
173
  label: "更新时间",
106
- children: (
107
- <RangePicker
108
- style={{ width: "100%" }}
109
- format="YYYY-MM-DD"
110
- placeholder={["开始时间", "结束时间"]}
111
- className="underline-datepicker"
112
- />
113
- ),
174
+ children: <RangePicker className={css.underline} />,
114
175
  });
115
176
  } else if (type === 2) {
116
177
  // 配置名称
@@ -125,10 +186,10 @@ export default () => {
125
186
  name: "effectStatus",
126
187
  label: "使用标识",
127
188
  children: (
128
- <SearchSelect className="underline" allowClear={true}>
129
- <Option value={0}>已失效</Option>
130
- <Option value={1}>使用中</Option>
131
- </SearchSelect>
189
+ <RadioGroup>
190
+ <AntRadio value={0}>已失效</AntRadio>
191
+ <AntRadio value={1}>使用中</AntRadio>
192
+ </RadioGroup>
132
193
  ),
133
194
  });
134
195
 
@@ -137,10 +198,10 @@ export default () => {
137
198
  name: "attribution",
138
199
  label: "我的收发角色",
139
200
  children: (
140
- <SearchSelect className="underline" allowClear={true}>
141
- <Option value={1}>发送方</Option>
142
- <Option value={2}>接收方</Option>
143
- </SearchSelect>
201
+ <RadioGroup>
202
+ <AntRadio value={1}>发送方</AntRadio>
203
+ <AntRadio value={2}>接收方</AntRadio>
204
+ </RadioGroup>
144
205
  ),
145
206
  });
146
207
 
@@ -149,7 +210,7 @@ export default () => {
149
210
  name: "senderParticipantId",
150
211
  label: "我司对应DID",
151
212
  children: (
152
- <SearchSelect className="underline" allowClear={true}>
213
+ <SearchSelect className={css.underline} allowClear>
153
214
  {didEnum.map((item: any) => (
154
215
  <Option key={item.value} value={item.value}>
155
216
  {item.label}
@@ -178,7 +239,7 @@ export default () => {
178
239
  name: "type",
179
240
  label: "单据大类",
180
241
  children: (
181
- <SearchSelect className="underline" allowClear={true}>
242
+ <SearchSelect className={css.underline} allowClear onChange={handleTypeChange}>
182
243
  {billEnum.map((item: any) => (
183
244
  <Option key={item.value} value={item.value}>
184
245
  {item.label}
@@ -190,13 +251,14 @@ export default () => {
190
251
 
191
252
  // 单据子类
192
253
  items.push({
193
- name: "profile",
194
- label: "单据子类",
254
+ name: 'profile',
255
+ label: '单据子类',
256
+ hidden: profileEnumRef.current.length === 0,
195
257
  children: (
196
- <SearchSelect className="underline" allowClear={true}>
197
- {profileEnum.map((item: any) => (
258
+ <SearchSelect className={css.underline} allowClear>
259
+ {profileEnumRef.current.map((item: any) => (
198
260
  <Option key={item.value} value={item.value}>
199
- {item.name}
261
+ {item.label}
200
262
  </Option>
201
263
  ))}
202
264
  </SearchSelect>
@@ -207,144 +269,27 @@ export default () => {
207
269
  items.push({
208
270
  name: "createTime",
209
271
  label: "发布时间",
210
- children: (
211
- <RangePicker
212
- style={{ width: "100%" }}
213
- format="YYYY-MM-DD"
214
- placeholder={["开始时间", "结束时间"]}
215
- className="underline-datepicker"
216
- />
217
- ),
272
+ children: <RangePicker className={css.underline} />,
218
273
  });
219
274
  }
220
275
 
221
276
  return items;
222
- }, [billEnum, type, profileEnum, didlist]);
223
-
224
- useEffect(() => {
225
- (async () => {
226
- const res = await DocumentsService.instance.service?.call({ url: '/participant/listBySubjectId', data: {}, type: 'get' }) as any;
227
- if (res.res) {
228
- setDidList(res.res);
229
- }
230
- })()
231
- }, []);
232
-
233
- // 处理单据子类的动态更新
234
- useEffect(() => {
235
- const selectedType = (params as any).type;
236
- if (selectedType) {
237
- const target: any = billEnum.find((item: any) => item.value === selectedType);
238
- if (target && target.profileList) {
239
- const list = target.profileList.map((item: any) => {
240
- return {
241
- label: item.name,
242
- value: item.value
243
- }
244
- })
245
- setProfile(list);
246
- } else {
247
- setProfile([])
248
- }
249
- } else {
250
- setProfile([])
251
- }
252
- }, [billEnum, params]);
253
-
254
- useEffect(() => {
255
- (async () => {
256
- const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
257
- if (res.err) {
258
- return false;
259
- } else {
260
- const list = res.res.map((item: any) => {
261
- return { ...item, label: item.name, value: item.value }
262
- })
263
- setBill(list);
264
- }
265
- })()
266
- }, []);
267
- const onSearchFormSubmit = React.useCallback((value) => {
268
- value = {
269
- ...value,
270
- typeList: value['typeList'] && [value['typeList']],
271
- beginCreateTime: value['beginCreateTime'] && moment(value['beginCreateTime']).format('YYYY-MM-DD 00:00:00'),
272
- endCreateTime: value['endCreateTime'] && moment(value['endCreateTime']).format('YYYY-MM-DD 23:59:59'),
273
- beginSendTime: value['beginSendTime'] && moment(value['beginSendTime']).format('YYYY-MM-DD 00:00:00'),
274
- endSendTime: value['endSendTime'] && moment(value['endSendTime']).format('YYYY-MM-DD 23:59:59'),
275
- pageNum: 1,
276
- pageSize: 10
277
- }
278
- controller.pipeline(async s => {
279
- s.params = value;
280
- })()
281
- }, [controller])
282
-
277
+ }, [billEnum, type, didlist]);
278
+ const onCreateType = useCallback((category, record?) => {
279
+ history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
280
+ }, [])
283
281
  // 创建搜索组件
284
- const { search, setSearchValues } = SearchXui.useCreate({
282
+ const { search } = SearchXui.useCreate({
285
283
  labelCol: 9,
286
284
  onSubmit: (e) => {
287
- const processedValues = {
288
- ...e,
289
- beginCreateTime: e.createTime && e.createTime[0] ? e.createTime[0].format('YYYY-MM-DD 00:00:00') : undefined,
290
- endCreateTime: e.createTime && e.createTime[1] ? e.createTime[1].format('YYYY-MM-DD 23:59:59') : undefined,
291
- beginSendTime: e.sendTime && e.sendTime[0] ? e.sendTime[0].format('YYYY-MM-DD 00:00:00') : undefined,
292
- endSendTime: e.sendTime && e.sendTime[1] ? e.sendTime[1].format('YYYY-MM-DD 23:59:59') : undefined,
293
- pageNum: 1,
294
- pageSize: 10
295
- };
296
- // 移除原始的日期字段
297
- delete processedValues.createTime;
298
- delete processedValues.sendTime;
299
- onSearchFormSubmit(processedValues);
285
+ onSearchFormSubmit(e);
300
286
  },
301
287
  values: React.useMemo(() => {
302
- // 转换搜索值格式
303
- const convertedValues = { ...params } as any;
304
- const paramsAny = params as any;
305
- if (paramsAny.beginCreateTime && paramsAny.endCreateTime) {
306
- convertedValues.createTime = [paramsAny.beginCreateTime, paramsAny.endCreateTime];
307
- }
308
- if (paramsAny.beginSendTime && paramsAny.endSendTime) {
309
- convertedValues.sendTime = [paramsAny.beginSendTime, paramsAny.endSendTime];
310
- }
311
- return searchUnFormat(convertedValues, formItems);
288
+ return searchUnFormat(params, formItems);
312
289
  }, [params, formItems]),
313
290
  formItems,
314
291
  });
315
292
 
316
- useEffect(() => {
317
- const convertedValues = { ...params } as any;
318
- const paramsAny = params as any;
319
- if (paramsAny.beginCreateTime && paramsAny.endCreateTime) {
320
- convertedValues.createTime = [paramsAny.beginCreateTime, paramsAny.endCreateTime];
321
- }
322
- if (paramsAny.beginSendTime && paramsAny.endSendTime) {
323
- convertedValues.sendTime = [paramsAny.beginSendTime, paramsAny.endSendTime];
324
- }
325
- setSearchValues(searchUnFormat(convertedValues, formItems));
326
- }, [formItems, params, setSearchValues]);
327
-
328
- const switchType = React.useCallback((e) => {
329
- controller.pipeline(async s => {
330
- s.type = e.target.value;
331
- s.params = { pageNum: 1, pageSize: 10 }
332
- history.push({ pathname: '/rulelist', state: { type: e.target.value } })
333
- })()
334
- }, [])
335
- const handleCancel = React.useCallback(() => {
336
- controller.pipeline(async s => {
337
- s.visible = false;
338
- })()
339
- }, []);
340
- const batchSend = React.useCallback(() => {
341
- controller.pipeline(async s => {
342
- s.visible = true;
343
- })()
344
- }, [controller]);
345
- const onCreateType = useCallback((category, record?) => {
346
- history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
347
- }, [])
348
293
  const topExpand = useCallback(() => {
349
294
  return (
350
295
  <div style={{ display: 'flex' }}>
@@ -354,8 +299,10 @@ export default () => {
354
299
  <Radio.Button value={2} style={{whiteSpace:'nowrap'}}>发布记录</Radio.Button>
355
300
  </Radio.Group>
356
301
  </div>
357
- <div style={{ flex: 1 }}>
358
- {search}
302
+ <div style={{ width: "100%", paddingTop: '10px' }}>
303
+ <div style={{ display: "flex", alignItems: "flex-start", gap: "16px" }}>
304
+ <div style={{ flex: 1 }}>{search}</div>
305
+ </div>
359
306
  </div>
360
307
  </div>
361
308
  );
@@ -22,7 +22,9 @@ export default function validaterule(props: any) {
22
22
  const res = await DocumentsService.instance.service?.call({
23
23
  url: '/schema/config/queryConfigSchemaPage', data: params, type: 'post'
24
24
  }) as any;
25
-
25
+ if(!res){
26
+ return false;
27
+ }
26
28
  if (res.err) {
27
29
  return false;
28
30
  }
@@ -33,9 +35,11 @@ export default function validaterule(props: any) {
33
35
  })()
34
36
  }, [params]);
35
37
  useEffect(() => {
36
- (async () => {
37
-
38
+ (async () => {
38
39
  const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
40
+ if(!res){
41
+ return false;
42
+ }
39
43
  if (res.err) {
40
44
  return false;
41
45
  } else {
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- interface UnifiedSearchProps {
3
- searchFormSubmit: (values: any) => void;
4
- searchValues: any;
5
- right?: any;
6
- onRefresh?: () => void;
7
- didlist?: any[];
8
- labelCol?: number;
9
- }
10
- export default function UnifiedSearch(props: UnifiedSearchProps): React.JSX.Element;
11
- export {};
@@ -1,119 +0,0 @@
1
- // UnifiedSearch 组件样式 - 控件只有下边框
2
- .unifiedSearch {
3
- :global(.ktsAntX-xui-page-header-foot){
4
- box-shadow: none !important;
5
- }
6
- :global(.ktsAntX-xui-page-header-foot::after) {
7
- box-shadow: none !important;
8
- }
9
- :global(.ktsAntX-xui-page-header-foot .ktsAntX-xui-page-header-operate) {
10
- border: none !important;
11
- }
12
- :global(.ktsAntX-xui-page-header-operate){
13
- padding: 0px !important;
14
- }
15
- }
16
-
17
- // 按钮容器样式
18
- .btnBox {
19
- display: flex;
20
- flex-direction: row;
21
- align-items: flex-start;
22
- justify-content: flex-end;
23
- flex: 1;
24
- margin-top: 13px;
25
- .btn {
26
- height:30px;
27
- line-height: 30px;
28
- background-color:rgba(0,116,255,1);
29
- border-radius:15px;
30
- border:1px solid rgba(0,116,255,1);
31
- font-size:12px;
32
- color: #FFFFFF;
33
- padding: 0px 28px;
34
- cursor: pointer;
35
- margin-left: 10px;
36
- word-break: keep-all;
37
- }
38
- .moreBtn {
39
- height:30px;
40
- line-height: 30px;
41
- background-color: #ffffff;
42
- border-radius:15px;
43
- border:1px solid #0074FF;
44
- font-size:12px;
45
- color: #0074FF;
46
- padding: 0px 28px;
47
- cursor: pointer;
48
- margin-left: 10px;
49
- word-break: keep-all;
50
- }
51
- .moreBtn:hover {
52
- background-color: rgba(0, 116, 255, 0.2);
53
- }
54
- .refreshBtn {
55
- padding: 0 18px;
56
- justify-content: center;
57
- align-items: center;
58
- display: inline-flex;
59
- .refreshIcon {
60
- height: 18px;
61
- width: 18px;
62
- }
63
- }
64
- }
65
-
66
- // 全局样式 - 所有输入框只显示下边框
67
- :global(.underline-datepicker) {
68
- :global(.ant-input){
69
- border: none !important;
70
- border-bottom: 1px solid #d9d9d9 !important;
71
- }
72
- }
73
- :global(.underline){
74
- :global(.ktsAntX-select-selector){
75
- border: none !important;
76
- border-bottom: 1px solid #d9d9d9 !important;
77
- }
78
- }
79
- // kts-xui 组件全局样式覆盖 - 只显示下边框
80
- :global(.ktsAntX-xui-input .ant-input) {
81
- border: none !important;
82
- border-bottom: 1px solid #d9d9d9 !important;
83
- border-radius: 0 !important;
84
- box-shadow: none !important;
85
- background: transparent !important;
86
- outline: none !important;
87
- }
88
-
89
- :global(.ktsAntX-xui-input .ant-input:focus),
90
- :global(.ktsAntX-xui-input .ant-input:hover) {
91
- border-bottom: 1px solid #40a9ff !important;
92
- box-shadow: none !important;
93
- }
94
-
95
- :global(.ktsAntX-xui-input .ant-input:focus) {
96
- border-bottom: 1px solid #1890ff !important;
97
- }
98
-
99
- :global(.ktsAntX-xui-select .ant-select-selector) {
100
- border: none !important;
101
- border-bottom: 1px solid #d9d9d9 !important;
102
- border-radius: 0 !important;
103
- box-shadow: none !important;
104
- background: transparent !important;
105
- outline: none !important;
106
- }
107
-
108
- :global(.ktsAntX-xui-select .ant-select-selector:hover) {
109
- border-bottom: 1px solid #40a9ff !important;
110
- }
111
-
112
- :global(.ktsAntX-xui-select.ant-select-focused .ant-select-selector) {
113
- border-bottom: 1px solid #1890ff !important;
114
- box-shadow: none !important;
115
- }
116
-
117
- :global(.ktsAntX-xui-select .ant-select-arrow) {
118
- color: #666;
119
- }