mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 20:06:47 +08:00
案例导入的修改
This commit is contained in:
@@ -2,7 +2,13 @@ import http from "./configSys";
|
|||||||
|
|
||||||
// 案例列表
|
// 案例列表
|
||||||
export const RECOMMEND_PAGE = "/systemapi/xboe/m/boe/cases/recommend/page post";
|
export const RECOMMEND_PAGE = "/systemapi/xboe/m/boe/cases/recommend/page post";
|
||||||
|
//发起案例列表或案例管理列表
|
||||||
|
export const isTopList = (data) => http.post('/xboe/m/boe/cases/isTopList', data, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
||||||
|
}
|
||||||
|
})
|
||||||
//下载失败数据
|
//下载失败数据
|
||||||
export const downloadErrorData = (params = {}) => http.post("/xboe/m/boe/cases/recommend/download", params);
|
export const downloadErrorData = (params) => http.get('/xboe/m/boe/cases/recommend/download', { params })
|
||||||
//推送消息
|
//推送消息
|
||||||
export const recommendLaunch = (params = {}) => http.post("/xboe/m/boe/cases/recommend/launch", params);
|
export const recommendLaunch = (data = {}) => http.post("/xboe/m/boe/cases/recommend/launch", data);
|
||||||
|
|||||||
@@ -105,23 +105,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="upload">
|
<div class="upload">
|
||||||
<a-upload :file-list="state.fileList" :action="state.uploadAction" name="file" @change="handleChange"
|
<a-upload :file-list="state.fileList" :action="state.uploadAction" name="file" @change="handleChange"
|
||||||
:showUploadList="false" :multiple="false" :data="{
|
:showUploadList="false" :multiple="false">
|
||||||
result: '123456'
|
|
||||||
}">
|
|
||||||
<a-button style="width: 150px;">
|
<a-button style="width: 150px;">
|
||||||
上传文件
|
上传文件
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<span class="ant-upload-hint">支持文件格式:.xls/.xlsx</span>
|
<span class="ant-upload-hint">支持文件格式:.xls/.xlsx</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress">
|
<div class="progress" v-if="state.status">
|
||||||
<div class="nameAndProgress" style="display: flex;justify-content: space-between;padding-right: 36px;">
|
<div class="nameAndProgress" style="display: flex;justify-content: space-between;padding-right: 36px;">
|
||||||
<span>{{ state.fileName }}</span>
|
<span>{{ state.fileName }}</span>
|
||||||
<span>上传完成</span>
|
<span>{{ state.status }}</span>
|
||||||
</div>
|
</div>
|
||||||
<a-progress :percent="state.uploadpercent" status="active" />
|
<a-progress :percent="state.uploadpercent" status="active" :strokeColor="state.progressColor" />
|
||||||
</div>
|
</div>
|
||||||
<div class="importDetail" style="display: flex;flex-direction: column;">
|
<div class="importDetail" style="display: flex;flex-direction: column;" v-if="state.status">
|
||||||
<span>导入 1039 条,成功 1007 条,失败 <span style="color: red;">32</span> 条。</span>
|
<span>导入 1039 条,成功 1007 条,失败 <span style="color: red;">32</span> 条。</span>
|
||||||
<div class="defeat">
|
<div class="defeat">
|
||||||
<div class="detext" @click="downloadErrorInfo">
|
<div class="detext" @click="downloadErrorInfo">
|
||||||
@@ -138,7 +136,7 @@ import { reactive, ref, watch, computed, nextTick } from 'vue';
|
|||||||
import { Form, message } from "ant-design-vue";
|
import { Form, message } from "ant-design-vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Cookies from "vue-cookies";
|
import Cookies from "vue-cookies";
|
||||||
import { downloadErrorData } from '@/api/case'
|
import { downloadErrorData,isTopList } from '@/api/case'
|
||||||
import useDownload from '@/hooks/useDownload'
|
import useDownload from '@/hooks/useDownload'
|
||||||
import CommonRecommend from "@/components/CaseManage/CommonRecommend";
|
import CommonRecommend from "@/components/CaseManage/CommonRecommend";
|
||||||
defineProps({
|
defineProps({
|
||||||
@@ -154,6 +152,8 @@ defineProps({
|
|||||||
const emit = defineEmits(['update:visible'])
|
const emit = defineEmits(['update:visible'])
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
status:'',//上传的状态
|
||||||
|
progressColor: '',//进度条颜色
|
||||||
type: 1,//添加学员
|
type: 1,//添加学员
|
||||||
stage: '',//
|
stage: '',//
|
||||||
importId: '',//导入id
|
importId: '',//导入id
|
||||||
@@ -167,7 +167,7 @@ const state = reactive({
|
|||||||
fileName: '',//下载的名字
|
fileName: '',//下载的名字
|
||||||
uploadAction: process.env.VUE_APP_NEW_API + '/xboe/m/boe/cases/recommend/import',//下载地址
|
uploadAction: process.env.VUE_APP_NEW_API + '/xboe/m/boe/cases/recommend/import',//下载地址
|
||||||
addLoading: false,
|
addLoading: false,
|
||||||
fileList: [],
|
fileList: [],//上传列表
|
||||||
member: false,//收起和展开
|
member: false,//收起和展开
|
||||||
screenHeight: document.body.clientHeight,
|
screenHeight: document.body.clientHeight,
|
||||||
projectParams: {
|
projectParams: {
|
||||||
@@ -246,26 +246,23 @@ const onSelectChange = (selectedRowKeys, selectedRow) => {
|
|||||||
|
|
||||||
// 请求列表数据是formdata类型的
|
// 请求列表数据是formdata类型的
|
||||||
const getTopList = () => {
|
const getTopList = () => {
|
||||||
console.log(state.selectedRowKeys);
|
// axios({
|
||||||
|
// method: "post",
|
||||||
axios({
|
// url: "/systemapi/xboe/m/boe/cases/isTopList",
|
||||||
method: "post",
|
// data: { ...searchDataInfo },
|
||||||
url: "/systemapi/xboe/m/boe/cases/isTopList",
|
// headers: {
|
||||||
data: { ...searchDataInfo },
|
// token: Cookies.get("token"),
|
||||||
headers: {
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
token: Cookies.get("token"),
|
// },
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
// })
|
||||||
},
|
isTopList(searchDataInfo).then((res) => {
|
||||||
}).then((res) => {
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
console.log(res);
|
console.log(res);
|
||||||
res?.data?.result?.list?.forEach(element => {
|
res?.data?.result?.list?.forEach(element => {
|
||||||
element.key = element.id
|
element.key = element.id
|
||||||
});
|
});
|
||||||
state.dataSource = res?.data?.result?.list || []
|
state.dataSource = res?.data?.result?.list || []
|
||||||
total.value = res?.data?.result?.count || 0
|
total.value = res?.data?.result?.count
|
||||||
console.log(total.value);
|
|
||||||
console.log(state.dataSource);
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
message.error(err);
|
message.error(err);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -282,7 +279,10 @@ const handleSearch = (num) => {
|
|||||||
|
|
||||||
//下载模版
|
//下载模版
|
||||||
const downloadErrorInfo = () => {
|
const downloadErrorInfo = () => {
|
||||||
// if (!state.importId) return
|
if (!state.importId) {
|
||||||
|
message.warn('暂无失败数据')
|
||||||
|
return
|
||||||
|
}
|
||||||
downloadErrorData({ importId: state.importId }).then((res) => {
|
downloadErrorData({ importId: state.importId }).then((res) => {
|
||||||
if (res.status != 200) return
|
if (res.status != 200) return
|
||||||
useDownload(res, '失败数据.xsl')
|
useDownload(res, '失败数据.xsl')
|
||||||
@@ -318,6 +318,11 @@ const hideModal = () => {
|
|||||||
const handleChange = (info) => {
|
const handleChange = (info) => {
|
||||||
console.log("info", info);
|
console.log("info", info);
|
||||||
state.imptProgress = true
|
state.imptProgress = true
|
||||||
|
state.status = '正在上传'
|
||||||
|
state.progressColor = ''
|
||||||
|
state.fileList = []
|
||||||
|
state.fileList = info.fileList
|
||||||
|
state.fileName = info.file.name;
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
var FileExt = info.file.name.replace(/.+\./, "");
|
var FileExt = info.file.name.replace(/.+\./, "");
|
||||||
@@ -329,18 +334,18 @@ const handleChange = (info) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.addLoading = true;
|
|
||||||
state.uploadErr = false;
|
|
||||||
state.uploadpercent = parseInt(info.file.percent);
|
state.uploadpercent = parseInt(info.file.percent);
|
||||||
console.log("我是文件上传的进度---------->", info.file.percent);
|
|
||||||
const status = info.file.status;
|
const status = info.file.status;
|
||||||
if (status !== "uploading") {
|
if (status !== "uploading") {
|
||||||
console.log(info.file, info.fileList);
|
console.log(info.file, info.fileList);
|
||||||
}
|
}
|
||||||
if (status === "done") {
|
if (status === "done") {
|
||||||
state.fileName = info.file.name;
|
state.importId = info.file.response.result
|
||||||
let i = 0;
|
message.success(`${info.file.name}上传成功`);
|
||||||
state.timers = setInterval(() => {
|
state.progressColor = '#52c41a'
|
||||||
|
state.status = '上传成功'
|
||||||
|
// let i = 0;
|
||||||
|
// state.timers = setInterval(() => {
|
||||||
// let uid = info.file.response.data;
|
// let uid = info.file.response.data;
|
||||||
// caseImport(uid)
|
// caseImport(uid)
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
@@ -368,10 +373,10 @@ const handleChange = (info) => {
|
|||||||
// state.addLoading = false;
|
// state.addLoading = false;
|
||||||
// console.log("查询导入状态失败", err);
|
// console.log("查询导入状态失败", err);
|
||||||
// });
|
// });
|
||||||
}, 500);
|
// }, 500);
|
||||||
} else if (status === "error") {
|
} else if (status === "error") {
|
||||||
state.addLoading = false;
|
state.progressColor = 'red'
|
||||||
state.uploadErr = true;
|
state.status = '上传失败'
|
||||||
message.error(`${info.file.name}上传失败`);
|
message.error(`${info.file.name}上传失败`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user