| | |
| | | <template> |
| | | <el-dialog v-model="params.visible" title="发布评优任务" width="50%" @open="openDialog" @close="dialogClose"> |
| | | <el-dialog v-model="params.visible" :title="`发布评优任务(${params.data?.taskName || ''})`" width="50%" @open="openDialog" @close="dialogClose"> |
| | | <div class="content"> |
| | | <el-form :model="form" ref="formRef" :rules="rules" label-position="top"> |
| | | <el-form-item label="任务类别" prop="taskType"> |
| | | <el-form-item prop="categoryEntities"> |
| | | <template #label> |
| | | 评优类别 |
| | | <el-button type="primary" icon="el-icon-view" text>查看第一轮候选结果</el-button> |
| | | </template> |
| | | <ul class="type-list"> |
| | | <li class="type-item"> |
| | | <div class="title">类别</div> |
| | |
| | | <div class="number">名额</div> |
| | | <div class="tool">操作</div> |
| | | </li> |
| | | <li class="type-item" v-for="(item, index) in form.taskType" :key="index"> |
| | | <div class="title">{{ item.title }}</div> |
| | | <li class="type-item" v-for="(item, index) in form.categoryEntities" :key="index"> |
| | | <div class="title">{{ item.categoryName }}</div> |
| | | <el-tooltip effect="dark" placement="top"> |
| | | <template #content> |
| | | <p style="width: 500px;">{{ item.introduction }}</p> |
| | | <p style="max-width: 500px;">{{ item.standard }}</p> |
| | | </template> |
| | | <div class="introduction"> |
| | | {{ item.introduction }} |
| | | {{ item.standard }} |
| | | </div> |
| | | </el-tooltip> |
| | | |
| | | <div class="number">{{ item.number }}</div> |
| | | <div class="number">{{ item.peopleNum }}</div> |
| | | <div class="tool"> |
| | | <el-button type="primary" icon="el-icon-plus" text>添加候选人</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" text @click="addEcCandidateHandler(item)">添加候选人</el-button> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | </el-form-item> |
| | | <el-form-item label="投票人员" prop="employees"> |
| | | <el-checkbox-group v-model="form.employees"> |
| | | <el-form-item label="投票人员" prop="pollingPersons"> |
| | | <el-checkbox-group v-model="form.pollingPersons"> |
| | | <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey"> |
| | | {{ item.dictValue }} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | <el-form-item label="第二轮任务结束时间" required> |
| | | <el-form-item class="time-box" prop="candidateCutoffTimeStart"> |
| | | <el-date-picker v-model="form.candidateCutoffTimeStart" type="datetime" placeholder="请选择任务开始时间" |
| | | <el-form-item class="time-box" prop="evaluateCutoffTimeStart"> |
| | | <el-date-picker v-model="form.evaluateCutoffTimeStart" type="datetime" placeholder="请选择任务开始时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%;" /> |
| | | </el-form-item> |
| | | <span class="time-span">至</span> |
| | | <el-form-item class="time-box" prop="candidateCutoffTimeEnd"> |
| | | <el-date-picker v-model="form.candidateCutoffTimeEnd" type="datetime" placeholder="请选择任务结束时间" |
| | | <el-form-item class="time-box" prop="evaluateCutoffTimeEnd"> |
| | | <el-date-picker v-model="form.evaluateCutoffTimeEnd" type="datetime" placeholder="请选择任务结束时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%;" /> |
| | | </el-form-item> |
| | | </el-form-item> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="() => params.visible = false">取消</el-button> |
| | | <el-button type="primary">确定发布</el-button> |
| | | <el-button type="primary" @click="taskPublic">确认发布</el-button> |
| | | </template> |
| | | <addEcCandidate :params="addEcCandidateParams" /> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import _ from 'lodash'; |
| | | import { getDict } from '@/api/dict' |
| | | import { getEcList } from '@/api/evaluate/evaluateTask' |
| | | import { update, getEcList } from '@/api/evaluate/evaluateTask' |
| | | import addEcCandidate from './addEcCandidate.vue'; |
| | | |
| | | export default { |
| | | components: { |
| | | addEcCandidate |
| | | }, |
| | | props: { |
| | | params: { |
| | | type: Object, |
| | |
| | | return { |
| | | employeeDict: [], |
| | | form: { |
| | | taskType: [], |
| | | employees: [], |
| | | candidateCutoffTimeStart: '', |
| | | candidateCutoffTimeEnd: '' |
| | | categoryEntities: [], |
| | | pollingPersons: [], |
| | | evaluateCutoffTimeStart: '', |
| | | evaluateCutoffTimeEnd: '' |
| | | }, |
| | | rules: { |
| | | taskType: [ |
| | | categoryEntities: [ |
| | | { required: true, message: '任务类别不可为空', trigger: 'click' }, |
| | | ], |
| | | employees: [ |
| | | pollingPersons: [ |
| | | { required: true, message: '请选择评定人员', trigger: 'click' }, |
| | | ], |
| | | candidateCutoffTimeStart: [ |
| | | evaluateCutoffTimeStart: [ |
| | | { required: true, message: '请选择任务开始时间', trigger: 'click' }, |
| | | ], |
| | | candidateCutoffTimeEnd: [ |
| | | evaluateCutoffTimeEnd: [ |
| | | { required: true, message: '请选择任务开始时间', trigger: 'click' }, |
| | | ] |
| | | }, |
| | | page: { |
| | | current: 1, |
| | | size: 10, |
| | | size: 100, |
| | | total: 0 |
| | | } |
| | | }, |
| | | addEcCandidateParams: {} |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | const { id } = this.params.data |
| | | const { current, size } = this.page |
| | | getEcList(current, size, id).then(ecResult => { |
| | | const { code, data } = ecResult.data |
| | | console.log(data); |
| | | const { code, data: { records } } = ecResult.data |
| | | if (code !== 200) return this.$message.error('评优类别加载失败') |
| | | this.form.categoryEntities = records |
| | | }) |
| | | }, |
| | | initDict() { |
| | |
| | | } |
| | | this.employeeDict = data |
| | | }) |
| | | }, |
| | | taskPublic() { |
| | | this.$refs.formRef.validate(valid => { |
| | | if (!valid) return |
| | | const data = _.cloneDeep(this.form) |
| | | const { id } = this.params.data |
| | | data.id = id |
| | | data.candidateState = 2 |
| | | data.evaluateState = 1 |
| | | data.pollingPersons = data.pollingPersons.join(',') |
| | | delete data.categoryEntities |
| | | update(data).then(res => { |
| | | if (res.data.code !== 200) return |
| | | this.params.visible = false |
| | | this.$emit('refreshTable', { currentPage:1, pageSize: 10 }) |
| | | }) |
| | | }) |
| | | }, |
| | | addEcCandidateHandler(row) { |
| | | this.addEcCandidateParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | } |
| | | } |
| | | }; |