| | |
| | | style="margin-right: 6px;" |
| | | @click="toReviewTask()" |
| | | >新建复核</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.download" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-download" |
| | | style="margin-right: 6px;" |
| | | :loading="downloadTemplateLoading" |
| | | @click="downloadTemplate" |
| | | >下载模板</el-button> |
| | | </crudOperation> |
| | | <div> |
| | | <span> |
| | |
| | | taskTotal: {}, |
| | | taskDatas: [], |
| | | taskLoading: false, |
| | | downloadTemplateLoading: false, |
| | | defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' }, |
| | | permission: { |
| | | list: ['admin', 'taskUser:list'], |
| | |
| | | 隔绝列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 === constant.TASK_STATUS_NOT_STARTED || |
| | | item.taskStatus === constant.TASK_STATUS_IN_HAND || |
| | | item.taskStatus === constant.TASK_STATUS_TEST || |
| | | item.taskStatus === constant.TASK_STATUS_STOP || |
| | | item.taskStatus === constant.TASK_STATUS_UNRECOGNIZED || |
| | | item.taskStatus === constant.TASK_STATUS_COMPLETED |
| | | )) { |
| | | 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() { |
| | |
| | | const that = this |
| | | that.$set(that.form, 'userId', null) |
| | | that.$set(that.form, 'userIds', []) |
| | | }, |
| | | |
| | | // 下载模板 |
| | | downloadTemplate() { |
| | | const that = this |
| | | that.downloadTemplateLoading = true |
| | | that.crud.crudMethod.templateDownload().then(res => { |
| | | downloadFile(res, '任务分配模板', 'xlsx') |
| | | }).catch(e => { |
| | | that.$message.error(e.message) |
| | | }).finally( |
| | | that.downloadTemplateLoading = false |
| | | ) |
| | | } |
| | | } |
| | | } |