| | |
| | | </el-form-item> |
| | | <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"> |
| | | <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey" |
| | | @change="checkBoxChange($event, item)"> |
| | | {{ item.dictValue }} |
| | | <el-button type="primary" icon="el-icon-edit" text |
| | | @click="selectionHandler(item)">设置人员</el-button> |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | |
| | | <el-button @click="() => params.visible = false">取消</el-button> |
| | | <el-button type="primary" @click="submit">确定</el-button> |
| | | </template> |
| | | <!-- 人员选择 --> |
| | | <selectionDialog :params="selectionParams" @addEvaluateParams="addEvaluateParams" /> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | |
| | | import { getDict } from '@/api/dict' |
| | | import { update } from '@/api/evaluate/evaluateTask' |
| | | import _ from 'lodash'; |
| | | import selectionDialog from './selectionDialog.vue'; |
| | | |
| | | export default { |
| | | inject: ['type'], |
| | | components: { |
| | | selectionDialog |
| | | }, |
| | | props: { |
| | | params: { |
| | | type: Object, |
| | |
| | | evaluateAwards: '', |
| | | identificationStandard: '', |
| | | pollingPersons: [], |
| | | votePersonObjInfo: [], |
| | | evaluateCutoffTimeStart: '', |
| | | evaluateCutoffTimeEnd: '' |
| | | }, |
| | |
| | | } |
| | | ] |
| | | }, |
| | | employeeDict: [] |
| | | employeeDict: [], |
| | | selectionParams: {} |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | openDialog() { |
| | | this.initDict() |
| | | const { id, taskName, evaluateAwards, identificationStandard, pollingPersons, evaluateCutoffTimeStart, evaluateCutoffTimeEnd } = this.params.data |
| | | const { id, taskName, evaluateAwards, identificationStandard, pollingPersons, votePersonObjInfo, evaluateCutoffTimeStart, evaluateCutoffTimeEnd } = this.params.data |
| | | this.form = { |
| | | id, |
| | | taskName, |
| | | evaluateAwards, |
| | | identificationStandard, |
| | | pollingPersons: pollingPersons.split(','), |
| | | evaluateCutoffTimeStart, |
| | | taskName, |
| | | evaluateAwards, |
| | | identificationStandard, |
| | | pollingPersons: pollingPersons.split(',') || [], |
| | | votePersonObjInfo: JSON.parse(votePersonObjInfo) || [], |
| | | evaluateCutoffTimeStart, |
| | | evaluateCutoffTimeEnd |
| | | } |
| | | console.log(this.form); |
| | | }, |
| | | submit() { |
| | | this.$refs.formRef.validate(vaild => { |
| | |
| | | } |
| | | this.employeeDict = data |
| | | }) |
| | | }, |
| | | selectionHandler(row) { |
| | | const obj = this.form.votePersonObjInfo.find(item => item.employeeType === row.dictKey) || {} |
| | | this.selectionParams = { |
| | | visible: true, |
| | | data: row, |
| | | values: obj |
| | | } |
| | | }, |
| | | checkBoxChange(e, { dictKey }) { |
| | | const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === dictKey) |
| | | if (!e) { |
| | | this.form.votePersonObjInfo.splice(index, 1) |
| | | return |
| | | } |
| | | getEmployeeLevelList(dictKey).then((res) => { |
| | | const { code, data } = res.data |
| | | if (code !== 200) return this.$message.error('当前级别人员加载失败,请重试!!') |
| | | const participateInList = data.map(item => { |
| | | const { id, name, deptId, deptName, postId, postName } = item |
| | | return { id, name, deptId, deptName, postId, postName } |
| | | }) |
| | | const params = { |
| | | employeeType: dictKey, |
| | | participateIn: participateInList, |
| | | notParticipateIn: [] |
| | | } |
| | | if (index === -1) { |
| | | this.form.votePersonObjInfo.push(params) |
| | | } else { |
| | | this.form.votePersonObjInfo[index] = params |
| | | } |
| | | }) |
| | | }, |
| | | addEvaluateParams(params) { |
| | | const { participateIn, employeeType } = params |
| | | const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === employeeType) |
| | | const typeIndex = this.form.pollingPersons.findIndex(item => item === employeeType) |
| | | |
| | | if (index === -1) { |
| | | if (participateIn.length > 0) { |
| | | this.form.votePersonObjInfo.push(params) |
| | | this.form.pollingPersons.push(params.employeeType) |
| | | } |
| | | } else { |
| | | if (participateIn.length > 0) { |
| | | this.form.votePersonObjInfo[index] = params |
| | | } else { |
| | | this.form.votePersonObjInfo.splice(index, 1) |
| | | this.form.pollingPersons.splice(typeIndex, 1) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |