diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 1d9ba9dd..68980b17 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -271,10 +271,9 @@ const fetchRejectReasons = async(query: any): Promise => { const getAvailablePickers = async (query: any): Promise => { return api({ - url: 'performFind', - method: 'get', - params: query, - cache: true + url: "solr-query", + method: "post", + data: query, }) } diff --git a/src/views/AssignPickerModal.vue b/src/views/AssignPickerModal.vue index cc2f5cb7..26b74018 100644 --- a/src/views/AssignPickerModal.vue +++ b/src/views/AssignPickerModal.vue @@ -190,54 +190,36 @@ export default defineComponent({ }, async findPickers() { this.isLoading = true; - - let inputFields = {} + let query = {} this.pickers = [] if(this.queryString.length > 0) { - inputFields = { - firstName_value: this.queryString, - firstName_op: 'contains', - firstName_ic: 'Y', - firstName_grp: '1', - externalId_value: this.queryString, - externalId_op: 'contains', - externalId_ic: 'Y', - externalId_grp: '2', - lastName_value: this.queryString, - lastName_op: 'contains', - lastName_ic: 'Y', - lastName_grp: '3', - partyId_value: this.queryString, - partyId_op: 'contains', - partyId_ic: 'Y', - partyId_grp: '4', - groupName_value: this.queryString, - groupName_op: 'contains', - groupName_ic: 'Y', - groupName_grp: '5' - } + let keyword = this.queryString.trim().split(' ') + query = `(${keyword.map(key => `*${key}*`).join(' OR ')}) OR "${this.queryString}"^100`; + } + else { + query = `*:*` } const payload = { - inputFields: { - ...inputFields, - roleTypeIdTo: 'WAREHOUSE_PICKER' - }, - viewSize: 50, - entityName: 'PartyRelationshipAndDetail', - noConditionFind: 'Y', - orderBy: "firstName ASC", - filterByDate: "Y", - distinct: "Y", - fieldList: ["firstName", "groupName", "lastName", "partyId", "externalId"] + "json": { + "params": { + "rows": "50", + "q": query, + "defType" : "edismax", + "qf": "firstName lastName groupName partyId externalId", + "sort": "firstName asc" + }, + "filter": ["docType:EMPLOYEE", "WAREHOUSE_PICKER_role:true"] + } } try { const resp = await UtilService.getAvailablePickers(payload); if (resp.status === 200 && !hasError(resp)) { - this.pickers = resp.data.docs.map((picker) => ({ - name: picker.groupName ? picker.groupName : picker.firstName + ' ' + picker.lastName, + this.pickers = resp.data.response.docs.map((picker) => ({ + name: picker.groupName ? picker.groupName : (picker.firstName || picker.lastName) + ? (picker.firstName ? picker.firstName : '') + (picker.lastName ? ' ' + picker.lastName : '') : picker.partyId, id: picker.partyId, externalId: picker.externalId }))