From 9c471a494c0010d9f28db232332dc3f57aa6d138 Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Tue, 9 Dec 2025 17:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AD=97=E6=AE=B5=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/workAdd/workAdd.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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