From 4d18b374aee81a8408aa0a0afc90ecb8becfc0eb Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Mon, 25 Dec 2023 16:51:19 +0800
Subject: [PATCH] 评优任务发布按钮调整

---
 src/views/evaluate/evaluateTask.vue |   61 +++++++++++++++++-------------
 1 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/src/views/evaluate/evaluateTask.vue b/src/views/evaluate/evaluateTask.vue
index 5aa471c..647ecef 100644
--- a/src/views/evaluate/evaluateTask.vue
+++ b/src/views/evaluate/evaluateTask.vue
@@ -17,15 +17,16 @@
         <!-- <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" 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-form :model="publicForm" :rules="publicRules" ref="publicFormRef">
+        <el-form-item label="评优评先截止时间:" prop="publicData">
           <el-date-picker v-model="publicForm.publicData" type="datetime" placeholder="请选择截止时间"
             value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%;" />
         </el-form-item>
@@ -86,6 +87,11 @@
       dialogVisible: false,
       publicForm: {
         publicData: '',
+      },
+      publicRules: {
+        publicData: [
+          { required: true, message: '请选择发布时间', trigger: 'click' },
+        ]
       },
       isAddDialogVisible: false,
       addParams: {},
@@ -348,29 +354,32 @@
     },
     // 发布
     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;
+      this.$refs.publicFormRef.validate(valid => {
+        if (!valid) return
+        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 = {

--
Gitblit v1.9.3