| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-else filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <el-select v-else v-model="form" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <el-option |
| | | v-for="item in formTaskUserIds" |
| | | :key="item.id" |
| | |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="checkForm(1)">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | 'form.consumedHours': function(newVal, oldVal) { |
| | | this.newValue = newVal |
| | | this.oldValue = oldVal |
| | | }, |
| | | 'confirmProgress': function(newVal) { |
| | | this.confirmProgress = newVal |
| | | }, |
| | | 'confirmHours': function(newVal) { |
| | | this.confirmHours = newVal |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | this.taskLoading = false |
| | | }, |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | // 先check一下 |
| | | this.resData = this.getCheckResult(this.form.taskProgress, this.form.taskUserMongo.id) |
| | | console.log(2) |
| | | console.log(this.resData) |
| | | if (this.resData === false && !this.confirmProgress) { |
| | | }, |
| | | checkForm(flag) { |
| | | crudTaskDaliy.checkTaskHours({ 'taskProgress': this.form.taskProgress, 'taskUserId': this.form.taskUserMongo.id, 'fillDate': this.form.fillDate }).then(res => { |
| | | if (res === false && !this.confirmProgress) { |
| | | flag++ |
| | | // 为假 |
| | | this.centerDialogVisibleTaskProgress = true |
| | | this.waitForPropertyConfirmProgress() |
| | | return false |
| | | } |
| | | |
| | | if (this.confirmProgress) { |
| | | // 如果确定了 |
| | | const result = (this.form.alreadyConsumedHours - 0) + (this.newValue - 0) - (this.oldValue - 0) |
| | | if (result > this.form.taskHours && !this.confirmHours) { |
| | | this.centerDialogVisibleTaskHours = true |
| | | this.waitForPropertyConfirmHours() |
| | | return false |
| | | if (this.confirmHours) { |
| | | this.crud.submitCU() |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | this.checkForm() |
| | | } |
| | | |
| | | return true |
| | | }, |
| | | getCheckResult(taskProgress, taskUserId) { |
| | | return (async function() { |
| | | console.log(1) |
| | | const result = await crudTaskDaliy.checkTaskHours({ 'taskProgress': taskProgress, 'taskUserId': taskUserId }) |
| | | console.log(3) |
| | | return result |
| | | })() |
| | | } |
| | | } else { |
| | | this.crud.submitCU() |
| | | } |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | // 没确定 |
| | | this.checkForm() |
| | | } |
| | | } |
| | | } else { |
| | | flag++ |
| | | // 判读时间 |
| | | const result = (this.form.alreadyConsumedHours - 0) + (this.newValue - 0) - (this.oldValue - 0) |
| | | if (result > this.form.taskHours && !this.confirmHours) { |
| | | this.centerDialogVisibleTaskHours = true |
| | | if (this.confirmHours) { |
| | | this.crud.submitCU() |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | this.checkForm() |
| | | } |
| | | } |
| | | } else { |
| | | this.crud.submitCU() |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | getAdventTasks() { |
| | | crudTaskUser.getAdventTasks().then(res => { |
| | |
| | | submitDialogTaskProgress() { |
| | | this.centerDialogVisibleTaskProgress = false |
| | | this.confirmProgress = true |
| | | }, |
| | | waitForPropertyConfirmHours() { |
| | | new Promise(resolve => { |
| | | this.$watch('confirmHours', (newValue) => { |
| | | if (newValue === true) { |
| | | console.log(newValue) |
| | | resolve(this.crud.submitCU()) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | waitForPropertyConfirmProgress() { |
| | | new Promise(resolve => { |
| | | this.$watch('confirmProgress', (newValue) => { |
| | | if (newValue === true) { |
| | | resolve(this.crud.submitCU()) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |