fix: 🧩 修复bug
This commit is contained in:
@@ -216,6 +216,9 @@ const getBannerRead = async (id: any) => {
|
|||||||
setImgOrVideo();
|
setImgOrVideo();
|
||||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||||
|
if (!id || !name || !link) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let obj: any = {
|
let obj: any = {
|
||||||
label: name, // 确保这里的name是你想要显示的文本
|
label: name, // 确保这里的name是你想要显示的文本
|
||||||
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ const dataStore = reactive<any>({
|
|||||||
searchFormData: FORM_DATA, //搜索配置项
|
searchFormData: FORM_DATA, //搜索配置项
|
||||||
visible: false,
|
visible: false,
|
||||||
data: [],
|
data: [],
|
||||||
|
isFirstRequest: true,
|
||||||
selectRow: {} //当前选择的row
|
selectRow: {} //当前选择的row
|
||||||
});
|
});
|
||||||
const selectedNodes = ref(null);
|
const selectedNodes = ref(null);
|
||||||
@@ -139,8 +140,8 @@ const treeProps = {
|
|||||||
label: "label",
|
label: "label",
|
||||||
value: "value"
|
value: "value"
|
||||||
};
|
};
|
||||||
//用于判断模块地址请求是不是第一次
|
// //用于判断模块地址请求是不是第一次
|
||||||
let isFirstRequest = true;
|
// let isFirstRequest = true;
|
||||||
const buildTree = (data: any, outerLinkTo: any = "") => {
|
const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||||
return data.map((item: any) => {
|
return data.map((item: any) => {
|
||||||
const { name, id, url, data: childData = [], children: nestedChildren = [] } = item;
|
const { name, id, url, data: childData = [], children: nestedChildren = [] } = item;
|
||||||
@@ -161,13 +162,13 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
|
|||||||
};
|
};
|
||||||
const getSystemUrls = async (node: any, resolve: any) => {
|
const getSystemUrls = async (node: any, resolve: any) => {
|
||||||
//第一次请求
|
//第一次请求
|
||||||
if (isFirstRequest) {
|
if (dataStore.isFirstRequest) {
|
||||||
const result = await getSystemUrlsApi();
|
const result = await getSystemUrlsApi();
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
const children = buildTree(result?.data);
|
const children = buildTree(result?.data);
|
||||||
dataStore.data = children;
|
dataStore.data = children;
|
||||||
resolve(children);
|
resolve(children);
|
||||||
isFirstRequest = false;
|
dataStore.isFirstRequest = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//第二次请求
|
//第二次请求
|
||||||
@@ -208,6 +209,9 @@ const getItemsRead = async (id: any) => {
|
|||||||
dataStore.editRuleForm = result?.data;
|
dataStore.editRuleForm = result?.data;
|
||||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||||
|
if (!id || !name || !link) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let obj: any = {
|
let obj: any = {
|
||||||
label: name, // 确保这里的name是你想要显示的文本
|
label: name, // 确保这里的name是你想要显示的文本
|
||||||
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
value: `${dataStore.editRuleForm.link_to}` + "/" + `${id}` + "/" + `${name}`,
|
||||||
@@ -297,6 +301,7 @@ const getItemsSave = async () => {
|
|||||||
dataStore.visible = false;
|
dataStore.visible = false;
|
||||||
resetForm();
|
resetForm();
|
||||||
getItemsList();
|
getItemsList();
|
||||||
|
dataStore.isFirstRequest = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSelectChangeEmits = (params: any) => {
|
const handleSelectChangeEmits = (params: any) => {
|
||||||
@@ -315,6 +320,7 @@ const getItemsListEditUp = async () => {
|
|||||||
dataStore.visible = false;
|
dataStore.visible = false;
|
||||||
resetForm();
|
resetForm();
|
||||||
getItemsList();
|
getItemsList();
|
||||||
|
dataStore.isFirstRequest = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//抽屉确认
|
//抽屉确认
|
||||||
@@ -356,6 +362,7 @@ const handleBeforeClone = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
resetFields();
|
resetFields();
|
||||||
dataStore.visible = false;
|
dataStore.visible = false;
|
||||||
|
dataStore.isFirstRequest = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user