| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="请输入任务名称" |
| | | prefix-icon="el-icon-search" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select |
| | | v-model="query.taskStatus" |
| | | filterable |
| | |
| | | <el-form-item v-show="form.rid !== null" label="复核对象" prop="rname"> |
| | | <el-input v-model="form.rname" disabled style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务名称"> |
| | | <el-form-item label="任务名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | |
| | | >小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-form-item v-if="crud.status.add === 1" label="选择类型" prop="selectType"> |
| | | <el-radio-group v-model="form.selectType" style="width: 340px;" @change="handleTypeChange"> |
| | | <el-radio-button label="single">单选</el-radio-button> |
| | | <el-radio-button label="multiple">多选</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item v-show="form.selectType === 'single'" label="所属员工" prop="userId"> |
| | | <el-select |
| | | v-model="form.userId" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择" |
| | | style="width: 340px;" |
| | | :disabled="form.start" |
| | | @change="withUser(form)" |
| | | > |
| | | <el-option |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-show="form.selectType === 'multiple'" label="所属员工" prop="userIds"> |
| | | <el-select |
| | | v-model="form.userIds" |
| | | filterable |
| | | clearable |
| | | multiple |
| | | placeholder="请选择" |
| | | style="width: 340px;" |
| | | @change="withUser(form)" |
| | | > |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled=" |
| | | !item.enabled || form.divideUserIds.includes(item.id) |
| | | " |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ |
| | | item.levelName |
| | | }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="绩效工时" prop="performanceHours"> |
| | | <el-input |
| | | v-model="form.performanceHours" |
| | |
| | | is_ok: null, |
| | | uid: null, |
| | | rid: null, |
| | | rname: null |
| | | rname: null, |
| | | // 多选用户id |
| | | userIds: [], |
| | | // 用于新增用户时单选或多选 |
| | | selectType: 'single' |
| | | } |
| | | export default { |
| | | name: 'TaskUser', |
| | |
| | | generate: ['admin', 'taskUser:add'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '任务名称不能为空', trigger: 'change' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | | ], |
| | |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'taskStatus', display_name: '任务状态' }, |
| | | { key: 'createTime', display_name: '创建时间' } |
| | | { key: 'createTime', display_name: '创建时间' }, |
| | | { key: 'name', display_name: '名称' } |
| | | ], |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | // 新建之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterEditCancel]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | // 取消新建之前 |
| | | [CRUD.HOOK.beforeAddCancel]() { |
| | |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | // 提交之后 |
| | | [CRUD.HOOK.afterSubmit]() { |
| | |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.task.id = this.query.taskId |
| | |
| | | 隔绝列8, |
| | | ...newItem |
| | | } = item |
| | | if ('任务开始时间' in newItem) { |
| | | // 判断日期格式是否正确,如果不正确,则提示错误信息,并覆盖数据为false |
| | | if ('任务开始时间' in newItem && Number.isFinite(newItem['任务开始时间'])) { |
| | | newItem['任务开始时间'] = formatExcelDate(newItem['任务开始时间']) |
| | | } else { |
| | | this.$message.warning('第' + (this.generateForm.indexOf(item) + 1) + '项的任务开始时间格式不正确') |
| | | return false |
| | | } |
| | | if ('任务结束时间' in newItem) { |
| | | if ('任务结束时间' in newItem && Number.isFinite(newItem['任务结束时间'])) { |
| | | newItem['任务结束时间'] = formatExcelDate(newItem['任务结束时间']) |
| | | } else { |
| | | this.$message.warning('第' + (this.generateForm.indexOf(item) + 1) + '项的任务结束时间格式不正确') |
| | | return false |
| | | } |
| | | return newItem |
| | | }) |
| | | // 表头数据转换 |
| | | this.generateFormTwo = transformData(results) |
| | | for (let i = 0; i < this.generateFormTwo.length; i++) { |
| | | const item = this.generateFormTwo[i] |
| | | if (!item.name) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的名称为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | |
| | | if (this.generateForm.includes(false)) { |
| | | // 存在异常数据,清空表单数据 |
| | | this.generateForm = [] |
| | | return false |
| | | } else { |
| | | // 表头数据转换 |
| | | this.generateFormTwo = transformData(results) |
| | | for (let i = 0; i < this.generateFormTwo.length; i++) { |
| | | const item = this.generateFormTwo[i] |
| | | if (!item.name) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的名称为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskStartDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务开始时间为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskEndDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务结束时间为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskHours) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务工时为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskStatus) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务状态为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | // 状态转换 |
| | | if (item.taskStatus === '未开始') { |
| | | item.taskStatus = constant.TASK_STATUS_NOT_STARTED |
| | | } else if (item.taskStatus === '进行中') { |
| | | item.taskStatus = constant.TASK_STATUS_IN_HAND |
| | | } else if (item.taskStatus === '待测试') { |
| | | item.taskStatus = constant.TASK_STATUS_TEST |
| | | } else if (item.taskStatus === '已暂停') { |
| | | item.taskStatus = constant.TASK_STATUS_STOP |
| | | } else if (item.taskStatus === '未承认') { |
| | | item.taskStatus = constant.TASK_STATUS_UNRECOGNIZED |
| | | } else if (item.taskStatus === '已完成') { |
| | | item.taskStatus = constant.TASK_STATUS_COMPLETED |
| | | } |
| | | if (item.taskStartDate > item.taskEndDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务开始时间大于任务结束时间`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | } |
| | | if (!item.taskStartDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务开始时间为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskEndDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务结束时间为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskHours) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务工时为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskStatus) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务状态为空`, |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | this.tableHeader = header.filter( |
| | | item => |
| | | item !== '所属员工ID' && item !== '任务状态ID' && item !== '优先度ID' && item !== '隔绝列1' && |
| | | item !== '隔绝列2' && item !== '隔绝列3' && item !== '隔绝列4' && item !== '隔绝列5' && item !== '隔绝列6' && |
| | | item !== '隔绝列7' && item !== '隔绝列8' |
| | | ) |
| | | } |
| | | this.tableHeader = header.filter( |
| | | item => |
| | | item !== '所属员工ID' && item !== '任务状态ID' && item !== '优先度ID' && item !== '隔绝列1' && |
| | | item !== '隔绝列2' && item !== '隔绝列3' && item !== '隔绝列4' && item !== '隔绝列5' && item !== '隔绝列6' && |
| | | item !== '隔绝列7' && item !== '隔绝列8' |
| | | ) |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | |
| | | } else { |
| | | that.$message.warning('复核任务下不可创建复核任务') |
| | | } |
| | | }, |
| | | // 切换类型时清空之前的选择 |
| | | handleTypeChange() { |
| | | const that = this |
| | | that.$set(that.form, 'userId', null) |
| | | that.$set(that.form, 'userIds', []) |
| | | } |
| | | } |
| | | } |