优化字段生成

This commit is contained in:
24kycj
2025-12-09 17:32:42 +08:00
parent 03a5a18998
commit 9c471a494c
+16 -4
View File
@@ -589,6 +589,10 @@ export default {
that.form[key] = that.saveWorkList[key] that.form[key] = that.saveWorkList[key]
} }
that.form.task_name = that.saveWorkList.task_name 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) { if (that.saveWorkList.json_file) {
fs.readFile(that.saveWorkList.json_file, 'utf8', (err, data) => { fs.readFile(that.saveWorkList.json_file, 'utf8', (err, data) => {
if (err) { if (err) {
@@ -1127,10 +1131,18 @@ export default {
show() { show() {
this.addShow = true this.addShow = true
this.getTemplates() this.getTemplates()
this.form.task_uuid = this.genTaskUUID() // 只有新建作业时才生成新的task_uuid和label,打开已有文件时保留原有的值
this.csvForm.req_info.uuid = this.form.task_uuid if (this.isNew) {
this.form.label = dayjs().format('YYYY-MM-DD') this.form.task_uuid = this.genTaskUUID()
console.log(this.form.task_uuid) this.csvForm.req_info.uuid = this.form.task_uuid
this.form.label = dayjs().format('YYYY-MM-DD')
} else {
// 打开已有文件时,使用从文件加载的task_uuid和labelisNew watch会恢复)
// 使用$nextTick确保isNew watch先执行,恢复task_uuid
this.$nextTick(() => {
this.csvForm.req_info.uuid = this.form.task_uuid
})
}
}, },
close() { close() {
this.addShow = false this.addShow = false