diff --git a/src/components/Cascader/Dictionary/index.js b/src/components/Cascader/Dictionary/index.js index cdba877..4c08580 100644 --- a/src/components/Cascader/Dictionary/index.js +++ b/src/components/Cascader/Dictionary/index.js @@ -19,7 +19,12 @@ function DictionaryCascader(props) { const getData = async () => { if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) { - console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中"); + console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`); + return; + } + + if (!dictValue) { + console.error(`【DictionaryCascader】 缺少 dictValue 参数`); return; } diff --git a/src/components/LeftTree/Dictionary/index.js b/src/components/LeftTree/Dictionary/index.js index e0a6468..111b348 100644 --- a/src/components/LeftTree/Dictionary/index.js +++ b/src/components/LeftTree/Dictionary/index.js @@ -19,7 +19,12 @@ function DictionaryLeftTree(props) { const getData = async () => { if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) { - console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中"); + console.error(`【DictionaryLeftTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`); + return; + } + + if (!dictValue) { + console.error(`【DictionaryLeftTree】 缺少 dictValue 参数`); return; } diff --git a/src/components/Map/CesiumMap.js b/src/components/Map/CesiumMap.js index f0002bd..f9727ed 100644 --- a/src/components/Map/CesiumMap.js +++ b/src/components/Map/CesiumMap.js @@ -158,7 +158,7 @@ export default class CesiumMap { } else { if (callback && typeof callback === "function") - callback(new Error("无法获取坐标"), null); + callback(new Error("【Map】 无法获取坐标"), null); } }, window.Cesium.ScreenSpaceEventType.LEFT_CLICK); }; diff --git a/src/components/Map/MapSelector.js b/src/components/Map/MapSelector.js index 3d4486d..bd5d6b7 100644 --- a/src/components/Map/MapSelector.js +++ b/src/components/Map/MapSelector.js @@ -166,7 +166,7 @@ const MapSelector = (props) => { // 加载地图资源 const loadMap = () => { if (!window.mapLongitude && !window.mapLatitude) { - console.error("请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用"); + console.error("【Map】 请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用"); return; } if (type === "baidu") { diff --git a/src/components/Select/Dictionary/index.js b/src/components/Select/Dictionary/index.js index e58f2c8..6c20929 100644 --- a/src/components/Select/Dictionary/index.js +++ b/src/components/Select/Dictionary/index.js @@ -19,7 +19,12 @@ function DictionarySelect(props) { const getData = async () => { if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) { - console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中"); + console.error(`【DictionarySelect】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`); + return; + } + + if (!dictValue) { + console.error(`【DictionarySelect】 缺少 dictValue 参数`); return; } diff --git a/src/components/Select/Personnel/Gwj/index.js b/src/components/Select/Personnel/Gwj/index.js index 45740cd..7167311 100644 --- a/src/components/Select/Personnel/Gwj/index.js +++ b/src/components/Select/Personnel/Gwj/index.js @@ -31,7 +31,7 @@ function PersonnelSelect(props) { if (isNeedPostId && !params.postId) return; if (!isNeedCorpInfoId && !isNeedDepartmentId && !isNeedPostId) { - console.error("请至少传入一个参数"); + console.error("【PersonnelSelect】 请至少传入一个参数"); return; } diff --git a/src/components/SelectTree/Dictionary/index.js b/src/components/SelectTree/Dictionary/index.js index f271a56..cad6563 100644 --- a/src/components/SelectTree/Dictionary/index.js +++ b/src/components/SelectTree/Dictionary/index.js @@ -19,7 +19,12 @@ function DictionarySelectTree(props) { const getData = async () => { if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) { - console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中"); + console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${appKey}`); + return; + } + + if (!dictValue) { + console.error(`【DictionarySelectTree】 缺少 dictValue 参数`); return; } diff --git a/src/hooks/useDeleteFile/index.js b/src/hooks/useDeleteFile/index.js index e34579b..ff7b564 100644 --- a/src/hooks/useDeleteFile/index.js +++ b/src/hooks/useDeleteFile/index.js @@ -13,7 +13,7 @@ function useDeleteFile(returnType = "object") { // 删除文件 const deleteFile = (options) => { if (!options) { - console.error("请传入 options"); + console.error("【deleteFile】 缺少 options 参数"); return; } @@ -27,11 +27,11 @@ function useDeleteFile(returnType = "object") { const { files = [], single = true } = options; if (!files) { - console.error("请传入 files"); + console.error("【deleteFile】 缺少 files 参数"); return; } if (!Array.isArray(files)) { - console.error("请传入有效的 files"); + console.error("【deleteFile】 的 files 需要是一个数组"); return; } diff --git a/src/hooks/useDictionary/index.js b/src/hooks/useDictionary/index.js index faa0734..73c5133 100644 --- a/src/hooks/useDictionary/index.js +++ b/src/hooks/useDictionary/index.js @@ -14,7 +14,7 @@ function useDictionary(returnType = "object") { // 获取数据字典 const getDictionary = (options) => { if (!options) { - console.error("请传入 options"); + console.error("【getDictionary】 缺少 options 参数"); return; } @@ -28,11 +28,12 @@ function useDictionary(returnType = "object") { const { appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT, dictValue } = options; if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) { - console.error("传入的 options.appKey 不在 DICTIONARY_APP_KEY_ENUM 中"); + console.error(`【getDictionary】 传入的 options.appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 options.appKey 是 ${appKey}`); return; } + if (!dictValue) { - console.error("请传入 options.dictValue"); + console.error(`【getDictionary】 缺少 options.dictValue 参数`); return; } diff --git a/src/hooks/useDownloadBlob/index.js b/src/hooks/useDownloadBlob/index.js index 41010a9..1d8c4a8 100644 --- a/src/hooks/useDownloadBlob/index.js +++ b/src/hooks/useDownloadBlob/index.js @@ -19,10 +19,12 @@ export default function useDownloadBlob(returnType = "object") { setLoading(true); } - return new Promise((resolve, reject) => { - if (!url) - return reject(new Error("请传入 url")); + if (!url) { + console.error("【downloadBlob】 缺少 url 参数"); + return; + } + return new Promise((resolve, reject) => { const { name = "", type = "", params = {} } = options; const finalUrl = new URL((process.env.app.API_HOST || window.__JJB_ENVIRONMENT__.API_HOST) + url); Object.entries(params).forEach(([key, value]) => { @@ -38,7 +40,7 @@ export default function useDownloadBlob(returnType = "object") { }) .then((response) => { if (!response.ok) { - console.error("网络响应异常"); + console.error("【downloadBlob】 网络响应异常"); return; } return response.blob(); diff --git a/src/hooks/useDownloadFile/index.js b/src/hooks/useDownloadFile/index.js index 9989638..8f94500 100644 --- a/src/hooks/useDownloadFile/index.js +++ b/src/hooks/useDownloadFile/index.js @@ -21,7 +21,7 @@ export default function useDownloadFile(returnType = "object") { const { url, name: fileName } = options; if (!url) { - console.error("请传入 url"); + console.error("【downloadFile】 缺少 url 参数"); return; } diff --git a/src/hooks/useGetFile/index.js b/src/hooks/useGetFile/index.js index 892bed5..91517a2 100644 --- a/src/hooks/useGetFile/index.js +++ b/src/hooks/useGetFile/index.js @@ -15,7 +15,7 @@ function useGetFile(returnType = "object") { // 获取文件 const getFile = (options) => { if (!options) { - console.error("请传入 options"); + console.error("【getFile】 缺少 options 参数"); return; } @@ -29,18 +29,18 @@ function useGetFile(returnType = "object") { const { eqType, eqForeignKey } = options; if (!eqType) { - console.error("请传入 options.eqType"); + console.error("【getFile】 缺少 options.eqType 参数"); return; } // 检查eqType是否在UPLOAD_FILE_TYPE_ENUM中 if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(eqType)) { - console.error("传入的 eqType 不在 UPLOAD_FILE_TYPE_ENUM 中"); + console.error(`【getFile】 传入的 eqType 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 eqType 是 ${eqType}`); return; } if (eqForeignKey === undefined || eqForeignKey === null) { - console.error("请传入 options.eqForeignKey"); + console.error("【getFile】 缺少 options.eqForeignKey 参数"); return; } diff --git a/src/hooks/useImportFile/index.js b/src/hooks/useImportFile/index.js index ec72f15..5d91c64 100644 --- a/src/hooks/useImportFile/index.js +++ b/src/hooks/useImportFile/index.js @@ -18,9 +18,12 @@ export default function useImportFile(returnType = "object") { setLoading(true); } + if (!url) { + console.error("【importFile】 缺少 url 参数"); + return; + } + return new Promise((resolve, reject) => { - if (!url) - return reject(new Error("请传入 url")); const { files = [], params = {} } = options; const formData = new FormData(); diff --git a/src/hooks/useTable/index.js b/src/hooks/useTable/index.js index 7d292ba..4d1ebba 100644 --- a/src/hooks/useTable/index.js +++ b/src/hooks/useTable/index.js @@ -45,7 +45,7 @@ function getService(service, getExtraParams = {}, transform, usePermission) { */ function useTable(service, options) { if (!service) { - console.error("请传入 service") + console.error("【useTable】 缺少 service 参数"); return; } diff --git a/src/hooks/useUploadFile/index.js b/src/hooks/useUploadFile/index.js index 5f7b10a..0d9567f 100644 --- a/src/hooks/useUploadFile/index.js +++ b/src/hooks/useUploadFile/index.js @@ -14,7 +14,7 @@ function useUploadFile(returnType = "object") { // 上传文件 const uploadFile = (options) => { if (!options) { - console.error("请传入 options"); + console.error("【uploadFile】 缺少 options 参数"); return; } @@ -28,39 +28,39 @@ function useUploadFile(returnType = "object") { const { files = [], single = true, params } = options; if (!files) { - console.error("请传入 files"); + console.error("【uploadFile】 缺少 files 参数"); return; } if (!Array.isArray(files)) { - console.error("请传入有效的 files"); + console.error("【uploadFile】 的 files 需要是一个数组"); return; } if (!params) { - console.error("请传入 options.params"); + console.error("【uploadFile】 缺少 options.params 参数"); return; } if (!params.type) { - console.error("请传入 options.params.type"); + console.error("【uploadFile】 缺少 options.params.type 参数"); return; } // 检查type是否在UPLOAD_FILE_TYPE_ENUM中 if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(params.type)) { - console.error("传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中"); + console.error(`【uploadFile】 传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 type 是 ${params.type}`); return; } // 根据type获取对应的path const path = UPLOAD_FILE_PATH_ENUM[params.type]; if (!path) { - console.error(`未找到 type ${params.type} 对应的 path `); + console.error(`【uploadFile】未找到 type ${params.type} 对应的 path `); return; } // 当single为false时,foreignKey是必需的 if (!single) { if (!params.hasOwnProperty("foreignKey")) { - console.error("请传入 options.params.foreignKey"); + console.error("【uploadFile】 的 single 是 false,缺少 options.params.foreignKey 参数"); return; } // 如果 foreignKey 是 undefined,设置默认值为空字符串