fix: 🧩 树状结构支持多选
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
scope.row.status === 1 ? "启用" : "禁用"
|
||||
<el-tag :type="scope.row.status == 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
scope.row.status == 1 ? "启用" : "禁用"
|
||||
}}</el-tag>
|
||||
</template>
|
||||
<template #operation="scope">
|
||||
@@ -85,6 +85,7 @@ import { useMsg } from "@/hooks/useMsg";
|
||||
import { useExport } from "@/hooks/useExport";
|
||||
import { integerRexg } from "@/utils/regexp/index";
|
||||
import { getProductCategoryListApi } from "@/api/modules/productList";
|
||||
// import { addLabelValue } from "@/utils/addLabelValue";
|
||||
// 图片地址
|
||||
import { h } from "@/utils/url";
|
||||
// 列表接口
|
||||
@@ -123,7 +124,7 @@ const dataStore = reactive<any>({
|
||||
isFirstRequest: true
|
||||
});
|
||||
|
||||
const selectedNodes = ref(null);
|
||||
const selectedNodes = ref<any>(null);
|
||||
|
||||
const treeRef = ref(null);
|
||||
|
||||
@@ -203,24 +204,30 @@ const getSystemUrls = async (node: any, resolve: any) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
const setImgOrVideo = () => {
|
||||
if (dataStore.editRuleForm.type === "image") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
const setImgOrVideo = (result: any) => {
|
||||
if (result?.data?.type === "image") {
|
||||
dataStore.editFormData = cloneDeep(EDIT_FORM_DATA);
|
||||
}
|
||||
if (dataStore.editRuleForm.type === "video") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
if (result?.data?.type === "video") {
|
||||
dataStore.editFormData = cloneDeep(EDIT_FORM_DATA1);
|
||||
}
|
||||
|
||||
getBannerClassEditList();
|
||||
};
|
||||
// 详情
|
||||
const getBannerRead = async (id: any) => {
|
||||
selectedNodes.value = "";
|
||||
dataStore.data = [];
|
||||
dataStore.title = "编辑Banner";
|
||||
dataStore.visible = true;
|
||||
const result = await getBannerReadApi(id);
|
||||
if (result?.code === 0) {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
setImgOrVideo();
|
||||
// setImgOrVideo(result);
|
||||
await setImgOrVideo(result);
|
||||
dataStore.editRuleForm = await result?.data;
|
||||
getProductCategoryList();
|
||||
|
||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||
if (!id || !name || !link) {
|
||||
@@ -273,12 +280,12 @@ const getBannerUp = async () => {
|
||||
const getBannerClassEditList = async () => {
|
||||
const result = await getBannerClassListApi();
|
||||
if (result?.code === 0) {
|
||||
let arr: any = [];
|
||||
result?.data?.forEach((item: any) => {
|
||||
arr.push({ value: item.id, label: item.name });
|
||||
});
|
||||
dataStore.formData[1].options = arr;
|
||||
dataStore.editFormData[5].options = arr;
|
||||
// let arr: any = [];
|
||||
// result?.data?.forEach((item: any) => {
|
||||
// arr.push({ value: item.id, label: item.name });
|
||||
// });
|
||||
dataStore.formData[1].options = addLabelValue(result?.data);
|
||||
dataStore.editFormData[5].options = addLabelValue(result?.data);
|
||||
}
|
||||
};
|
||||
getBannerClassEditList();
|
||||
|
||||
Reference in New Issue
Block a user