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

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 (22) hide show
  1. package/dist/DocumentsList/DocumentsListController/DocumentsListControllerState/index.d.ts +4 -0
  2. package/dist/index.esm.js +540 -476
  3. package/dist/index.js +592 -528
  4. package/package.json +4 -4
  5. package/src/DocumentWhiteList/control/actions/blacklist/index.ts +3 -0
  6. package/src/DocumentWhiteList/control/actions/checkclient/index.ts +4 -1
  7. package/src/DocumentWhiteList/control/actions/didilist/index.ts +3 -0
  8. package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +3 -0
  9. package/src/DocumentWhiteList/control/actions/enablelist/index.ts +3 -0
  10. package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +3 -0
  11. package/src/DocumentWhiteList/control/actions/synclist/index.ts +3 -0
  12. package/src/DocumentWhiteList/control/actions/whitelist/index.ts +3 -0
  13. package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +87 -10
  14. package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +89 -9
  15. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +1 -1
  16. package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +4 -0
  17. package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +107 -168
  18. package/src/DocumentsList/ui/PageHeader/index.tsx +150 -213
  19. package/src/DocumentsList/ui/RuleTable/index.tsx +7 -3
  20. package/dist/DocumentWhiteList/ui/UnifiedSearch/index.d.ts +0 -11
  21. package/src/DocumentWhiteList/ui/UnifiedSearch/index.scss +0 -119
  22. package/src/DocumentWhiteList/ui/UnifiedSearch/index.tsx +0 -146
@@ -1,20 +1,14 @@
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';
4
+ import { AdvancedSearch, KtsForm } from 'kts-components';
5
5
  import { LifeCycleTypes } from '@formily/antd';
6
6
  import Main from '../..';
7
7
  import ModalComfirm from '../ModalComfirm'
8
8
  import { DocumentsService } from "../../..";
9
9
  import _ from 'lodash';
10
10
  import { useHistory } from 'react-router-dom';
11
- import { Search as SearchXui, searchFormat, searchUnFormat, ISearchItemProps } from 'kts-xui';
12
- import { Select as SearchSelect, DatePicker } from 'kts-xui';
13
- import { Select } from 'antd';
14
11
  const { SubMenu } = Menu;
15
- const { Option } = Select;
16
- const { RangePicker } = DatePicker;
17
-
18
12
  export default () => {
19
13
  const history = useHistory();
20
14
  const controller = Main.useController();
@@ -24,99 +18,8 @@ export default () => {
24
18
  const params = controller.useMemo(s => s.params, [])
25
19
  const visible = controller.useMemo(s => s.visible, []);
26
20
  const [profileEnum, setProfile] = useState([]);
27
-
28
- // 动态生成 formItems
29
- const formItems: ISearchItemProps[] = useMemo(() => {
30
- const items: ISearchItemProps[] = [];
31
-
32
- // 配置名称
33
- items.push({
34
- name: "configName",
35
- label: "配置名称",
36
- children: <SearchXui.Input />,
37
- });
38
-
39
- // 发送对象 (仅在 type === 2 时显示)
40
- if (type === 2) {
41
- items.push({
42
- name: "attributionList",
43
- label: "发送对象",
44
- children: <SearchXui.Input />,
45
- });
46
- }
47
-
48
- // 单据大类
49
- items.push({
50
- name: "type",
51
- label: "单据大类",
52
- children: (
53
- <SearchSelect className="underline" allowClear={true}>
54
- {billEnum.map((item: any) => (
55
- <Option key={item.value} value={item.value}>
56
- {item.label}
57
- </Option>
58
- ))}
59
- </SearchSelect>
60
- ),
61
- });
62
-
63
- // 单据子类
64
- items.push({
65
- name: "profile",
66
- label: "单据子类",
67
- children: (
68
- <SearchSelect className="underline" allowClear={true}>
69
- {profileEnum.map((item: any) => (
70
- <Option key={item.value} value={item.value}>
71
- {item.name}
72
- </Option>
73
- ))}
74
- </SearchSelect>
75
- ),
76
- });
77
-
78
- // 收发角色
79
- items.push({
80
- name: "attribution",
81
- label: "收发角色",
82
- children: (
83
- <SearchSelect className="underline" allowClear={true} mode="multiple">
84
- <Option value="1">发送方</Option>
85
- <Option value="0">接收方</Option>
86
- </SearchSelect>
87
- ),
88
- });
89
-
90
- // 创建时间
91
- items.push({
92
- name: "createTime",
93
- label: "创建时间",
94
- children: (
95
- <RangePicker
96
- style={{ width: "100%" }}
97
- format="YYYY-MM-DD"
98
- placeholder={["开始时间", "结束时间"]}
99
- className="underline-datepicker"
100
- />
101
- ),
102
- });
103
-
104
- // 更新时间
105
- items.push({
106
- name: "sendTime",
107
- label: "更新时间",
108
- children: (
109
- <RangePicker
110
- style={{ width: "100%" }}
111
- format="YYYY-MM-DD"
112
- placeholder={["开始时间", "结束时间"]}
113
- className="underline-datepicker"
114
- />
115
- ),
116
- });
117
-
118
- return items;
119
- }, [billEnum, type, profileEnum]);
21
+ const [schema, setSchema] = useState({});
22
+ const ktsRef = useRef(null);
120
23
  useEffect(() => {
121
24
  (async () => {
122
25
  const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
@@ -130,27 +33,6 @@ export default () => {
130
33
  }
131
34
  })()
132
35
  }, []);
133
-
134
- // 处理单据子类的动态更新
135
- useEffect(() => {
136
- const selectedType = params.type;
137
- if (selectedType) {
138
- const target: any = billEnum.find((item: any) => item.value === selectedType);
139
- if (target && target.profileList) {
140
- const list = target.profileList.map((item: any) => {
141
- return {
142
- label: item.name,
143
- value: item.value
144
- }
145
- })
146
- setProfile(list);
147
- } else {
148
- setProfile([])
149
- }
150
- } else {
151
- setProfile([])
152
- }
153
- }, [billEnum, params.type]);
154
36
  const onSearchFormSubmit = React.useCallback((value) => {
155
37
  value = {
156
38
  ...value,
@@ -161,49 +43,6 @@ export default () => {
161
43
  })()
162
44
  }, [controller])
163
45
 
164
- // 创建搜索组件
165
- const { search, setSearchValues } = SearchXui.useCreate({
166
- labelCol: 9,
167
- onSubmit: (e) => {
168
- const processedValues = {
169
- ...e,
170
- beginCreateTime: e.createTime && e.createTime[0] ? e.createTime[0].format('YYYY-MM-DD 00:00:00') : undefined,
171
- endCreateTime: e.createTime && e.createTime[1] ? e.createTime[1].format('YYYY-MM-DD 23:59:59') : undefined,
172
- beginSendTime: e.sendTime && e.sendTime[0] ? e.sendTime[0].format('YYYY-MM-DD 00:00:00') : undefined,
173
- endSendTime: e.sendTime && e.sendTime[1] ? e.sendTime[1].format('YYYY-MM-DD 23:59:59') : undefined,
174
- };
175
- // 移除原始的日期字段
176
- delete processedValues.createTime;
177
- delete processedValues.sendTime;
178
- onSearchFormSubmit(processedValues);
179
- },
180
- values: React.useMemo(() => {
181
- // 转换搜索值格式
182
- const convertedValues = { ...params } as any;
183
- const paramsAny = params as any;
184
- if (paramsAny.beginCreateTime && paramsAny.endCreateTime) {
185
- convertedValues.createTime = [paramsAny.beginCreateTime, paramsAny.endCreateTime];
186
- }
187
- if (paramsAny.beginSendTime && paramsAny.endSendTime) {
188
- convertedValues.sendTime = [paramsAny.beginSendTime, paramsAny.endSendTime];
189
- }
190
- return searchUnFormat(convertedValues, formItems);
191
- }, [params, formItems]),
192
- formItems,
193
- });
194
-
195
- useEffect(() => {
196
- const convertedValues = { ...params } as any;
197
- const paramsAny = params as any;
198
- if (paramsAny.beginCreateTime && paramsAny.endCreateTime) {
199
- convertedValues.createTime = [paramsAny.beginCreateTime, paramsAny.endCreateTime];
200
- }
201
- if (paramsAny.beginSendTime && paramsAny.endSendTime) {
202
- convertedValues.sendTime = [paramsAny.beginSendTime, paramsAny.endSendTime];
203
- }
204
- setSearchValues(searchUnFormat(convertedValues, formItems));
205
- }, [formItems, params, setSearchValues]);
206
-
207
46
  const switchType = React.useCallback((e) => {
208
47
  controller.pipeline(async s => {
209
48
  s.type = e.target.value;
@@ -220,6 +59,60 @@ export default () => {
220
59
  s.visible = true;
221
60
  })()
222
61
  }, [controller]);
62
+ useEffect(() => {
63
+ let obj: any = {
64
+ type: "object",
65
+ properties: {
66
+ configName: {
67
+ type: "string",
68
+ title: "配置名称",
69
+ },
70
+ attributionList: {
71
+ type: "string",
72
+ title: "发送对象",
73
+ visible: type === 2 ? true : false
74
+ },
75
+ type: {
76
+ type: "string",
77
+ title: "单据大类",
78
+ enum: billEnum,
79
+ },
80
+ profile: {
81
+ type: "string",
82
+ title: "单据子类",
83
+ enum: profileEnum,
84
+ visible: false
85
+ },
86
+ attribution: {
87
+ type: "radio",
88
+ title: "收发角色",
89
+ enum: [{
90
+ "label": "发送方",
91
+ "value": '1'
92
+ }, {
93
+ "label": "接收方",
94
+ "value": '0'
95
+ }],
96
+ 'x-props': {
97
+ mode: "multiple"
98
+ }
99
+ },
100
+ '[beginCreateTime,endCreateTime]': {
101
+ key: "[beginCreateTime,endCreateTime",
102
+ name: "[beginCreateTime,endCreateTime",
103
+ type: "daterange",
104
+ title: "创建时间",
105
+ },
106
+ '[beginSendTime,endSendTime]': {
107
+ key: "[beginSendTime,endSendTime",
108
+ name: "[beginSendTime,endSendTime",
109
+ type: "daterange",
110
+ title: "更新时间",
111
+ },
112
+ }
113
+ }
114
+ setSchema(obj);
115
+ }, [billEnum, type, profileEnum])
223
116
  const onCreateType = useCallback((category, record?) => {
224
117
  history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
225
118
  }, [])
@@ -232,12 +125,58 @@ export default () => {
232
125
  <Radio.Button value={2}>发布记录</Radio.Button>
233
126
  </Radio.Group>
234
127
  </div>
235
- <div style={{ flex: 1 }}>
236
- {search}
237
- </div>
128
+ <AdvancedSearch
129
+ width={480}
130
+ height={44}
131
+ compact={true}
132
+ defaultKey="configName"
133
+ placeholder="输入配置名称"
134
+ searchFormSubmit={onSearchFormSubmit}
135
+ >
136
+ <KtsForm
137
+ ref={ktsRef}
138
+ labelCol={9}
139
+ wrapperCol={15}
140
+ labelAlign='left'
141
+ compact={true}
142
+ schema={schema}
143
+ defaultValue={_.pick(params, ['configName', 'type', 'profile', 'attributionList', 'attribution', '[beginCreateTime,endCreateTime]', '[beginSendTime,endSendTime]'])}
144
+ effects={($: any, actions: any) => {
145
+ $(LifeCycleTypes.ON_FIELD_VALUE_CHANGE, 'type',).subscribe((fieldState: any) => {
146
+ if (fieldState.value) {
147
+ const target: any = billEnum.find((item: any) => item.value === fieldState.value);
148
+ if (target && target.profileList) {
149
+ actions.setFieldState('profile', (state: any) => {
150
+ state.visible = true;
151
+ });
152
+ const list = target.profileList.map((item: any) => {
153
+ return {
154
+ label: item.name,
155
+ value: item.value
156
+ }
157
+ })
158
+ setProfile(list);
159
+ } else {
160
+ actions.setFieldState('profile', (state: any) => {
161
+ state.visible = false;
162
+ });
163
+ setProfile([])
164
+ }
165
+ } else {
166
+ actions.setFieldState('profile', (state: any) => {
167
+ state.visible = false;
168
+ });
169
+ setProfile([])
170
+ }
171
+ });
172
+ }}
173
+ >
174
+ </KtsForm>
175
+ </AdvancedSearch>
176
+
238
177
  </div>
239
178
  );
240
- }, [type, search]);
179
+ }, [type,schema]);
241
180
  const menu = useMemo(() => {
242
181
  return (
243
182
  <Menu>