提交 81d8ea72 authored 作者: lidongxu's avatar lidongxu

feat(plan): 促销计划弹窗标签准备

同上
上级 c8221a8a
......@@ -16,7 +16,3 @@ VITE_APP_PUBLIC_PATH = '/'
# 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://localhost:8080/'
# 阿里云 OSS 外链前缀访问资源
VITE_APP_OSS_PUBLIC_URL = 'https://link-promotion-dev.oss-cn-shanghai.aliyuncs.com/'
......@@ -13,6 +13,3 @@ VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:86/link/'
# 阿里云 OSS 外链前缀访问资源
VITE_APP_OSS_PUBLIC_URL = '正式环境 OSS 外链地址'
......@@ -13,6 +13,3 @@ VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:85/link/'
\ No newline at end of file
# 阿里云 OSS 外链前缀访问资源
VITE_APP_OSS_PUBLIC_URL = 'https://link-promotion-dev.oss-cn-shanghai.aliyuncs.com/'
\ No newline at end of file
import request from '@/utils/request'
import OSS from 'ali-oss'
const ossAuthURL = `${import.meta.env.VITE_APP_PROMOTION}/user/aliyun/sts_token` // 后台获取阿里云 OSS 权限信息接口
const ossPublickURL = import.meta.env.VITE_APP_OSS_PUBLIC_URL // OSS 公共域名
import { v4 as uuidv4 } from 'uuid';
import store from '@/store'
// OSS 上传文件
export const uploadFileToOSSAPI = (fileName, filePath) => {
......@@ -29,7 +26,7 @@ export const uploadFileToOSSAPI = (fileName, filePath) => {
});
// 发送请求上传文件 (文件名包含路径文件夹名字)
const res = await client.put(`planExcel/${store.state.name}/${uuidv4()}-` + fileName, filePath)
const res = await client.put(fileName, filePath)
resolve(res.url) // 上传成功
})
......
......@@ -17,3 +17,13 @@ export function getPlanListAPI(queryParams) {
}
})
}
// 表格新增计划
export function addPlanAPI(data) {
return request({
baseURL: VITE_APP_PROMOTION,
url: '/plan/v2/core/self/upload',
method: 'POST',
data
})
}
\ No newline at end of file
......@@ -12,7 +12,8 @@ export default defineStore(
name: '',
avatar: '',
roles: [],
permissions: []
permissions: [],
userInfo: ''
}),
actions: {
/**
......@@ -61,6 +62,7 @@ export default defineStore(
this.id = user.userId
this.name = user.nickName
this.avatar = avatar
this.userInfo = user
resolve(res)
}).catch(error => {
reject(error)
......
......@@ -231,7 +231,7 @@
</template>
<script setup>
import { getBrandListAPI, getTasteListAPI, getSpecListAPI, getSeriesListAPI, getProductListAPI, getFinanceListAPI, getFinanceDetailAPI, getFinanceSubListAPI, downloadFinanceListAPI } from '@/api'
import { getBrandListAPI, getTasteListAPI, getSpecListAPI, getSeriesListAPI, getProductListAPI, getFinanceListAPI, getFinanceDetailAPI, getFinanceSubListAPI, downloadFinanceListAPI, addPlanAPI } from '@/api'
import { useDatePickerOptions } from '@/hooks'
import { formatNumberWithUnit, parseTime } from '@/utils'
......@@ -782,7 +782,6 @@ const detailFormatter = (row, column, value) => {
const changeShowOver = () => {
showOverFlowToolTip.value = !showOverFlowToolTip.value
}
</script>
<style scoped
......
......@@ -16,8 +16,7 @@
:shortcuts="pickerOptions" />
</el-form-item>
<el-form-item label="上传计划">
<el-upload v-model:file-list="fileList"
class="upload-demo"
<el-upload class="upload-demo"
action="#"
accept=".xls,.xlsx"
:http-request="uploadFile"
......@@ -46,6 +45,22 @@
:formatter="formatter"
:fixed="item.fixed" />
</el-table>
<!-- 弹窗确认上传计划 -->
<el-dialog title="上传计划"
v-model="dialogVisible"
width="80%">
<div>
<!-- 计划表格 -->
<el-table :data="planTableList"
border
style="width: 100%">
<el-table-column prop="name"
label="文件名"
width="200">
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</div>
</template>
......@@ -53,6 +68,8 @@
<script setup>
import { getPlanListAPI, uploadFileToOSSAPI } from '@/api'
import { useDatePickerOptions } from '@/hooks'
import { v4 as uuidv4 } from 'uuid';
import store from '@/store'
const { recentPickerOptions: pickerOptions, last7Date } = useDatePickerOptions(0)
const queryParams = reactive({
......@@ -137,10 +154,19 @@ const formatter = (row, col, value) => {
}
// 上传计划
const fileList = ref([])
const uploadFile = (file) => {
uploadFileToOSSAPI(file.file.name, file.file)
const uploadFile = async (file) => {
console.log(store.state)
const excelUrl = await uploadFileToOSSAPI(`planExcel/${store.state.value.user.name}/${uuidv4()}-` + file.file.name, file.file)
// const res = await addPlanAPI({
// "excelUrl": excelUrl,
// "employeeNo": store.state.value.user.userInfo.userName
// })
dialogVisible.value = true
}
// 确认计划
const planTableList = ref([])
const dialogVisible = ref(false)
</script>
<style scoped
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论