From ded017bd2c0c81f66cefa9771bb998c97dd96a4c Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Tue, 17 Jan 2023 06:45:38 +0000
Subject: [PATCH] 修复

---
 eladmin-web-master/src/views/project/project/index.vue |   63 ++++++++++++++++++++++++++-----
 1 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/eladmin-web-master/src/views/project/project/index.vue b/eladmin-web-master/src/views/project/project/index.vue
index cc23b95..f535033 100644
--- a/eladmin-web-master/src/views/project/project/index.vue
+++ b/eladmin-web-master/src/views/project/project/index.vue
@@ -59,6 +59,19 @@
           :disabled="crud.selections.length === 0"
           @click="projectAdmit(crud.selections)"
         >承认</el-button>
+        <el-button
+          slot="right"
+          v-permission="permission.seeTask"
+          class="filter-item"
+          size="mini"
+          type="primary"
+          icon="el-icon-share"
+          :disabled="crud.selections.length !== 1"
+          style="margin-left: 4px !important;"
+          @click="toSeeTask(crud.selections[0])"
+        >
+          查看任务
+        </el-button>
       </crudOperation>
       <!--表单组件-->
       <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="690px">
@@ -331,7 +344,8 @@
         edit: ['admin', 'project:edit'],
         del: ['admin', 'project:del'],
         download: ['admin', 'project:download'],
-        admit: ['admin', 'project:admit']
+        admit: ['admin', 'project:admit'],
+        seeTask: ['admin', 'project:seeTask']
       },
       rules: {
         name: [
@@ -411,7 +425,9 @@
   methods: {
     // 钩子:在获取表格数据之前执行,false 则代表不获取数据
     [CRUD.HOOK.beforeRefresh]() {
+      // 获取项目类型
       this.getPackageTypeAll()
+      // 获取责任人
       this.getUserListAll()
       return true
     },
@@ -422,7 +438,9 @@
     },
     // 获取项目类型
     getPackageTypeAll() {
+      // 获取项目类型
       crudProjectType.getAll().then(res => {
+        // 项目类型列表
         this.projectTypeList = res
       }).catch(() => {
 
@@ -430,7 +448,9 @@
     },
     // 获取责任人
     getUserListAll() {
+      // 获取责任人
       crudUser.getAll().then(res => {
+        // 用户列表
         this.userList = res
       }).catch(() => {
 
@@ -446,8 +466,9 @@
         this.form.quotationPrice = res[0].standardQuotationPrice
         // 单价金额赋值
         this.form.performancePrice = res[0].standardPerformancePrice
-        //
+        // 绩效目标赋值
         this.form.performanceObjectives = res[0].standardPerformanceObjectives
+        // 随机数
         this.random = Math.random()
       })
     },
@@ -457,10 +478,12 @@
     },
     // 项目承认
     projectAdmit(row) {
+      // 选中的id
       this.ids = []
       // 判断是多个项目承认还是单个项目承认
       if (row.id !== undefined) {
         this.$refs[`popover_${row.id}`].showPopper = false
+        // 选中的id
         this.ids.push(row.id)
         // 项目承认
         crudProject.editAdmit(this.ids).then(res => {
@@ -468,30 +491,48 @@
           this.crud.refresh()
         })
       } else {
+        // 确认框
         this.$confirm('此操作将承认' + row.length + '个项目, 是否继续?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'success'
         }).then(() => {
-          this.$message({
-            type: 'success',
-            message: '项目已承认!'
-          })
+          // 循环选中数据
           for (let i = 0; i < row.length; i++) {
+            // 选中的id
             this.ids.push(row[i].id)
+            // 判断循环是否结束
+            if (i === row.length - 1) {
+              // 项目承认
+              crudProject.editAdmit(this.ids).then(res => {
+                // 消息提示
+                this.$message({
+                  type: 'success',
+                  message: '项目已承认!'
+                })
+                // 刷新数据
+                this.crud.refresh()
+              })
+            }
           }
-          // 项目承认
-          crudProject.editAdmit(this.ids).then(res => {
-            // 刷新数据
-            this.crud.refresh()
-          })
         }).catch(() => {
+          // 消息提示
           this.$message({
             type: 'info',
             message: '已取消项目承认'
           })
         })
       }
+    },
+    // 查看任务
+    toSeeTask(data) {
+      // 跳转页面
+      this.$router.push({
+        name: 'ProjectTask',
+        params: {
+          projectId: data.id
+        }
+      })
     }
   }
 }

--
Gitblit v1.9.3