diff --git a/src/services/commont.js b/src/services/commont.js index 0eb2ee4..fe4e3fe 100644 --- a/src/services/commont.js +++ b/src/services/commont.js @@ -446,7 +446,19 @@ export const initOss = (file) => { } }); } - +//深拷贝 +export function deepClone(obj, hash = new WeakMap()) { + if (obj == null || typeof obj !== "object") return obj + if (obj instanceof Date) return new Date(obj) + if (obj instanceof RegExp) return new RegExp(obj.source, obj.flags) + if (hash.has(obj)) return hash.set(obj) + const deepArr = Array.isArray(obj) ? [] : {} + hash.set(obj, deepArr); + for (const key in obj) { + deepArr[key] = deepClone(obj[key], hash); + } + return deepArr +} let commont = { maskData: maskData, @@ -467,7 +479,8 @@ let commont = { compression: compression, isObject: isObject, isArray: isArray, - initOss: initOss + initOss: initOss, + deepClone: deepClone } diff --git a/src/views/NewlyBuiltGoods/components/specificationDialog.vue b/src/views/NewlyBuiltGoods/components/specificationDialog.vue index b868e84..5054956 100644 --- a/src/views/NewlyBuiltGoods/components/specificationDialog.vue +++ b/src/views/NewlyBuiltGoods/components/specificationDialog.vue @@ -209,6 +209,10 @@ const submit_specification = (formEl) => { }); }; const submitForm = () => { + if (!specification_list.value.length) + return ElMessage.warning("没有添加任何规格属性!"); + if (!specification_list.value.every((item) => item.valueGrop.length)) + return ElMessage.warning("添加规格后至少添加一个属性值!"); $emit("specificationSubmit", specification_list); specificationClose(); }; diff --git a/src/views/NewlyBuiltGoods/index.vue b/src/views/NewlyBuiltGoods/index.vue index f0c430b..ad312fa 100644 --- a/src/views/NewlyBuiltGoods/index.vue +++ b/src/views/NewlyBuiltGoods/index.vue @@ -144,9 +144,9 @@ {{ el.xyName }}187/500
- + + + 新增闲鱼店铺
@@ -229,9 +229,9 @@ v-if="item.type === 'add'" @click="item.add" > - + + + 添加多规格深库存
- - - - - - - - +