fix: 商品编辑

fix/0524_ch
向文可 2 years ago
parent 06bd37d6cb
commit da861c397c

@ -28,16 +28,16 @@
const activeTab = computed(() => store.state.layout.activeTab); const activeTab = computed(() => store.state.layout.activeTab);
const tabList = computed(() => store.state.layout.tabList); const tabList = computed(() => store.state.layout.tabList);
// //
watch( // watch(
() => unref(tabList), // () => unref(tabList),
(value) => { // (value) => {
if (!unref(activeTab) || value.findIndex((item) => item.name === unref(activeTab)) === -1) { // if (!unref(activeTab) || value.findIndex((item) => item.name === unref(activeTab)) === -1) {
console.info('[router] tabs push ' + value[0].fullPath); // console.info('[router] tabs push ' + value[0].fullPath);
router.push(value[0].fullPath); // router.push(value[0].fullPath);
} // }
}, // },
{ immediate: true, deep: true } // { immediate: true, deep: true }
); // );
const handleCloseTab = (index) => { const handleCloseTab = (index) => {
store.commit('layout/closeTab', { store.commit('layout/closeTab', {
index, index,

@ -44,17 +44,24 @@ const mutations = {
state.tabList.push(tab); state.tabList.push(tab);
} }
}, },
closeTab: (state, { index, reverse }) => { closeTab: (state, { index, reverse, current }) => {
if (typeof index === 'undefined') { if (current) {
state.tabList.splice(1); state.tabList.splice(
state.tabList.findIndex((item) => item.name === state.activeTab),
1
);
} else { } else {
if (reverse) { if (typeof index === 'undefined') {
let tab = state.tabList[index]; state.tabList.splice(1);
router.push(tab.fullPath); } else {
state.tabList = [tab]; if (reverse) {
} else if (state.tabList.length > 1) { let tab = state.tabList[index];
state.tabList.splice(index, 1); router.push(tab.fullPath);
router.push(state.tabList[Math.min(index, state.tabList.length - 1)].fullPath); state.tabList = [tab];
} else if (state.tabList.length > 1) {
state.tabList.splice(index, 1);
router.push(state.tabList[Math.min(index, state.tabList.length - 1)].fullPath);
}
} }
} }
}, },

@ -289,6 +289,7 @@
await store.dispatch('product/enable', { id: route.params.id, isEnable: true }); await store.dispatch('product/enable', { id: route.params.id, isEnable: true });
} }
await store.dispatch('productSkus/save', { id: route.params.id, data }); await store.dispatch('productSkus/save', { id: route.params.id, data });
store.commit('layout/closeTab', { current: true });
router.push({ name: 'ProductManagement' }); router.push({ name: 'ProductManagement' });
} }
state.loading = false; state.loading = false;

Loading…
Cancel
Save