From 0ee82baedf5e7611b978040f7285ddfbc436bc34 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Thu, 04 Jan 2024 11:25:24 +0800
Subject: [PATCH] 评优任务页面修改

---
 src/views/evaluate/evaluateTask.vue |  156 ++++++++++++++--------------------------------------
 1 files changed, 42 insertions(+), 114 deletions(-)

diff --git a/src/views/evaluate/evaluateTask.vue b/src/views/evaluate/evaluateTask.vue
index 47dafef..e932947 100644
--- a/src/views/evaluate/evaluateTask.vue
+++ b/src/views/evaluate/evaluateTask.vue
@@ -5,42 +5,33 @@
       :data="data" :permission="permissionList" :before-open="beforeOpen" ref="crud" @row-update="rowUpdate"
       @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">
+      @refresh-change="refreshChange" >
+      <!-- @on-load="onLoad" -->
+      <template #candidateCutoffTimeEnd="{ row }">
+        {{ row.candidateCutoffTimeStart || '开始时间未完善' }}
+        <div style="text-align: center;">-</div>
+        {{ row.candidateCutoffTimeEnd || '结束时间未完善' }}
+      </template>
+      <template #evaluateCutoffTimeEnd="{ row }">
+        {{ row.evaluateCutoffTimeStart || '开始时间未完善' }}
+        <div style="text-align: center;">-</div>
+        {{ row.candidateCutoffTimeEnd || '结束时间未完善' }}
+      </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="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" />
+    <!-- 预览 -->
     <viewEvaluateDetail :params="viewEvaluateDetailParams" />
   </basic-container>
 </template>
@@ -55,15 +46,14 @@
 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';
 
 export default {
   components: {
-    addDialog,
-    addCandidate,
+    addIndividualTask,
+    addSectionTask,
     viewEvaluateDetail
   },
   data() {
@@ -81,13 +71,8 @@
       selectionList: [],
       option: option,
       data: [],
-      // 发布弹窗
-      dialogVisible: false,
-      publicForm: {
-        publicData: '',
-      },
-      isAddDialogVisible: false,
-      addParams: {},
+      addIndividualParams: {},
+      addSectionParams: {},
       viewParams: {},
       depts: [],
       // 考核结果参数
@@ -104,8 +89,6 @@
           },
         ],
       },
-      // 新增候选人params
-      addCandidateParams: {},
       // 信息预览弹窗
       viewEvaluateDetailParams: {},
     };
@@ -121,7 +104,7 @@
         // 更改option
         !n ? (this.option = option) : (this.option = sectionOption)
         this.page.currentPage = 1;
-        this.onLoad(this.page, params);
+        // this.onLoad(this.page, params);
       },
       immediate: true,
     },
@@ -146,13 +129,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,20 +157,10 @@
         }
       );
     },
-    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
       }
     },
@@ -325,64 +302,15 @@
         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>
 

--
Gitblit v1.9.3