bugfix multiple call for lookup item (#324)
							parent
							
								
									252cc43679
								
							
						
					
					
						commit
						2d9b33398e
					
				| 
						 | 
				
			
			@ -138,8 +138,11 @@ export default {
 | 
			
		|||
      if (!this.metadata.inTable) {
 | 
			
		||||
        if (this.metadata.displayed) {
 | 
			
		||||
          if (!this.options.some(option => option.key === value)) {
 | 
			
		||||
            this.options.push({
 | 
			
		||||
              key: value,
 | 
			
		||||
              label: this.findLabel(value)
 | 
			
		||||
            })
 | 
			
		||||
            this.value = value
 | 
			
		||||
            this.getDataLookupItem()
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        this.value = value
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,8 @@ const callOutControl = {
 | 
			
		|||
              newValues,
 | 
			
		||||
              isSendToServer: false,
 | 
			
		||||
              withOutColumnNames,
 | 
			
		||||
              isSendCallout: false
 | 
			
		||||
              isSendCallout: false,
 | 
			
		||||
              isChangeFromCallout: true
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -362,7 +362,8 @@ const panel = {
 | 
			
		|||
      isSendCallout = true,
 | 
			
		||||
      isAdvancedQuery = false,
 | 
			
		||||
      isPrivateAccess = false,
 | 
			
		||||
      fieldList = []
 | 
			
		||||
      fieldList = [],
 | 
			
		||||
      isChangeFromCallout = false
 | 
			
		||||
    }) {
 | 
			
		||||
      if (!fieldList.length) {
 | 
			
		||||
        fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
 | 
			
		||||
| 
						 | 
				
			
			@ -377,6 +378,46 @@ const panel = {
 | 
			
		|||
        if (!newValues.hasOwnProperty(actionField.columnName)) {
 | 
			
		||||
          return
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isChangeFromCallout && actionField.componentPath === 'FieldSelect' && !newValues.hasOwnProperty(`DisplayColumn_${actionField.columnName}`)) {
 | 
			
		||||
          const lookup = getters.getLookupItem({
 | 
			
		||||
            parentUuid: parentUuid,
 | 
			
		||||
            containerUuid: containerUuid,
 | 
			
		||||
            directQuery: actionField.reference.directQuery,
 | 
			
		||||
            tableName: actionField.reference.tableName,
 | 
			
		||||
            value: newValues[actionField.columnName]
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          if (isEmptyValue(lookup)) {
 | 
			
		||||
            dispatch('getLookupItemFromServer', {
 | 
			
		||||
              parentUuid: parentUuid,
 | 
			
		||||
              containerUuid: containerUuid,
 | 
			
		||||
              tableName: actionField.reference.tableName,
 | 
			
		||||
              directQuery: actionField.reference.parsedDirectQuery,
 | 
			
		||||
              value: newValues[actionField.columnName]
 | 
			
		||||
            })
 | 
			
		||||
              .then(response => {
 | 
			
		||||
                dispatch('notifyFieldChange', {
 | 
			
		||||
                  isSendToServer,
 | 
			
		||||
                  isSendCallout,
 | 
			
		||||
                  isAdvancedQuery,
 | 
			
		||||
                  panelType,
 | 
			
		||||
                  parentUuid,
 | 
			
		||||
                  containerUuid,
 | 
			
		||||
                  columnName: actionField.columnName,
 | 
			
		||||
                  displayColumn: response.label,
 | 
			
		||||
                  newValue: newValues[actionField.columnName],
 | 
			
		||||
                  valueTo: newValues[`${actionField.columnName}_To`],
 | 
			
		||||
                  fieldList,
 | 
			
		||||
                  field: actionField,
 | 
			
		||||
                  withOutColumnNames,
 | 
			
		||||
                  isChangedOldValue: true // defines if set oldValue with newValue instead of current value
 | 
			
		||||
                })
 | 
			
		||||
              })
 | 
			
		||||
          } else {
 | 
			
		||||
            newValues[`DisplayColumn_${actionField.columnName}`] = lookup.label
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        dispatch('notifyFieldChange', {
 | 
			
		||||
          isSendToServer,
 | 
			
		||||
          isSendCallout,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue