Commit 40b90cda99df5bd2a49fc64428eb54df4182e405

Authored by qiang.tian
1 parent 13fbbdd7

fix: 字段类型错误

@@ -9,9 +9,8 @@ export enum FieldBaseType { @@ -9,9 +9,8 @@ export enum FieldBaseType {
9 YEAR_SEC = 'DATE', 9 YEAR_SEC = 'DATE',
10 } 10 }
11 11
12 -  
13 export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => { 12 export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => {
14 - const [localOptions, setLocalOptions] = useState(props.value || props.options || []); 13 + const [localOptions, setLocalOptions] = useState(props.options || []);
15 14
16 const getDefaultConditionOptions = (item: QxBaseConditionField) => ({ 15 const getDefaultConditionOptions = (item: QxBaseConditionField) => ({
17 ...item, 16 ...item,
@@ -36,7 +35,7 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => { @@ -36,7 +35,7 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => {
36 const handleDelete = (key: number) => { 35 const handleDelete = (key: number) => {
37 localOptions.splice(key, 1); 36 localOptions.splice(key, 1);
38 setLocalOptions([...localOptions]); 37 setLocalOptions([...localOptions]);
39 - props.onChange?.([...localOptions]) 38 + props.onChange?.([...localOptions]);
40 }; 39 };
41 40
42 useEffect(() => { 41 useEffect(() => {
@@ -52,12 +51,18 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => { @@ -52,12 +51,18 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => {
52 key={item.code || key} 51 key={item.code || key}
53 mode={props.mode} 52 mode={props.mode}
54 {...item} 53 {...item}
55 - value={props.value?.[key] || getDefaultConditionOptions(item)} 54 + value={Object.assign(
  55 + {},
  56 + getDefaultConditionOptions(item),
  57 + props.value?.[key] || {},
  58 + )}
56 field={item} 59 field={item}
57 onChange={(val) => handleItemChange(val, key)} 60 onChange={(val) => handleItemChange(val, key)}
58 remove={() => handleDelete(key)} 61 remove={() => handleDelete(key)}
59 ValueAssignmentPopup={ 62 ValueAssignmentPopup={
60 - (item.showValueAssignmentPopup ?? true) ? props.ValueAssignmentPopup : undefined 63 + item.showValueAssignmentPopup ?? true
  64 + ? props.ValueAssignmentPopup
  65 + : undefined
61 } 66 }
62 /> 67 />
63 </div> 68 </div>
@@ -86,7 +91,7 @@ export interface QxBaseConditionOptionsProps extends QxBaseConditionField { @@ -86,7 +91,7 @@ export interface QxBaseConditionOptionsProps extends QxBaseConditionField {
86 [key: string]: any; 91 [key: string]: any;
87 } 92 }
88 93
89 -export type QxBaseConditionMode = 'condition' | 'variable' 94 +export type QxBaseConditionMode = 'condition' | 'variable';
90 95
91 export interface QxBaseConditionProps { 96 export interface QxBaseConditionProps {
92 showIdx?: boolean; 97 showIdx?: boolean;
@@ -41,7 +41,9 @@ export default () => { @@ -41,7 +41,9 @@ export default () => {
41 hideCurrentOrg={true} 41 hideCurrentOrg={true}
42 hideCurrentUser={true} 42 hideCurrentUser={true}
43 isMixValue={false} 43 isMixValue={false}
44 - onChange={() => {}} 44 + onChange={(val) => {
  45 + console.log(222222,val)
  46 + }}
45 tableFields={optionsList} 47 tableFields={optionsList}
46 params={{ funCoded: 'cjQhMZnwkO2QoVzxVPC', useId: true }} 48 params={{ funCoded: 'cjQhMZnwkO2QoVzxVPC', useId: true }}
47 value={{ 49 value={{