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

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

同上
上级 c8221a8a
...@@ -16,7 +16,3 @@ VITE_APP_PUBLIC_PATH = '/' ...@@ -16,7 +16,3 @@ VITE_APP_PUBLIC_PATH = '/'
# 第三方服务回调地址 # 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://localhost:8080/' 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 = './' ...@@ -13,6 +13,3 @@ VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址 # 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:86/link/' 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 = './' ...@@ -13,6 +13,3 @@ VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址 # 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:85/link/' VITE_APP_REDIRECT_URL = 'http://111.198.15.68:85/link/'
# 阿里云 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 request from '@/utils/request'
import OSS from 'ali-oss' import OSS from 'ali-oss'
const ossAuthURL = `${import.meta.env.VITE_APP_PROMOTION}/user/aliyun/sts_token` // 后台获取阿里云 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 上传文件 // OSS 上传文件
export const uploadFileToOSSAPI = (fileName, filePath) => { export const uploadFileToOSSAPI = (fileName, filePath) => {
...@@ -29,7 +26,7 @@ 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) // 上传成功 resolve(res.url) // 上传成功
}) })
......
...@@ -17,3 +17,13 @@ export function getPlanListAPI(queryParams) { ...@@ -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( ...@@ -12,7 +12,8 @@ export default defineStore(
name: '', name: '',
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [] permissions: [],
userInfo: ''
}), }),
actions: { actions: {
/** /**
...@@ -61,6 +62,7 @@ export default defineStore( ...@@ -61,6 +62,7 @@ export default defineStore(
this.id = user.userId this.id = user.userId
this.name = user.nickName this.name = user.nickName
this.avatar = avatar this.avatar = avatar
this.userInfo = user
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
......
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
</template> </template>
<script setup> <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 { useDatePickerOptions } from '@/hooks'
import { formatNumberWithUnit, parseTime } from '@/utils' import { formatNumberWithUnit, parseTime } from '@/utils'
...@@ -782,7 +782,6 @@ const detailFormatter = (row, column, value) => { ...@@ -782,7 +782,6 @@ const detailFormatter = (row, column, value) => {
const changeShowOver = () => { const changeShowOver = () => {
showOverFlowToolTip.value = !showOverFlowToolTip.value showOverFlowToolTip.value = !showOverFlowToolTip.value
} }
</script> </script>
<style scoped <style scoped
......
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
:shortcuts="pickerOptions" /> :shortcuts="pickerOptions" />
</el-form-item> </el-form-item>
<el-form-item label="上传计划"> <el-form-item label="上传计划">
<el-upload v-model:file-list="fileList" <el-upload class="upload-demo"
class="upload-demo"
action="#" action="#"
accept=".xls,.xlsx" accept=".xls,.xlsx"
:http-request="uploadFile" :http-request="uploadFile"
...@@ -46,6 +45,22 @@ ...@@ -46,6 +45,22 @@
:formatter="formatter" :formatter="formatter"
:fixed="item.fixed" /> :fixed="item.fixed" />
</el-table> </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>
</div> </div>
</template> </template>
...@@ -53,6 +68,8 @@ ...@@ -53,6 +68,8 @@
<script setup> <script setup>
import { getPlanListAPI, uploadFileToOSSAPI } from '@/api' import { getPlanListAPI, uploadFileToOSSAPI } from '@/api'
import { useDatePickerOptions } from '@/hooks' import { useDatePickerOptions } from '@/hooks'
import { v4 as uuidv4 } from 'uuid';
import store from '@/store'
const { recentPickerOptions: pickerOptions, last7Date } = useDatePickerOptions(0) const { recentPickerOptions: pickerOptions, last7Date } = useDatePickerOptions(0)
const queryParams = reactive({ const queryParams = reactive({
...@@ -137,10 +154,19 @@ const formatter = (row, col, value) => { ...@@ -137,10 +154,19 @@ const formatter = (row, col, value) => {
} }
// 上传计划 // 上传计划
const fileList = ref([]) const uploadFile = async (file) => {
const uploadFile = (file) => { console.log(store.state)
uploadFileToOSSAPI(file.file.name, file.file) 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> </script>
<style scoped <style scoped
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论