提交 eaed0e2c authored 作者: lidongxu's avatar lidongxu

feat(promotion): 批量表格修改计划

同上
上级 087856b2
......@@ -7,7 +7,7 @@ export const uploadFileToOSSAPI = (fileName, filePath) => {
return new Promise(async (resolve, reject) => {
const authRes = await request({
baseURL: ossAuthURL,
url: ''
url: '/'
})
const { accessKeyId, securityToken, accessKeySecret, expiration, region, web_js_link } = authRes.data;
......
......@@ -108,4 +108,14 @@ export function getPlanStoreListAPI(queryParams = {}) {
storeCode: queryParams.storeCode,
}
})
}
// 表格-修改计划
export function updatePlanAPI(data) {
return request({
baseURL: VITE_APP_PROMOTION,
url: '/plan/v2/core/put',
method: 'PUT',
data
})
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
if (config.baseURL === promotionBaseURL) {
if (config.baseURL === promotionBaseURL || config.baseURL.startsWith(promotionBaseURL)) {
// 促销后台不能带 Bearer 前缀
config.headers['Authorization'] = getToken()
} else {
......
......@@ -142,6 +142,15 @@
@click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-upload class="upload-demo"
action="#"
accept=".xls,.xlsx"
:http-request="uploadChangeFile"
:show-file-list="false">
<template #trigger>
<el-button type="success">批量修改计划</el-button>
</template>
</el-upload>
<el-upload class="upload-demo"
action="#"
accept=".xls,.xlsx"
......@@ -385,7 +394,7 @@
</template>
<script setup>
import { getPlanListAPI, uploadFileToOSSAPI, addPlanAPI, savePlanAPI, deletePlanAPI, addPlanByRoleAPI, getProCityAPI, getDealerListAPI, getWarZoneListAPI, getChargeListAPI, addPlanByWebAPI, updatePlanByWebAPI, getPlanStoreListAPI } from '@/api'
import { getPlanListAPI, uploadFileToOSSAPI, addPlanAPI, savePlanAPI, deletePlanAPI, addPlanByRoleAPI, getProCityAPI, getDealerListAPI, getWarZoneListAPI, getChargeListAPI, addPlanByWebAPI, updatePlanByWebAPI, getPlanStoreListAPI, updatePlanAPI } from '@/api'
import { useDatePickerOptions } from '@/hooks'
import { v4 as uuidv4 } from 'uuid';
import store from '@/store'
......@@ -1071,6 +1080,23 @@ const selPattern = () => {
const selEmployee = () => {
addOrEditPlanRef.value.clearValidate('employeeNo');
}
// 批量表格修改计划
const uploadChangeFile = async (file) => {
// 拼接当前月数为文件夹名
const date = new Date()
const month = date.getMonth() + 1
const excelUrl = await uploadFileToOSSAPI(`planExcel/${date.getFullYear()}-${month}/${store.state.value.user.userInfo.userName}/${uuidv4()}.xlsx`, file.file)
const res = await updatePlanAPI({
"excelUrl": excelUrl,
"employeeNo": store.state.value.user.userInfo.userName
})
planTableList.value = res.data.table
confirmExcelUUID.value = res.data.uuid
dialogVisible.value = true
return true
}
</script>
<style scoped
......@@ -1087,6 +1113,11 @@ const selEmployee = () => {
}
}
.upload-demo {
display: inline-block;
margin: 0 5px;
}
/* 门店列表选择后-下面的介绍信息 */
.info_p {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论