fix: 商品编辑

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

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

@ -44,17 +44,24 @@ const mutations = {
state.tabList.push(tab);
}
},
closeTab: (state, { index, reverse }) => {
if (typeof index === 'undefined') {
state.tabList.splice(1);
closeTab: (state, { index, reverse, current }) => {
if (current) {
state.tabList.splice(
state.tabList.findIndex((item) => item.name === state.activeTab),
1
);
} else {
if (reverse) {
let tab = state.tabList[index];
router.push(tab.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);
if (typeof index === 'undefined') {
state.tabList.splice(1);
} else {
if (reverse) {
let tab = state.tabList[index];
router.push(tab.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('productSkus/save', { id: route.params.id, data });
store.commit('layout/closeTab', { current: true });
router.push({ name: 'ProductManagement' });
}
state.loading = false;

Loading…
Cancel
Save