kts-components-document-access-point 1.4.4 → 1.4.7
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/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +11 -11
- package/README.md +3 -3
- package/dist/index.esm.js +13 -12
- package/dist/index.js +13 -12
- package/docs/index.md +3 -3
- package/index.html +12 -12
- package/package.json +56 -56
- package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
- package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
- package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
- package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
- package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
- package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
- package/src/DocumentWhiteList/control/index.tsx +42 -42
- package/src/DocumentWhiteList/control/state/index.ts +47 -47
- package/src/DocumentWhiteList/index.md +5 -5
- package/src/DocumentWhiteList/index.tsx +40 -40
- package/src/DocumentWhiteList/interface/index.ts +30 -30
- package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
- package/src/DocumentWhiteList/ui/main/black.tsx +126 -132
- package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
- package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
- package/src/DocumentWhiteList/ui/main/white.tsx +119 -120
- package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
- package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
- package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
- package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
- package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
- package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
- package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
- package/src/DocumentsCont/index.md +9 -9
- package/src/DocumentsCont/index.tsx +54 -51
- package/src/DocumentsDemo/Controller/index.tsx +14 -14
- package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
- package/src/DocumentsDemo/Text.tsx +22 -22
- package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
- package/src/DocumentsDemo/index.md +6 -6
- package/src/DocumentsDemo/index.tsx +38 -38
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
- package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
- package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
- package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +93 -93
- package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
- package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
- package/src/DocumentsEdit/___demo___/monitor/index.tsx +1421 -1421
- package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
- package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
- package/src/DocumentsEdit/index.less +45 -45
- package/src/DocumentsEdit/index.md +10 -10
- package/src/DocumentsEdit/index.tsx +117 -117
- package/src/DocumentsEdit/tools/index.ts +88 -88
- package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -238
- package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
- package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
- package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
- package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
- package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -70
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
- package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
- package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
- package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
- package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
- package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
- package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
- package/src/DocumentsList/___demo___/list/index.tsx +4 -4
- package/src/DocumentsList/index.less +22 -22
- package/src/DocumentsList/index.md +3 -3
- package/src/DocumentsList/index.tsx +46 -46
- package/src/DocumentsList/ui/ModalComfirm/index.tsx +94 -92
- package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
- package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
- package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
- package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
- package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
- package/src/DocumentsList/util/ConfigEnum.ts +11 -11
- package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
- package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
- package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
- package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
- package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
- package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
- package/src/DocumentsRule/control/index.tsx +30 -30
- package/src/DocumentsRule/control/state/index.ts +42 -42
- package/src/DocumentsRule/index.md +1 -1
- package/src/DocumentsRule/index.tsx +25 -25
- package/src/DocumentsRule/interface/index.ts +28 -28
- package/src/DocumentsRule/ui/main/index.tsx +362 -362
- package/src/DocumentsService/index.ts +18 -18
- package/src/index.ts +9 -9
- package/tsconfig.json +29 -29
- package/typings.d.ts +3 -3
- package/docs-dist/404.html +0 -38
- package/docs-dist/index.html +0 -38
- package/docs-dist/static/icon.050945f2.svg +0 -1
- package/docs-dist/umi.css +0 -11
- package/docs-dist/umi.js +0 -1
|
@@ -1,325 +1,325 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
-
import { Radio, Button, Dropdown, PageHeaderFoot } from 'kts-xui';
|
|
3
|
-
import { Menu } from 'kts-components-antd-x4';
|
|
4
|
-
import { AdvancedSearch, KtsForm } from 'kts-components';
|
|
5
|
-
import { LifeCycleTypes } from '@formily/antd';
|
|
6
|
-
import Main from '../../';
|
|
7
|
-
import ModalComfirm from '../ModalComfirm'
|
|
8
|
-
import { DocumentsService } from "../../../";
|
|
9
|
-
import _ from 'lodash';
|
|
10
|
-
import { useHistory } from 'react-router-dom';
|
|
11
|
-
import moment from 'moment';
|
|
12
|
-
const { SubMenu } = Menu;
|
|
13
|
-
export default () => {
|
|
14
|
-
const history = useHistory();
|
|
15
|
-
const controller = Main.useController();
|
|
16
|
-
const type = controller.useMemo(s => s.type, [])
|
|
17
|
-
const [billEnum, setBill] = useState([]);
|
|
18
|
-
const selectedRowKey = controller.useMemo(s => s.selectedRowKey, [])
|
|
19
|
-
const params = controller.useMemo(s => s.params, [])
|
|
20
|
-
const visible = controller.useMemo(s => s.visible, []);
|
|
21
|
-
const [profileEnum, setProfile] = useState([]);
|
|
22
|
-
const [schema, setSchema] = useState({});
|
|
23
|
-
const ktsRef = useRef(null);
|
|
24
|
-
const [didlist, setDidList] = useState([]);//我司对应DID
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
(async () => {
|
|
27
|
-
const res = await DocumentsService.instance.service?.call({ url: '/participant/listBySubjectId', data: {}, type: 'get' }) as any;
|
|
28
|
-
if (res.res) {
|
|
29
|
-
setDidList(res.res);
|
|
30
|
-
}
|
|
31
|
-
})()
|
|
32
|
-
}, []);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
(async () => {
|
|
35
|
-
const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
|
|
36
|
-
if (res.err) {
|
|
37
|
-
return false;
|
|
38
|
-
} else {
|
|
39
|
-
const list = res.res.map((item: any) => {
|
|
40
|
-
return { ...item, label: item.name, value: item.value }
|
|
41
|
-
})
|
|
42
|
-
setBill(list);
|
|
43
|
-
}
|
|
44
|
-
})()
|
|
45
|
-
}, []);
|
|
46
|
-
const onSearchFormSubmit = React.useCallback((value) => {
|
|
47
|
-
value = {
|
|
48
|
-
...value,
|
|
49
|
-
typeList: value['typeList'] && [value['typeList']],
|
|
50
|
-
beginCreateTime: value['beginCreateTime'] && moment(value['beginCreateTime']).format('YYYY-MM-DD 00:00:00'),
|
|
51
|
-
endCreateTime: value['endCreateTime'] && moment(value['endCreateTime']).format('YYYY-MM-DD 23:59:59'),
|
|
52
|
-
beginSendTime: value['beginSendTime'] && moment(value['beginSendTime']).format('YYYY-MM-DD 00:00:00'),
|
|
53
|
-
endSendTime: value['endSendTime'] && moment(value['endSendTime']).format('YYYY-MM-DD 23:59:59'),
|
|
54
|
-
pageNum: 1,
|
|
55
|
-
pageSize: 10
|
|
56
|
-
}
|
|
57
|
-
controller.pipeline(async s => {
|
|
58
|
-
s.params = value;
|
|
59
|
-
})()
|
|
60
|
-
}, [controller])
|
|
61
|
-
|
|
62
|
-
const switchType = React.useCallback((e) => {
|
|
63
|
-
controller.pipeline(async s => {
|
|
64
|
-
s.type = e.target.value;
|
|
65
|
-
s.params = { pageNum: 1, pageSize: 10 }
|
|
66
|
-
history.push({ pathname: '/rulelist', state: { type: e.target.value } })
|
|
67
|
-
})()
|
|
68
|
-
}, [])
|
|
69
|
-
const handleCancel = React.useCallback(() => {
|
|
70
|
-
controller.pipeline(async s => {
|
|
71
|
-
s.visible = false;
|
|
72
|
-
})()
|
|
73
|
-
}, []);
|
|
74
|
-
const batchSend = React.useCallback(() => {
|
|
75
|
-
controller.pipeline(async s => {
|
|
76
|
-
s.visible = true;
|
|
77
|
-
})()
|
|
78
|
-
}, [controller]);
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
const didEnum = didlist.map((item: any) => {
|
|
81
|
-
return { label: item.remarkName + ':' + item.participantId, value: item.participantId };
|
|
82
|
-
})
|
|
83
|
-
if (type === 1) {
|
|
84
|
-
let obj: any = {
|
|
85
|
-
type: "object",
|
|
86
|
-
properties: {
|
|
87
|
-
configName: {
|
|
88
|
-
type: "string",
|
|
89
|
-
title: "配置名称",
|
|
90
|
-
},
|
|
91
|
-
type: {
|
|
92
|
-
type: "string",
|
|
93
|
-
title: "单据大类",
|
|
94
|
-
enum: billEnum,
|
|
95
|
-
},
|
|
96
|
-
profile: {
|
|
97
|
-
type: "string",
|
|
98
|
-
title: "单据子类",
|
|
99
|
-
enum: profileEnum,
|
|
100
|
-
visible: false
|
|
101
|
-
},
|
|
102
|
-
attributionList: {
|
|
103
|
-
type: "checkbox",
|
|
104
|
-
title: "收发角色",
|
|
105
|
-
enum: [{
|
|
106
|
-
"label": "发送方",
|
|
107
|
-
"value": 1
|
|
108
|
-
}, {
|
|
109
|
-
"label": "接收方",
|
|
110
|
-
"value": 2
|
|
111
|
-
}],
|
|
112
|
-
'x-props': {
|
|
113
|
-
mode: "multiple"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
createTime: {
|
|
117
|
-
type: "daterange",
|
|
118
|
-
title: "创建时间",
|
|
119
|
-
'x-props':{
|
|
120
|
-
extendsFields: ['beginCreateTime', 'endCreateTime'],
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
sendTime: {
|
|
124
|
-
type: "daterange",
|
|
125
|
-
title: "更新时间",
|
|
126
|
-
'x-props':{
|
|
127
|
-
extendsFields: ['beginSendTime', 'endSendTime'],
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
setSchema(obj);
|
|
133
|
-
} else if (type === 2) {
|
|
134
|
-
let obj: any = {
|
|
135
|
-
type: "object",
|
|
136
|
-
properties: {
|
|
137
|
-
configName: {
|
|
138
|
-
type: "string",
|
|
139
|
-
title: "配置名称",
|
|
140
|
-
},
|
|
141
|
-
effectStatus: {
|
|
142
|
-
type: "radio",
|
|
143
|
-
title: "使用标识",
|
|
144
|
-
enum: [{
|
|
145
|
-
"label": "已失效",
|
|
146
|
-
"value": 0
|
|
147
|
-
}, {
|
|
148
|
-
"label": "使用中",
|
|
149
|
-
"value": 1
|
|
150
|
-
}]
|
|
151
|
-
},
|
|
152
|
-
attribution: {
|
|
153
|
-
type: "radio",
|
|
154
|
-
title: "我的收发角色",
|
|
155
|
-
enum: [{
|
|
156
|
-
"label": "发送方",
|
|
157
|
-
"value": 1
|
|
158
|
-
}, {
|
|
159
|
-
"label": "接收方",
|
|
160
|
-
"value": 2
|
|
161
|
-
}],
|
|
162
|
-
},
|
|
163
|
-
// attributionList: {
|
|
164
|
-
// type: "string",
|
|
165
|
-
// title: "发送对象",
|
|
166
|
-
// visible: true
|
|
167
|
-
// },
|
|
168
|
-
senderParticipantId: {
|
|
169
|
-
type: "string",
|
|
170
|
-
title: "我司对应DID",
|
|
171
|
-
enum: didEnum
|
|
172
|
-
},
|
|
173
|
-
receiverParticipantId: {
|
|
174
|
-
type: "string",
|
|
175
|
-
title: "接受对象",
|
|
176
|
-
},
|
|
177
|
-
receiverCompany: {
|
|
178
|
-
type: "string",
|
|
179
|
-
title: "接受对象所属公司",
|
|
180
|
-
},
|
|
181
|
-
type: {
|
|
182
|
-
type: "string",
|
|
183
|
-
title: "单据大类",
|
|
184
|
-
enum: billEnum,
|
|
185
|
-
},
|
|
186
|
-
profile: {
|
|
187
|
-
type: "string",
|
|
188
|
-
title: "单据子类",
|
|
189
|
-
enum: profileEnum,
|
|
190
|
-
visible: false
|
|
191
|
-
},
|
|
192
|
-
createTime: {
|
|
193
|
-
type: "daterange",
|
|
194
|
-
title: "发布时间",
|
|
195
|
-
'x-props':{
|
|
196
|
-
extendsFields: ['beginCreateTime', 'endCreateTime'],
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
// '[beginSendTime,endSendTime]': {
|
|
200
|
-
// key: "[beginSendTime,endSendTime]",
|
|
201
|
-
// name: "[beginSendTime,endSendTime]",
|
|
202
|
-
// type: "daterange",
|
|
203
|
-
// title: "更新时间",
|
|
204
|
-
// },
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
setSchema(obj);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
}, [billEnum, type, profileEnum, didlist])
|
|
211
|
-
const onCreateType = useCallback((category, record?) => {
|
|
212
|
-
history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
|
|
213
|
-
}, [])
|
|
214
|
-
const topExpand = useCallback(() => {
|
|
215
|
-
return (
|
|
216
|
-
<div style={{ display: 'flex' }}>
|
|
217
|
-
<div style={{ marginRight: 10 }}>
|
|
218
|
-
<Radio.Group value={type} onChange={switchType}>
|
|
219
|
-
<Radio.Button value={1}>单据校验规则配置</Radio.Button>
|
|
220
|
-
<Radio.Button value={2}>发布记录</Radio.Button>
|
|
221
|
-
</Radio.Group>
|
|
222
|
-
</div>
|
|
223
|
-
<AdvancedSearch
|
|
224
|
-
width={480}
|
|
225
|
-
height={44}
|
|
226
|
-
compact={true}
|
|
227
|
-
defaultKey="configName"
|
|
228
|
-
placeholder="输入配置名称"
|
|
229
|
-
searchFormSubmit={onSearchFormSubmit}
|
|
230
|
-
>
|
|
231
|
-
<KtsForm
|
|
232
|
-
ref={ktsRef}
|
|
233
|
-
labelCol={9}
|
|
234
|
-
wrapperCol={15}
|
|
235
|
-
labelAlign='left'
|
|
236
|
-
compact={true}
|
|
237
|
-
schema={schema}
|
|
238
|
-
defaultValue={params}
|
|
239
|
-
effects={($: any, actions: any) => {
|
|
240
|
-
$(LifeCycleTypes.ON_FIELD_VALUE_CHANGE, 'type',).subscribe((fieldState: any) => {
|
|
241
|
-
if (fieldState.value) {
|
|
242
|
-
const target: any = billEnum.find((item: any) => item.value === fieldState.value);
|
|
243
|
-
if (target && target.profileList) {
|
|
244
|
-
actions.setFieldState('profile', (state: any) => {
|
|
245
|
-
state.visible = true;
|
|
246
|
-
});
|
|
247
|
-
const list = target.profileList.map((item: any) => {
|
|
248
|
-
return {
|
|
249
|
-
label: item.name,
|
|
250
|
-
value: item.value
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
setProfile(list);
|
|
254
|
-
} else {
|
|
255
|
-
actions.setFieldState('profile', (state: any) => {
|
|
256
|
-
state.visible = false;
|
|
257
|
-
});
|
|
258
|
-
setProfile([])
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
actions.setFieldState('profile', (state: any) => {
|
|
262
|
-
state.visible = false;
|
|
263
|
-
});
|
|
264
|
-
setProfile([])
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}}
|
|
268
|
-
>
|
|
269
|
-
</KtsForm>
|
|
270
|
-
</AdvancedSearch>
|
|
271
|
-
|
|
272
|
-
</div>
|
|
273
|
-
);
|
|
274
|
-
}, [type, schema]);
|
|
275
|
-
const menu = useMemo(() => {
|
|
276
|
-
return (
|
|
277
|
-
<Menu>
|
|
278
|
-
{billEnum && billEnum.map((item: any, key) => {
|
|
279
|
-
if (item.profileList) {
|
|
280
|
-
return (
|
|
281
|
-
<SubMenu key={key} title={item.label}>
|
|
282
|
-
{
|
|
283
|
-
item.profileList.map((element: any) => {
|
|
284
|
-
return (
|
|
285
|
-
<Menu.Item key={element.value} onClick={() => { onCreateType(item.value, element); }}>
|
|
286
|
-
<a >
|
|
287
|
-
{element.name}
|
|
288
|
-
</a>
|
|
289
|
-
</Menu.Item>
|
|
290
|
-
)
|
|
291
|
-
})
|
|
292
|
-
}
|
|
293
|
-
</SubMenu>
|
|
294
|
-
)
|
|
295
|
-
} else {
|
|
296
|
-
return (
|
|
297
|
-
<Menu.Item key={item.value} onClick={() => { onCreateType(item.value); }}>
|
|
298
|
-
<a >
|
|
299
|
-
{item.label}
|
|
300
|
-
</a>
|
|
301
|
-
</Menu.Item>
|
|
302
|
-
)
|
|
303
|
-
}
|
|
304
|
-
})}
|
|
305
|
-
|
|
306
|
-
</Menu>);
|
|
307
|
-
}, [billEnum]);
|
|
308
|
-
return (
|
|
309
|
-
<div style={{ flex: 'none', position: 'relative', zIndex: 1 }}>
|
|
310
|
-
<PageHeaderFoot
|
|
311
|
-
expandLeft={topExpand()}
|
|
312
|
-
expandRight={[
|
|
313
|
-
type === 1 && <Button disabled={selectedRowKey.length === 0} key="1" onClick={batchSend} style={{ marginRight: 10 }}>发布</Button>,
|
|
314
|
-
type === 1 && <Dropdown key="2" overlay={menu}>
|
|
315
|
-
<Button type="primary" >创建配置</Button>
|
|
316
|
-
</Dropdown>
|
|
317
|
-
]}
|
|
318
|
-
>
|
|
319
|
-
</PageHeaderFoot>
|
|
320
|
-
{
|
|
321
|
-
visible && <ModalComfirm handleCancel={handleCancel} list={selectedRowKey} />
|
|
322
|
-
}
|
|
323
|
-
</div>
|
|
324
|
-
);
|
|
325
|
-
};
|
|
1
|
+
import React, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
+
import { Radio, Button, Dropdown, PageHeaderFoot } from 'kts-xui';
|
|
3
|
+
import { Menu } from 'kts-components-antd-x4';
|
|
4
|
+
import { AdvancedSearch, KtsForm } from 'kts-components';
|
|
5
|
+
import { LifeCycleTypes } from '@formily/antd';
|
|
6
|
+
import Main from '../../';
|
|
7
|
+
import ModalComfirm from '../ModalComfirm'
|
|
8
|
+
import { DocumentsService } from "../../../";
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import { useHistory } from 'react-router-dom';
|
|
11
|
+
import moment from 'moment';
|
|
12
|
+
const { SubMenu } = Menu;
|
|
13
|
+
export default () => {
|
|
14
|
+
const history = useHistory();
|
|
15
|
+
const controller = Main.useController();
|
|
16
|
+
const type = controller.useMemo(s => s.type, [])
|
|
17
|
+
const [billEnum, setBill] = useState([]);
|
|
18
|
+
const selectedRowKey = controller.useMemo(s => s.selectedRowKey, [])
|
|
19
|
+
const params = controller.useMemo(s => s.params, [])
|
|
20
|
+
const visible = controller.useMemo(s => s.visible, []);
|
|
21
|
+
const [profileEnum, setProfile] = useState([]);
|
|
22
|
+
const [schema, setSchema] = useState({});
|
|
23
|
+
const ktsRef = useRef(null);
|
|
24
|
+
const [didlist, setDidList] = useState([]);//我司对应DID
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
(async () => {
|
|
27
|
+
const res = await DocumentsService.instance.service?.call({ url: '/participant/listBySubjectId', data: {}, type: 'get' }) as any;
|
|
28
|
+
if (res.res) {
|
|
29
|
+
setDidList(res.res);
|
|
30
|
+
}
|
|
31
|
+
})()
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
(async () => {
|
|
35
|
+
const res = await DocumentsService.instance.service?.call({ url: '/schema/config/getDefaultTypeList', data: {}, type: 'get' }) as any;
|
|
36
|
+
if (res.err) {
|
|
37
|
+
return false;
|
|
38
|
+
} else {
|
|
39
|
+
const list = res.res.map((item: any) => {
|
|
40
|
+
return { ...item, label: item.name, value: item.value }
|
|
41
|
+
})
|
|
42
|
+
setBill(list);
|
|
43
|
+
}
|
|
44
|
+
})()
|
|
45
|
+
}, []);
|
|
46
|
+
const onSearchFormSubmit = React.useCallback((value) => {
|
|
47
|
+
value = {
|
|
48
|
+
...value,
|
|
49
|
+
typeList: value['typeList'] && [value['typeList']],
|
|
50
|
+
beginCreateTime: value['beginCreateTime'] && moment(value['beginCreateTime']).format('YYYY-MM-DD 00:00:00'),
|
|
51
|
+
endCreateTime: value['endCreateTime'] && moment(value['endCreateTime']).format('YYYY-MM-DD 23:59:59'),
|
|
52
|
+
beginSendTime: value['beginSendTime'] && moment(value['beginSendTime']).format('YYYY-MM-DD 00:00:00'),
|
|
53
|
+
endSendTime: value['endSendTime'] && moment(value['endSendTime']).format('YYYY-MM-DD 23:59:59'),
|
|
54
|
+
pageNum: 1,
|
|
55
|
+
pageSize: 10
|
|
56
|
+
}
|
|
57
|
+
controller.pipeline(async s => {
|
|
58
|
+
s.params = value;
|
|
59
|
+
})()
|
|
60
|
+
}, [controller])
|
|
61
|
+
|
|
62
|
+
const switchType = React.useCallback((e) => {
|
|
63
|
+
controller.pipeline(async s => {
|
|
64
|
+
s.type = e.target.value;
|
|
65
|
+
s.params = { pageNum: 1, pageSize: 10 }
|
|
66
|
+
history.push({ pathname: '/rulelist', state: { type: e.target.value } })
|
|
67
|
+
})()
|
|
68
|
+
}, [])
|
|
69
|
+
const handleCancel = React.useCallback(() => {
|
|
70
|
+
controller.pipeline(async s => {
|
|
71
|
+
s.visible = false;
|
|
72
|
+
})()
|
|
73
|
+
}, []);
|
|
74
|
+
const batchSend = React.useCallback(() => {
|
|
75
|
+
controller.pipeline(async s => {
|
|
76
|
+
s.visible = true;
|
|
77
|
+
})()
|
|
78
|
+
}, [controller]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const didEnum = didlist.map((item: any) => {
|
|
81
|
+
return { label: item.remarkName + ':' + item.participantId, value: item.participantId };
|
|
82
|
+
})
|
|
83
|
+
if (type === 1) {
|
|
84
|
+
let obj: any = {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
configName: {
|
|
88
|
+
type: "string",
|
|
89
|
+
title: "配置名称",
|
|
90
|
+
},
|
|
91
|
+
type: {
|
|
92
|
+
type: "string",
|
|
93
|
+
title: "单据大类",
|
|
94
|
+
enum: billEnum,
|
|
95
|
+
},
|
|
96
|
+
profile: {
|
|
97
|
+
type: "string",
|
|
98
|
+
title: "单据子类",
|
|
99
|
+
enum: profileEnum,
|
|
100
|
+
visible: false
|
|
101
|
+
},
|
|
102
|
+
attributionList: {
|
|
103
|
+
type: "checkbox",
|
|
104
|
+
title: "收发角色",
|
|
105
|
+
enum: [{
|
|
106
|
+
"label": "发送方",
|
|
107
|
+
"value": 1
|
|
108
|
+
}, {
|
|
109
|
+
"label": "接收方",
|
|
110
|
+
"value": 2
|
|
111
|
+
}],
|
|
112
|
+
'x-props': {
|
|
113
|
+
mode: "multiple"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
createTime: {
|
|
117
|
+
type: "daterange",
|
|
118
|
+
title: "创建时间",
|
|
119
|
+
'x-props':{
|
|
120
|
+
extendsFields: ['beginCreateTime', 'endCreateTime'],
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
sendTime: {
|
|
124
|
+
type: "daterange",
|
|
125
|
+
title: "更新时间",
|
|
126
|
+
'x-props':{
|
|
127
|
+
extendsFields: ['beginSendTime', 'endSendTime'],
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
setSchema(obj);
|
|
133
|
+
} else if (type === 2) {
|
|
134
|
+
let obj: any = {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
configName: {
|
|
138
|
+
type: "string",
|
|
139
|
+
title: "配置名称",
|
|
140
|
+
},
|
|
141
|
+
effectStatus: {
|
|
142
|
+
type: "radio",
|
|
143
|
+
title: "使用标识",
|
|
144
|
+
enum: [{
|
|
145
|
+
"label": "已失效",
|
|
146
|
+
"value": 0
|
|
147
|
+
}, {
|
|
148
|
+
"label": "使用中",
|
|
149
|
+
"value": 1
|
|
150
|
+
}]
|
|
151
|
+
},
|
|
152
|
+
attribution: {
|
|
153
|
+
type: "radio",
|
|
154
|
+
title: "我的收发角色",
|
|
155
|
+
enum: [{
|
|
156
|
+
"label": "发送方",
|
|
157
|
+
"value": 1
|
|
158
|
+
}, {
|
|
159
|
+
"label": "接收方",
|
|
160
|
+
"value": 2
|
|
161
|
+
}],
|
|
162
|
+
},
|
|
163
|
+
// attributionList: {
|
|
164
|
+
// type: "string",
|
|
165
|
+
// title: "发送对象",
|
|
166
|
+
// visible: true
|
|
167
|
+
// },
|
|
168
|
+
senderParticipantId: {
|
|
169
|
+
type: "string",
|
|
170
|
+
title: "我司对应DID",
|
|
171
|
+
enum: didEnum
|
|
172
|
+
},
|
|
173
|
+
receiverParticipantId: {
|
|
174
|
+
type: "string",
|
|
175
|
+
title: "接受对象",
|
|
176
|
+
},
|
|
177
|
+
receiverCompany: {
|
|
178
|
+
type: "string",
|
|
179
|
+
title: "接受对象所属公司",
|
|
180
|
+
},
|
|
181
|
+
type: {
|
|
182
|
+
type: "string",
|
|
183
|
+
title: "单据大类",
|
|
184
|
+
enum: billEnum,
|
|
185
|
+
},
|
|
186
|
+
profile: {
|
|
187
|
+
type: "string",
|
|
188
|
+
title: "单据子类",
|
|
189
|
+
enum: profileEnum,
|
|
190
|
+
visible: false
|
|
191
|
+
},
|
|
192
|
+
createTime: {
|
|
193
|
+
type: "daterange",
|
|
194
|
+
title: "发布时间",
|
|
195
|
+
'x-props':{
|
|
196
|
+
extendsFields: ['beginCreateTime', 'endCreateTime'],
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
// '[beginSendTime,endSendTime]': {
|
|
200
|
+
// key: "[beginSendTime,endSendTime]",
|
|
201
|
+
// name: "[beginSendTime,endSendTime]",
|
|
202
|
+
// type: "daterange",
|
|
203
|
+
// title: "更新时间",
|
|
204
|
+
// },
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
setSchema(obj);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
}, [billEnum, type, profileEnum, didlist])
|
|
211
|
+
const onCreateType = useCallback((category, record?) => {
|
|
212
|
+
history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
|
|
213
|
+
}, [])
|
|
214
|
+
const topExpand = useCallback(() => {
|
|
215
|
+
return (
|
|
216
|
+
<div style={{ display: 'flex' }}>
|
|
217
|
+
<div style={{ marginRight: 10 }}>
|
|
218
|
+
<Radio.Group value={type} onChange={switchType}>
|
|
219
|
+
<Radio.Button value={1}>单据校验规则配置</Radio.Button>
|
|
220
|
+
<Radio.Button value={2}>发布记录</Radio.Button>
|
|
221
|
+
</Radio.Group>
|
|
222
|
+
</div>
|
|
223
|
+
<AdvancedSearch
|
|
224
|
+
width={480}
|
|
225
|
+
height={44}
|
|
226
|
+
compact={true}
|
|
227
|
+
defaultKey="configName"
|
|
228
|
+
placeholder="输入配置名称"
|
|
229
|
+
searchFormSubmit={onSearchFormSubmit}
|
|
230
|
+
>
|
|
231
|
+
<KtsForm
|
|
232
|
+
ref={ktsRef}
|
|
233
|
+
labelCol={9}
|
|
234
|
+
wrapperCol={15}
|
|
235
|
+
labelAlign='left'
|
|
236
|
+
compact={true}
|
|
237
|
+
schema={schema}
|
|
238
|
+
defaultValue={params}
|
|
239
|
+
effects={($: any, actions: any) => {
|
|
240
|
+
$(LifeCycleTypes.ON_FIELD_VALUE_CHANGE, 'type',).subscribe((fieldState: any) => {
|
|
241
|
+
if (fieldState.value) {
|
|
242
|
+
const target: any = billEnum.find((item: any) => item.value === fieldState.value);
|
|
243
|
+
if (target && target.profileList) {
|
|
244
|
+
actions.setFieldState('profile', (state: any) => {
|
|
245
|
+
state.visible = true;
|
|
246
|
+
});
|
|
247
|
+
const list = target.profileList.map((item: any) => {
|
|
248
|
+
return {
|
|
249
|
+
label: item.name,
|
|
250
|
+
value: item.value
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
setProfile(list);
|
|
254
|
+
} else {
|
|
255
|
+
actions.setFieldState('profile', (state: any) => {
|
|
256
|
+
state.visible = false;
|
|
257
|
+
});
|
|
258
|
+
setProfile([])
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
actions.setFieldState('profile', (state: any) => {
|
|
262
|
+
state.visible = false;
|
|
263
|
+
});
|
|
264
|
+
setProfile([])
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
</KtsForm>
|
|
270
|
+
</AdvancedSearch>
|
|
271
|
+
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
}, [type, schema]);
|
|
275
|
+
const menu = useMemo(() => {
|
|
276
|
+
return (
|
|
277
|
+
<Menu>
|
|
278
|
+
{billEnum && billEnum.map((item: any, key) => {
|
|
279
|
+
if (item.profileList) {
|
|
280
|
+
return (
|
|
281
|
+
<SubMenu key={key} title={item.label}>
|
|
282
|
+
{
|
|
283
|
+
item.profileList.map((element: any) => {
|
|
284
|
+
return (
|
|
285
|
+
<Menu.Item key={element.value} onClick={() => { onCreateType(item.value, element); }}>
|
|
286
|
+
<a >
|
|
287
|
+
{element.name}
|
|
288
|
+
</a>
|
|
289
|
+
</Menu.Item>
|
|
290
|
+
)
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
</SubMenu>
|
|
294
|
+
)
|
|
295
|
+
} else {
|
|
296
|
+
return (
|
|
297
|
+
<Menu.Item key={item.value} onClick={() => { onCreateType(item.value); }}>
|
|
298
|
+
<a >
|
|
299
|
+
{item.label}
|
|
300
|
+
</a>
|
|
301
|
+
</Menu.Item>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
})}
|
|
305
|
+
|
|
306
|
+
</Menu>);
|
|
307
|
+
}, [billEnum]);
|
|
308
|
+
return (
|
|
309
|
+
<div style={{ flex: 'none', position: 'relative', zIndex: 1 }}>
|
|
310
|
+
<PageHeaderFoot
|
|
311
|
+
expandLeft={topExpand()}
|
|
312
|
+
expandRight={[
|
|
313
|
+
type === 1 && <Button disabled={selectedRowKey.length === 0} key="1" onClick={batchSend} style={{ marginRight: 10 }}>发布</Button>,
|
|
314
|
+
type === 1 && <Dropdown key="2" overlay={menu}>
|
|
315
|
+
<Button type="primary" >创建配置</Button>
|
|
316
|
+
</Dropdown>
|
|
317
|
+
]}
|
|
318
|
+
>
|
|
319
|
+
</PageHeaderFoot>
|
|
320
|
+
{
|
|
321
|
+
visible && <ModalComfirm handleCancel={handleCancel} list={selectedRowKey} />
|
|
322
|
+
}
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
};
|