Commit f474161ae7759f05d05f713d5f1d80aed1ad8af7

Authored by 陈洋
1 parent c03f6a67

pref: 参数设计器 添加字段

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