From 86b0362eaf4c320dc6a54fc12ce80b0bf7890a85 Mon Sep 17 00:00:00 2001
From: yaozc <yaozc@yhzhg.cn>
Date: Thu, 30 May 2024 02:06:17 +0000
Subject: [PATCH] 11111

---
 eladmin-web-master/src/views/task/taskUser/index.vue |  708 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 358 insertions(+), 350 deletions(-)

diff --git a/eladmin-web-master/src/views/task/taskUser/index.vue b/eladmin-web-master/src/views/task/taskUser/index.vue
index f805d9b..5866264 100644
--- a/eladmin-web-master/src/views/task/taskUser/index.vue
+++ b/eladmin-web-master/src/views/task/taskUser/index.vue
@@ -34,9 +34,9 @@
             </div>
             <div
               v-if="!infinite"
+              v-loading="taskLoading"
               class="infinite-list"
               style="overflow:auto;height:500px"
-              v-loading="taskLoading"
             >
               <el-card
                 v-for="task in taskDatas"
@@ -107,15 +107,14 @@
                   :color="ProgressStatus"
                   :format="formatTaskProgress"
                 />
-                <br />
-                <i>任务预计时长:{{ expectedHours }}小时</i
-                ><i style="margin-left: 40px"
-                  >任务实际用时:{{ actualHours }}小时</i
-                >
+                <br>
+                <i>任务预计时长:{{ expectedHours }}小时</i><i
+                  style="margin-left: 40px"
+                >任务实际用时:{{ actualHours }}小时</i>
               </div>
             </el-card>
           </div>
-          <br />
+          <br>
           <div
             v-if="steps.length > 0"
             v-loading="dialogLoading_taskUser"
@@ -168,13 +167,13 @@
                 :key="index"
                 style="padding-top: 10px"
               >
-                <span>{{ index }} 分配时长: {{ item }} 小时</span><br />
+                <span>{{ index }} 分配时长: {{ item }} 小时</span><br>
               </div>
             </el-card>
           </div>
           <div v-else>
             <el-card style="padding-top: 10px">
-              <span>暂无数据</span><br />
+              <span>暂无数据</span><br>
             </el-card>
           </div>
           <div
@@ -185,8 +184,8 @@
         </el-dialog>
 
         <el-dialog
-          title="临期任务"
           v-loading="taskLoading_L"
+          title="临期任务"
           :visible.sync="dialogVisible_task_LQ"
           @closed="setNull"
           @close="dialogLoading_task_LQ = false"
@@ -219,14 +218,14 @@
               </el-tab-pane>
             </el-tabs>
             <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
               :current-page="currentPage"
               :page-sizes="[10, 20, 30, 40]"
               :page-size="pageSize"
               layout="total, prev, pager, next, sizes , jumper"
               :total="total"
-            ></el-pagination>
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+            />
           </el-card>
         </el-dialog>
         <!--工具栏-->
@@ -279,23 +278,20 @@
               icon="el-icon-plus"
               style="margin-right: 6px;"
               @click="openGenerate"
-              >导入</el-button
-            >
+            >导入</el-button>
             <el-button
               slot="right"
-              :loading="slong"
               v-permission="permission.generate"
+              :loading="slong"
               class="filter-item"
               size="mini"
               type="primary"
               icon="el-icon-bottom"
               style="margin-right: 6px;"
               @click="exportUser()"
-              >生成员工Excel</el-button
-            >
+            >生成员工Excel</el-button>
             <el-button
               slot="right"
-              v-permission="permission.generate"
               :disabled="crud.selections.length !== 1"
               class="filter-item"
               size="mini"
@@ -303,42 +299,39 @@
               icon="el-icon-search"
               style="margin-right: 6px;"
               @click="showDetail(crud.selections[0])"
-              >任务详情</el-button
-            >
+            >任务详情</el-button>
             <el-button
               slot="right"
               v-permission="permission.generate"
+              :disabled="crud.selections.length === 0"
               class="filter-item"
               size="mini"
               type="primary"
               icon="el-icon-check"
               style="margin-right: 6px;"
-              @click="taskCompleted"
-              >任务完结</el-button
-            >
+              @click="toTaskCompleted"
+            >任务完结</el-button>
             <el-button
               slot="right"
-              v-permission="permission.generate"
               class="filter-item"
               size="mini"
               type="primary"
               icon="el-icon-tickets"
               style="margin-right: 60px;"
               @click="adventTesk()"
-              >临期任务</el-button
-            >
+            >临期任务</el-button>
           </crudOperation>
           <div>
             <span>
               当前任务:<i> {{ selectedTaskName }} </i>
-              <span v-if="taskTotal.performanceType" style="magin: right 10px;"
-                ><i>
-                  (绩效类型:
-                  {{
-                    taskTotal.performanceType === "1" ? "绩效" : "非绩效"
-                  }})</i
-                ></span
-              >
+              <span
+                v-if="taskTotal.performanceType"
+                style="magin: right 10px;"
+              ><i>
+                (绩效类型:
+                {{
+                  taskTotal.performanceType === "1" ? "绩效" : "非绩效"
+                }})</i></span>
             </span>
             <el-divider>
               <span
@@ -434,9 +427,9 @@
                 style="width: 340px;"
                 @change="withUser(form)"
               >
-                <template slot="append"
-                  >小时</template
-                >
+                <template
+                  slot="append"
+                >小时</template>
               </el-input>
             </el-form-item>
             <el-form-item label="所属员工" prop="userId">
@@ -471,9 +464,9 @@
                 style="width: 340px;"
                 :disabled="true"
               >
-                <template slot="append"
-                  >小时</template
-                >
+                <template
+                  slot="append"
+                >小时</template>
               </el-input>
             </el-form-item>
             <el-form-item label="任务进度" prop="newTaskProgress">
@@ -484,23 +477,11 @@
               />
             </el-form-item>
             <el-form-item v-if="form.newTaskProgress === 100" label="任务状态">
-              <!-- <el-switch
-                v-if="form.taskStatus === taskSt"
-                v-model="form.is_ok"
-                v-permission="permission.list"
-                active-text="已完成"
-              />
-              <el-switch
-                v-if="form.taskStatus === taskSo"
-                v-model="form.is_ok"
-                v-permission="permission.list"
-                active-text="未承认"
-              /> -->
               <el-switch
                 v-if="form.taskStatus === taskSt || form.taskStatus === taskSo"
                 v-model="form.is_ok"
                 v-permission="permission.list"
-                :active-text= "taskStatusOne"
+                :active-text="taskStatusOne"
                 @change="handleChange"
               />
             </el-form-item>
@@ -511,8 +492,7 @@
               :loading="crud.status.cu === 2"
               type="primary"
               @click="crud.submitCU"
-              >确认</el-button
-            >
+            >确认</el-button>
           </div>
         </el-dialog>
         <el-table
@@ -581,13 +561,19 @@
           />
           <el-table-column
             :show-overflow-tooltip="true"
+            prop="costHours"
+            label="消耗工时"
+            width="80"
+          />
+          <el-table-column
+            :show-overflow-tooltip="true"
             label="任务进度"
             width="80"
           >
             <template slot-scope="scope">
-              <span style="margin-left: 10px"
-                >{{ scope.row.newTaskProgress }}%</span
-              >
+              <span
+                style="margin-left: 10px"
+              >{{ scope.row.newTaskProgress }}%</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -619,8 +605,7 @@
                 type="primary"
                 style="float: left"
                 :disabled="true"
-                >已分配</el-button
-              >
+              >已分配</el-button>
               <el-button
                 v-else
                 slot="left"
@@ -629,8 +614,7 @@
                 type="primary"
                 style="float: left"
                 @click="unPick(scope.row)"
-                >获取</el-button
-              >
+              >获取</el-button>
               <udOperation
                 v-if="flag"
                 :data="scope.row"
@@ -642,6 +626,19 @@
         <!--表格渲染-->
         <!--分页组件-->
         <pagination />
+        <!--进度不足100%-->
+        <el-dialog
+          title="提示"
+          :visible.sync="centerDialogVisibleTaskProgress"
+          width="30%"
+          center
+        >
+          <span>当前要完结的任务中存在没有到达100%的任务,确定要完结吗?</span>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="centerDialogVisibleTaskProgress = false">取 消</el-button>
+            <el-button type="primary" @click="doTaskCompleted">确 定</el-button>
+          </span>
+        </el-dialog>
         <!--表单组件-->
         <el-dialog
           :close-on-click-modal="false"
@@ -676,8 +673,7 @@
               type="primary"
               :disabled="uploading"
               @click="submitGenerate"
-              >确认</el-button
-            >
+            >确认</el-button>
           </div>
         </el-dialog>
       </el-col>
@@ -685,28 +681,29 @@
   </div>
 </template>
 <script>
-import crudTaskUser from "@/api/task/taskUser";
-import crudTask from "@/api/task/task";
-import crudUser from "@/api/system/user";
-import crudUserInsurance from "@/api/treatment/userInsurance";
-import CRUD, { presenter, header, form, crud } from "@crud/crud";
-import rrOperation from "@crud/RR.operation";
-import crudOperation from "@crud/CRUD.operation";
-import udOperation from "@crud/UD.operation";
-import pagination from "@crud/Pagination";
-import DateRangePicker from "@/components/DateRangePicker";
-import Treeselect from "@riophae/vue-treeselect";
-import { mapGetters } from "vuex";
-import constant from "@/utils/constant";
-import UploadExcelComponent from "@/components/UploadExcel/index.vue";
-import UploadExcelComponentTwo from "@/components/UploadExcel/excelIndex.vue";
-import { transformData, formatExcelDate } from "@/utils/trans";
-import { parseTime, downloadFile } from "@/utils/index";
+import crudTaskUser from '@/api/task/taskUser'
+import crudTask from '@/api/task/task'
+import crudUser from '@/api/system/user'
+import crudUserInsurance from '@/api/treatment/userInsurance'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import DateRangePicker from '@/components/DateRangePicker'
+import Treeselect from '@riophae/vue-treeselect'
+import { mapGetters } from 'vuex'
+import constant from '@/utils/constant'
+import UploadExcelComponent from '@/components/UploadExcel/index.vue'
+import UploadExcelComponentTwo from '@/components/UploadExcel/excelIndex.vue'
+import { transformData, formatExcelDate } from '@/utils/trans'
+import { parseTime, downloadFile } from '@/utils/index'
 const defaultForm = {
   id: null,
+  name: null,
   userId: null,
   projectId: null,
-  task: { id: null },
+  task: { id: null, name: null },
   taskStartDate: null,
   taskEndDate: null,
   taskHours: null,
@@ -716,9 +713,9 @@
   remarks: null,
   divideUserIds: [],
   is_ok: null
-};
+}
 export default {
-  name: "TaskUser",
+  name: 'TaskUser',
   // eslint-disable-next-line vue/no-unused-components
   components: {
     Treeselect,
@@ -732,10 +729,10 @@
   },
   cruds() {
     return CRUD({
-      title: "任务分配",
-      url: "api/taskUser",
+      title: '任务分配',
+      url: 'api/taskUser',
       crudMethod: { ...crudTaskUser }
-    });
+    })
   },
   mixins: [presenter(), header(), form(defaultForm), crud()],
   // 数据字典
@@ -749,47 +746,47 @@
     // 时长(万内)验证
     // eslint-disable-next-line no-unused-vars
     var durationValidate = (rule, value, callback) => {
-      const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/;
-      if (value != null && value !== "" && !reg.test(value)) {
-        callback(new Error("请输入 一万 以内的正整数或两位小数"));
+      const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/
+      if (value != null && value !== '' && !reg.test(value)) {
+        callback(new Error('请输入 一万 以内的正整数或两位小数'))
       } else {
-        callback();
+        callback()
       }
-    };
+    }
     return {
       projectId: null,
       projectDatas: [],
-      taskName: "",
-      selectedTaskName: "",
+      taskName: '',
+      selectedTaskName: '',
       planStartTime: null,
       planEndTime: null,
       taskTotal: {},
       taskDatas: [],
       taskLoading: false,
-      defaultProps: { children: "nodes", label: "name", isLeaf: "leaf" },
+      defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' },
       permission: {
-        list: ["admin", "taskUser:list"],
-        add: ["admin", "taskUser:add"],
-        edit: ["admin", "taskUser:edit"],
-        del: ["admin", "taskUser:del"],
-        download: ["admin", "taskUser:download"],
-        generate: ["admin", "taskUser:add"]
+        list: ['admin', 'taskUser:list'],
+        add: ['admin', 'taskUser:add'],
+        edit: ['admin', 'taskUser:edit'],
+        del: ['admin', 'taskUser:del'],
+        download: ['admin', 'taskUser:download'],
+        generate: ['admin', 'taskUser:add']
       },
       rules: {
         taskStartDate: [
-          { required: true, message: "任务开始时间不能为空", trigger: "change" }
+          { required: true, message: '任务开始时间不能为空', trigger: 'change' }
         ],
         taskEndDate: [
-          { required: true, message: "任务结束时间不能为空", trigger: "change" }
+          { required: true, message: '任务结束时间不能为空', trigger: 'change' }
         ],
         taskHours: [
-          { required: true, message: "任务时长不能为空", trigger: "change" }
+          { required: true, message: '任务时长不能为空', trigger: 'change' }
         ]
       },
       queryTypeOptions: [
-        { key: "userId", display_name: "所属员工" },
-        { key: "taskStatus", display_name: "任务状态" },
-        { key: "createTime", display_name: "创建时间" }
+        { key: 'userId', display_name: '所属员工' },
+        { key: 'taskStatus', display_name: '任务状态' },
+        { key: 'createTime', display_name: '创建时间' }
       ],
       // 字典:任务状态
       taskStatus: constant.TASK_STATUS,
@@ -818,10 +815,12 @@
       generateStatus: false,
       // 生成表单加载
       generateLoading: false,
+      // 进度未达到100%确认
+      centerDialogVisibleTaskProgress: false,
       uploading: true,
       flag: false,
       infinite: false,
-      selectedTask: "",
+      selectedTask: '',
       dialogVisible_taskUser: false,
       dialogLoading_taskUser: true,
       taskLoading_L: true,
@@ -830,16 +829,16 @@
       dialogLoading_task: true,
       dialogLoading_task_LQ: true,
       steps: [],
-      TaskName: "",
-      expectedHours: "",
-      actualHours: "",
+      TaskName: '',
+      expectedHours: '',
+      actualHours: '',
       taskUserDetail: {},
       taskDetail: {},
-      taskProgress: "",
-      ProgressStatus: "",
+      taskProgress: '',
+      ProgressStatus: '',
       advList: [],
-      tobeOver: "first",
-      tobeTasked: "任务详细",
+      tobeOver: 'first',
+      tobeTasked: '任务详细',
       total: 0,
       currentPage: 1,
       pageSize: 10,
@@ -847,81 +846,84 @@
       taskSo: constant.TASK_STATUS_UNRECOGNIZED,
       taskSt: constant.TASK_STATUS_COMPLETED,
       taskStatusOne: ''
-    };
+    }
   },
   computed: {
-    ...mapGetters(["user"])
+    ...mapGetters(['user'])
   },
   mounted() {
-    this.getAllProjectDatas();
-    this.getTaskDatas();
+    this.getAllProjectDatas()
+    this.getTaskDatas()
   },
   methods: {
     // 钩子:在获取表格数据之前执行,false 则代表不获取数据
     [CRUD.HOOK.beforeRefresh]() {
       if (!this.query.taskId) {
-        this.taskTotal = {};
-        return false;
+        this.taskTotal = {}
+        return false
       }
       crudTaskUser.getSum({ taskId: this.query.taskId }).then(res => {
-        this.taskTotal = res;
-      });
-      return true;
+        this.taskTotal = res
+      })
+      return true
     },
     [CRUD.HOOK.afterSubmit]() {
-      this.formTasks = [];
-      this.form.name = null;
-      this.form.performanceHours = null;
-      this.form.start = false;
+      this.formTasks = []
+      this.form.name = null
+      this.form.performanceHours = null
+      this.form.start = false
     },
     // 编辑之前
     [CRUD.HOOK.beforeToEdit]() {
-      if(this.form.taskStatus == this.taskSo) {
+      if (this.form.taskStatus == this.taskSo) {
         this.form.is_ok = false
-        this.taskStatusOne = "未承认"
+        this.taskStatusOne = '未承认'
       }
-      if(this.form.taskStatus == this.taskSt) {
+      if (this.form.taskStatus == this.taskSt) {
         this.form.is_ok = true
-        this.taskStatusOne = "已完成"
+        this.taskStatusOne = '已完成'
       }
     },
     [CRUD.HOOK.afterEditError]() {
-      this.formTasks = [];
-      this.form.name = null;
-      this.form.performanceHours = null;
-      this.form.start = false;
+      this.formTasks = []
+      this.form.name = null
+      this.form.performanceHours = null
+      this.form.start = false
     },
     [CRUD.HOOK.afterEditCancel]() {
-      this.formTasks = [];
-      this.form.name = null;
-      this.form.performanceHours = null;
-      this.form.start = false;
+      this.formTasks = []
+      this.form.name = null
+      this.form.performanceHours = null
+      this.form.start = false
     },
     [CRUD.HOOK.afterAddCancel]() {
-      this.formTasks = [];
-      this.form.name = null;
-      this.form.performanceHours = null;
-      this.form.start = false;
+      this.formTasks = []
+      this.form.name = null
+      this.form.performanceHours = null
+      this.form.start = false
     },
     [CRUD.HOOK.afterAddError]() {
-      this.formTasks = [];
-      this.form.name = null;
-      this.form.performanceHours = null;
-      this.form.start = false;
+      this.formTasks = []
+      this.form.name = null
+      this.form.performanceHours = null
+      this.form.start = false
     },
     [CRUD.HOOK.beforeToCU]() {
-      this.form.task.id = this.query.taskId;
-      this.form.task.name = this.selectedTaskName;
-      this.form.projectId = this.projectId;
+      this.form.task.id = this.query.taskId
+      this.form.task.name = this.selectedTaskName
+      this.form.projectId = this.projectId
     },
     [CRUD.HOOK.beforeSubmit]() {
       if (!this.form.taskStatus) {
-        this.form.taskStatus = "task_status_not_started";
+        this.form.taskStatus = 'task_status_not_started'
+      }
+      if (!this.form.name) {
+        this.form.name = this.form.task.name
       }
       // if (this.form.task.id === undefined || this.form.task.id === null || this.form.task.id === '') {
       //   this.form.task = null
       // }
-      return true;
+      return true
     },
     // [CRUD.HOOK.afterCrudDelete]() {
     //   this.advList = []
@@ -930,40 +932,40 @@
       return (
         time.getTime() < new Date(this.planStartTime) - 8.64e7 ||
         time.getTime() > new Date(this.planEndTime).getTime()
-      );
+      )
     },
     handleChange(value) {
       if (value) {
-        this.taskStatusOne = '已完成';
+        this.taskStatusOne = '已完成'
       } else {
-        this.taskStatusOne = '未承认';
+        this.taskStatusOne = '未承认'
       }
     },
     checkStartTime(time) {
       if (time > this.planEndTime || time < this.planStartTime) {
-        this.form.taskStartDate = null;
+        this.form.taskStartDate = null
         this.$notify({
-          title: "无效时间",
-          type: "error",
+          title: '无效时间',
+          type: 'error',
           duration: 2500
-        });
-        return;
+        })
+        return
       }
     },
     changer() {
-      this.getTaskDatas();
-      this.crud.data = [];
-      this.taskDatas = [];
+      this.getTaskDatas()
+      this.crud.data = []
+      this.taskDatas = []
     },
     checkEndTime(time) {
       if (time > this.planEndTime || time < this.planStartTime) {
-        this.form.taskEndDate = null;
+        this.form.taskEndDate = null
         this.$notify({
-          title: "无效时间",
-          type: "error",
+          title: '无效时间',
+          type: 'error',
           duration: 2500
-        });
-        return;
+        })
+        return
       }
     },
     // 获取用户
@@ -971,8 +973,8 @@
       // 获取用户
       crudUser.getProjectUser(taskId).then(res => {
         // 用户列表
-        this.users = res;
-      });
+        this.users = res
+      })
     },
 
     // 获取项目包含所有的用户
@@ -980,132 +982,126 @@
       // 获取用户
       crudUser.getAllUser(taskId).then(res => {
         // 用户列表
-        this.proUsers = res;
-      });
+        this.proUsers = res
+      })
     },
     getAllProjectDatas() {
       crudTask.getProjects().then(res => {
-        this.projectDatas = res;
-      });
+        this.projectDatas = res
+      })
     },
     // 获取左侧部门数据
     getTaskDatas(node, resolve) {
       // if (node !== undefined) {
       //   this.infinite = true
       // }
-      const sort = "id,desc";
-      const params = { sort: sort };
+      const sort = 'id,desc'
+      const params = { sort: sort }
       if (!this.projectId) {
-        return;
+        return
       } else {
-        params["projectId"] = this.projectId;
-        this.taskLoading = true;
+        params['projectId'] = this.projectId
+        this.taskLoading = true
       }
-      if (typeof node === "object" && node.level !== 0) {
-        params["pid"] = node.data.id;
+      if (typeof node === 'object' && node.level !== 0) {
+        params['pid'] = node.data.id
       } else {
-        params["isTop"] = true;
+        params['isTop'] = true
       }
       if (this.taskName) {
-        params["name"] = this.taskName;
+        params['name'] = this.taskName
       }
       setTimeout(() => {
         crudTask
           .ChildrenTaskAnyParent(params)
           .then(res => {
             if (resolve) {
-              resolve(res);
+              resolve(res)
             } else {
-              this.infinite = false;
-              this.taskDatas = res;
+              this.infinite = false
+              this.taskDatas = res
             }
-            this.taskLoading = false;
+            this.taskLoading = false
           })
           .catch(() => {
-            this.taskLoading = false;
-          });
-      }, 100);
+            this.taskLoading = false
+          })
+      }, 100)
     },
     // 生成员工Excel
     exportUser() {
-      this.slong = true;
+      this.slong = true
       crudTaskUser
         .exportUser(this.query.taskId)
         .then(res => {
-          downloadFile(res, "测试数据", "xlsx");
-          this.slong = false;
-          this.crud.notify("生成成功", CRUD.NOTIFICATION_TYPE.SUCCESS);
+          downloadFile(res, '测试数据', 'xlsx')
+          this.slong = false
+          this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
         })
         .catch(error => {
-          console.error(error);
-          this.slong = false;
-          this.crud.notify("生成失败", CRUD.NOTIFICATION_TYPE.ERROR);
-        });
+          this.slong = false
+          this.crud.notify('生成失败', CRUD.NOTIFICATION_TYPE.ERROR)
+        })
     },
     // 切换任务
     handleNodeClick(data) {
-      this.selectedTask = data;
+      this.selectedTask = data
       if (data.pid === 0) {
-        this.query.taskId = null;
-        this.query.taskStatus = [];
-        this.selectedTaskName = null;
+        this.query.taskId = null
+        this.query.taskStatus = []
+        this.selectedTaskName = null
       } else {
-        this.query.taskId = data.id;
+        this.query.taskId = data.id
         this.query.taskStatus = [
-          "task_status_not_started",
-          "task_status_in_hand",
-          "task_status_test",
-          "task_status_stop",
-        ];
-        this.selectedTaskName = data.name;
-        this.flag = data.flag;
-        console.log("data : ", data);
-        this.planStartTime = data.planStartTime;
-        this.planEndTime = data.planEndTime;
-        // crudTaskUser.getSum({ 'taskId': this.query.taskId }).then(res => {
-        //   this.taskTotal = res
-        // })
+          'task_status_not_started',
+          'task_status_in_hand',
+          'task_status_test',
+          'task_status_stop',
+          'task_status_unrecognized'
+        ]
+        this.selectedTaskName = data.name
+        this.flag = true // data.flag;
+        this.planStartTime = data.planStartTime
+        this.planEndTime = data.planEndTime
       }
-      this.crud.toQuery();
-      this.getUser(this.query.taskId);
-      this.getProUser(this.query.taskId);
+      this.crud.toQuery()
+      this.getUser(this.query.taskId)
+      this.getProUser(this.query.taskId)
     },
     handleSizeChange(val) {
-      this.pageSize = val;
-      this.adventTesk();
+      this.pageSize = val
+      this.adventTesk()
     },
     handleCurrentChange(val) {
-      this.currentPage = val;
-      this.adventTesk();
+      this.currentPage = val
+      this.adventTesk()
     },
     // 临期任务
     adventTesk() {
-      this.dialogVisible_task_LQ = true;
+      this.dialogVisible_task_LQ = true
       // 点击侧面查询临期任务
       crudTaskUser
         .getTaskUserAdvent(this.query.taskId, this.currentPage, this.pageSize)
         .then(res => {
-          this.advList = res.data;
-          this.total = res.total;
-          this.taskLoading_L = false;
-        });
+          this.advList = res.data
+          this.total = res.total
+          this.taskLoading_L = false
+        })
     },
     beforeUpload(file) {
-      const isLt1M = file.size / 1024 / 1024 < 1;
+      const isLt1M = file.size / 1024 / 1024 < 1
       if (isLt1M) {
-        return true;
+        return true
       }
       this.$message({
-        message: "请不要上传大于1m的文件.",
-        type: "warning"
-      });
-      return false;
+        message: '请不要上传大于1m的文件.',
+        type: 'warning'
+      })
+      return false
     },
     handleSuccess({ results, header }) {
-      this.uploading = false;
-      this.generateForm = results;
-      console.log("res:" + this.generateForm);
-      console.log("header:" + header);
+      this.uploading = false
+      this.generateForm = results
       this.generateForm = results.map(item => {
         const {
           所属员工ID: _,
@@ -1120,93 +1116,93 @@
           隔绝列7: __________,
           隔绝列8: ____________,
           ...newItem
-        } = item;
-        if ("任务开始时间" in newItem) {
-          newItem["任务开始时间"] = formatExcelDate(newItem["任务开始时间"]);
+        } = item
+        if ('任务开始时间' in newItem) {
+          newItem['任务开始时间'] = formatExcelDate(newItem['任务开始时间'])
         }
-        if ("任务结束时间" in newItem) {
-          newItem["任务结束时间"] = formatExcelDate(newItem["任务结束时间"]);
+        if ('任务结束时间' in newItem) {
+          newItem['任务结束时间'] = formatExcelDate(newItem['任务结束时间'])
         }
-        return newItem;
-      });
+        return newItem
+      })
       // 表头数据转换
-      this.generateFormTwo = transformData(results);
+      this.generateFormTwo = transformData(results)
       for (let i = 0; i < this.generateFormTwo.length; i++) {
-        const item = this.generateFormTwo[i];
+        const item = this.generateFormTwo[i]
         if (!item.name) {
           this.$message({
             message: `第${i + 1}项的名称为空`,
-            type: "warning"
-          });
-          this.generateFormTwo = [];
-          this.generateForm = [];
-          return false;
+            type: 'warning'
+          })
+          this.generateFormTwo = []
+          this.generateForm = []
+          return false
         }
         if (!item.taskStartDate) {
           this.$message({
             message: `第${i + 1}项的任务开始时间为空`,
-            type: "warning"
-          });
-          this.generateFormTwo = [];
-          this.generateForm = [];
-          return false;
+            type: 'warning'
+          })
+          this.generateFormTwo = []
+          this.generateForm = []
+          return false
         }
         if (!item.taskEndDate) {
           this.$message({
             message: `第${i + 1}项的任务结束时间为空`,
-            type: "warning"
-          });
-          this.generateFormTwo = [];
-          this.generateForm = [];
-          return false;
+            type: 'warning'
+          })
+          this.generateFormTwo = []
+          this.generateForm = []
+          return false
         }
         if (!item.taskHours) {
           this.$message({
             message: `第${i + 1}项的任务工时为空`,
-            type: "warning"
-          });
-          this.generateFormTwo = [];
-          this.generateForm = [];
-          return false;
+            type: 'warning'
+          })
+          this.generateFormTwo = []
+          this.generateForm = []
+          return false
         }
         if (!item.taskStatus) {
           this.$message({
             message: `第${i + 1}项的任务状态为空`,
-            type: "warning"
-          });
-          this.generateFormTwo = [];
-          this.generateForm = [];
-          return false;
+            type: 'warning'
+          })
+          this.generateFormTwo = []
+          this.generateForm = []
+          return false
         }
       }
       this.tableHeader = header.filter(
         item =>
-          item !== "所属员工ID" && item !== "任务状态ID" && item !== "优先度ID" && item !== "隔绝列1" &&
-          item !== "隔绝列2" && item !== "隔绝列3" && item !== "隔绝列4" && item !== "隔绝列5" && item !== "隔绝列6" &&
-          item !== "隔绝列7" && item !== "隔绝列8"
-      );
+          item !== '所属员工ID' && item !== '任务状态ID' && item !== '优先度ID' && item !== '隔绝列1' &&
+          item !== '隔绝列2' && item !== '隔绝列3' && item !== '隔绝列4' && item !== '隔绝列5' && item !== '隔绝列6' &&
+          item !== '隔绝列7' && item !== '隔绝列8'
+      )
     },
     // 生成表单打开
     openGenerate() {
       // 生成表单数据
-      this.generateForm = [];
+      this.generateForm = []
       // 生成表单状态
-      this.generateStatus = true;
+      this.generateStatus = true
     },
     // 生成表单关闭
     closeGenerate() {
       // 生成表单状态
-      this.generateStatus = false;
+      this.generateStatus = false
     },
     // 生成表单提交
     submitGenerate() {
       if (!this.generateForm) {
-        this.$message.warning("请选择上传的文件");
-        return;
+        this.$message.warning('请选择上传的文件')
+        return
       }
       // 生成表单加载
-      this.generateLoading = true;
-      this.uploading = true;
+      this.generateLoading = true
+      this.uploading = true
       crudTaskUser
         .generate({
           generateForm: this.generateFormTwo,
@@ -1214,133 +1210,145 @@
         })
         .then(res => {
           // 生成表单关闭
-          this.closeGenerate();
+          this.closeGenerate()
           // 生成表单加载
-          this.generateLoading = false;
+          this.generateLoading = false
           // 搜索:刷新表格
-          this.crud.toQuery();
-          this.crud.notify("导入成功", CRUD.NOTIFICATION_TYPE.SUCCESS);
+          this.crud.toQuery()
+          this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
         })
         .catch(err => {
-          this.uploading = false;
+          this.uploading = false
           // 生成表单加载
-          this.generateLoading = false;
-        });
+          this.generateLoading = false
+        })
     },
 
     unPick(e) {
       crudTaskUser
         .addTaskUser({ TaskId: e.id, projectId: this.projectId })
         .then(res => {
-          this.pickFlg = false;
+          this.pickFlg = false
           if (res === 1) {
             this.$notify({
-              title: "获取成功",
-              type: "success",
+              title: '获取成功',
+              type: 'success',
               duration: 2500
-            });
+            })
 
-            this.crud.toQuery();
+            this.crud.toQuery()
           } else {
             this.$notify({
-              title: "获取失败",
-              type: "error",
+              title: '获取失败',
+              type: 'error',
               duration: 2500
-            });
+            })
           }
-        });
+        })
     },
-    taskCompleted() {
-      const selectData = this.$refs.table.selection;
-      var changesId = [];
+    toTaskCompleted() {
+      const selectData = this.$refs.table.selection
+      var changesId = []
       for (var i = 0; i < selectData.length; i++) {
         if (selectData[i].newTaskProgress !== 100) {
-          this.$notify.error({
-            title: "任务进度未达到100%"
-          });
-          return;
+          this.centerDialogVisibleTaskProgress = true
+          return
         }
-        changesId.push(selectData[i].id);
+        changesId.push(selectData[i].id)
       }
       // 当程序执行到这里时,说明选择的都是已经达到100的任务
       crudTaskUser.changeStatus(changesId).then(res => {
-        this.crud.toQuery();
+        this.crud.toQuery()
         this.$notify.success({
-          title: "确认成功"
-        });
-      });
+          title: '确认成功'
+        })
+      })
+    },
+    doTaskCompleted() {
+      this.centerDialogVisibleTaskProgress = false
+      const selectData = this.$refs.table.selection
+      var changesId = []
+      for (var i = 0; i < selectData.length; i++) {
+        changesId.push(selectData[i].id)
+      }
+      // 当程序执行到这里时,说明选择的都是已经达到100的任务
+      crudTaskUser.changeStatus(changesId).then(res => {
+        this.crud.toQuery()
+        this.$notify.success({
+          title: '确认成功'
+        })
+      })
     },
     // 当选择完人物计算出绩效工时
     withUser(data) {
-      if (data.taskHours != null && data.userId != null) {
-        crudTaskUser
-          .getPerformanceg({
-            taskHours: data.taskHours,
-            userId: data.userId
-          })
-          .then(res => {
-            this.form.performanceHours = res == 0 ? null : res;
-          });
-      }
+      // 绩效直下
+      this.form.performanceHours = data.taskHours
+      // if (data.taskHours != null && data.userId != null) {
+      //   crudTaskUser
+      //     .getPerformanceg({
+      //       taskHours: data.taskHours,
+      //       userId: data.userId
+      //     })
+      //     .then(res => {
+      //       this.form.performanceHours = res == 0 ? null : res;
+      //     });
+      // }
     },
     showDetail(e) {
-      this.dialogVisible_taskUser = true;
-      this.TaskName = e.name;
-      this.expectedHours = e.performanceHours;
-      this.actualHours = 0;
+      this.dialogVisible_taskUser = true
+      this.TaskName = e.name
+      this.expectedHours = e.performanceHours
+      this.actualHours = 0
       // 发送taskUser,获取所有的日报信息,并在后台进行处理,将处理后的结果返回给前端的steps中,进行显示
       crudTaskUser.getTaskUserDetail(e.id).then(res => {
-        this.steps = res;
+        this.steps = res
         for (let i = 0; i < this.steps.length; i++) {
           this.taskUserDetail[this.steps[i].taskUserName] = this.steps[
             i
-          ].alreadyConsumeHours;
+          ].alreadyConsumeHours
         }
 
         // var key = this.taskUserDetail.keySet();
         for (var key in this.taskUserDetail) {
-          this.actualHours += this.taskUserDetail[key];
+          this.actualHours += this.taskUserDetail[key]
         }
 
         this.taskProgress = Math.round(
           (this.actualHours / this.expectedHours) * 100
-        );
+        )
         if (this.taskProgress > 100) {
-          this.taskProgress = 100;
+          this.taskProgress = 100
         }
         if (this.taskProgress === 100) {
-          this.ProgressStatus = "#F56C6C";
+          this.ProgressStatus = '#F56C6C'
         }
         if (this.taskProgress < 100) {
-          this.ProgressStatus = "#409EFF";
+          this.ProgressStatus = '#409EFF'
         }
-        // this.taskUserDetail.forEach(function(value,key){
-        //   console.log(value,key);
-        // });
-        this.dialogLoading_taskUser = false;
-      });
+        this.dialogLoading_taskUser = false
+      })
     },
     setNull() {
-      this.taskUserDetail = {};
-      this.dialogLoading_taskUser = true;
-      this.dialogLoading_task = true;
-      this.dialogLoading_task_LQ = true;
+      this.taskUserDetail = {}
+      this.dialogLoading_taskUser = true
+      this.dialogLoading_task = true
+      this.dialogLoading_task_LQ = true
     },
     showTaskDetail(e) {
-      this.taskDetail = {};
-      this.dialogVisible_task = true;
+      this.taskDetail = {}
+      this.dialogVisible_task = true
       crudTaskUser.getTaskDetail(e.id).then(res => {
         for (let i = 0; i < res.length; i++) {
-          this.taskDetail[res[i].nickName] = res[i].assignedWork;
+          this.taskDetail[res[i].nickName] = res[i].assignedWork
         }
-        this.dialogLoading_task = false;
-      });
+        this.dialogLoading_task = false
+      })
     },
     formatTaskProgress(percentage) {
-      return percentage === 100 ? "实际消耗已超出计划时长" : `${percentage}%`;
+      return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%`
     }
   }
-};
+}
 </script>
 
 <style rel="stylesheet/scss" lang="scss">

--
Gitblit v1.9.3