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

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

同上
上级 087856b2
...@@ -7,7 +7,7 @@ export const uploadFileToOSSAPI = (fileName, filePath) => { ...@@ -7,7 +7,7 @@ export const uploadFileToOSSAPI = (fileName, filePath) => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const authRes = await request({ const authRes = await request({
baseURL: ossAuthURL, baseURL: ossAuthURL,
url: '' url: '/'
}) })
const { accessKeyId, securityToken, accessKeySecret, expiration, region, web_js_link } = authRes.data; const { accessKeyId, securityToken, accessKeySecret, expiration, region, web_js_link } = authRes.data;
......
...@@ -109,3 +109,13 @@ export function getPlanStoreListAPI(queryParams = {}) { ...@@ -109,3 +109,13 @@ export function getPlanStoreListAPI(queryParams = {}) {
} }
}) })
} }
// 表格-修改计划
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 => { ...@@ -31,7 +31,7 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交 // 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) { if (getToken() && !isToken) {
if (config.baseURL === promotionBaseURL) { if (config.baseURL === promotionBaseURL || config.baseURL.startsWith(promotionBaseURL)) {
// 促销后台不能带 Bearer 前缀 // 促销后台不能带 Bearer 前缀
config.headers['Authorization'] = getToken() config.headers['Authorization'] = getToken()
} else { } else {
......
...@@ -142,6 +142,15 @@ ...@@ -142,6 +142,15 @@
@click="handleAdd">新增</el-button> @click="handleAdd">新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <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" <el-upload class="upload-demo"
action="#" action="#"
accept=".xls,.xlsx" accept=".xls,.xlsx"
...@@ -385,7 +394,7 @@ ...@@ -385,7 +394,7 @@
</template> </template>
<script setup> <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 { useDatePickerOptions } from '@/hooks'
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import store from '@/store' import store from '@/store'
...@@ -1071,6 +1080,23 @@ const selPattern = () => { ...@@ -1071,6 +1080,23 @@ const selPattern = () => {
const selEmployee = () => { const selEmployee = () => {
addOrEditPlanRef.value.clearValidate('employeeNo'); 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> </script>
<style scoped <style scoped
...@@ -1087,6 +1113,11 @@ const selEmployee = () => { ...@@ -1087,6 +1113,11 @@ const selEmployee = () => {
} }
} }
.upload-demo {
display: inline-block;
margin: 0 5px;
}
/* 门店列表选择后-下面的介绍信息 */ /* 门店列表选择后-下面的介绍信息 */
.info_p { .info_p {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论