fix: 🧩 树状结构支持多选

This commit is contained in:
2025-06-06 14:05:40 +08:00
parent f2ee833412
commit 6f8a3e72a5
25 changed files with 96 additions and 85 deletions

View File

@@ -26,7 +26,7 @@
</el-table-column>
<el-table-column prop="is_show" label="是否显示">
<template #default="{ row }">
{{ row.is_show === 1 ? "✔️" : "❌" }}
{{ row.is_show == 1 ? "✔️" : "❌" }}
</template>
</el-table-column>
<el-table-column label="操作" :width="350">
@@ -207,12 +207,12 @@ const reset = () => {
};
//重置表单配置
const resetFrom = () => {
if (dataStore.selectLevel === 1 || dataStore.selectLevel === 2) {
if (dataStore.selectLevel == 1 || dataStore.selectLevel == 2) {
dataStore.ruleForm = cloneDeep(RULE_FORM_LV1);
dataStore.formData = cloneDeep(FORM_DATA_LV1);
dataStore.rules = RULES_LV1;
}
if (dataStore.selectLevel === 3) {
if (dataStore.selectLevel == 3) {
dataStore.ruleForm = cloneDeep(RULE_FORM_LV2);
dataStore.formData = cloneDeep(FORM_DATA_LV2);
dataStore.rules = RULES_LV2;

View File

@@ -44,7 +44,7 @@
<el-table-column v-for="attrId in selectedAttrIds" :key="attrId" :label="findAttrById(attrId)?.attr_name">
<template #default="{ row }">
<el-form :model="row">
<el-form-item v-if="findAttrById(attrId)?.attr_type === 1" style="margin: 0">
<el-form-item v-if="findAttrById(attrId)?.attr_type == 1" style="margin: 0">
<el-select v-model="findAttrObjInRow(row, attrId).attr_value" placeholder="请选择">
<el-option
v-for="prop in findAttrById(attrId)?.props"

View File

@@ -1,5 +1,6 @@
interface FormItem {
prop: string;
prop1?: string;
label?: string;
placeholder?: string;
type: string;
@@ -31,7 +32,8 @@ export const FORM_DATA: FormItem[] = [
label: "型号: "
},
{
prop: "category_id",
prop: "treeIds",
prop1: "category_id",
placeholder: "请选择",
type: "treeSelect",
isArray: true,

View File

@@ -15,13 +15,13 @@
<el-image :src="scope.row.cover_image ? h + scope.row.cover_image : ''" style="width: 60px; height: 60px" />
</template>
<template #status="scope">
<el-tag effect="dark" :type="scope.row.status === 1 ? 'success' : 'danger'">{{
scope.row.status === 1 ? "启用" : "禁用"
<el-tag effect="dark" :type="scope.row.status == 1 ? 'success' : 'danger'">{{
scope.row.status == 1 ? "启用" : "禁用"
}}</el-tag>
</template>
<template #is_show="scope">
<el-tag :type="scope.row.is_show === 1 ? 'success' : 'danger'" effect="dark">{{
scope.row.is_show === 1 ? "已上架" : "未上架"
<el-tag :type="scope.row.is_show == 1 ? 'success' : 'danger'" effect="dark">{{
scope.row.is_show == 1 ? "已上架" : "未上架"
}}</el-tag>
</template>
<!-- sort -->
@@ -31,9 +31,9 @@
<template #operation="scope">
<el-button
size="small"
:type="scope.row.is_show === 1 ? 'danger' : 'primary'"
:type="scope.row.is_show == 1 ? 'danger' : 'primary'"
@click="handleBtnClick('上下架', scope.row)"
>{{ scope.row.is_show === 1 ? "下架" : "上架" }}</el-button
>{{ scope.row.is_show == 1 ? "下架" : "上架" }}</el-button
>
<el-button size="small" type="info" style="cursor: not-allowed" @click="handleBtnClick('添加SKU', scope.row)"
>添加SKU</el-button

View File

@@ -1,5 +1,6 @@
interface FormItem {
prop: string;
prop1?: string;
label?: string;
placeholder?: string;
type: string;
@@ -31,7 +32,8 @@ export const FORM_DATA: FormItem[] = [
label: "型号: "
},
{
prop: "category_id",
prop: "treeIds",
prop1: "category_id",
placeholder: "请选择",
type: "treeSelect",
isArray: true,

View File

@@ -8,11 +8,11 @@
:request-api="getProductTrashListApi"
:init-param="dataStore.initParam"
>
<template #image="scope">
<el-image :src="scope.row.image ? h + scope.row.image : ''" style="width: 60px; height: 60px" />
<template #cover_image="scope">
<el-image :src="scope.row.cover_image ? h + scope.row.cover_image : ''" style="width: 60px; height: 60px" />
</template>
<template #status="scope">
<el-tag type="danger" effect="dark"> {{ scope.row.status === 1 ? "删除" : "删除" }}</el-tag>
<el-tag type="danger" effect="dark"> {{ scope.row.status == 1 ? "删除" : "删除" }}</el-tag>
</template>
<template #operation="scope">