Compare commits
	
		
			3 Commits
		
	
	
		
			de46692c89
			...
			6bea984e06
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6bea984e06 | |||
| 3522ef30ea | |||
| 8fdb1078ae | 
@ -21,6 +21,7 @@
 | 
			
		||||
		"echarts-gl": "^2.0.9",
 | 
			
		||||
		"echarts-wordcloud": "^2.1.0",
 | 
			
		||||
		"element-plus": "^2.6.1",
 | 
			
		||||
		"file-saver": "^2.0.5",
 | 
			
		||||
		"js-cookie": "^3.0.5",
 | 
			
		||||
		"js-table2excel": "^1.1.2",
 | 
			
		||||
		"jsplumb": "^2.15.6",
 | 
			
		||||
@ -42,6 +43,7 @@
 | 
			
		||||
		"vue-router": "^4.3.0"
 | 
			
		||||
	},
 | 
			
		||||
	"devDependencies": {
 | 
			
		||||
		"@types/file-saver": "^2.0.7",
 | 
			
		||||
		"@types/chart.js": "^2.9.41",
 | 
			
		||||
		"@types/mockjs": "^1.0.10",
 | 
			
		||||
		"@types/node": "^20.11.28",
 | 
			
		||||
 | 
			
		||||
@ -26,11 +26,11 @@ export function attachmentApi() {
 | 
			
		||||
				method: 'get',
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		downloadFiles: (ids: object) => {
 | 
			
		||||
		downloadFiles: (ids: String) => {
 | 
			
		||||
			return request({
 | 
			
		||||
				url: baseUrlHost + '/enAttachment/uploadByType',
 | 
			
		||||
				url: baseUrlHost + `/enAttachment/downloadFiles/${ids}`,
 | 
			
		||||
				method: 'get',
 | 
			
		||||
				ids,
 | 
			
		||||
				responseType: 'blob',
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
@ -35,8 +35,13 @@
 | 
			
		||||
					批量下载
 | 
			
		||||
				</el-button>
 | 
			
		||||
			</div>
 | 
			
		||||
			<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%" @selection-change="handleSelectionChange"
 | 
			
		||||
			ref="tableRef">
 | 
			
		||||
			<el-table
 | 
			
		||||
				:data="state.tableData.data"
 | 
			
		||||
				v-loading="state.tableData.loading"
 | 
			
		||||
				style="width: 100%"
 | 
			
		||||
				@selection-change="handleSelectionChange"
 | 
			
		||||
				ref="tableRef"
 | 
			
		||||
			>
 | 
			
		||||
				<el-table-column type="selection" width="55" />
 | 
			
		||||
				<el-table-column prop="name" label="附件名称" show-overflow-tooltip></el-table-column>
 | 
			
		||||
				<el-table-column prop="moduleName" label="模块" show-overflow-tooltip></el-table-column>
 | 
			
		||||
@ -72,6 +77,7 @@ import { articleApi } from '/@/api/article';
 | 
			
		||||
import { attachmentApi } from '/@/api/attachment';
 | 
			
		||||
import { ElMessage, TableColumnCtx } from 'element-plus';
 | 
			
		||||
import { useRouter } from 'vue-router';
 | 
			
		||||
import FileSaver from 'file-saver';
 | 
			
		||||
 | 
			
		||||
const router = useRouter();
 | 
			
		||||
 | 
			
		||||
@ -135,21 +141,17 @@ const handleSelectionChange = (selection: any[]) => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 批量下载
 | 
			
		||||
const downloadSelected = () => {
 | 
			
		||||
const downloadSelected = async () => {
 | 
			
		||||
	if (!state.selectedRows.length) {
 | 
			
		||||
		ElMessage.warning('请先选择附件!');
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	state.selectedRows.forEach((file) => {
 | 
			
		||||
		// 假设提供了 API 或工具进行文件下载
 | 
			
		||||
		// 示例:使用 Blob URL 或直接调用下载 API
 | 
			
		||||
		console.log(`下载文件: ${file.id}`);
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// 需要传给后端ids的数据
 | 
			
		||||
	const ids = state.selectedRows.map((item) => item.id);
 | 
			
		||||
	console.log(ids);
 | 
			
		||||
	atcmApi.downloadFiles(ids);
 | 
			
		||||
	const ids = state.selectedRows.map((item) => item.id).join(',');
 | 
			
		||||
	let res = await atcmApi.downloadFiles(ids);
 | 
			
		||||
	
 | 
			
		||||
	const blob = new Blob([res], { type: 'application/zip' });
 | 
			
		||||
	FileSaver.saveAs(blob, "attachment.zip");
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const getModuleList = async () => {
 | 
			
		||||
 | 
			
		||||
@ -38,15 +38,15 @@ const state = reactive({
 | 
			
		||||
	ruleForm: {
 | 
			
		||||
		id: '',
 | 
			
		||||
		title: '',
 | 
			
		||||
		sendUserName: "",
 | 
			
		||||
		userName: "",
 | 
			
		||||
		message: "",
 | 
			
		||||
		createtime: []
 | 
			
		||||
		sendUserName: '',
 | 
			
		||||
		userName: '',
 | 
			
		||||
		message: '',
 | 
			
		||||
		createtime: [],
 | 
			
		||||
	},
 | 
			
		||||
	dialog: {
 | 
			
		||||
		isShowDialog: false,
 | 
			
		||||
		title: '',
 | 
			
		||||
		loading: false
 | 
			
		||||
		loading: false,
 | 
			
		||||
	},
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -55,37 +55,50 @@ const mesApi = messagePushApi();
 | 
			
		||||
 | 
			
		||||
// 日期格式化
 | 
			
		||||
const dateFormatter = () => {
 | 
			
		||||
    if(state.ruleForm.createtime === null) return '暂无';
 | 
			
		||||
	if (state.ruleForm.createtime === null) return '暂无';
 | 
			
		||||
	let date = state.ruleForm.createtime;
 | 
			
		||||
	return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5]}`;
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 获取信息详情
 | 
			
		||||
const getDetail = async(id? : number) => {
 | 
			
		||||
const getDetail = async (id?: number) => {
 | 
			
		||||
	try {
 | 
			
		||||
		state.dialog.loading = true;
 | 
			
		||||
		let res = await mesApi.getMessagePushDetail(id);
 | 
			
		||||
		if(res?.success){
 | 
			
		||||
		console.log(res);
 | 
			
		||||
		if (res?.success) {
 | 
			
		||||
			// 当res.data为null时,给state.ruleForm赋值为空对象
 | 
			
		||||
			if (res.data === null) {
 | 
			
		||||
				state.ruleForm = {
 | 
			
		||||
					id: '',
 | 
			
		||||
					title: '无',
 | 
			
		||||
					sendUserName: '无',
 | 
			
		||||
					userName: '无',
 | 
			
		||||
					message: '无',
 | 
			
		||||
					createtime: [],
 | 
			
		||||
				};
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			state.ruleForm = res.data;
 | 
			
		||||
		}else{
 | 
			
		||||
		} else {
 | 
			
		||||
			ElMessage.error('信息详情获取失败!');
 | 
			
		||||
		}
 | 
			
		||||
	} catch (error) {
 | 
			
		||||
	} finally {
 | 
			
		||||
		state.dialog.loading = false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 打开弹窗
 | 
			
		||||
const openDialog = (id?: any) => {
 | 
			
		||||
    console.log(id)
 | 
			
		||||
	state.dialog.isShowDialog = true;
 | 
			
		||||
    state.dialog.title = '人才信息';
 | 
			
		||||
	getDetail(id);
 | 
			
		||||
};
 | 
			
		||||
// 关闭弹窗
 | 
			
		||||
const closeDialog = () => {
 | 
			
		||||
	console.log('close');
 | 
			
		||||
	state.dialog.isShowDialog = false;
 | 
			
		||||
	console.log(state.dialog.isShowDialog);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 取消
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user