Improve display for locator component (#678)
							parent
							
								
									9a56b69292
								
							
						
					
					
						commit
						44077e45f8
					
				|  | @ -1,12 +1,31 @@ | ||||||
|  | // API used for get information of locator from server API,
 | ||||||
|  | // please don't change it if is not related to locator field
 | ||||||
| const tableName = 'M_Locator' | const tableName = 'M_Locator' | ||||||
| 
 | 
 | ||||||
| export function requestLocatorList({ | // Get Locator list based on warehouse ID
 | ||||||
|  | export function getLocatorList({ | ||||||
|   warehouseId |   warehouseId | ||||||
| }) { | }) { | ||||||
|   const { requestListEntities } = require('@/api/ADempiere/persistence.js') |   const { requestListEntities } = require('@/api/ADempiere/persistence.js') | ||||||
| 
 |   return new Promise(resolve => { | ||||||
|   return requestListEntities({ |     requestListEntities({ | ||||||
|     tableName, |       tableName, | ||||||
|     whereClause: `M_Warehouse_ID = ${warehouseId}` |       whereClause: `M_Warehouse_ID = ${warehouseId}` | ||||||
|  |     }).then(locatorData => { | ||||||
|  |       var locatorList = [] | ||||||
|  |       if (locatorData) { | ||||||
|  |         locatorData.recordsList.map(record => { | ||||||
|  |           locatorList.push({ | ||||||
|  |             id: record.id, | ||||||
|  |             value: record.attributes.Value, | ||||||
|  |             warehouseId: record.attributes.M_Warehouse_ID, | ||||||
|  |             rack: record.attributes.X, | ||||||
|  |             column: record.attributes.Y, | ||||||
|  |             level: record.attributes.Z | ||||||
|  |           }) | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |       resolve(locatorList) | ||||||
|  |     }) | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js' | import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js' | ||||||
| import { requestLocatorList } from '@/api/ADempiere/field/locator.js' | import { getLocatorList } from '@/api/ADempiere/field/locator.js' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: 'FieldLocation', |   name: 'FieldLocation', | ||||||
|  | @ -67,34 +67,20 @@ export default { | ||||||
|       this.value = value |       this.value = value | ||||||
|     }, |     }, | ||||||
|     searchLocatorByWarehouse(node, resolve) { |     searchLocatorByWarehouse(node, resolve) { | ||||||
|       requestLocatorList({ |       getLocatorList({ | ||||||
|         warehouseId: node.value |         warehouseId: node.value | ||||||
|       }) |       }) | ||||||
|         .then(responseData => { |         .then(locators => { | ||||||
|           const data = responseData.recordsList[this.level] |           const locatorList = [] | ||||||
|           const locatorList = [ |           locators.map(locator => { | ||||||
|             { |             locatorList.push({ | ||||||
|               value: data.id, |               value: locator.id, | ||||||
|               label: data.attributes.Value, |               label: locator.value, | ||||||
|               warehouse: data.id, |               warehouse: locator.warehouseId, | ||||||
|               leaf: true |               leaf: true | ||||||
|             }, { |             }) | ||||||
|               value: data.id, |           }) | ||||||
|               label: data.attributes.X, |           //  Resolve this | ||||||
|               warehouse: data.id, |  | ||||||
|               leaf: true |  | ||||||
|             }, { |  | ||||||
|               value: data.id, |  | ||||||
|               label: data.attributes.Y, |  | ||||||
|               warehouse: data.id, |  | ||||||
|               leaf: true |  | ||||||
|             }, { |  | ||||||
|               value: data.id, |  | ||||||
|               label: data.attributes.Z, |  | ||||||
|               warehouse: data.id, |  | ||||||
|               leaf: true |  | ||||||
|             } |  | ||||||
|           ] |  | ||||||
|           resolve(locatorList) |           resolve(locatorList) | ||||||
|         }) |         }) | ||||||
|         .catch(error => { |         .catch(error => { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Yamel Senih
						Yamel Senih