mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
还原页面代码,添加导入逻辑
This commit is contained in:
@@ -24,10 +24,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="del_btnbox" v-if="isCloseBtn">
|
<div class="del_btnbox" v-if="isCloseBtn">
|
||||||
<div class="del_btn btn2" @click="close" v-if="cancel">
|
<div class="del_btn btn2" @click="close" v-if="cancel">
|
||||||
<div class="btnText">取消</div>
|
<div class="btnText">{{ cancelText }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="del_btn btn2" @click="handleConfirm">
|
<div class="del_btn btn2" @click="handleConfirm">
|
||||||
<div class="btnText">确定</div>
|
<div class="btnText">{{ okText }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="del_btnbox" v-else>
|
<div class="del_btnbox" v-else>
|
||||||
@@ -73,6 +73,14 @@ const props = defineProps({
|
|||||||
isCloseBtn: {
|
isCloseBtn: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
okText: {
|
||||||
|
type: String,
|
||||||
|
default: "确定"
|
||||||
|
},
|
||||||
|
cancelText: {
|
||||||
|
type: String,
|
||||||
|
default: "取消"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const types = {
|
const types = {
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
import http from "@/api/configSys";
|
import http from "@/api/configSys";
|
||||||
import httpBase from "@/api/config";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} url [请求的url地址]
|
* @param {String} url [请求的url地址]
|
||||||
* @param {Object} params [参数]
|
* @param {Object} params [参数]
|
||||||
* @param {String} fileName [导出文件名称] 默认值 导出文件
|
* @param {String} fileName [导出文件名称] 默认值 导出文件
|
||||||
* @param {String} fileType [导出文件类型] 默认值 xls
|
* @param {String} fileType [导出文件类型] 默认值 xls
|
||||||
* @param {string} mimeType [导出文件类型]
|
* @param {string} mimeType [导出文件类型]
|
||||||
* @param {boolean} useSysApi [是否使用系统API] 默认值 true
|
|
||||||
*/
|
*/
|
||||||
const useDownload = (url, params = {}, fileName = '导出文件', fileType = 'xls', mimeType = 'application/vnd.ms-excel;charset=UTF-8', useSysApi = true) => {
|
const useDownload = (url, params = {}, fileName = '导出文件', fileType = 'xls', mimeType = 'application/vnd.ms-excel;charset=UTF-8') => {
|
||||||
const request = useSysApi ? http : httpBase;
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request.post(url, params, { responseType: 'blob' })
|
http.post(url, params, { responseType: 'blob' })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
if (!res.data) {
|
if (!res.data) {
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ import { useStore } from "vuex";
|
|||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import dialog from "@/utils/dialog";
|
import dialog from "@/utils/dialog";
|
||||||
import "@wangeditor/editor/dist/css/style.css";
|
import "@wangeditor/editor/dist/css/style.css";
|
||||||
import useDownload from '@/hooks/useDownload'
|
|
||||||
import {
|
import {
|
||||||
getExquisiteCoursePage,
|
getExquisiteCoursePage,
|
||||||
getExquisiteYearList,
|
getExquisiteYearList,
|
||||||
@@ -182,6 +181,7 @@ import {
|
|||||||
getExport
|
getExport
|
||||||
} from "@/api/indexCourse";
|
} from "@/api/indexCourse";
|
||||||
import * as moment from "moment";
|
import * as moment from "moment";
|
||||||
|
import useDownload from "@/hooks/useDownload";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {},
|
components: {},
|
||||||
@@ -652,11 +652,11 @@ export default defineComponent({
|
|||||||
years: state.years // 添加年份参数
|
years: state.years // 添加年份参数
|
||||||
})
|
})
|
||||||
getTableDate();
|
getTableDate();
|
||||||
}; // 全部导出
|
};
|
||||||
|
// 全部导出
|
||||||
const exportAll = async () => {
|
const exportAll = async () => {
|
||||||
try {
|
try {
|
||||||
await useDownload(
|
let res = await getExport(
|
||||||
"/quality/manage/export",
|
|
||||||
{
|
{
|
||||||
courseNameOrTeacherName: state.courseNameOrTeacherName,
|
courseNameOrTeacherName: state.courseNameOrTeacherName,
|
||||||
courseSource: state.courseSource,
|
courseSource: state.courseSource,
|
||||||
@@ -664,15 +664,17 @@ export default defineComponent({
|
|||||||
sysType: state.sysTypeId,
|
sysType: state.sysTypeId,
|
||||||
},
|
},
|
||||||
"精品课程导出",
|
"精品课程导出",
|
||||||
"xlsx",
|
"xlsx"
|
||||||
"application/vnd.ms-excel;charset=UTF-8",
|
|
||||||
false
|
|
||||||
);
|
);
|
||||||
message.success("导出成功");
|
if (res.data.data.status == 200) {
|
||||||
|
message.success(res.data.data.message);
|
||||||
|
// 重新加载数据
|
||||||
getTableDate();
|
getTableDate();
|
||||||
|
} else {
|
||||||
|
message.error(res.data.data.message);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("导出失败:", error);
|
console.error("导出失败:", error);
|
||||||
message.error("导出失败");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 导入标记
|
// 导入标记
|
||||||
@@ -713,8 +715,9 @@ export default defineComponent({
|
|||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
getTableDate();
|
getTableDate();
|
||||||
} else {
|
} else {
|
||||||
dialog({ content: res.data.data.message, ok: okMarkT() });
|
state.importMarkVisible = false;
|
||||||
message.error(res.data.data.message);
|
dialog({ content: res.data.data.message, ok: okMarkT(), okText: "重新输入" });
|
||||||
|
// message.error(res.data.data.message);
|
||||||
}
|
}
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
getTableDate();
|
getTableDate();
|
||||||
|
|||||||
Reference in New Issue
Block a user