diff --git a/src/api/lb-purchase-apply.js b/src/api/lb-purchase-apply.js
index 368542f..5c1a0ea 100644
--- a/src/api/lb-purchase-apply.js
+++ b/src/api/lb-purchase-apply.js
@@ -65,6 +65,20 @@ export function syncHxrAdminUserVip(params) {
})
}
+/** 按租户ID与申请日期范围导出进货申请 Excel */
+export function exportLbPurchaseApply(params) {
+ return request({
+ url: '/lbPurchaseApply/export',
+ method: 'get',
+ params: {
+ applyDateStart: params.applyDateStart,
+ applyDateEnd: params.applyDateEnd,
+ tenantId: params.tenantId
+ },
+ responseType: 'blob'
+ })
+}
+
/** 按申请日期区间与租户同步同事 hxrd 用户 VIP(可能较慢,依赖外部管理端) */
export function syncHxrAdminColleagueVip(params) {
return request({
diff --git a/src/views/lb-business/purchase-apply/index.vue b/src/views/lb-business/purchase-apply/index.vue
index 7fd8418..583c988 100644
--- a/src/views/lb-business/purchase-apply/index.vue
+++ b/src/views/lb-business/purchase-apply/index.vue
@@ -51,6 +51,14 @@
开通同事特权
+
+ 导出新人特权
+
@@ -271,6 +279,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -293,6 +336,7 @@
import {
addLbPurchaseApply,
deleteLbPurchaseApply,
+ exportLbPurchaseApply,
getLbPurchaseApplyList,
needPrivilegeRecommenders,
parseLbPurchaseApplyFromOrderInfo,
@@ -328,6 +372,15 @@ export default {
dialogTitle: '',
isEdit: false,
privilegeLoading: false,
+ exportNewcomerPrivilegeDialogVisible: false,
+ exportNewcomerPrivilegeLoading: false,
+ exportNewcomerPrivilegeTenantIdDisplay: '',
+ exportNewcomerPrivilegeForm: {
+ applyDateRange: []
+ },
+ exportNewcomerPrivilegeRules: {
+ applyDateRange: [{ required: true, message: '请选择申请日期范围', trigger: 'change' }]
+ },
privilegeDateRange: [today, today],
privilegeList: [],
queryParams: {
@@ -509,6 +562,73 @@ export default {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
+ openExportNewcomerPrivilegeDialog() {
+ const today = this.getCurrentDate()
+ this.exportNewcomerPrivilegeTenantIdDisplay = this.getTenantIdFromBusinessHeaders()
+ if (
+ Array.isArray(this.privilegeDateRange) &&
+ this.privilegeDateRange.length === 2 &&
+ this.privilegeDateRange[0] &&
+ this.privilegeDateRange[1]
+ ) {
+ this.exportNewcomerPrivilegeForm.applyDateRange = [...this.privilegeDateRange]
+ } else {
+ this.exportNewcomerPrivilegeForm.applyDateRange = [today, today]
+ }
+ this.exportNewcomerPrivilegeDialogVisible = true
+ this.$nextTick(() => {
+ if (this.$refs.exportNewcomerPrivilegeFormRef) {
+ this.$refs.exportNewcomerPrivilegeFormRef.clearValidate()
+ }
+ })
+ },
+ submitExportNewcomerPrivilege() {
+ this.$refs.exportNewcomerPrivilegeFormRef.validate((valid) => {
+ if (!valid) return
+ const tenantId = this.getTenantIdFromBusinessHeaders()
+ if (!tenantId) {
+ this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
+ return
+ }
+ const range = this.exportNewcomerPrivilegeForm.applyDateRange || []
+ const applyDateStart = range[0]
+ const applyDateEnd = range[1]
+ if (!applyDateStart || !applyDateEnd) {
+ this.$message.warning('请选择申请日期范围')
+ return
+ }
+ this.exportNewcomerPrivilegeLoading = true
+ exportLbPurchaseApply({ applyDateStart, applyDateEnd, tenantId })
+ .then((blob) => {
+ const safeBlob = blob instanceof Blob ? blob : new Blob([blob], {
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+ })
+ const url = window.URL.createObjectURL(safeBlob)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = `lbPurchaseApply_${applyDateStart}_${applyDateEnd}_${tenantId}.xlsx`
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ window.URL.revokeObjectURL(url)
+ this.$message.success('导出成功')
+ this.exportNewcomerPrivilegeDialogVisible = false
+ })
+ .finally(() => {
+ this.exportNewcomerPrivilegeLoading = false
+ })
+ })
+ },
+ resetExportNewcomerPrivilegeForm() {
+ if (this.$refs.exportNewcomerPrivilegeFormRef) {
+ this.$refs.exportNewcomerPrivilegeFormRef.resetFields()
+ }
+ this.exportNewcomerPrivilegeForm = {
+ applyDateRange: []
+ }
+ this.exportNewcomerPrivilegeTenantIdDisplay = ''
+ this.exportNewcomerPrivilegeLoading = false
+ },
handleViewPrivilege() {
if (!Array.isArray(this.privilegeDateRange) || this.privilegeDateRange.length !== 2) {
this.$message.warning('请选择开始日期和结束日期')