Compare commits

..

No commits in common. "6bea984e0683d6a8a8f5f45a15eb331d09e59057" and "de46692c895cd548732957c4d9fd5e2f25f989b8" have entirely different histories.

4 changed files with 41 additions and 58 deletions

View File

@ -21,7 +21,6 @@
"echarts-gl": "^2.0.9", "echarts-gl": "^2.0.9",
"echarts-wordcloud": "^2.1.0", "echarts-wordcloud": "^2.1.0",
"element-plus": "^2.6.1", "element-plus": "^2.6.1",
"file-saver": "^2.0.5",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"js-table2excel": "^1.1.2", "js-table2excel": "^1.1.2",
"jsplumb": "^2.15.6", "jsplumb": "^2.15.6",
@ -43,7 +42,6 @@
"vue-router": "^4.3.0" "vue-router": "^4.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/file-saver": "^2.0.7",
"@types/chart.js": "^2.9.41", "@types/chart.js": "^2.9.41",
"@types/mockjs": "^1.0.10", "@types/mockjs": "^1.0.10",
"@types/node": "^20.11.28", "@types/node": "^20.11.28",

View File

@ -26,11 +26,11 @@ export function attachmentApi() {
method: 'get', method: 'get',
}); });
}, },
downloadFiles: (ids: String) => { downloadFiles: (ids: object) => {
return request({ return request({
url: baseUrlHost + `/enAttachment/downloadFiles/${ids}`, url: baseUrlHost + '/enAttachment/uploadByType',
method: 'get', method: 'get',
responseType: 'blob', ids,
}) })
} }
}; };

View File

@ -35,13 +35,8 @@
批量下载 批量下载
</el-button> </el-button>
</div> </div>
<el-table <el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%" @selection-change="handleSelectionChange"
:data="state.tableData.data" ref="tableRef">
v-loading="state.tableData.loading"
style="width: 100%"
@selection-change="handleSelectionChange"
ref="tableRef"
>
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="name" label="附件名称" show-overflow-tooltip></el-table-column> <el-table-column prop="name" label="附件名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="moduleName" label="模块" show-overflow-tooltip></el-table-column> <el-table-column prop="moduleName" label="模块" show-overflow-tooltip></el-table-column>
@ -77,7 +72,6 @@ import { articleApi } from '/@/api/article';
import { attachmentApi } from '/@/api/attachment'; import { attachmentApi } from '/@/api/attachment';
import { ElMessage, TableColumnCtx } from 'element-plus'; import { ElMessage, TableColumnCtx } from 'element-plus';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import FileSaver from 'file-saver';
const router = useRouter(); const router = useRouter();
@ -141,17 +135,21 @@ const handleSelectionChange = (selection: any[]) => {
}; };
// //
const downloadSelected = async () => { const downloadSelected = () => {
if (!state.selectedRows.length) { if (!state.selectedRows.length) {
ElMessage.warning('请先选择附件!'); ElMessage.warning('请先选择附件!');
return; return;
} }
// ids state.selectedRows.forEach((file) => {
const ids = state.selectedRows.map((item) => item.id).join(','); // API
let res = await atcmApi.downloadFiles(ids); // 使 Blob URL API
console.log(`下载文件: ${file.id}`);
});
const blob = new Blob([res], { type: 'application/zip' }); // ids
FileSaver.saveAs(blob, "attachment.zip"); const ids = state.selectedRows.map((item) => item.id);
console.log(ids);
atcmApi.downloadFiles(ids);
}; };
const getModuleList = async () => { const getModuleList = async () => {

View File

@ -38,15 +38,15 @@ const state = reactive({
ruleForm: { ruleForm: {
id: '', id: '',
title: '', title: '',
sendUserName: '', sendUserName: "",
userName: '', userName: "",
message: '', message: "",
createtime: [], createtime: []
}, },
dialog: { dialog: {
isShowDialog: false, isShowDialog: false,
title: '', title: '',
loading: false, loading: false
}, },
}); });
@ -58,27 +58,14 @@ const dateFormatter = () => {
if(state.ruleForm.createtime === null) return '暂无'; if(state.ruleForm.createtime === null) return '暂无';
let date = state.ruleForm.createtime; let date = state.ruleForm.createtime;
return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5]}`; return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5]}`;
}; }
// //
const getDetail = async(id? : number) => { const getDetail = async(id? : number) => {
try { try {
state.dialog.loading = true; state.dialog.loading = true;
let res = await mesApi.getMessagePushDetail(id); let res = await mesApi.getMessagePushDetail(id);
console.log(res);
if(res?.success){ if(res?.success){
// res.datanullstate.ruleForm
if (res.data === null) {
state.ruleForm = {
id: '',
title: '无',
sendUserName: '无',
userName: '无',
message: '无',
createtime: [],
};
return;
}
state.ruleForm = res.data; state.ruleForm = res.data;
}else{ }else{
ElMessage.error('信息详情获取失败!'); ElMessage.error('信息详情获取失败!');
@ -87,18 +74,18 @@ const getDetail = async (id?: number) => {
} finally { } finally {
state.dialog.loading = false; state.dialog.loading = false;
} }
}; }
// //
const openDialog = (id?: any) => { const openDialog = (id?: any) => {
console.log(id)
state.dialog.isShowDialog = true; state.dialog.isShowDialog = true;
state.dialog.title = '人才信息';
getDetail(id); getDetail(id);
}; };
// //
const closeDialog = () => { const closeDialog = () => {
console.log('close');
state.dialog.isShowDialog = false; state.dialog.isShowDialog = false;
console.log(state.dialog.isShowDialog);
}; };
// //