parent
0e328cfa43
commit
dcbc80f844
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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") {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function PersonnelSelect(props) {
|
|||
if (isNeedPostId && !params.postId)
|
||||
return;
|
||||
if (!isNeedCorpInfoId && !isNeedDepartmentId && !isNeedPostId) {
|
||||
console.error("请至少传入一个参数");
|
||||
console.error("【PersonnelSelect】 请至少传入一个参数");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ function getService(service, getExtraParams = {}, transform, usePermission) {
|
|||
*/
|
||||
function useTable(service, options) {
|
||||
if (!service) {
|
||||
console.error("请传入 service")
|
||||
console.error("【useTable】 缺少 service 参数");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,设置默认值为空字符串
|
||||
|
|
|
|||
Loading…
Reference in New Issue