| | |
| | | @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 #candidateState="{ row }"> |
| | | <div v-if="row.candidateState !== 1">{{ setStatus(row.candidateState) }}</div> |
| | | <el-button v-else text type="success" icon="el-icon-edit" @click="updateState(row, 'candidateState')">{{ |
| | | setStatus(row.candidateState) }}</el-button> |
| | | </template> |
| | | <template #evaluateState="{ row }"> |
| | | <div v-if="row.evaluateState !== 1">{{ setStatus(row.evaluateState) }}</div> |
| | | <el-button v-else :disabled="row.evaluateState !== 1" text type="success" icon="el-icon-edit" |
| | | @click="updateState(row, 'evaluateState')">{{ |
| | | setStatus(row.evaluateState) }}</el-button> |
| | | </template> |
| | | <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" text plain icon="el-icon-view" @click="viewHandlerClick(row)">结果详情</el-button> |
| | | <el-button type="primary" text plain icon="el-icon-view" |
| | | @click="viewVotingDetailsHandlerClick(row)">投票详情</el-button> |
| | | <el-button type="primary" text plain icon="el-icon-position" |
| | | v-if="!row.type && row.candidateState === 2 && !row.evaluateState" @click="taskPublicDialog(row)">发布</el-button> |
| | | <el-button type="success" v-if="(row.candidateState === 0 && !row.type) || (row.evaluateState === 0 && row.type)" |
| | | text plain icon="el-icon-edit" @click="editTaskDialog(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" /> |
| | | <!-- 预览弹窗 --> |
| | | <viewEvaluateDetail :params="viewEvaluateDetailParams" /> |
| | | <!-- 新增个人评优任务弹窗 --> |
| | | <addIndividualTask :params="addIndividualParams" @refreshTable="this.onLoad" /> |
| | | <addSectionTask :params="addSectionParams" @refreshTable="this.onLoad" /> |
| | | <!-- 编辑任务 --> |
| | | <editIndividualTask :params="editIndividualTaskParams" @refreshTable="this.onLoad" /> |
| | | <editSectionTask :params="editSectionTaskParams" @refreshTable="this.onLoad" /> |
| | | <!-- 发布 --> |
| | | <individualTaskPublic :params="taskPublicParams" @refreshTable="this.onLoad" /> |
| | | <!-- 预览 --> |
| | | <viewEvaluate :params="viewEvaluateParams" /> |
| | | <!-- 投票详情 --> |
| | | <votingDetails :params="votingParams" /> |
| | | </basic-container> |
| | | </template> |
| | | |
| | |
| | | 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 viewEvaluateDetail from './components/viewEvaluateDetail.vue'; |
| | | import { getDeptTree } from '@/api/system/dept'; |
| | | import addIndividualTask from './components/addIndividualTask.vue'; |
| | | import addSectionTask from './components/addSectionTask.vue'; |
| | | import viewEvaluate from './components/viewEvaluateDetail.vue'; |
| | | import individualTaskPublic from './components/IndividualTaskPublic.vue'; |
| | | import votingDetails from './components/votingDetails.vue'; |
| | | import editIndividualTask from './components/editIndividualTask.vue' |
| | | import editSectionTask from './components/editSectionTask.vue' |
| | | |
| | | export default { |
| | | components: { |
| | | addDialog, |
| | | addCandidate, |
| | | viewEvaluateDetail |
| | | addIndividualTask, |
| | | addSectionTask, |
| | | individualTaskPublic, |
| | | viewEvaluate, |
| | | votingDetails, |
| | | editIndividualTask, |
| | | editSectionTask |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | selectionList: [], |
| | | option: option, |
| | | data: [], |
| | | // 发布弹窗 |
| | | dialogVisible: false, |
| | | publicForm: { |
| | | publicData: '', |
| | | }, |
| | | isAddDialogVisible: false, |
| | | addParams: {}, |
| | | addIndividualParams: {}, |
| | | addSectionParams: {}, |
| | | viewParams: {}, |
| | | depts: [], |
| | | // 考核结果参数 |
| | | defaultTaskType: 0, |
| | | taskTypeList: { |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | // 新增候选人params |
| | | addCandidateParams: {}, |
| | | // 信息预览弹窗 |
| | | viewEvaluateDetailParams: {}, |
| | | viewEvaluateParams: {}, |
| | | taskPublicParams: {}, |
| | | votingParams: {}, |
| | | // 编辑 |
| | | editIndividualTaskParams: {}, |
| | | editSectionTaskParams: {}, |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | }, |
| | | 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( |
| | |
| | | } |
| | | ); |
| | | }, |
| | | editDialog(row) { |
| | | this.addParams = { |
| | | viewHandlerClick(row) { |
| | | this.viewEvaluateParams = { |
| | | visible: true, |
| | | title: '编辑', |
| | | isEdit: true, |
| | | type: this.defaultTaskType, |
| | | addForm: { |
| | | ...row, |
| | | }, |
| | | }; |
| | | data: row |
| | | } |
| | | }, |
| | | viewDateilDialog(row) { |
| | | this.viewEvaluateDetailParams = { |
| | | viewVotingDetailsHandlerClick(row) { |
| | | this.votingParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | }, |
| | | editTaskDialog(row) { |
| | | if (!this.defaultTaskType) { |
| | | this.editIndividualTaskParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | } else { |
| | | this.editSectionTaskParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | } |
| | | |
| | | }, |
| | | taskPublicDialog(row) { |
| | | this.taskPublicParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | |
| | | |
| | | let values = { |
| | | ...this.query, |
| | | ...params, |
| | | taskName_like: taskName, |
| | | ...params |
| | | }; |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | const data = res.data.data; |
| | |
| | | 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; |
| | | }, |
| | | setStatus(value) { |
| | | const status = { |
| | | 0: '未开始', |
| | | 1: '进行中', |
| | | 2: '已完成' |
| | | } |
| | | return status[value] |
| | | }, |
| | | updateState(row, name) { |
| | | const text = (name === 'candidateState' ? '是否提前结束第一轮评优?' : '是否提前结束评优任务?') |
| | | this.$confirm(text, { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(res => { |
| | | const { id } = row |
| | | let params = { |
| | | id |
| | | } |
| | | name === 'candidateState' ? Object.assign(params, { candidateState: 2 }) : Object.assign(params, { evaluateState: 2 }) |
| | | update(params).then(res => { |
| | | if (res.data.code !== 200) return this.$message.error(res.data.msg) |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | this.onLoad(this.page); |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | type: () => this.defaultTaskType |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | | <style lang="scss" scoped> |
| | | .time-box { |
| | | display: inline-block; |
| | | text-align: center; |
| | | } |
| | | </style> |