|
@@ -13,6 +13,8 @@ const props = withDefaults(
|
|
|
noAll?: boolean;
|
|
|
noSet?: boolean;
|
|
|
code?: string;
|
|
|
+ isSupplier?: boolean;
|
|
|
+ placeholder?: string;
|
|
|
}>(),
|
|
|
{
|
|
|
code: ""
|
|
@@ -40,9 +42,11 @@ let scrollWrapper: HTMLDivElement | null = null;
|
|
|
|
|
|
const debouceScroll = useDebounceFn(handleScroll, 500);
|
|
|
|
|
|
-function convertList(list){
|
|
|
- const isSupplier = userLevel.value === "3"
|
|
|
- if (isSupplier) return list
|
|
|
+function convertList(list) {
|
|
|
+ const isSupplier = userLevel.value === "3" || props.isSupplier;
|
|
|
+
|
|
|
+ if (isSupplier) return list;
|
|
|
+
|
|
|
return list.map(item => ({
|
|
|
...item,
|
|
|
code: item.companyNo,
|
|
@@ -54,12 +58,13 @@ async function requesetSupplierAll(name: string, companyNo: string) {
|
|
|
state.name = name;
|
|
|
state.page = 1;
|
|
|
state.noMore = false;
|
|
|
- const isSupplier = userLevel.value === "3"
|
|
|
- const api = isSupplier ? httpSupplierList : httpBusinessList;
|
|
|
+ const isSupplier = userLevel.value === "3" || props.isSupplier;
|
|
|
+ const api =
|
|
|
+ isSupplier || props.isSupplier ? httpSupplierList : httpBusinessList;
|
|
|
const { data, message, code } = await api({
|
|
|
- [isSupplier ? "name" : 'companyName']: state.name,
|
|
|
- [isSupplier ? "code" : 'companyNo']: companyNo,
|
|
|
- page: state.page,
|
|
|
+ [isSupplier ? "name" : "companyName"]: state.name,
|
|
|
+ [isSupplier ? "code" : "companyNo"]: companyNo,
|
|
|
+ page: state.page
|
|
|
});
|
|
|
|
|
|
responseHandle({
|
|
@@ -92,7 +97,10 @@ async function handleScroll() {
|
|
|
state.page++;
|
|
|
state.loading = true;
|
|
|
|
|
|
- const api = userLevel.value === "3" ? httpSupplierList : httpBusinessList;
|
|
|
+ const api =
|
|
|
+ userLevel.value === "3" || props.isSupplier
|
|
|
+ ? httpSupplierList
|
|
|
+ : httpBusinessList;
|
|
|
|
|
|
const { data, message, code } = await api({
|
|
|
name: state.name,
|
|
@@ -177,9 +185,14 @@ defineExpose({
|
|
|
:remote-method="requesetSupplierAll"
|
|
|
@change="handleChange"
|
|
|
style="width: 450px"
|
|
|
+ :placeholder="placeholder"
|
|
|
ref="selectRef"
|
|
|
>
|
|
|
- <ElOption v-if="!noAll" label="所有公司" :value="''" />
|
|
|
+ <ElOption
|
|
|
+ v-if="!noAll"
|
|
|
+ :label="userLevel === '3' ? '所有供应商公司' : '所有业务公司'"
|
|
|
+ :value="''"
|
|
|
+ />
|
|
|
<ElOption
|
|
|
class="super-item"
|
|
|
v-for="c in list"
|