feat: sync page state and global state saving behavior (#1540)
This commit is contained in:
parent
c157e9f19c
commit
021d3c4d35
|
@ -230,7 +230,7 @@ export default {
|
||||||
|
|
||||||
if (activeName.value === STATE.CURRENT_STATE) {
|
if (activeName.value === STATE.CURRENT_STATE) {
|
||||||
// 校验
|
// 校验
|
||||||
variableRef.value.validateForm().then(() => {
|
variableRef.value.validateForm().then(async () => {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const variable = variableRef.value.getFormData()
|
const variable = variableRef.value.getFormData()
|
||||||
|
|
||||||
|
@ -243,7 +243,17 @@ export default {
|
||||||
updateSchema({ state: { ...(schema.state || {}), [name]: variable } })
|
updateSchema({ state: { ...(schema.state || {}), [name]: variable } })
|
||||||
|
|
||||||
useHistory().addHistory()
|
useHistory().addHistory()
|
||||||
openCommon()
|
|
||||||
|
const isFixed = props.fixedPanels.includes(PLUGIN_NAME.State)
|
||||||
|
// 如果面板没有固定,临时固定,避免因保存时清空选中状态导致的面板关闭
|
||||||
|
if (!isFixed) {
|
||||||
|
useLayout().changeLeftFixedPanels(PLUGIN_NAME.State)
|
||||||
|
}
|
||||||
|
await openCommon()
|
||||||
|
// 恢复原来固定的状态
|
||||||
|
if (!isFixed) {
|
||||||
|
useLayout().changeLeftFixedPanels(PLUGIN_NAME.State)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
storeRef.value.validateForm().then(() => {
|
storeRef.value.validateForm().then(() => {
|
||||||
|
@ -276,6 +286,7 @@ export default {
|
||||||
updateGlobalState(id, { global_state: storeList }).then((res) => {
|
updateGlobalState(id, { global_state: storeList }).then((res) => {
|
||||||
isPanelShow.value = false
|
isPanelShow.value = false
|
||||||
useResource().appSchemaState.globalState = res.global_state || []
|
useResource().appSchemaState.globalState = res.global_state || []
|
||||||
|
useNotify({ message: '保存成功!', type: 'success' })
|
||||||
})
|
})
|
||||||
openCommon()
|
openCommon()
|
||||||
})
|
})
|
||||||
|
|
|
@ -173,7 +173,7 @@ export const openCommon = async () => {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
saveCommon(state.code).finally(() => {
|
return saveCommon(state.code).finally(() => {
|
||||||
state.disabled = false
|
state.disabled = false
|
||||||
|
|
||||||
if (typeof saved === 'function') {
|
if (typeof saved === 'function') {
|
||||||
|
|
Loading…
Reference in New Issue