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