|
|
@@ -70,8 +70,9 @@
|
|
|
<script setup lang="uts">
|
|
|
import { ref, onMounted, onUnmounted } from 'vue'
|
|
|
import { getUserInfo } from '../../utils/storage'
|
|
|
+ import { checkPermission } from '../../utils/permission'
|
|
|
import { getPendingReceiveLines, signReceiveLine, getProductSalseList } from '../../api/out/index'
|
|
|
- import { getPendingReceiveApplyCount } from '../../api/apply/index'
|
|
|
+ import { getPendingReceiveApplyCount, getConfirmedApplyCount } from '../../api/apply/index'
|
|
|
type QuickFunction = {
|
|
|
id: number
|
|
|
title: string
|
|
|
@@ -264,22 +265,40 @@ const loadReceiveList = (): void => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- // 加载物料申请待领取 badge 数量
|
|
|
+ // 加载物料申请 badge 数量
|
|
|
const loadApplyBadge = (): void => {
|
|
|
- if (currentUserId.length === 0) return
|
|
|
- // 查询物料申请待领取数量
|
|
|
- getPendingReceiveApplyCount(currentUserId).then((res: any) => {
|
|
|
- const result = res as UTSJSONObject
|
|
|
- const count = result['data']
|
|
|
- // 更新快捷功能中的物料申请 badge
|
|
|
- quickFunctions.value.forEach((functionItem) => {
|
|
|
- if (functionItem.id === 1) {
|
|
|
- functionItem.badge = count != null ? parseInt(count.toString()) : 0
|
|
|
- }
|
|
|
+ const hasPurchasePermission = checkPermission('mes:wm:mergePurchase:add')
|
|
|
+
|
|
|
+ if (hasPurchasePermission) {
|
|
|
+ // 有采购权限,统计已确认单据数量
|
|
|
+ getConfirmedApplyCount().then((res: any) => {
|
|
|
+ const result = res as UTSJSONObject
|
|
|
+ const count = result['data']
|
|
|
+ // 更新快捷功能中的物料申请 badge
|
|
|
+ quickFunctions.value.forEach((functionItem) => {
|
|
|
+ if (functionItem.id === 1) {
|
|
|
+ functionItem.badge = count != null ? parseInt(count.toString()) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch((e) => {
|
|
|
+ console.error('加载物料申请 badge 失败:', e)
|
|
|
})
|
|
|
- }).catch((e) => {
|
|
|
- console.error('加载物料申请 badge 失败:', e)
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ // 没有采购权限,统计待领取数量(保持现状)
|
|
|
+ if (currentUserId.length === 0) return
|
|
|
+ getPendingReceiveApplyCount(currentUserId).then((res: any) => {
|
|
|
+ const result = res as UTSJSONObject
|
|
|
+ const count = result['data']
|
|
|
+ // 更新快捷功能中的物料申请 badge
|
|
|
+ quickFunctions.value.forEach((functionItem) => {
|
|
|
+ if (functionItem.id === 1) {
|
|
|
+ functionItem.badge = count != null ? parseInt(count.toString()) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch((e) => {
|
|
|
+ console.error('加载物料申请 badge 失败:', e)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
// 启动定时刷新
|
|
|
const startRefreshTimer = (): void => {
|