1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<el-select
filterable
:value="value === 0 ? undefined : value"
@change="change"
v-bind="$attrs"
clearable
>
<el-option
v-for="supplier in getSuppliers"
:key="supplier.id"
:label="$l(supplier, 'company')"
:value="supplier.id"
></el-option>
</el-select>
</template>
<script>
/**
* 供应商
*/
export default {
name: "supplierSelect",
props: {
companyType: String,
value: Number,
allSupplier: Array,
//0-國内供應商,1-國外供應商 lanbm 2024-05-11 添加注释
areaType: {
type: Number,
default: 0,
},
},
model: {
prop: "value",
event: "change",
},
data() {
return {};
},
computed: {
getSuppliers() {
//alert(this.areaType);
//alert(this.companyType);
let allSupplier = this.allSupplier.filter(
(item) => item.areaType == this.areaType
);
//0-國内供應商,1-國外供應商 lanbm 2024-05-11 添加注释
//if(this.areaType == 1 || !this.companyType) return allSupplier;
//lanbm 2024-05-11 把或改且,解决空运供应商获取是海运供应商问题
//
if (this.areaType == 1) return allSupplier;
if (
this.companyType == null ||
this.companyType == "" ||
this.companyType == undefined
) {
return allSupplier;
} else {
return allSupplier.filter((item) =>
item.companyTypes.includes(this.companyType)
);
}
},
},
methods: {
change(val) {
this.$emit("change", val);
},
},
};
</script>