From b54921574744d19ffa4872ebbeec732a5fe7d408 Mon Sep 17 00:00:00 2001
From: yaozc2021 <yaozc@yhzhg.cn>
Date: Tue, 15 Apr 2025 02:04:33 +0000
Subject: [PATCH] 出差关联查询

---
 eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue b/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
index 0b45d4a..b9510d2 100644
--- a/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
+++ b/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
@@ -250,6 +250,26 @@
               "
             />
           </el-form-item>
+          <el-form-item label="关联项目" prop="projectId">
+            <el-select
+              v-model="form.projectId"
+              filterable
+              clearable
+              placeholder="请选择"
+              style="width: 340px;"
+              :disabled="
+                form.approvalStatus == dictGoOutAgree ||
+                  form.approvalStatus == dictGoOutReturn
+              "
+            >
+              <el-option
+                v-for="item in projects"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
           <el-form-item label="出差分类" prop="category">
             <el-select
               v-model="form.category"
@@ -459,6 +479,16 @@
           show-overflow-tooltip
         />
         <el-table-column
+          prop="category"
+          label="出差分类"
+          width="80"
+          show-overflow-tooltip
+        >
+          <template slot-scope="scope">
+            {{ dict.label[dictBusinessTravelCategory][scope.row.category] }}
+          </template>
+        </el-table-column>
+        <el-table-column
           prop="approvalStatus"
           label="审批状态"
           width="80"
@@ -581,6 +611,7 @@
 <script>
 import crudAttendanceBusinessTravel from '@/api/attendance/attendanceBusinessTravel'
 import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import crudProject from '@/api/project/project'
 import rrOperation from '@crud/RR.operation'
 import crudUser from '@/api/system/user'
 import { mapGetters } from 'vuex'
@@ -602,6 +633,7 @@
   departureCity: null,
   arrivalCity: null,
   category: null,
+  projectId: null,
   approvalStatus: null,
   approvalDescription: null,
   remarks: null,
@@ -659,10 +691,15 @@
         ],
         approvalStatus: [
           { required: true, message: '审批状态不能为空', trigger: 'change' }
+        ],
+        projectId: [
+          { required: true, message: '请选择项目', trigger: 'change' }
         ]
       },
       users: [],
       approvalUsers: [],
+      // 项目列表
+      projects: [],
       dictBussinessStatus: constant.BUSSINESS_APPROVE_STATUS,
       dictGoOutAppRev: constant.BUSSINESS_APPROVE_STATUS_REVIEWED,
       dictGoOutAgree: constant.BUSSINESS_APPROVE_STATUS_AGREE,
@@ -693,6 +730,8 @@
       const userRolesLevel = this.user.roles.map(({ level }) => level)
       // 用户最大角色级别
       this.userRolesLevelMin = Math.min(...userRolesLevel)
+      // 获取项目列表
+      this.getProjects()
       return true
     },
     // 钩子:新建 - 之前
@@ -717,6 +756,17 @@
         return true
       }
     },
+    // 获取项目列表
+    getProjects() {
+      // 获取项目列表
+      crudProject.getRelevant({
+        'projectStatusIn': ['project_status_not_started', 'project_status_under_way'],
+        'approve_status': 'approve_status_acknowledged'
+      }).then(res => {
+        // 项目列表
+        this.projects = res
+      })
+    },
     // 查询员工
     getUsers() {
       crudUser.getAll().then(res => {

--
Gitblit v1.9.3