Ver código fonte

feat: 调整delivery表格操作栏逻辑判断

Jack Zhou 3 meses atrás
pai
commit
e06f19f6ec

+ 2 - 1
src/stores/modules/user.ts

@@ -9,6 +9,7 @@ interface UserInfo {
   last_name: string
   user_type: string
   email: string
+  employee_email: string
   expire_day: number
   date_format: string
   numbers_format: string
@@ -86,7 +87,7 @@ export const useUserStore = defineStore('user', {
 
     async logout(isNeedLogout: boolean = true) {
       if (isNeedLogout) {
-        await $api.logout().then(() => {})
+        await $api.logout().then(() => { })
       }
       localStorage.removeItem('userInfo')
       this.userInfo = {}

+ 28 - 5
src/views/DestinationDelivery/src/components/TableView/src/TableView.vue

@@ -9,6 +9,9 @@ import BookingDetailDialog from './components/BookingDetailDialog.vue'
 import EmailDialog from './components/EmailDialog.vue'
 import TipsDialog from './components/TipsDialog.vue'
 import { useRouter } from 'vue-router'
+import { useUserStore } from '@/stores/modules/user'
+
+const userStore = useUserStore()
 const router = useRouter()
 
 const props = defineProps({
@@ -388,7 +391,11 @@ defineExpose({
         </el-button>
         <!-- email -->
         <el-button
-          v-if="!isEmployeeRole && row.status === 'Approved'"
+          v-if="
+            !isEmployeeRole &&
+            row.status === 'Approved' &&
+            row.modify_by === userStore.userInfo.uname
+          "
           @click="clickEmailBtn(row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
@@ -400,7 +407,11 @@ defineExpose({
           @click="handleEdit(row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
-          v-if="!isEmployeeRole && (row.status === 'Pending Approval' || row.status === 'Rejected')"
+          v-if="
+            !isEmployeeRole &&
+            (row.status === 'Pending Approval' || row.status === 'Rejected') &&
+            row.modify_by === userStore.userInfo.uname
+          "
         >
           <span class="font_family icon-icon_edit_b"> </span>
         </el-button>
@@ -409,7 +420,11 @@ defineExpose({
           @click="handleTips('cancel', row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
-          v-if="!isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="
+            !isEmployeeRole &&
+            row.status === 'Pending Approval' &&
+            row.modify_by === userStore.userInfo.uname
+          "
         >
           <span class="font_family icon-icon_cancelled_b"> </span>
         </el-button>
@@ -417,14 +432,22 @@ defineExpose({
         <el-button
           @click="handleTips('approve', row)"
           class="action-btn el-button--blue"
-          v-if="isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="
+            isEmployeeRole &&
+            row.status === 'Pending Approval' &&
+            row.kln_pic.includes(userStore.userInfo.employee_email)
+          "
           style="height: 24px; width: 24px"
         >
           <span class="font_family icon-icon_confirm_b"> </span>
         </el-button>
         <!-- reject -->
         <el-button
-          v-if="isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="
+            isEmployeeRole &&
+            row.status === 'Pending Approval' &&
+            row.kln_pic.includes(userStore.userInfo.employee_email)
+          "
           @click="handleTips('reject', row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"