mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Improve display for locator component (#678)
This commit is contained in:
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'
|
||||
|
||||
export function requestLocatorList({
|
||||
// Get Locator list based on warehouse ID
|
||||
export function getLocatorList({
|
||||
warehouseId
|
||||
}) {
|
||||
const { requestListEntities } = require('@/api/ADempiere/persistence.js')
|
||||
|
||||
return requestListEntities({
|
||||
tableName,
|
||||
whereClause: `M_Warehouse_ID = ${warehouseId}`
|
||||
return new Promise(resolve => {
|
||||
requestListEntities({
|
||||
tableName,
|
||||
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>
|
||||
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 {
|
||||
name: 'FieldLocation',
|
||||
@ -67,34 +67,20 @@ export default {
|
||||
this.value = value
|
||||
},
|
||||
searchLocatorByWarehouse(node, resolve) {
|
||||
requestLocatorList({
|
||||
getLocatorList({
|
||||
warehouseId: node.value
|
||||
})
|
||||
.then(responseData => {
|
||||
const data = responseData.recordsList[this.level]
|
||||
const locatorList = [
|
||||
{
|
||||
value: data.id,
|
||||
label: data.attributes.Value,
|
||||
warehouse: data.id,
|
||||
.then(locators => {
|
||||
const locatorList = []
|
||||
locators.map(locator => {
|
||||
locatorList.push({
|
||||
value: locator.id,
|
||||
label: locator.value,
|
||||
warehouse: locator.warehouseId,
|
||||
leaf: true
|
||||
}, {
|
||||
value: data.id,
|
||||
label: data.attributes.X,
|
||||
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 this
|
||||
resolve(locatorList)
|
||||
})
|
||||
.catch(error => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user