优化部分功能
parent
b14a771cc9
commit
87bb9ed9eb
|
|
@ -18,6 +18,8 @@ function DictionaryCascader(props) {
|
||||||
const [treeData, setTreeData] = useState([]);
|
const [treeData, setTreeData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setTreeData([]);
|
||||||
|
|
||||||
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
||||||
console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -28,13 +30,12 @@ function DictionaryCascader(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTreeData([]);
|
|
||||||
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
||||||
setTreeData(data);
|
setTreeData(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dictValue && getData();
|
getData();
|
||||||
}, [dictValue]);
|
}, [dictValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ function DictionaryLeftTree(props) {
|
||||||
const [treeData, setTreeData] = useState([]);
|
const [treeData, setTreeData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setTreeData([]);
|
||||||
|
|
||||||
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
||||||
console.error(`【DictionaryLeftTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
console.error(`【DictionaryLeftTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -28,13 +30,12 @@ function DictionaryLeftTree(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTreeData([]);
|
|
||||||
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
||||||
setTreeData(data);
|
setTreeData(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dictValue && getData();
|
getData();
|
||||||
}, [dictValue]);
|
}, [dictValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ function DictionarySelect(props) {
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setData([]);
|
||||||
|
|
||||||
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
||||||
console.error(`【DictionarySelect】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
console.error(`【DictionarySelect】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -28,13 +30,12 @@ function DictionarySelect(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setData([]);
|
|
||||||
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
||||||
setData(data);
|
setData(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dictValue && getData();
|
getData();
|
||||||
}, [dictValue]);
|
}, [dictValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,21 @@ function PersonnelSelect(props) {
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setData([]);
|
||||||
|
|
||||||
|
if (!isNeedCorpInfoId && !isNeedDepartmentId && !isNeedPostId) {
|
||||||
|
console.error("【PersonnelSelect】 请至少传入一个参数");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据参数决定是否发送请求
|
||||||
|
if (isNeedCorpInfoId && (!params.corpinfoId || typeof params.corpinfoId !== 'string'))
|
||||||
|
return;
|
||||||
|
if (isNeedDepartmentId && (!params.departmentId || typeof params.departmentId !== 'string'))
|
||||||
|
return;
|
||||||
|
if (isNeedPostId && (!params.postId || typeof params.postId !== 'string'))
|
||||||
|
return;
|
||||||
|
|
||||||
const actualExtraParams = { ...defaultExtraParams, ...extraParams };
|
const actualExtraParams = { ...defaultExtraParams, ...extraParams };
|
||||||
|
|
||||||
// 生成缓存键
|
// 生成缓存键
|
||||||
|
|
@ -38,19 +53,6 @@ function PersonnelSelect(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setData([]);
|
|
||||||
// 根据参数决定是否发送请求
|
|
||||||
if (isNeedCorpInfoId && !params.corpinfoId)
|
|
||||||
return;
|
|
||||||
if (isNeedDepartmentId && !params.departmentId)
|
|
||||||
return;
|
|
||||||
if (isNeedPostId && !params.postId)
|
|
||||||
return;
|
|
||||||
if (!isNeedCorpInfoId && !isNeedDepartmentId && !isNeedPostId) {
|
|
||||||
console.error("【PersonnelSelect】 请至少传入一个参数");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...actualExtraParams, time: new Date().getTime() });
|
const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...actualExtraParams, time: new Date().getTime() });
|
||||||
|
|
||||||
// 存入缓存
|
// 存入缓存
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ function DepartmentSelectTree(props) {
|
||||||
const [treeData, setTreeData] = useState([]);
|
const [treeData, setTreeData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setTreeData([]);
|
||||||
|
|
||||||
// 生成缓存键
|
// 生成缓存键
|
||||||
const paramsStr = JSON.stringify(params);
|
const paramsStr = JSON.stringify(params);
|
||||||
const cacheKey = `${searchType}_${paramsStr}`;
|
const cacheKey = `${searchType}_${paramsStr}`;
|
||||||
|
|
@ -31,8 +33,6 @@ function DepartmentSelectTree(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTreeData([]);
|
|
||||||
|
|
||||||
if (searchType === "current") {
|
if (searchType === "current") {
|
||||||
if (isNeedCorpInfoId && !params.eqCorpinfoId)
|
if (isNeedCorpInfoId && !params.eqCorpinfoId)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ function DictionarySelectTree(props) {
|
||||||
const [treeData, setTreeData] = useState([]);
|
const [treeData, setTreeData] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
setTreeData([]);
|
||||||
|
|
||||||
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
||||||
console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -28,13 +30,12 @@ function DictionarySelectTree(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTreeData([]);
|
|
||||||
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
|
||||||
setTreeData(data);
|
setTreeData(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dictValue && getData();
|
getData();
|
||||||
}, [dictValue]);
|
}, [dictValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ function HiddenLevelSelectTree(props) {
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
setTreeData([]);
|
setTreeData([]);
|
||||||
|
|
||||||
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey: DICTIONARY_APP_KEY_ENUM.GWJ, dictValue: "hiddenLevel" });
|
const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey: DICTIONARY_APP_KEY_ENUM.GWJ, dictValue: "hiddenLevel" });
|
||||||
const filterData = filterTreeData(data);
|
const filterData = filterTreeData(data);
|
||||||
setTreeData(filterData);
|
setTreeData(filterData);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue