From 901607bb65a40aebf55a246d64b09d3f3a99cd5c Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Fri, 05 Jan 2024 17:12:00 +0800
Subject: [PATCH] 个人评优任务更新

---
 src/views/evaluate/evaluateTask.vue |  179 +++++++++++++++++++++--------------------------------------
 1 files changed, 63 insertions(+), 116 deletions(-)

diff --git a/src/views/evaluate/evaluateTask.vue b/src/views/evaluate/evaluateTask.vue
index 47dafef..31275e5 100644
--- a/src/views/evaluate/evaluateTask.vue
+++ b/src/views/evaluate/evaluateTask.vue
@@ -6,41 +6,39 @@
       @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
       @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
       @refresh-change="refreshChange" @on-load="onLoad">
+      <template #candidateCutoffTimeEnd="{ row }">
+        <div class="time-box">
+          {{ row.candidateCutoffTimeStart }}
+          <div>-</div>
+          {{ row.candidateCutoffTimeEnd }}
+        </div>
+      </template>
+      <template #evaluateCutoffTimeEnd="{ row }">
+        <div class="time-box">
+          {{ row.evaluateCutoffTimeStart }}
+          <div>-</div>
+          {{ row.evaluateCutoffTimeEnd }}
+        </div>
+      </template>
       <template #menu-left>
-        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
+        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增评优任务</el-button>
         <el-button type="danger" icon="el-icon-delete" plain v-if="permission.evaluateTask_delete"
           @click="handleDelete">删除</el-button>
         <!-- <el-button type="warning" plain icon="el-icon-download" @click="handleExport">导出</el-button> -->
       </template>
       <template #menu="{ size, row, index }">
         <el-button type="primary" text plain icon="el-icon-view" @click="viewDateilDialog(row)">详情</el-button>
-        <el-button type="primary" text plain icon="el-icon-edit" @click="editDialog(row)">编辑</el-button>
-        <el-button type="primary" text plain icon="el-icon-position" @click="publicTimeBtn(row)"
-          v-if="row.candidateState === 2 && row.evaluateState === 0">发布</el-button>
-        <el-button type="primary" v-if="row.type === 0 && row.candidateState === 0" text plain icon="el-icon-plus" @click="addCandidateHandle(row)">新增候选人</el-button>
-        <!-- <el-button type="primary" text plain icon="el-icon-download">导出</el-button> -->
+        <el-button type="primary" v-if="!row.type && row.candidateState === 2 && !row.evaluateState" text plain icon="el-icon-position"
+          @click="taskPublicDialog(row)">发布</el-button>
+        <el-button type="danger" text plain icon="el-icon-delete" @click="rowDel(row)">删除</el-button>
       </template>
     </avue-crud>
-    <!-- 发布弹窗 -->
-    <el-dialog v-model="dialogVisible" title="发布" width="500px">
-      <el-form :model="publicForm">
-        <el-form-item label="评优评先截止时间:">
-          <el-date-picker v-model="publicForm.publicData" type="datetime" placeholder="请选择截止时间"
-            value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%;" />
-        </el-form-item>
-      </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="dialogVisible = false">取消</el-button>
-          <el-button type="primary" @click="timeSubmit">确认</el-button>
-        </span>
-      </template>
-    </el-dialog>
-    <!-- 新增编辑弹窗 -->
-    <addDialog :params="addParams" @refreshTable="this.onLoad" />
-    <!-- 新增候选人 -->
-    <addCandidate :params="addCandidateParams" @refreshTable="this.onLoad" />
-    <!-- 预览弹窗 -->
+    <!-- 新增个人评优任务弹窗 -->
+    <addIndividualTask :params="addIndividualParams" @refreshTable="this.onLoad" />
+    <addSectionTask :params="addSectionParams" @refreshTable="this.onLoad" />
+    <!-- 发布 -->
+    <individualTaskPublic :params="taskPublicParams" @refreshTable="this.onLoad" />
+    <!-- 预览 -->
     <viewEvaluateDetail :params="viewEvaluateDetailParams" />
   </basic-container>
 </template>
@@ -55,15 +53,16 @@
 import { dateNow } from '@/utils/date';
 import NProgress from 'nprogress';
 import 'nprogress/nprogress.css';
-import addDialog from './components/addDialog.vue';
-import addCandidate from './components/addCandidate.vue';
+import addIndividualTask from './components/addIndividualTask.vue';
+import addSectionTask from './components/addSectionTask.vue';
 import viewEvaluateDetail from './components/viewEvaluateDetail.vue';
-import { getDeptTree } from '@/api/system/dept';
+import individualTaskPublic from './components/IndividualTaskPublic.vue';
 
 export default {
   components: {
-    addDialog,
-    addCandidate,
+    addIndividualTask,
+    addSectionTask,
+    individualTaskPublic,
     viewEvaluateDetail
   },
   data() {
@@ -81,15 +80,9 @@
       selectionList: [],
       option: option,
       data: [],
-      // 发布弹窗
-      dialogVisible: false,
-      publicForm: {
-        publicData: '',
-      },
-      isAddDialogVisible: false,
-      addParams: {},
+      addIndividualParams: {},
+      addSectionParams: {},
       viewParams: {},
-      depts: [],
       // 考核结果参数
       defaultTaskType: 0,
       taskTypeList: {
@@ -104,10 +97,9 @@
           },
         ],
       },
-      // 新增候选人params
-      addCandidateParams: {},
       // 信息预览弹窗
       viewEvaluateDetailParams: {},
+      taskPublicParams: {}
     };
   },
   watch: {
@@ -146,13 +138,17 @@
   },
   methods: {
     handleAdd() {
-      this.addParams = {
+      if (!this.defaultTaskType) {
+        this.addIndividualParams = {
+          visible: true,
+          title: '添加个人评优任务'
+        }
+        return
+      }
+      this.addSectionParams = {
         visible: true,
-        title: '添加',
-        isEdit: false,
-        type: this.defaultTaskType,
-        addForm: {},
-      };
+        title: '添加部门评优任务'
+      }
     },
     rowSave(row, done, loading) {
       add(row).then(
@@ -170,19 +166,15 @@
         }
       );
     },
-    editDialog(row) {
-      this.addParams = {
-        visible: true,
-        title: '编辑',
-        isEdit: true,
-        type: this.defaultTaskType,
-        addForm: {
-          ...row,
-        },
-      };
-    },
     viewDateilDialog(row) {
       this.viewEvaluateDetailParams = {
+        visible: true,
+        type: this.defaultTaskType,
+        data: row
+      }
+    },
+    taskPublicDialog(row) {
+      this.taskPublicParams = {
         visible: true,
         data: row
       }
@@ -314,8 +306,7 @@
 
       let values = {
         ...this.query,
-        ...params,
-        taskName_like: taskName,
+        ...params
       };
       getList(page.currentPage, page.pageSize, values).then(res => {
         const data = res.data.data;
@@ -325,65 +316,21 @@
         this.selectionClear();
       });
     },
-    deptData() {
-      return getDeptTree(this.website.tenantId).then(deptResult => {
-        const result = deptResult.data.data;
-        let deptList = [];
-        result.forEach(dept => {
-          if (dept.children) {
-            deptList = result.concat(dept.children);
-            delete dept.children;
-          } else {
-            deptList.push(dept);
-          }
-        });
-        return deptList;
-      });
-    },
-    publicTimeBtn(row) {
-      this.rowData = row;
-      this.dialogVisible = true;
-    },
-    // 发布
-    timeSubmit() {
-      const { id } = this.rowData;
-      const params = {
-        id,
-        // candidateState: 1,
-        evaluateState: 1,
-        evaluateCutoffTime: this.publicForm.publicData,
-      };
-      update(params).then(
-        res => {
-          this.$message({
-            type: 'success',
-            message: '操作成功!',
-          });
-          this.refreshChange();
-        },
-        error => {
-          this.$message({
-            type: 'success',
-            message: error,
-          });
-        }
-      );
-      this.dialogVisible = false;
-    },
-    addCandidateHandle(row) {
-      this.addCandidateParams = {
-        visible: true,
-        type: 0,
-        data: {
-          ...row
-        }
-      }
-    },
     tabChange(value) {
       this.defaultTaskType = value.prop;
-    },
+    }
   },
+  provide() {
+    return {
+      type: () => this.defaultTaskType
+    }
+  }
 };
 </script>
 
-<style></style>
+<style lang="scss" scoped>
+.time-box {
+  display: inline-block;
+  text-align: center;
+}
+</style>

--
Gitblit v1.9.3