修复标准代码表添加数据后编辑问题
Showing
1 changed file
with
23 additions
and
2 deletions
| ... | @@ -412,7 +412,6 @@ function confirm () { | ... | @@ -412,7 +412,6 @@ function confirm () { |
| 412 | } | 412 | } |
| 413 | } | 413 | } |
| 414 | } | 414 | } |
| 415 | debugger | ||
| 416 | confirmLoading.value = true | 415 | confirmLoading.value = true |
| 417 | request(body).then((res:any) => { | 416 | request(body).then((res:any) => { |
| 418 | if (res.code === proxy.$passCode) { | 417 | if (res.code === proxy.$passCode) { |
| ... | @@ -428,6 +427,7 @@ function confirm () { | ... | @@ -428,6 +427,7 @@ function confirm () { |
| 428 | 427 | ||
| 429 | function getTreeSelectOptions () { | 428 | function getTreeSelectOptions () { |
| 430 | return getMetaStandardTree().then((res:any) => { | 429 | return getMetaStandardTree().then((res:any) => { |
| 430 | loading.value = false | ||
| 431 | if (res.code === proxy.$passCode) { | 431 | if (res.code === proxy.$passCode) { |
| 432 | let data = res.data || [] | 432 | let data = res.data || [] |
| 433 | data.forEach(item => { | 433 | data.forEach(item => { |
| ... | @@ -449,15 +449,36 @@ watch( | ... | @@ -449,15 +449,36 @@ watch( |
| 449 | treeSelectDisabled.value = false | 449 | treeSelectDisabled.value = false |
| 450 | if (props.type === 'edit') { | 450 | if (props.type === 'edit') { |
| 451 | // fieldsControlDisabled.value = false | 451 | // fieldsControlDisabled.value = false |
| 452 | 452 | loading.value = true | |
| 453 | getTreeSelectOptions().then(() => { | 453 | getTreeSelectOptions().then(() => { |
| 454 | loading.value = false | ||
| 455 | let guid = props.currentNode?.guid; | ||
| 456 | treeCurrentNode.value = props.currentNode | ||
| 457 | if (guid) { | ||
| 458 | let getNode = (object: any) => { | ||
| 459 | for (const select of object) { | ||
| 460 | if (select.guid == guid) { | ||
| 461 | return select; | ||
| 462 | } | ||
| 463 | if (select?.children?.length) { | ||
| 464 | return getNode(select.children); | ||
| 465 | } | ||
| 466 | } | ||
| 467 | } | ||
| 468 | let node = getNode(treeSelectData.value); | ||
| 469 | if (node) { | ||
| 470 | treeCurrentNode.value = node; | ||
| 471 | } | ||
| 472 | } | ||
| 454 | getDetail().then(() => formatOptions(treeSelectData.value)) | 473 | getDetail().then(() => formatOptions(treeSelectData.value)) |
| 455 | }) | 474 | }) |
| 456 | treeCurrentNode.value = props.currentNode | 475 | treeCurrentNode.value = props.currentNode |
| 457 | } else { | 476 | } else { |
| 458 | // fieldsControlDisabled.value = true | 477 | // fieldsControlDisabled.value = true |
| 459 | form.value = { ...formTpl } | 478 | form.value = { ...formTpl } |
| 479 | loading.value = true | ||
| 460 | getTreeSelectOptions().then(() => { | 480 | getTreeSelectOptions().then(() => { |
| 481 | loading.value = false | ||
| 461 | formatOptions(treeSelectData.value) | 482 | formatOptions(treeSelectData.value) |
| 462 | }) | 483 | }) |
| 463 | treeCurrentNode.value = {} | 484 | treeCurrentNode.value = {} | ... | ... |
-
Please register or sign in to post a comment