Lines 2-8
Link Here
|
2 |
<v-select |
2 |
<v-select |
3 |
:id="id" |
3 |
:id="id" |
4 |
v-model="model" |
4 |
v-model="model" |
5 |
:label="queryProperty" |
5 |
:label="label" |
6 |
:options="paginationRequired ? paginated : data" |
6 |
:options="paginationRequired ? paginated : data" |
7 |
:reduce="item => item[dataIdentifier]" |
7 |
:reduce="item => item[dataIdentifier]" |
8 |
@open="onOpen" |
8 |
@open="onOpen" |
Lines 30-69
Link Here
|
30 |
import { APIClient } from "../fetch/api-client.js" |
30 |
import { APIClient } from "../fetch/api-client.js" |
31 |
|
31 |
|
32 |
export default { |
32 |
export default { |
33 |
created() { |
|
|
34 |
switch (this.dataType) { |
35 |
case "vendors": |
36 |
this.dataIdentifier = "id" |
37 |
this.queryProperty = "name" |
38 |
break |
39 |
case "agreements": |
40 |
this.dataIdentifier = "agreement_id" |
41 |
this.queryProperty = "name" |
42 |
break |
43 |
case "licenses": |
44 |
this.dataIdentifier = "license_id" |
45 |
this.queryProperty = "name" |
46 |
break |
47 |
case "localPackages": |
48 |
this.dataIdentifier = "package_id" |
49 |
this.queryProperty = "name" |
50 |
break |
51 |
default: |
52 |
break |
53 |
} |
54 |
}, |
55 |
props: { |
33 |
props: { |
56 |
id: String, |
34 |
id: String, |
57 |
dataType: String, |
35 |
dataType: String, |
58 |
modelValue: Number, |
36 |
modelValue: Number, |
|
|
37 |
label: String, |
38 |
dataIdentifier: String, |
59 |
required: Boolean, |
39 |
required: Boolean, |
60 |
}, |
40 |
}, |
61 |
emits: ["update:modelValue"], |
41 |
emits: ["update:modelValue"], |
62 |
data() { |
42 |
data() { |
63 |
return { |
43 |
return { |
64 |
observer: null, |
44 |
observer: null, |
65 |
dataIdentifier: null, |
|
|
66 |
queryProperty: null, |
67 |
limit: null, |
45 |
limit: null, |
68 |
search: "", |
46 |
search: "", |
69 |
scrollPage: null, |
47 |
scrollPage: null, |
Lines 82-88
export default {
Link Here
|
82 |
}, |
60 |
}, |
83 |
filtered() { |
61 |
filtered() { |
84 |
return this.data.filter(item => |
62 |
return this.data.filter(item => |
85 |
item[this.queryProperty].includes(this.search) |
63 |
item[this.label].includes(this.search) |
86 |
) |
64 |
) |
87 |
}, |
65 |
}, |
88 |
paginated() { |
66 |
paginated() { |
Lines 124-130
export default {
Link Here
|
124 |
this.data = [] |
102 |
this.data = [] |
125 |
this.search = e |
103 |
this.search = e |
126 |
const client = APIClient.erm |
104 |
const client = APIClient.erm |
127 |
const attribute = "me." + this.queryProperty |
105 |
const attribute = "me." + this.label |
128 |
const q = {} |
106 |
const q = {} |
129 |
q[attribute] = { like: `%${e}%` } |
107 |
q[attribute] = { like: `%${e}%` } |
130 |
await client[this.dataType] |
108 |
await client[this.dataType] |
131 |
- |
|
|