From ceed4eccea0e2d9d51c6906ca214d251d7d22ca4 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 26 Dec 2023 15:57:24 +0800
Subject: [PATCH] 头部按钮显示修改
---
src/views/evaluate/evaluateTask.vue | 120 +++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 83 insertions(+), 37 deletions(-)
diff --git a/src/views/evaluate/evaluateTask.vue b/src/views/evaluate/evaluateTask.vue
index 7db0bf3..2de84f1 100644
--- a/src/views/evaluate/evaluateTask.vue
+++ b/src/views/evaluate/evaluateTask.vue
@@ -10,18 +10,23 @@
<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>
+ <!-- <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-edit" @click="editDialog(row)">编辑</el-button>
- <el-button type="primary" text plain icon="el-icon-position" @click="publicTimeBtn(row)" v-if="row.status === 2">发布</el-button>
- <el-button type="primary" text plain icon="el-icon-download">导出</el-button>
+ <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 === 2 && row.evaluateState === 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>
@@ -35,6 +40,10 @@
</el-dialog>
<!-- 新增编辑弹窗 -->
<addDialog :params="addParams" @refreshTable="this.onLoad" />
+ <!-- 新增候选人 -->
+ <addCandidate :params="addCandidateParams" @refreshTable="this.onLoad" />
+ <!-- 预览弹窗 -->
+ <viewEvaluateDetail :params="viewEvaluateDetailParams" />
</basic-container>
</template>
@@ -49,11 +58,15 @@
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import addDialog from './components/addDialog.vue';
+import addCandidate from './components/addCandidate.vue';
+import viewEvaluateDetail from './components/viewEvaluateDetail.vue';
import { getDeptTree } from '@/api/system/dept';
export default {
components: {
addDialog,
+ addCandidate,
+ viewEvaluateDetail
},
data() {
return {
@@ -75,6 +88,11 @@
publicForm: {
publicData: '',
},
+ publicRules: {
+ publicData: [
+ { required: true, message: '请选择发布时间', trigger: 'click' },
+ ]
+ },
isAddDialogVisible: false,
addParams: {},
viewParams: {},
@@ -93,6 +111,10 @@
},
],
},
+ // 新增候选人params
+ addCandidateParams: {},
+ // 信息预览弹窗
+ viewEvaluateDetailParams: {},
};
},
watch: {
@@ -104,7 +126,7 @@
type: n,
};
// 更改option
- !n ? (this.option = option) : (this.option = sectionOption)
+ !n ? (this.option = option) : (this.option = sectionOption)
this.page.currentPage = 1;
this.onLoad(this.page, params);
},
@@ -165,6 +187,13 @@
...row,
},
};
+ },
+ viewDateilDialog(row) {
+ this.viewEvaluateDetailParams = {
+ visible: true,
+ type: this.defaultTaskType,
+ data: row
+ }
},
rowUpdate(row, index, done, loading) {
update(row).then(
@@ -244,14 +273,13 @@
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
if (type === 'view') {
- this.deptData().then(deptRes => {
- const candidates = [];
- res.data.data.candidateNum.forEach(item => {
- const value = deptRes.find(dept => dept.id === item.deptId);
- candidates.push(`${value.title}: ${item.val || 0}人`);
- });
- this.form.candidateNum = candidates.join('、');
- });
+ const candidates = [];
+ res.data.data.candidateNum.forEach(item => {
+ const users = []
+ item.users.forEach(item => users.push(item.name))
+ candidates.push(`${item.deptName}(${item.val || 0}人): ${users.join('、')}`);
+ })
+ this.form.candidateNum = candidates.join('\n');
}
this.form = res.data.data;
});
@@ -260,10 +288,13 @@
},
searchReset() {
this.query = {};
- this.onLoad(this.page);
+ this.onLoad(this.page, { type: this.defaultTaskType });
},
searchChange(params, done) {
- this.query = params;
+ this.query = {
+ ...params,
+ type: this.defaultTaskType,
+ };
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
@@ -321,28 +352,43 @@
this.rowData = row;
this.dialogVisible = true;
},
+ // 发布
timeSubmit() {
- const { id } = this.rowData;
- const params = {
- id,
- evaluateCutoffTime: this.publicForm.publicData,
- };
- add(params).then(
- res => {
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- this.refreshChange();
- },
- error => {
- this.$message({
- type: 'success',
- message: error,
- });
+ 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 = {
+ visible: true,
+ type: 0,
+ data: {
+ ...row
}
- );
- this.dialogVisible = false;
+ }
},
tabChange(value) {
this.defaultTaskType = value.prop;
--
Gitblit v1.9.3