diff --git a/src/utils/api.js b/src/utils/api.js index 45a8ce2..8edaba2 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -39,7 +39,8 @@ export default { updateCustomerByRoleId: `nakadai/nakadai/customer/updateCustomerByRoleId`, checkEmailOrPhone: `nakadai/nakadai/customer/checkEmailOrPhone`, // 新增客户前:校验手机号或者邮箱 getProductsSubscribedByCustomers: `nakadai/nakadai/customer/getProductsSubscribedByCustomers`, - orderBulkDisableEnable: `/nakadai/nakadai/orderOther/orderBulkDisableEnable`, + orderBulkDisableEnable: `nakadai/nakadai/orderOther/orderBulkDisableEnable`, + exportSubscribedRecords: `nakadai/nakadai/order/exportSubscribedRecords`, resetPwdCustomer: `nakadai/nakadai/customer/resetPwd`, queryCustomerIsExists: `nakadai/nakadai/customer/queryCustomerIsExists`, diff --git a/src/utils/util.js b/src/utils/util.js index 92a55f5..97025c4 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -24,7 +24,22 @@ const util = { }); } return result; - } + }, + // 传入文件名和数据,下载文件 + downloadFileDirect(fileName,data) { + if ('download' in document.createElement('a')) { // 非IE下载 + const elink = document.createElement('a') + elink.download = fileName + elink.style.display = 'none' + elink.href = URL.createObjectURL(data) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) // 释放URL 对象 + document.body.removeChild(elink) + } else { // IE10+下载 + navigator.msSaveBlob(data, fileName) + } + }, }; export default util; \ No newline at end of file diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index 566e326..233f97f 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -83,13 +83,13 @@