kts-components-document-access-point 2.0.1 → 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.
@@ -10,9 +10,6 @@ import { DocumentsService } from "../../../";
10
10
  import _ from 'lodash';
11
11
  import { useHistory } from 'react-router-dom';
12
12
  import moment from 'moment';
13
- import css from './index.less';
14
-
15
- const { Option } = Select;
16
13
  const { RangePicker } = DatePicker;
17
14
  const { Group: RadioGroup } = AntRadio;
18
15
  const { Group: CheckboxGroup } = Checkbox;
@@ -25,8 +22,7 @@ export default () => {
25
22
  const selectedRowKey = controller.useMemo(s => s.selectedRowKey, [])
26
23
  const params = controller.useMemo(s => s.params, [])
27
24
  const visible = controller.useMemo(s => s.visible, []);
28
- const profileEnumRef = useRef<any[]>([]);
29
- const [, forceUpdate] = useState({});
25
+ const [profileEnum, setProfileEnum] = useState<any[]>([]);
30
26
  const ktsRef = useRef(null);
31
27
  const [didlist, setDidList] = useState([]);//我司对应DID
32
28
  useEffect(() => {
@@ -75,12 +71,13 @@ export default () => {
75
71
  // 处理单据大类变化
76
72
  const handleTypeChange = useCallback((value: any) => {
77
73
  const target: any = billEnum.find((item: any) => item.value === value);
78
- profileEnumRef.current = target?.profileList?.map((item: any) => ({
74
+ const newProfileEnum = target?.profileList?.map((item: any) => ({
79
75
  label: item.name,
80
76
  value: item.value,
81
77
  })) || [];
82
- forceUpdate({});
83
- }, [billEnum]);
78
+ setProfileEnum(newProfileEnum);
79
+ form?.setFieldsValue({ profile: undefined });
80
+ }, [billEnum, controller]);
84
81
 
85
82
  const switchType = React.useCallback((e) => {
86
83
  controller.pipeline(async s => {
@@ -88,6 +85,8 @@ export default () => {
88
85
  s.params = { pageNum: 1, pageSize: 10 }
89
86
  history.push({ pathname: '/rulelist', state: { type: e.target.value } })
90
87
  })()
88
+ // 切换类型时也清空单据子类的值并重新创建表单
89
+ setProfileEnum([]);
91
90
  }, [])
92
91
  const handleCancel = React.useCallback(() => {
93
92
  controller.pipeline(async s => {
@@ -120,13 +119,7 @@ export default () => {
120
119
  name: "type",
121
120
  label: "单据大类",
122
121
  children: (
123
- <SearchSelect className={css.underline} allowClear onChange={handleTypeChange}>
124
- {billEnum.map((item: any) => (
125
- <Option key={item.value} value={item.value}>
126
- {item.label}
127
- </Option>
128
- ))}
129
- </SearchSelect>
122
+ <SearchSelect className={"underline"} allowClear onChange={handleTypeChange} options={billEnum} />
130
123
  ),
131
124
  });
132
125
 
@@ -134,15 +127,14 @@ export default () => {
134
127
  items.push({
135
128
  name: 'profile',
136
129
  label: '单据子类',
137
- hidden: profileEnumRef.current.length === 0,
130
+ hidden: profileEnum.length === 0,
138
131
  children: (
139
- <SearchSelect className={css.underline} allowClear>
140
- {profileEnumRef.current.map((item: any) => (
141
- <Option key={item.value} value={item.value}>
142
- {item.label}
143
- </Option>
144
- ))}
145
- </SearchSelect>
132
+ <SearchSelect
133
+ key={`profile-${params?.type || 'none'}`}
134
+ className={"underline"}
135
+ allowClear
136
+ options={profileEnum}
137
+ />
146
138
  ),
147
139
  });
148
140
 
@@ -164,14 +156,14 @@ export default () => {
164
156
  items.push({
165
157
  name: "createTime",
166
158
  label: "创建时间",
167
- children: <RangePicker className={css.underline} />,
159
+ children: <RangePicker className={"underline-datepicker"} />,
168
160
  });
169
161
 
170
162
  // 更新时间
171
163
  items.push({
172
164
  name: "sendTime",
173
165
  label: "更新时间",
174
- children: <RangePicker className={css.underline} />,
166
+ children: <RangePicker className={"underline-datepicker"} />,
175
167
  });
176
168
  } else if (type === 2) {
177
169
  // 配置名称
@@ -191,6 +183,10 @@ export default () => {
191
183
  <AntRadio value={1}>使用中</AntRadio>
192
184
  </RadioGroup>
193
185
  ),
186
+ // options: [
187
+ // { label: '已失效', value: 0 },
188
+ // { label: '使用中', value: 1 },
189
+ // ],
194
190
  });
195
191
 
196
192
  // 我的收发角色
@@ -203,6 +199,10 @@ export default () => {
203
199
  <AntRadio value={2}>接收方</AntRadio>
204
200
  </RadioGroup>
205
201
  ),
202
+ // options: [
203
+ // { label: '发送方', value: 1 },
204
+ // { label: '接收方', value: 2 },
205
+ // ],
206
206
  });
207
207
 
208
208
  // 我司对应DID
@@ -210,13 +210,7 @@ export default () => {
210
210
  name: "senderParticipantId",
211
211
  label: "我司对应DID",
212
212
  children: (
213
- <SearchSelect className={css.underline} allowClear>
214
- {didEnum.map((item: any) => (
215
- <Option key={item.value} value={item.value}>
216
- {item.label}
217
- </Option>
218
- ))}
219
- </SearchSelect>
213
+ <SearchSelect className="underline" allowClear options={didEnum} />
220
214
  ),
221
215
  });
222
216
 
@@ -239,13 +233,7 @@ export default () => {
239
233
  name: "type",
240
234
  label: "单据大类",
241
235
  children: (
242
- <SearchSelect className={css.underline} allowClear onChange={handleTypeChange}>
243
- {billEnum.map((item: any) => (
244
- <Option key={item.value} value={item.value}>
245
- {item.label}
246
- </Option>
247
- ))}
248
- </SearchSelect>
236
+ <SearchSelect className={"underline"} allowClear onChange={handleTypeChange} options={billEnum} />
249
237
  ),
250
238
  });
251
239
 
@@ -253,15 +241,13 @@ export default () => {
253
241
  items.push({
254
242
  name: 'profile',
255
243
  label: '单据子类',
256
- hidden: profileEnumRef.current.length === 0,
244
+ hidden: profileEnum.length === 0,
257
245
  children: (
258
- <SearchSelect className={css.underline} allowClear>
259
- {profileEnumRef.current.map((item: any) => (
260
- <Option key={item.value} value={item.value}>
261
- {item.label}
262
- </Option>
263
- ))}
264
- </SearchSelect>
246
+ <SearchSelect
247
+ className={"underline"}
248
+ allowClear
249
+ options={profileEnum}
250
+ />
265
251
  ),
266
252
  });
267
253
 
@@ -269,44 +255,40 @@ export default () => {
269
255
  items.push({
270
256
  name: "createTime",
271
257
  label: "发布时间",
272
- children: <RangePicker className={css.underline} />,
258
+ children: <RangePicker className={"underline-datepicker"} />,
273
259
  });
274
260
  }
275
261
 
276
262
  return items;
277
- }, [billEnum, type, didlist]);
263
+ }, [billEnum, type, didlist, profileEnum]);
278
264
  const onCreateType = useCallback((category, record?) => {
279
265
  history.push({ pathname: `/rule`, search: `?type=config&profile=${record && record.value || ''}&billtype=${category}` })
280
266
  }, [])
281
267
  // 创建搜索组件
282
- const { search } = SearchXui.useCreate({
268
+ const { search, inventory, form } = SearchXui.useCreate({
283
269
  labelCol: 9,
284
270
  onSubmit: (e) => {
285
271
  onSearchFormSubmit(e);
286
272
  },
287
273
  values: React.useMemo(() => {
288
274
  return searchUnFormat(params, formItems);
289
- }, [params, formItems]),
275
+ }, [params, formItems]),
290
276
  formItems,
291
277
  });
292
278
 
293
279
  const topExpand = useCallback(() => {
294
280
  return (
295
- <div style={{ display: 'flex' }}>
296
- <div style={{ marginRight: 10 }}>
297
- <Radio.Group value={type} onChange={switchType}>
298
- <Radio.Button value={1} style={{whiteSpace:'nowrap'}}>单据校验规则配置</Radio.Button>
299
- <Radio.Button value={2} style={{whiteSpace:'nowrap'}}>发布记录</Radio.Button>
300
- </Radio.Group>
301
- </div>
302
- <div style={{ width: "100%", paddingTop: '10px' }}>
303
- <div style={{ display: "flex", alignItems: "flex-start", gap: "16px" }}>
281
+ <div style={{ width: "100%" }}>
282
+ <div className={'unifiedSearch'}>
283
+ <div style={{ display: "flex", alignItems: "flex-start", gap: "16px", padding: '10px 0px' }}>
304
284
  <div style={{ flex: 1 }}>{search}</div>
305
285
  </div>
286
+ {/* 搜索条件标签 */}
287
+ {inventory}
306
288
  </div>
307
289
  </div>
308
290
  );
309
- }, [type, search]);
291
+ }, [type, search, inventory]);
310
292
  const menu = useMemo(() => {
311
293
  return (
312
294
  <Menu>
@@ -341,6 +323,13 @@ export default () => {
341
323
  </Menu>);
342
324
  }, [billEnum]);
343
325
  return (
326
+ <>
327
+ <div style={{padding:"16px 20px", borderBottom: "1px solid rgb(240, 240, 240)" }}>
328
+ <Radio.Group value={type} onChange={switchType}>
329
+ <Radio.Button value={1} style={{whiteSpace:'nowrap'}}>单据校验规则配置</Radio.Button>
330
+ <Radio.Button value={2} style={{whiteSpace:'nowrap'}}>发布记录</Radio.Button>
331
+ </Radio.Group>
332
+ </div>
344
333
  <div style={{ flex: 'none', position: 'relative', zIndex: 1 }}>
345
334
  <PageHeaderFoot
346
335
  expandLeft={topExpand()}
@@ -356,5 +345,6 @@ export default () => {
356
345
  visible && <ModalComfirm handleCancel={handleCancel} list={selectedRowKey} />
357
346
  }
358
347
  </div>
348
+ </>
359
349
  );
360
350
  };
@@ -1,10 +0,0 @@
1
- .underline{
2
- :global(.ktsAntX-select-selector){
3
- border: none !important;
4
- border-bottom: 1px solid #d9d9d9 !important;
5
- }
6
- :global(.ant-input){
7
- border: none !important;
8
- border-bottom: 1px solid #d9d9d9 !important;
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- .underline{
2
- :global(.ktsAntX-select-selector){
3
- border: none !important;
4
- border-bottom: 1px solid #d9d9d9 !important;
5
- }
6
- :global(.ant-input){
7
- border: none !important;
8
- border-bottom: 1px solid #d9d9d9 !important;
9
- }
10
- }