lu-lowcode-package-form 0.11.41 → 0.11.43
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/dist/index.cjs.js +199 -199
- package/dist/index.es.js +10542 -10533
- package/package.json +1 -1
- package/src/App copy 4.jsx +948 -0
- package/src/App.jsx +3 -471
- package/src/components/field/select/search-select.jsx +58 -20
- package/src/components/form-container/index.jsx +24 -5
@@ -0,0 +1,948 @@
|
|
1
|
+
import { FormContainer, Field, FormContainerWrapper, Layout, Setter, EditorQuill, EditorWang, EditorWang2, EditorWang3, WangEditor, WangEditorNext, Show } from './components';
|
2
|
+
import './App.css';
|
3
|
+
import { Button, Input, Select } from 'antd';
|
4
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
5
|
+
import Draggable from 'react-draggable';
|
6
|
+
import { throttle, debounce } from 'lodash';
|
7
|
+
import { SortList } from "./components"
|
8
|
+
import { TinyMCEEditor } from './components'
|
9
|
+
import { PrinterOutlined } from '@ant-design/icons';
|
10
|
+
const searchSelectOptions = [
|
11
|
+
{ id: 1, name: "1111" },
|
12
|
+
{ id: 2, name: "2222" },
|
13
|
+
{ id: 3, name: "3333" },
|
14
|
+
{ id: 4, name: "4444" },
|
15
|
+
{ id: 5, name: "5555" },
|
16
|
+
{ id: 6, name: "6666" },
|
17
|
+
{ id: 7, name: "7777" },
|
18
|
+
{ id: 8, name: "8888" },
|
19
|
+
{ id: 9, name: "9999" },
|
20
|
+
]
|
21
|
+
const searchSelectRequest = async (params) => {
|
22
|
+
// console.log("params", params)
|
23
|
+
return await new Promise((resolve) => {
|
24
|
+
setTimeout(() => {
|
25
|
+
if (params && params?.name) {
|
26
|
+
resolve({ code: 0, data: searchSelectOptions.filter(item => item.name.includes(params.name)) })
|
27
|
+
}
|
28
|
+
resolve({ code: 0, data: searchSelectOptions })
|
29
|
+
}, 20);
|
30
|
+
})
|
31
|
+
}
|
32
|
+
const DraggableBtn = () => {
|
33
|
+
const [dragging, setDragging] = useState(false);
|
34
|
+
|
35
|
+
const handleStart = (e) => {
|
36
|
+
e.preventDefault();
|
37
|
+
setDragging(false);
|
38
|
+
};
|
39
|
+
|
40
|
+
const handleDrag = () => {
|
41
|
+
setDragging(true);
|
42
|
+
};
|
43
|
+
|
44
|
+
const handleStop = (e) => {
|
45
|
+
e.preventDefault();
|
46
|
+
if (!dragging) {
|
47
|
+
alert('Button clicked!');
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
return (
|
52
|
+
<Draggable
|
53
|
+
onStart={handleStart}
|
54
|
+
onDrag={handleDrag}
|
55
|
+
onStop={handleStop}
|
56
|
+
>
|
57
|
+
<button className="floating-button">Drag me!</button>
|
58
|
+
</Draggable>
|
59
|
+
);
|
60
|
+
}
|
61
|
+
|
62
|
+
const treeData = [
|
63
|
+
{
|
64
|
+
title: '0-1',
|
65
|
+
key: '0-1',
|
66
|
+
children: [
|
67
|
+
{ title: '0-1-0-0', key: '0-1-0-0' },
|
68
|
+
{ title: '0-1-0-1', key: '0-1-0-1' },
|
69
|
+
{ title: '0-1-0-2', key: '0-1-0-2' },
|
70
|
+
],
|
71
|
+
},
|
72
|
+
{
|
73
|
+
title: '0-2',
|
74
|
+
key: '0-2',
|
75
|
+
},
|
76
|
+
];
|
77
|
+
|
78
|
+
function App() {
|
79
|
+
const formRef = React.createRef();
|
80
|
+
const testRef = React.useRef()
|
81
|
+
const [testCalcHidden, setTestCalcHidden] = useState(false);
|
82
|
+
const [readonly, setReadonly] = useState(true);
|
83
|
+
|
84
|
+
const testdebounce = useCallback(debounce((param1, param2) => {
|
85
|
+
console.log("testdebounce param1", param1)
|
86
|
+
console.log("testdebounce param2", param2)
|
87
|
+
}, 200))
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
const [cols, setCols] = React.useState(3);
|
92
|
+
|
93
|
+
const getFormFields = () => {
|
94
|
+
console.log("formRef?.current", formRef)
|
95
|
+
const formData = formRef?.current?.formRef?.getFieldsValue();
|
96
|
+
console.log("formData", JSON.stringify(formData));
|
97
|
+
}
|
98
|
+
// 验证
|
99
|
+
const validateFields = async () => {
|
100
|
+
try {
|
101
|
+
var values = await formRef?.current?.formRef?.validateFields({
|
102
|
+
validateOnly: false,
|
103
|
+
})
|
104
|
+
console.log("values", values)
|
105
|
+
|
106
|
+
} catch (error) {
|
107
|
+
console.log("error", error)
|
108
|
+
console.log(error.errorFields[0].errors[0])
|
109
|
+
}
|
110
|
+
}
|
111
|
+
const setFormFields = () => {
|
112
|
+
formRef?.current?.setFieldsValue({ "__id": 1, "userselect": "1213131", "remark11": { "label": "选项1", "value": "1", "name": "1111", "table": "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, "table2": [{}], "table": [{ "product_num1": "123", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "remark11": { "label": "选项2", "value": "2" }, "product_price12": "", "tianchong1": { "label": "选项1", "value": "1", "tianchong2": { "label": "选项2", "value": "2" }, "tcinput1": "1111" }, "tianchong2": { "label": "选项2", "value": "2", "tcinput1": "8989", "tcinput2": "2222" }, "tcinput1": "8989", "tcinput2": "2222", "tcinput3": "2222" }, { "product_num1": "213", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "datetime2": "2024-08-22 11:09:07", "product_price13": 1, "product_price14": 2, "product_price12": "", "remark11": { "label": "选项3", "value": "3" }, "product_price11": 3 }], "product_total_price": "0.00", "DeptSelect": ["leaf11"], "PostSelect": ["parent 1-1", "leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false, "datetime": "2024-08-25", "datetime2": "2024-08-25", "datetime3": "", "datetime4": "2024-08-22 11:09:04", "remark12": JSON.stringify([{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }]) })
|
113
|
+
// formRef?.current?.setFieldsValue({"tianchong1":{"label":"选项1","value":"1"}, })
|
114
|
+
}
|
115
|
+
const handleCols = () => {
|
116
|
+
|
117
|
+
setCols(cols == 1 ? 3 : cols - 1)
|
118
|
+
}
|
119
|
+
|
120
|
+
const [items, setItems] = useState(['Item 1', 'Item 2', 'Item 3', 'Item 4']);
|
121
|
+
|
122
|
+
const handleUpdateReadonly = () => {
|
123
|
+
setReadonly(!readonly)
|
124
|
+
}
|
125
|
+
|
126
|
+
const [sortItems, setSortItems] = useState([{ id: 1, content: "sdfsfd" }, { id: 2, content: "sdfsfd2" }, { id: 3, content: "sdfsfd3" }]);
|
127
|
+
return (
|
128
|
+
<div className='fflex fflex-col fitems-center fh-screen '>
|
129
|
+
<div className='fflex fgap-2 fitems-center fjustify-center fw-full'>
|
130
|
+
<Button type="primary" onClick={() => {
|
131
|
+
setTestCalcHidden(!testCalcHidden)
|
132
|
+
}}>testCalcHidden</Button>
|
133
|
+
<Button type="primary" onClick={validateFields}>validateFields</Button>
|
134
|
+
<Button type="primary" onClick={getFormFields}>GetValues</Button>
|
135
|
+
<Button type="primary" onClick={setFormFields}>SetValues</Button>
|
136
|
+
<Button type="primary" onClick={() => {
|
137
|
+
console.log("testRef.current", testRef.current)
|
138
|
+
testRef.current?.handleChange({ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" })
|
139
|
+
}}>testwithref</Button>
|
140
|
+
<Button type="primary" onClick={handleCols}>UpdateCol</Button>
|
141
|
+
<Button type="primary" onClick={handleUpdateReadonly}>UpdateReadonly</Button>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div className=" fflex fflex-col fitems-center fflex-1 foverflow-y-auto">
|
145
|
+
<DraggableBtn />
|
146
|
+
{/* <MyPureComponentWithRef ref={testRef} />; */}
|
147
|
+
{/* <div className=' fp-4 fflex fjustify-center fw-[1336px]'>
|
148
|
+
<div className='fflex fflex-col'>
|
149
|
+
<SortList
|
150
|
+
items={sortItems}
|
151
|
+
setItems={setSortItems}
|
152
|
+
renderItem={(item, index, isDragging) => (
|
153
|
+
<div
|
154
|
+
style={{
|
155
|
+
padding: '8px',
|
156
|
+
margin: '4px',
|
157
|
+
border: '1px solid gray',
|
158
|
+
cursor: 'move',
|
159
|
+
opacity: isDragging ? 0.2 : 1,
|
160
|
+
|
161
|
+
}}
|
162
|
+
>
|
163
|
+
{item.content}
|
164
|
+
</div>
|
165
|
+
)}
|
166
|
+
/></div>
|
167
|
+
</div> */}
|
168
|
+
{/* <div className=' fp-4 fflex fjustify-center fw-[1336px]'>
|
169
|
+
<WangEditorNext />
|
170
|
+
</div> */}
|
171
|
+
{/* <div className='fw-full fp-4 fflex fjustify-center'>
|
172
|
+
<TinyMCEEditor />
|
173
|
+
</div> */}
|
174
|
+
{/* <div className='fw-full fp-4 fflex fjustify-center'>
|
175
|
+
<EditorWang />
|
176
|
+
</div> */}
|
177
|
+
{/* <div className='fw-full fp-4'>
|
178
|
+
<EditorQuill value={"[{\"insert\":\"sdfsd\"}]"} />
|
179
|
+
</div>
|
180
|
+
<div className='fw-full fp-4'>
|
181
|
+
<Select
|
182
|
+
mode="tags"
|
183
|
+
style={{ width: '100%' }}
|
184
|
+
placeholder="Tags Mode"
|
185
|
+
options={[{ label: '标签1', value: '1' }, { label: '标签2', value: '2' }]}
|
186
|
+
/>
|
187
|
+
<Setter.OptionSetter />
|
188
|
+
</div> */}
|
189
|
+
<div className='fw-[960px] frounded fbg-slate-50 fflex fflex-col fitems-center fpb-10'>
|
190
|
+
|
191
|
+
|
192
|
+
<FormContainerWrapper cols={cols} key={"formc"} className="" ref={formRef} >
|
193
|
+
|
194
|
+
<Field.WithSingleSelect
|
195
|
+
ref={testRef}
|
196
|
+
request={async (params) => {
|
197
|
+
return {
|
198
|
+
code: 0, data: {
|
199
|
+
list:
|
200
|
+
[
|
201
|
+
{ label: '选项1', value: '1', routeType: 1 },
|
202
|
+
{ label: '选项2', value: '2' , routeType:2 },
|
203
|
+
{ label: '选项3', value: '3' }
|
204
|
+
]
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}}
|
208
|
+
option_label="label"
|
209
|
+
option_value="value"
|
210
|
+
fillRules={[
|
211
|
+
{
|
212
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b19",
|
213
|
+
"type": 0,
|
214
|
+
"source": "routeType",
|
215
|
+
"target": "routeType",
|
216
|
+
},
|
217
|
+
|
218
|
+
]} label="类型填充" __id="fill_routeType" />
|
219
|
+
<Field.RadioGroup
|
220
|
+
buttonStyle="solid"
|
221
|
+
label="菜单类型"
|
222
|
+
__id="routeType"
|
223
|
+
defaultValue={2}
|
224
|
+
options={[{ label: "菜单分组", value: 999 }, { label: "URL", value: 1 }, { label: "绑定表单", value: 2 }]} />
|
225
|
+
|
226
|
+
|
227
|
+
<Field.Input label="测试 withVisible" __id="withVisible"
|
228
|
+
isRequired={true}
|
229
|
+
withIds={["routeType"]}
|
230
|
+
withVisible={{
|
231
|
+
"value": [
|
232
|
+
{
|
233
|
+
"insert": {
|
234
|
+
"span": true
|
235
|
+
},
|
236
|
+
"attributes": {
|
237
|
+
"id": "routeType",
|
238
|
+
"color": "blue",
|
239
|
+
"tagKey": "fieldsValue",
|
240
|
+
"content": "当前表单.开关"
|
241
|
+
}
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"insert": " == 1\n"
|
245
|
+
}
|
246
|
+
],
|
247
|
+
"version": 1734400834533,
|
248
|
+
"withData": [
|
249
|
+
|
250
|
+
]
|
251
|
+
}}
|
252
|
+
/>
|
253
|
+
<Field.Input label="测试 withVisible2" __id="withVisible2"
|
254
|
+
isRequired={true}
|
255
|
+
withIds={["routeType"]}
|
256
|
+
withVisible={{
|
257
|
+
"value": [
|
258
|
+
{
|
259
|
+
"insert": {
|
260
|
+
"span": true
|
261
|
+
},
|
262
|
+
"attributes": {
|
263
|
+
"id": "routeType",
|
264
|
+
"color": "blue",
|
265
|
+
"tagKey": "fieldsValue",
|
266
|
+
"content": "当前表单.开关2"
|
267
|
+
}
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"insert": " == 2\n"
|
271
|
+
}
|
272
|
+
],
|
273
|
+
"version": 1734400834533,
|
274
|
+
"withData": [
|
275
|
+
|
276
|
+
]
|
277
|
+
}}
|
278
|
+
/>
|
279
|
+
<Field.Input label="测试 withVisible21" __id="withVisible21"
|
280
|
+
isRequired={true}
|
281
|
+
withIds={["routeType"]}
|
282
|
+
withVisible={{
|
283
|
+
"value": [
|
284
|
+
{
|
285
|
+
"insert": {
|
286
|
+
"span": true
|
287
|
+
},
|
288
|
+
"attributes": {
|
289
|
+
"id": "routeType",
|
290
|
+
"color": "blue",
|
291
|
+
"tagKey": "fieldsValue",
|
292
|
+
"content": "当前表单.开关2"
|
293
|
+
}
|
294
|
+
},
|
295
|
+
{
|
296
|
+
"insert": " == 2\n"
|
297
|
+
}
|
298
|
+
],
|
299
|
+
"version": 1734400834533,
|
300
|
+
"withData": [
|
301
|
+
|
302
|
+
]
|
303
|
+
}}
|
304
|
+
/>
|
305
|
+
<Field.Select label="绑定表单"
|
306
|
+
option_label={"formTitle"}
|
307
|
+
__id="menuFormTemplateId"
|
308
|
+
withIds={["routeType"]}
|
309
|
+
withVisibleFunc={(fieldsValue) => {
|
310
|
+
const result = fieldsValue?.routeType == 2 ? true : false
|
311
|
+
// console.log("withVisibleFunc menuFormTemplateId", fieldsValue)
|
312
|
+
// console.log("withVisibleFunc menuFormTemplateId result", result)
|
313
|
+
return result
|
314
|
+
}} />
|
315
|
+
|
316
|
+
|
317
|
+
<Field.Input label="隐藏字段" __id="hidden1"
|
318
|
+
calcHidden={true}
|
319
|
+
/>
|
320
|
+
|
321
|
+
<Field.Input label="菜单URL" __id="route"
|
322
|
+
withIds={["routeType"]}
|
323
|
+
withVisibleFunc={(fieldsValue) => {
|
324
|
+
const result = fieldsValue?.routeType == 1 ? true : false
|
325
|
+
// console.log("withVisibleFunc route", fieldsValue)
|
326
|
+
// console.log("withVisibleFunc route result", result)
|
327
|
+
return result
|
328
|
+
}} />
|
329
|
+
<Field.TextArea label="备注" __id="remark"
|
330
|
+
withIds={["routeType"]}
|
331
|
+
withVisibleFunc={(fieldsValue) => {
|
332
|
+
return fieldsValue?.routeType != 999 ? true : false
|
333
|
+
}}
|
334
|
+
/>
|
335
|
+
|
336
|
+
<Field.WithSingleSelect
|
337
|
+
ref={testRef}
|
338
|
+
request={async (params) => {
|
339
|
+
console.log("request params", params)
|
340
|
+
return {
|
341
|
+
code: 0, data: {
|
342
|
+
list:
|
343
|
+
[
|
344
|
+
{ label: '选项1', value: '1', table_fill: [{ fill_tianchong1: { label: '选项1', value: '1' }, fill_tianchong2: { label: '选项2', value: '2' } }] },
|
345
|
+
{ label: '选项2', value: '2' },
|
346
|
+
{ label: '选项3', value: '3' }
|
347
|
+
]
|
348
|
+
}
|
349
|
+
}
|
350
|
+
}}
|
351
|
+
option_label="label"
|
352
|
+
option_value="value"
|
353
|
+
fillRules={[
|
354
|
+
{
|
355
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b19",
|
356
|
+
"type": 1,
|
357
|
+
"source": "table_fill",
|
358
|
+
"target": "table_fill",
|
359
|
+
"subRules": [
|
360
|
+
{
|
361
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b11",
|
362
|
+
"type": 0,
|
363
|
+
"source": "fill_tianchong1",
|
364
|
+
"target": "fill_tianchong1",
|
365
|
+
},
|
366
|
+
]
|
367
|
+
},
|
368
|
+
|
369
|
+
]} label="子表填充数据源" __id="fill_datasource1" />
|
370
|
+
<Layout.FormRow layout={'1'}>
|
371
|
+
<Field.Table label="测试主子表填充" __id="table_fill" isAllowAdd={true} isAllowCopy={true} >
|
372
|
+
|
373
|
+
<Field.WithSingleSelect
|
374
|
+
ref={testRef}
|
375
|
+
request={async (params) => {
|
376
|
+
console.log("request params", params)
|
377
|
+
return { code: 0, data: { list: [{ label: '选项1', value: '1', fill_tianchong2: { label: '选项2', value: '2' }, fill_tcinput1: "1111", }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
|
378
|
+
}}
|
379
|
+
option_label="label"
|
380
|
+
option_value="value"
|
381
|
+
fillRules={[
|
382
|
+
{
|
383
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b19",
|
384
|
+
"type": 0,
|
385
|
+
"source": "fill_tianchong2",
|
386
|
+
"target": "fill_tianchong2",
|
387
|
+
"subRules": [
|
388
|
+
]
|
389
|
+
},
|
390
|
+
{
|
391
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b11",
|
392
|
+
"type": 0,
|
393
|
+
"source": "fill_tcinput1",
|
394
|
+
"target": "fill_tcinput1",
|
395
|
+
"subRules": [
|
396
|
+
]
|
397
|
+
},
|
398
|
+
|
399
|
+
]} label="测试填充1" __id="fill_tianchong1" />
|
400
|
+
<Field.WithSingleSelect
|
401
|
+
ref={testRef}
|
402
|
+
request={async (params) => {
|
403
|
+
if (!params?.value) return { code: 0, data: { list: [{ label: '选项1', value: '1', }] } }
|
404
|
+
await new Promise(resolve => setTimeout(resolve, 200))
|
405
|
+
return { code: 0, data: { list: [{ label: '选项1', value: '1', }, { label: '选项2', value: '2', fill_tcinput1: "8989", fill_tcinput2: "2222" }, { label: '选项3', value: '3' }] } }
|
406
|
+
}}
|
407
|
+
option_label="label"
|
408
|
+
option_value="value"
|
409
|
+
option_search="label"
|
410
|
+
fillRules={[
|
411
|
+
{
|
412
|
+
"id": "636d3924-0298-4e9b-809a-16d4a10d7b29",
|
413
|
+
"type": 0,
|
414
|
+
"source": "fill_tcinput1",
|
415
|
+
"target": "fill_tcinput1",
|
416
|
+
"subRules": [
|
417
|
+
]
|
418
|
+
},
|
419
|
+
{
|
420
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b29",
|
421
|
+
"type": 0,
|
422
|
+
"source": "fill_tcinput2",
|
423
|
+
"target": "fill_tcinput2",
|
424
|
+
"subRules": [
|
425
|
+
]
|
426
|
+
},
|
427
|
+
|
428
|
+
]} label="测试填充2" __id="fill_tianchong2" />
|
429
|
+
<Field.Input label="测试被填充1" __id="fill_tcinput1" />
|
430
|
+
<Field.Input label="测试被填充2" __id="fill_tcinput2" />
|
431
|
+
<Field.Input label="测试被填充计算" __id="fill_tcinput3"
|
432
|
+
withIds={["table_fill.fill_tcinput2"]}
|
433
|
+
withFill={{
|
434
|
+
"value": [
|
435
|
+
{
|
436
|
+
"insert": {
|
437
|
+
"span": true
|
438
|
+
},
|
439
|
+
"attributes": {
|
440
|
+
"id": "table_fill.fill_tcinput2",
|
441
|
+
"color": "blue",
|
442
|
+
"tagKey": "fieldsValue",
|
443
|
+
"content": "当前表单.测试被填充2"
|
444
|
+
}
|
445
|
+
},
|
446
|
+
{
|
447
|
+
"insert": "* 0.5"
|
448
|
+
},
|
449
|
+
{
|
450
|
+
"insert": "\n\n"
|
451
|
+
}
|
452
|
+
],
|
453
|
+
"version": 1719296886283,
|
454
|
+
"withData": [
|
455
|
+
|
456
|
+
]
|
457
|
+
}}
|
458
|
+
/>
|
459
|
+
|
460
|
+
</Field.Table>
|
461
|
+
</Layout.FormRow>
|
462
|
+
<Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测试过滤条件" __id="selecta1" request={async (params) => {
|
463
|
+
return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
|
464
|
+
}}></Field.MultipleSelect>
|
465
|
+
<Layout.FormRow layout={'1'}>
|
466
|
+
|
467
|
+
<Show.WithTable label="测试关联子表" __id="withtable1"
|
468
|
+
filterRules={[
|
469
|
+
{
|
470
|
+
"value": {
|
471
|
+
"parent": "",
|
472
|
+
"field_key": "aa2",
|
473
|
+
"group_key": "fieldsValue",
|
474
|
+
"field_name": "当前表单.测试"
|
475
|
+
},
|
476
|
+
"valueType": "variable",
|
477
|
+
"column": {
|
478
|
+
"label": "库存表.所在仓库",
|
479
|
+
"value": "node_ocm009lpxt2",
|
480
|
+
"column_name": "node_ocm009lpxt2",
|
481
|
+
"column_type": ""
|
482
|
+
}
|
483
|
+
}
|
484
|
+
]} />
|
485
|
+
</Layout.FormRow>
|
486
|
+
<Field.Number label="测试" __id="aa2" isRequired={true} />
|
487
|
+
<Field.Number label="测试" __id="aa3" value={123} readonly={readonly} />
|
488
|
+
<Field.Number label="测试" __id="aa1" calcHidden={true} readonly={readonly} />
|
489
|
+
<Field.Number label="测试" __id="aa4" readonly={readonly} />
|
490
|
+
<Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} readonly={readonly} />
|
491
|
+
<Layout.FormGroupTitle title={"基本信息"} />
|
492
|
+
<Field.WithSingleSelect
|
493
|
+
rightIconRender={({ form, fieldName }) => {
|
494
|
+
// console.log("rightIconRender form", form,)
|
495
|
+
// console.log("rightIconRender fieldName", fieldName)
|
496
|
+
return <><PrinterOutlined /></>
|
497
|
+
}}
|
498
|
+
ref={testRef} fillRules={[
|
499
|
+
{
|
500
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
501
|
+
"type": 0,
|
502
|
+
"source": "shuilv",
|
503
|
+
"target": "shuilv",
|
504
|
+
"subRules": [
|
505
|
+
]
|
506
|
+
},
|
507
|
+
|
508
|
+
]} label="发票类型" options={[{ label: '选项1', value: '1', shuilv: 15, }, { label: '选项2', value: '2', shuilv: 50 }, { label: '选项3', value: '3', shuilv: 2 }]} __id="fapiaoleixing" />
|
509
|
+
|
510
|
+
<Field.Number label="税率(%)" __id="shuilv" />
|
511
|
+
|
512
|
+
<Field.WithSingleSelect ref={testRef} fillRules={[
|
513
|
+
{
|
514
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
515
|
+
"type": 0,
|
516
|
+
"source": "name",
|
517
|
+
"target": "name",
|
518
|
+
"subRules": [
|
519
|
+
|
520
|
+
]
|
521
|
+
},
|
522
|
+
{
|
523
|
+
"id": "93401e38-60a4-4acf-84a6-8958785a4a30",
|
524
|
+
"type": 1,
|
525
|
+
"source": "table",
|
526
|
+
"target": "table",
|
527
|
+
"subRules": [
|
528
|
+
{
|
529
|
+
"id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
|
530
|
+
"type": 0,
|
531
|
+
"source": "price",
|
532
|
+
"target": "product_price1"
|
533
|
+
},
|
534
|
+
|
535
|
+
{
|
536
|
+
"id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
|
537
|
+
"type": 0,
|
538
|
+
"source": "num",
|
539
|
+
"target": "product_num1"
|
540
|
+
},
|
541
|
+
]
|
542
|
+
}
|
543
|
+
]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
|
544
|
+
<Layout.FormRow layout={'1'}>
|
545
|
+
<Field.Number label="测试规则" __id="ceshi_rule1" />
|
546
|
+
</Layout.FormRow>
|
547
|
+
<Layout.FormRow layout={'1'}>
|
548
|
+
<Field.Table label="子表格" __id="table2" isAllowCopy={true} >
|
549
|
+
<Field.Number label="测试规则2" __id="ceshi_rule2" />
|
550
|
+
</Field.Table>
|
551
|
+
</Layout.FormRow>
|
552
|
+
|
553
|
+
<Field.WithSingleSelect
|
554
|
+
ref={testRef}
|
555
|
+
request={async (params) => {
|
556
|
+
console.log("request params", params);
|
557
|
+
const { page = 1, pageSize = 10 } = params; // 获取当前页码,默认为1
|
558
|
+
|
559
|
+
|
560
|
+
// 模拟数据集
|
561
|
+
const allData = [
|
562
|
+
{ label: '选项1', value: '1' },
|
563
|
+
{ label: '选项2', value: '2' },
|
564
|
+
{ label: '选项3', value: '3' },
|
565
|
+
{ label: '选项4', value: '4' },
|
566
|
+
{ label: '选项5', value: '5' },
|
567
|
+
{ label: '选项6', value: '6' },
|
568
|
+
{ label: '选项7', value: '7' },
|
569
|
+
{ label: '选项8', value: '8' },
|
570
|
+
{ label: '选项9', value: '9' },
|
571
|
+
{ label: '选项10', value: '10' },
|
572
|
+
{ label: '选项11', value: '11' },
|
573
|
+
{ label: '选项12', value: '12' },
|
574
|
+
{ label: '选项13', value: '13' },
|
575
|
+
{ label: '选项14', value: '14' },
|
576
|
+
{ label: '选项15', value: '15' },
|
577
|
+
{ label: '选项16', value: '16' },
|
578
|
+
{ label: '选项17', value: '17' },
|
579
|
+
{ label: '选项18', value: '18' },
|
580
|
+
{ label: '选项19', value: '19' },
|
581
|
+
{ label: '选项20', value: '20' },
|
582
|
+
{ label: '选项21', value: '21' },
|
583
|
+
{ label: '选项22', value: '22' },
|
584
|
+
{ label: '选项23', value: '23' },
|
585
|
+
{ label: '选项24', value: '24' }
|
586
|
+
];
|
587
|
+
|
588
|
+
// 根据页码和每页数据量计算当前页的数据
|
589
|
+
const startIndex = (page - 1) * pageSize;
|
590
|
+
const endIndex = startIndex + pageSize;
|
591
|
+
let pageData = []
|
592
|
+
if (startIndex < allData.length) {
|
593
|
+
pageData = allData.slice(startIndex, endIndex);
|
594
|
+
}
|
595
|
+
|
596
|
+
let result = { code: 0, data: { list: pageData } };
|
597
|
+
console.log("request result", result)
|
598
|
+
await new Promise(resolve => setTimeout(resolve, 200))
|
599
|
+
return result
|
600
|
+
}}
|
601
|
+
option_label="label"
|
602
|
+
option_value="value"
|
603
|
+
label="测试请求" __id="ceshirequest" />
|
604
|
+
|
605
|
+
<Layout.FormRow layout={'1'}>
|
606
|
+
<Field.Table label="子表格" __id="table" isAllowAdd={true} isAllowCopy={true} >
|
607
|
+
|
608
|
+
<Field.Number label="税率(%)" __id="shuilv_table" withIds={[
|
609
|
+
"shuilv"
|
610
|
+
]}
|
611
|
+
withFill={{
|
612
|
+
"value": [
|
613
|
+
{
|
614
|
+
"insert": {
|
615
|
+
"span": true
|
616
|
+
},
|
617
|
+
"attributes": {
|
618
|
+
"id": "shuilv",
|
619
|
+
"color": "blue",
|
620
|
+
"tagKey": "fieldsValue",
|
621
|
+
"content": "当前表单.税率(%)"
|
622
|
+
}
|
623
|
+
},
|
624
|
+
|
625
|
+
],
|
626
|
+
"version": 1723016911807,
|
627
|
+
"withData": [
|
628
|
+
|
629
|
+
]
|
630
|
+
}} />
|
631
|
+
<Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
|
632
|
+
|
633
|
+
<Field.WithSingleSelect ref={testRef}
|
634
|
+
request={async (params, ruleParams, fieldName) => {
|
635
|
+
console.log("request params", params, ruleParams, fieldName)
|
636
|
+
if (params?.ruleParams?.node_ocm009lpxt2 == 111)
|
637
|
+
return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
|
638
|
+
else return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' },] } }
|
639
|
+
}}
|
640
|
+
option_label="label"
|
641
|
+
option_value="value"
|
642
|
+
filterRules={[
|
643
|
+
{
|
644
|
+
"value": {
|
645
|
+
"parent": "",
|
646
|
+
"field_key": "shuilv",
|
647
|
+
"group_key": "fieldsValue",
|
648
|
+
"field_name": "当前表单.税率"
|
649
|
+
},
|
650
|
+
"valueType": "variable",
|
651
|
+
"column": {
|
652
|
+
"label": "库存表.所在仓库",
|
653
|
+
"value": "node_ocm009lpxt2",
|
654
|
+
"column_name": "node_ocm009lpxt2",
|
655
|
+
"column_type": ""
|
656
|
+
}
|
657
|
+
}
|
658
|
+
]}
|
659
|
+
|
660
|
+
fillRules={[
|
661
|
+
{
|
662
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
663
|
+
"type": 0,
|
664
|
+
"source": "product_price11",
|
665
|
+
"target": "product_price11",
|
666
|
+
"subRules": [
|
667
|
+
|
668
|
+
]
|
669
|
+
},
|
670
|
+
{
|
671
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
672
|
+
"type": 0,
|
673
|
+
"source": "product_price1",
|
674
|
+
"target": "product_price1",
|
675
|
+
"subRules": [
|
676
|
+
|
677
|
+
]
|
678
|
+
},
|
679
|
+
|
680
|
+
]} label="测试关联单选" __id="remark11" />
|
681
|
+
|
682
|
+
<Field.Switch label="开关" __id="switch_table"></Field.Switch>
|
683
|
+
<Field.Input defaultValue={3} label="含税单价" __id="product_price11" />
|
684
|
+
<Field.Input label="未税单价" __id="product_price12"
|
685
|
+
withIds={[
|
686
|
+
"table.product_price11",
|
687
|
+
"shuilv"
|
688
|
+
]}
|
689
|
+
withFill={{
|
690
|
+
"value": [
|
691
|
+
{
|
692
|
+
"insert": "("
|
693
|
+
},
|
694
|
+
{
|
695
|
+
"insert": {
|
696
|
+
"span": true
|
697
|
+
},
|
698
|
+
"attributes": {
|
699
|
+
"id": "table.product_price11",
|
700
|
+
"color": "blue",
|
701
|
+
"tagKey": "fieldsValue",
|
702
|
+
"content": "当前表单.产品列表.含税单价"
|
703
|
+
}
|
704
|
+
},
|
705
|
+
{
|
706
|
+
"insert": "/(1+"
|
707
|
+
},
|
708
|
+
{
|
709
|
+
"insert": {
|
710
|
+
"span": true
|
711
|
+
},
|
712
|
+
"attributes": {
|
713
|
+
"id": "shuilv",
|
714
|
+
"color": "blue",
|
715
|
+
"tagKey": "fieldsValue",
|
716
|
+
"content": "当前表单.税率(%)"
|
717
|
+
}
|
718
|
+
},
|
719
|
+
{
|
720
|
+
"insert": "/ 100)).toFixed(2)\n\n\n"
|
721
|
+
}
|
722
|
+
],
|
723
|
+
"version": 1723016911807,
|
724
|
+
"withData": [
|
725
|
+
|
726
|
+
]
|
727
|
+
}}
|
728
|
+
/>
|
729
|
+
<Field.Input defaultValue={1} label="商品价格" __id="product_price13" />
|
730
|
+
<Field.Input defaultValue={2} label="商品价格" __id="product_price14" />
|
731
|
+
<Field.Input label="商品价格" __id="product_price1" />
|
732
|
+
<Field.Input label="商品个数" __id="product_num1" />
|
733
|
+
<Field.Input disabled={true} label="商品总价" __id="product_sum1"
|
734
|
+
withIds={["table.product_price1", "table.product_num1"]}
|
735
|
+
withFill={{
|
736
|
+
"value": [
|
737
|
+
{
|
738
|
+
"insert": {
|
739
|
+
"span": true
|
740
|
+
},
|
741
|
+
"attributes": {
|
742
|
+
"id": "table.product_price1",
|
743
|
+
"color": "blue",
|
744
|
+
"tagKey": "fieldsValue",
|
745
|
+
"content": "当前表单.商品价格"
|
746
|
+
}
|
747
|
+
},
|
748
|
+
{
|
749
|
+
"insert": "*"
|
750
|
+
},
|
751
|
+
{
|
752
|
+
"insert": {
|
753
|
+
"span": true
|
754
|
+
},
|
755
|
+
"attributes": {
|
756
|
+
"id": "table.product_num1",
|
757
|
+
"color": "blue",
|
758
|
+
"tagKey": "fieldsValue",
|
759
|
+
"content": "当前表单.商品个数"
|
760
|
+
}
|
761
|
+
},
|
762
|
+
{
|
763
|
+
"insert": "\n\n"
|
764
|
+
}
|
765
|
+
],
|
766
|
+
"version": 1719296886283,
|
767
|
+
"withData": [
|
768
|
+
|
769
|
+
]
|
770
|
+
}} />
|
771
|
+
<Field.Input label="分组名" __id="node_oclxmzswzti" />
|
772
|
+
<Field.MultipleSelect mode="multiple" label="测多选" __id="select2" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.MultipleSelect>
|
773
|
+
|
774
|
+
</Field.Table>
|
775
|
+
</Layout.FormRow>
|
776
|
+
<Field.Input label="总价" disabled={true} __id="product_total_price" withIds={[
|
777
|
+
"table.product_sum1"
|
778
|
+
]}
|
779
|
+
withFill={{
|
780
|
+
"value": [
|
781
|
+
{
|
782
|
+
"insert": {
|
783
|
+
"span": true
|
784
|
+
},
|
785
|
+
"attributes": {
|
786
|
+
"id": "table.product_sum1",
|
787
|
+
"color": "blue",
|
788
|
+
"tagKey": "fieldsValue",
|
789
|
+
"content": "当前表单.标签.小计"
|
790
|
+
}
|
791
|
+
},
|
792
|
+
{
|
793
|
+
"insert": ".reduce((acc, curr) => parseFloat(acc||0) + parseFloat(curr||0), 0).toFixed(2)"
|
794
|
+
},
|
795
|
+
{
|
796
|
+
"insert": "\n"
|
797
|
+
}
|
798
|
+
],
|
799
|
+
"version": 1719383786677,
|
800
|
+
"withData": [
|
801
|
+
|
802
|
+
]
|
803
|
+
}}
|
804
|
+
/>
|
805
|
+
<Field.UserSelect label="选择用户" __id="userselect" customComponent={Input} />
|
806
|
+
<Field.DeptSelect label="DeptSelect" __id="DeptSelect" treeData={[{
|
807
|
+
value: 'parent 1-1',
|
808
|
+
title: 'parent 1-1',
|
809
|
+
children: [
|
810
|
+
{
|
811
|
+
value: 'leaf11',
|
812
|
+
title: <b style={{ color: '#08c' }}>leaf11</b>,
|
813
|
+
},
|
814
|
+
],
|
815
|
+
},]}></Field.DeptSelect>
|
816
|
+
<Field.PostSelect multiple={true} label="PostSelect" __id="PostSelect" treeData={[{
|
817
|
+
value: 'parent 1-1',
|
818
|
+
title: 'parent 1-1',
|
819
|
+
children: [
|
820
|
+
{
|
821
|
+
value: 'leaf11',
|
822
|
+
title: <b style={{ color: '#08c' }}>leaf11</b>,
|
823
|
+
},
|
824
|
+
],
|
825
|
+
},]}></Field.PostSelect>
|
826
|
+
<Field.SearchSelect mode='multiple' label="搜组件" __id="searchuser" request={searchSelectRequest} option_search={"name"} option_label="name" option_value="id"></Field.SearchSelect>
|
827
|
+
<Field.Input label="商品价格" __id="product_price" defaultValue={"12"} readonly={true} />
|
828
|
+
<Field.Input label="商品数量" __id="product_num" rules={"^(1[3-9]\\d{9})$"} />
|
829
|
+
<Field.NumberRange label="数量范围" __id="product_num_range" />
|
830
|
+
<Field.Input rules={["^(1[3-9]\\d{9})$", "^\\d+$"]} label="商品总价" __id="product_sum"
|
831
|
+
withIds={["product_price", "product_num"]}
|
832
|
+
withFill={{
|
833
|
+
"value": [
|
834
|
+
{
|
835
|
+
"insert": {
|
836
|
+
"span": true
|
837
|
+
},
|
838
|
+
"attributes": {
|
839
|
+
"id": "product_price",
|
840
|
+
"color": "blue",
|
841
|
+
"tagKey": "fieldsValue",
|
842
|
+
"content": "当前表单.商品价格"
|
843
|
+
}
|
844
|
+
},
|
845
|
+
{
|
846
|
+
"insert": "* "
|
847
|
+
},
|
848
|
+
{
|
849
|
+
"insert": {
|
850
|
+
"span": true
|
851
|
+
},
|
852
|
+
"attributes": {
|
853
|
+
"id": "product_num",
|
854
|
+
"color": "blue",
|
855
|
+
"tagKey": "fieldsValue",
|
856
|
+
"content": "当前表单.商品个数"
|
857
|
+
}
|
858
|
+
},
|
859
|
+
{
|
860
|
+
"insert": "\n\n"
|
861
|
+
}
|
862
|
+
],
|
863
|
+
"version": 1719296886283,
|
864
|
+
"withData": [
|
865
|
+
|
866
|
+
]
|
867
|
+
}} />
|
868
|
+
|
869
|
+
<Field.SingleSelect mode="single" option_value={"id"} label="测试单选" __id="select1" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.SingleSelect>
|
870
|
+
<Field.MultipleSelect mode="multiple" label="测多选" __id="select2" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.MultipleSelect>
|
871
|
+
<Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测多选2" __id="select2222" request={async (params) => {
|
872
|
+
return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
|
873
|
+
}}></Field.MultipleSelect>
|
874
|
+
<Field.TreeSelect label="分组名" __id="title11"></Field.TreeSelect>
|
875
|
+
<Field.Switch label="开关" __id="switch"></Field.Switch>
|
876
|
+
<Layout.FormGroupTitle title={"嘟嘟嘟嘟嘟"} />
|
877
|
+
<Field.CodeMachine label="角色编号" prompt="" __id="code"
|
878
|
+
withIds={["switch"]}
|
879
|
+
withVisibleFunc={(fieldsValue) => {
|
880
|
+
return fieldsValue?.switch ? true : false
|
881
|
+
}}
|
882
|
+
/>
|
883
|
+
|
884
|
+
<div className=' fh-10 fw-full fbg-green-300' __id="div1111"
|
885
|
+
_componentName="Field.div"
|
886
|
+
withIds={["switch"]}
|
887
|
+
withVisibleFunc={(fieldsValue) => {
|
888
|
+
return fieldsValue?.switch ? true : false
|
889
|
+
}}>1111</div>
|
890
|
+
<Field.DatePicker defaultNow={true} label="datetime" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
|
891
|
+
<Field.DatePicker label="datetime2" prompt="" datetype="date" __id="datetime2" />
|
892
|
+
<Field.DatePicker readonly={true} defaultNow={true} label="datetime3" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
|
893
|
+
<Field.DatePicker defaultNow={true} label="datetime4" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
|
894
|
+
<Field.Input label="角色名称" __id="name" />
|
895
|
+
<Layout.FormRow layout={'1,1'}>
|
896
|
+
<Field.Input label="角色名称布局" __id="name1" />
|
897
|
+
<Field.Input label="角色名称布局2" __id="name2" />
|
898
|
+
</Layout.FormRow>
|
899
|
+
<Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
|
900
|
+
<Layout.FormGroupTitle title={"关联信息"} />
|
901
|
+
<Field.WithMultipleSelect disabled={true} label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
|
902
|
+
<Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
|
903
|
+
|
904
|
+
<Layout.FormRow layout={'1'}>
|
905
|
+
<Field.RadioGroup withIds={["remark11"]}
|
906
|
+
withFill={{
|
907
|
+
"value": [
|
908
|
+
{
|
909
|
+
"insert": {
|
910
|
+
"span": true
|
911
|
+
},
|
912
|
+
"attributes": {
|
913
|
+
"id": "remark11",
|
914
|
+
"color": "blue",
|
915
|
+
"tagKey": "fieldsValue",
|
916
|
+
"content": "测试关联单选"
|
917
|
+
}
|
918
|
+
},
|
919
|
+
],
|
920
|
+
"version": 1719296886283,
|
921
|
+
"withData": [
|
922
|
+
|
923
|
+
]
|
924
|
+
}} options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="单选框" __id="radio" ></Field.RadioGroup>
|
925
|
+
</Layout.FormRow>
|
926
|
+
<Layout.FormRow layout={'1'}>
|
927
|
+
<Field.CheckboxGroup options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="多选框" __id="CheckboxGroup" ></Field.CheckboxGroup>
|
928
|
+
</Layout.FormRow>
|
929
|
+
<Field.UploadFile label="上传文件" __id="UploadFile" ></Field.UploadFile>
|
930
|
+
<Field.UploadImage label="上传图片" __id="UploadImage" ></Field.UploadImage>
|
931
|
+
|
932
|
+
</FormContainerWrapper>
|
933
|
+
<div className="fgroup">11111
|
934
|
+
<div className="fbg-red-500 group-hover:fbg-blue-500">
|
935
|
+
Hover over me or my parent!
|
936
|
+
</div>
|
937
|
+
</div>
|
938
|
+
|
939
|
+
</div>
|
940
|
+
|
941
|
+
</div>
|
942
|
+
</div>
|
943
|
+
);
|
944
|
+
}
|
945
|
+
|
946
|
+
export default App;
|
947
|
+
|
948
|
+
export { FormContainer, Field, FormContainerWrapper } from './components'
|