diff --git a/src/components/XTable/src/XTable.vue b/src/components/XTable/src/XTable.vue index 4ef431a0..a2588d92 100644 --- a/src/components/XTable/src/XTable.vue +++ b/src/components/XTable/src/XTable.vue @@ -160,26 +160,42 @@ const getProxyConfig = (options: XTableProps) => { queryParams.pageSize = page.pageSize queryParams.pageNo = page.currentPage } - return new Promise(async (resolve) => { - resolve(await getListApi(queryParams)) + return new Promise(async (resolve, reject) => { + try { + resolve(await getListApi(queryParams)) + } catch (e) { + reject(e) + } }) }, delete: ({ body }) => { - return new Promise(async (resolve) => { + return new Promise(async (resolve, reject) => { if (options.deleteApi) { - resolve(await options.deleteApi(JSON.stringify(body))) + try { + resolve(await options.deleteApi(JSON.stringify(body))) + } catch (e) { + reject(e) + } } else { - Promise.reject('未设置deleteApi') + reject('未设置deleteApi') } }) }, queryAll: ({ form }) => { const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form))) - return new Promise(async (resolve) => { + return new Promise(async (resolve, reject) => { if (options.getAllListApi) { - resolve(await options.getAllListApi(queryParams)) + try { + resolve(await options.getAllListApi(queryParams)) + } catch (e) { + reject(e) + } } else { - resolve(await getListApi(queryParams)) + try { + resolve(await getListApi(queryParams)) + } catch (e) { + reject(e) + } } }) } @@ -196,8 +212,12 @@ const getProxyConfig = (options: XTableProps) => { if (options?.params) { queryParams = Object.assign(queryParams, options.params) } - return new Promise(async (resolve) => { - resolve(await getListApi(queryParams)) + return new Promise(async (resolve, reject) => { + try { + resolve(await getListApi(queryParams)) + } catch (e) { + reject(e) + } }) } } diff --git a/src/layout/components/UserInfo/src/UserInfo.vue b/src/layout/components/UserInfo/src/UserInfo.vue index 174db7d2..6e0dab8b 100644 --- a/src/layout/components/UserInfo/src/UserInfo.vue +++ b/src/layout/components/UserInfo/src/UserInfo.vue @@ -65,17 +65,17 @@ const toDocument = () => {