Commit f474161ae7759f05d05f713d5f1d80aed1ad8af7

Authored by 陈洋
1 parent c03f6a67

pref: 参数设计器 添加字段

... ... @@ -6,7 +6,7 @@
6 6 align-items: center;
7 7 justify-content: space-between;
8 8 font-size: 14px;
9   - color: @N9
  9 + color: @N9;
10 10 }
11 11
12 12 &__header-icon {
... ... @@ -17,7 +17,7 @@
17 17
18 18 &__header-filter {
19 19 display: inline-block;
20   - min-width: 80px;
  20 + width: 100px;
21 21
22 22 &__select {
23 23 width: 100%;
... ... @@ -28,7 +28,7 @@
28 28 color: @N8;
29 29
30 30 &:hover {
31   - color: @E3
  31 + color: @E3;
32 32 }
33 33 }
34 34
... ... @@ -44,7 +44,7 @@
44 44 display: flex;
45 45 align-items: center;
46 46 justify-content: center;
47   - color: @N7
  47 + color: @N7;
48 48 }
49 49 }
50 50 }
... ...
... ... @@ -49,20 +49,20 @@ const valueOptions = [
49 49 { key: 'BOOL', title: '布尔' },
50 50 { key: 'OBJECT', title: '对象' },
51 51 { key: 'ARRAY', title: '数组' },
52   - { key: 'ANNEX', title: '附件' },
53   - { key: 'PIC', title: '图片' },
  52 + /*{ key: 'ANNEX', title: '附件' },
  53 + { key: 'PIC', title: '图片' },*/
54 54 { key: 'FORM', title: '表单' },
55 55 { key: 'USER', title: '人员' },
56 56 { key: 'ORG', title: '部门' },
57 57 ];
58 58
59 59 const timeFormat = [
60   - { lable: '年', value: 'YEAR' },
61   - { lable: '年-月', value: 'YEAR_MONTH' },
62   - { lable: '年-月-日', value: 'YEAR_DATE' },
63   - { lable: '年-月-日 时', value: 'YEAR_HOUR' },
64   - { lable: '年-月-日 时:分', value: 'YEAR_MIN' },
65   - { lable: '年-月-日 时:分:秒', value: 'YEAR_SEC' },
  60 + { label: '年', value: 'YEAR' },
  61 + { label: '年-月', value: 'YEAR_MONTH' },
  62 + { label: '年-月-日', value: 'YEAR_DATE' },
  63 + { label: '年-月-日 时', value: 'YEAR_HOUR' },
  64 + { label: '年-月-日 时:分', value: 'YEAR_MIN' },
  65 + { label: '年-月-日 时:分:秒', value: 'YEAR_SEC' },
66 66 ];
67 67
68 68 interface ParameterSettingProps {
... ... @@ -79,7 +79,8 @@ interface ParameterSettingProps {
79 79 handleAdd: (val: any) => void;
80 80 handleDelete: (val: any) => void;
81 81 appFormList?: any[]; // 当前应用表单list
82   - request?: any,
  82 + request?: any;
  83 + nodeType?: string | 'START' | 'END';
83 84 }
84 85 const EditableContext = React.createContext<FormInstance<any> | null>(null);
85 86
... ... @@ -120,8 +121,8 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
120 121 handleChange,
121 122 handleChangeField,
122 123 inputKey,
  124 + nodeType,
123 125 } = props;
124   - console.log('data', data);
125 126 // const [form] = Form.useForm()
126 127
127 128 //判断数组是否只有一个子节点
... ... @@ -139,7 +140,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
139 140 };
140 141
141 142 const checkShowTree = (_data: any) => {
142   - // console.log('_data', _data)
143 143 if (_data.type == 'ARRAY') {
144 144 if (_data.child && _data.child.length > 0) {
145 145 return false;
... ... @@ -244,8 +244,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
244 244 editable: true,
245 245 key: 'qxProps',
246 246 render: (text: any, record: any) => {
247   - console.log('record ====', record);
248   - console.log('text ====', text);
249 247 return (
250 248 <>
251 249 {record.type === 'FORM' ? <>
... ... @@ -392,6 +390,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
392 390 children: React.ReactNode;
393 391 dataIndex: keyof any;
394 392 record: any;
  393 + index: number;
395 394 // handleSave: (record: Item) => void;
396 395 }
397 396
... ... @@ -409,12 +408,10 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
409 408 const form = useContext(EditableContext)!;
410 409 const qxProps = record?.qxProps || {};
411 410 const [currentNode, setCurrentNode] = useState<any>('');
412   - // console.log('dataIndex', dataIndex)
413 411
414 412 useEffect(() => {
415 413 if (editing) {
416 414 if (inputRef.current) {
417   - // console.log('setEditing', inputRef)
418 415 inputRef.current!.focus();
419 416 }
420 417 }
... ... @@ -434,7 +431,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
434 431 const toggleEdit1 = (e) => {
435 432 const values = form.getFieldsValue();
436 433 e.persist();
437   - // console.log('vae.target.tagNamelues', e.target.tagName)
438 434 if (e.target.tagName == 'DIV') {
439 435 setCurrentNode(e.target)
440 436 // console.log('values', values)
... ... @@ -443,31 +439,8 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
443 439 props.handleChange(values?.newQxProps, record, 'qxProps')
444 440 }
445 441 }
446   -
447   - // setCurrentNode(e.currentTarget)
448   - // console.log('e-onburl', e.currentTarget.key)
449   - //
450   - // if (e.currentTarget == e.target) {
451   - // // setEditing(!editing);
452   - // }
453   - // form.setFieldsValue({ [dataIndex]: record[dataIndex] });
454 442 };
455 443
456   - // const test = (value) => {
457   - // console.log('value', value)
458   - // // form.setFieldsValue({
459   - // // ['qxProps']: { value: value }
460   - // // })
461   - // }
462   - // const toggleEdit2 = (e) => {
463   - // e.persist();
464   - // // console.log('e-onforce', e.currentTarget)
465   -
466   - // // e.dataTransfer.setData('text', e.target.getAttribute('data-row-key'));
467   - // // console.log('currentTarget-fource', currentNode)
468   - // // form.setFieldsValue({ [dataIndex]: record[dataIndex] });
469   - // };
470   -
471 444 const save = async (code: string) => {
472 445 const isProps = code.indexOf('qxProps');
473 446 const _newCode = isProps > -1 ? code.slice(8) : '';
... ... @@ -480,7 +453,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
480 453 props.handleChange(newValue, record, code);
481 454 // toggleEdit();
482 455 } catch (errInfo) {
483   - console.log('Save failed:', errInfo);
  456 + console.warn('Save failed:', errInfo);
484 457 }
485 458 };
486 459
... ... @@ -642,7 +615,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
642 615 key={item.value}
643 616 value={item.value}
644 617 >
645   - {item.lable}
  618 + {item.label}
646 619 </Select.Option>
647 620 );
648 621 })}
... ... @@ -859,7 +832,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
859 832 onCell: (record: any, index: any) => ({
860 833 index,
861 834 record,
862   - editable: record.disabled ? false : true,
  835 + editable: !record.disabled,
863 836 dataIndex: col.dataIndex,
864 837 title: col.title,
865 838 // handleSave,
... ...
... ... @@ -74,6 +74,7 @@ interface ParameterSettingProps {
74 74 // comHandleChange?: (val: any) => void;
75 75 appFormList?: any[]; // 当前应用表单list
76 76 request?: any,
  77 + nodeType?: string | 'START' | 'END';
77 78 }
78 79
79 80 export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
... ... @@ -779,6 +780,7 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
779 780 visible={visible}
780 781 request={props?.request}
781 782 appFormList={props?.appFormList}
  783 + nodeType={props?.nodeType}
782 784 />
783 785 </div>
784 786 );
... ...