m0_70156489 7 hours ago
parent
commit
136c13cc0e
1 changed files with 35 additions and 3 deletions
  1. 35 3
      src/view/SalaryManage/SalaryList.vue

+ 35 - 3
src/view/SalaryManage/SalaryList.vue

@@ -316,10 +316,28 @@
         <el-table-column label="标准工时(秒)" prop="标准工时" width="120" align="center" />
         <el-table-column label="标准总工时(秒)" prop="生产工时" width="150" align="center" />
         <!-- <el-table-column label="生产总工分" prop="生产分数" width="100" align="center" /> -->
-        <el-table-column label="操作" width="140" align="center" fixed="right">
+        <el-table-column
+          v-if="showDetailActions"
+          label="操作"
+          :width="canEditDetail && canDeleteDetail ? 140 : 80"
+          align="center"
+          fixed="right"
+        >
           <template #default="{ row }">
-            <el-button type="primary" link size="small" @click="openEditQty(row)">修改</el-button>
-            <el-button type="danger" link size="small" @click="deleteReportingWork(row)">删除</el-button>
+            <el-button
+              v-if="canEditDetail"
+              type="primary"
+              link
+              size="small"
+              @click="openEditQty(row)"
+            >修改</el-button>
+            <el-button
+              v-if="canDeleteDetail"
+              type="danger"
+              link
+              size="small"
+              @click="deleteReportingWork(row)"
+            >删除</el-button>
           </template>
         </el-table-column>
 
@@ -416,10 +434,16 @@ import {
 import ProcessProduction from '@/view/SalaryManage/ProcessProduction.vue'
 import TableColumnFilterHeader from '@/view/SalaryManage/TableColumnFilterHeader.vue'
 import { useUserStore } from '@/pinia/modules/user'
+import { useBtnAuth } from '@/utils/btnAuth'
 
 defineOptions({ name: 'SalaryList' })
 
 const userStore = useUserStore()
+/** 菜单可控按钮名:edit=修改,delete=删除(角色管理里分配) */
+const btnAuth = useBtnAuth()
+const canEditDetail = computed(() => !!btnAuth.edit)
+const canDeleteDetail = computed(() => !!btnAuth.delete)
+const showDetailActions = computed(() => canEditDetail.value || canDeleteDetail.value)
 
 const processProductionVisible = ref(false)
 const processProductionDialogKey = ref(0)
@@ -1329,6 +1353,10 @@ const deleteConfirmForm = ref({
 })
 
 function openEditQty(row) {
+  if (!canEditDetail.value) {
+    ElMessage.warning('无修改权限')
+    return
+  }
   const id = row?.id ?? row?.ID
   if (id === undefined || id === null || id === '') {
     ElMessage.warning('缺少报工记录ID,无法修改')
@@ -1348,6 +1376,10 @@ function openEditQty(row) {
 }
 
 function deleteReportingWork(row) {
+  if (!canDeleteDetail.value) {
+    ElMessage.warning('无删除权限')
+    return
+  }
   const deleteId = row?.id ?? row?.ID
   if (deleteId === undefined || deleteId === null || deleteId === '') {
     ElMessage.warning('缺少报工记录ID,无法删除')