From 79a4aa51899e85984dbc9440c46a7117fc324517 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 3 Jun 2023 20:50:07 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=EF=BC=9A=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 158585670ccab231b7a0902f62b9d134af747d50) --- src/utils/tree.ts | 3 +++ .../product/spu/components/BasicInfoForm.vue | 22 +++++++++++++------ .../spu/components/DescriptionForm.vue | 6 +++-- .../spu/components/OtherSettingsForm.vue | 3 +++ .../mall/product/spu/components/SkuList.vue | 4 +++- .../mall/product/spu/components/spu.data.ts | 1 + src/views/mall/product/spu/index.vue | 1 - 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/utils/tree.ts b/src/utils/tree.ts index e2bc600c..ded7d461 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -304,11 +304,14 @@ export const handleTree2 = (data, id, parentId, children, rootId) => { }) return treeData !== '' ? treeData : data } + /** + * 校验选中的节点,是否为指定 level * * @param tree 要操作的树结构数据 * @param nodeId 需要判断在什么层级的数据 * @param level 检查的级别, 默认检查到二级 + * @return true 是;false 否 */ export const checkSelectedNode = (tree: any[], nodeId: any, level = 2): boolean => { if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) { diff --git a/src/views/mall/product/spu/components/BasicInfoForm.vue b/src/views/mall/product/spu/components/BasicInfoForm.vue index 00a82a87..b8ae405c 100644 --- a/src/views/mall/product/spu/components/BasicInfoForm.vue +++ b/src/views/mall/product/spu/components/BasicInfoForm.vue @@ -1,4 +1,5 @@