提交 ff1782cc authored 作者: leon's avatar leon

医生,收货人列表 是否是经销商判断

上级 efd67664
...@@ -31,7 +31,16 @@ const getDistributorId = ({ colProps }) => { ...@@ -31,7 +31,16 @@ const getDistributorId = ({ colProps }) => {
rules: [{ required: true, type: 'object', message: '请选择经销商!' }], rules: [{ required: true, type: 'object', message: '请选择经销商!' }],
}, },
table: { table: {
customRender: ({ text, record }) => get(record, 'distributor.name') || text, customRender: ({ text, record }) => {
const getText = (text) => {
if (text === 0) {
return '供应商创建';
} else {
return '(已删除/不存在)';
}
};
return get(record, 'distributor.name') || getText(text);
},
}, },
}; };
}; };
......
...@@ -67,6 +67,12 @@ export const useUserStore = defineStore({ ...@@ -67,6 +67,12 @@ export const useUserStore = defineStore({
getDistributorId(): number { getDistributorId(): number {
return this.userInfo?.distributorId as number; return this.userInfo?.distributorId as number;
}, },
/**
* @description 是否是经销商 true 是 false
*/
getIsDistributor(): boolean {
return this.getDistributorId !== 0;
},
}, },
actions: { actions: {
setToken(info: string | undefined) { setToken(info: string | undefined) {
......
...@@ -194,10 +194,8 @@ ...@@ -194,10 +194,8 @@
} }
}); });
// 如果是经销商,只能看到自己的数据 // 如果是经销商,只能看到自己的数据
if (userStore.getDistributorId !== 0) { if (userStore.getIsDistributor) {
handledParams.distributorId = userStore.getDistributorId; handledParams.distributorId = userStore.getDistributorId;
} else if (userStore.getDistributorId == null) {
handledParams.distributorId = -1;
} }
return handledParams; return handledParams;
}; };
......
...@@ -191,10 +191,8 @@ ...@@ -191,10 +191,8 @@
} }
}); });
// 如果是经销商,只能看到自己的数据 // 如果是经销商,只能看到自己的数据
if (userStore.getDistributorId !== 0) { if (userStore.getIsDistributor) {
handledParams.distributorId = userStore.getDistributorId; handledParams.distributorId = userStore.getDistributorId;
} else if (userStore.getDistributorId == null) {
handledParams.distributorId = -1;
} }
return handledParams; return handledParams;
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论