| | |
| | | const { $index, id, deptId } = row |
| | | const params = $props.params.data |
| | | const info = params.candidateNum.find(item => item.deptId === deptId) |
| | | const index = info.users.find(item => item.id === id) |
| | | const index = info.users.findIndex(item => item.id === id) |
| | | info.users.splice(index, 1) |
| | | if (info.val > info.users.length) { |
| | | info.val = info.users.length |
| | | } |
| | | update(params).then( |
| | | () => { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | initData() |
| | | $emit('refreshTable', '') |
| | | }, |
| | | error => { |
| | | ElMessage({ |
| | | type: 'error', |
| | | message: error, |
| | | }); |
| | | } |
| | | ); |
| | | // if (info.val === 0) { |
| | | |
| | | // } |
| | | // if (info.val > info.users.length) { |
| | | // info.val = info.users.length |
| | | // } |
| | | // update(params).then( |
| | | // () => { |
| | | // ElMessage({ |
| | | // type: 'success', |
| | | // message: '操作成功!', |
| | | // }); |
| | | // initData() |
| | | // $emit('refreshTable', '') |
| | | // }, |
| | | // error => { |
| | | // ElMessage({ |
| | | // type: 'error', |
| | | // message: error, |
| | | // }); |
| | | // } |
| | | // ); |
| | | } |
| | | |
| | | watch(() => $props.params.visible, (val) => { |
| | |
| | | <template> |
| | | <el-dialog v-model="params.visible" :title="params.title" width="60%" destroy-on-close> |
| | | <el-dialog v-model="params.visible" :rules="rules" :title="params.title" width="60%" destroy-on-close> |
| | | <div class="content"> |
| | | <el-form :model="addForm" label-width="130px" :rules="rules" ref="addFormRef"> |
| | | <el-form-item label="任务名称:" prop="taskName"> |
| | |
| | | </el-form-item> --> |
| | | <el-form-item :label="params.type ? '评定部门:' : '候选部门:'" prop="candidateNum"> |
| | | <el-select v-model="selectGroup" value-key="deptId" multiple style="width: 100%;" placeholder="请选择候选部门"> |
| | | <el-option v-for="dept in depts" :key="dept.deptId" :label="dept.employees.length === 0 ? (dept.deptName + '(当前部门下员工人数为0)') : dept.deptName" |
| | | <el-option v-for="dept in depts" :key="dept.deptId" |
| | | :label="dept.employees.length === 0 ? (dept.deptName + '(当前部门下员工人数为0)') : dept.deptName" |
| | | :value="dept" :disabled="dept.employees.length === 0"></el-option> |
| | | </el-select> |
| | | <div class="select-list"> |
| | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="params.visible = false">取消</el-button> |
| | | <el-button type="primary" @click="params.isEdit ? handleEdit() : handleSubmit()">确认</el-button> |
| | | <el-button type="primary" @click="submitOrEdit">确认</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | { required: true, message: '请选择评优类型', trigger: 'blur' } |
| | | ], |
| | | candidateNum: [ |
| | | { required: true, message: '请选择候选人截止日期', trigger: 'click' } |
| | | { required: true, message: '请选择候选人', trigger: 'click' } |
| | | ], |
| | | candidateCutoffTime: [ |
| | | { required: true, message: '请选择候选人截止日期', trigger: 'click' }, |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | submitOrEdit() { |
| | | const { candidateNum } = this.addForm |
| | | const isExist = candidateNum.find(item => item.val === void 0 || item.val === 0 || item.users.length === 0) |
| | | if (isExist) { |
| | | this.$message.warning(`${isExist.deptName}候选人人数不可为空或者0`) |
| | | } else { |
| | | this.params.isEdit ? this.handleEdit() : this.handleSubmit() |
| | | } |
| | | }, |
| | | handleSubmit() { |
| | | this.$refs.addFormRef.validate(valid => { |
| | | add(this.addForm).then( |
| | |
| | | <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" v-if="row.type === 0" text plain icon="el-icon-plus" @click="addCandidateHandle(row)">新增候选人</el-button> |
| | | <!-- <el-button type="primary" v-if="row.type === 0" text plain icon="el-icon-plus" @click="addCandidateHandle(row)">新增候选人</el-button> --> |
| | | <el-button type="primary" text plain icon="el-icon-download">导出</el-button> |
| | | </template> |
| | | </avue-crud> |
| | |
| | | const result = deptResult.data.data; |
| | | let deptList = []; |
| | | result.forEach(dept => { |
| | | console.log(dept); |
| | | if (dept.children) { |
| | | deptList = result.concat(dept.children); |
| | | delete dept.children; |