diff --git a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue index df8ed9f..02bb08e 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue @@ -2,7 +2,7 @@ - + diff --git a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue index 37c81ee..e62fbab 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue @@ -45,28 +45,30 @@ > --> - - - - - - - - - + + + + + + + + + + + @@ -110,13 +112,14 @@ const tableStyle = { const getDataList = (formData: any) => { console.log(formData); - const index = supermarketAuxiliaryCodeEntityList.value.findIndex((item: any) => item.id === formData.id); - if (index === -1) { - supermarketAuxiliaryCodeEntityList.value.push(formData); + const index = supermarketAuxiliaryCodeEntityList.value?.findIndex((item: any) => item.id === formData.id); + if (supermarketAuxiliaryCodeEntityList.value == null || index == undefined) { + supermarketAuxiliaryCodeEntityList.value = [{ ...formData, isNew: true }]; + } else if (index === -1) { + supermarketAuxiliaryCodeEntityList.value.push({ ...formData, isNew: true }); } else { supermarketAuxiliaryCodeEntityList.value[index] = formData; } - console.log('a', supermarketAuxiliaryCodeEntityList.value); }; // 清空搜索条件 // const resetQuery = () => { diff --git a/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue index 442d64d..fbf3a8f 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue @@ -53,33 +53,35 @@ > --> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -122,13 +124,14 @@ const tableStyle = { const getDataList = (formData: any) => { console.log(formData); - const index = supermarketUnitEntityList.value.findIndex((item: any) => item.id === formData.id); - if (index === -1) { - supermarketUnitEntityList.value.push(formData); + const index = supermarketUnitEntityList.value?.findIndex((item: any) => item.id === formData.id); + if (supermarketUnitEntityList.value == null || index == undefined) { + supermarketUnitEntityList.value = [{ ...formData, isNew: true }]; + } else if (index === -1) { + supermarketUnitEntityList.value.push({ ...formData, isNew: true }); } else { supermarketUnitEntityList.value[index] = formData; } - console.log('a', supermarketUnitEntityList.value); }; // 清空搜索条件 diff --git a/src/views/supermarket/supermarketSpu/form.vue b/src/views/supermarket/supermarketSpu/form.vue index 2373b96..a0d69d1 100644 --- a/src/views/supermarket/supermarketSpu/form.vue +++ b/src/views/supermarket/supermarketSpu/form.vue @@ -4,183 +4,183 @@ - + - + - + - + - + - + - - - - - - - - - - - {{ item.label }} - - - - + - + - + - - - - - - + + + + {{ item.label }} + + + + + + + + + - + - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - + - + - - - - - + + + + + @@ -203,7 +203,7 @@ -