diff --git a/src/renderer/components/workAdd/workAdd.vue b/src/renderer/components/workAdd/workAdd.vue index e1ad4cb..dd8f7fa 100644 --- a/src/renderer/components/workAdd/workAdd.vue +++ b/src/renderer/components/workAdd/workAdd.vue @@ -589,6 +589,10 @@ export default { that.form[key] = that.saveWorkList[key] } that.form.task_name = that.saveWorkList.task_name + // 恢复task_uuid后,同步更新csvForm.req_info.uuid + if (that.form.task_uuid) { + that.csvForm.req_info.uuid = that.form.task_uuid + } if (that.saveWorkList.json_file) { fs.readFile(that.saveWorkList.json_file, 'utf8', (err, data) => { if (err) { @@ -1127,10 +1131,18 @@ export default { show() { this.addShow = true this.getTemplates() - this.form.task_uuid = this.genTaskUUID() - this.csvForm.req_info.uuid = this.form.task_uuid - this.form.label = dayjs().format('YYYY-MM-DD') - console.log(this.form.task_uuid) + // 只有新建作业时才生成新的task_uuid和label,打开已有文件时保留原有的值 + if (this.isNew) { + this.form.task_uuid = this.genTaskUUID() + this.csvForm.req_info.uuid = this.form.task_uuid + this.form.label = dayjs().format('YYYY-MM-DD') + } else { + // 打开已有文件时,使用从文件加载的task_uuid和label(isNew watch会恢复) + // 使用$nextTick确保isNew watch先执行,恢复task_uuid + this.$nextTick(() => { + this.csvForm.req_info.uuid = this.form.task_uuid + }) + } }, close() { this.addShow = false