明树Git Lab

Commit f71a1732 authored by yangyajing's avatar yangyajing

消息列表页

parent 3d224552
Pipeline #107751 passed with stage
in 20 seconds
......@@ -7,6 +7,12 @@
<!-- <span class="city-name">123123</span> -->
</div>
<div class="header-right">
<div class="message-wrap" @click="toMessagePage">
<el-icon size="20">
<ChatDotSquare />
</el-icon>
<div class="count">{{ messageCount }}</div>
</div>
<div>
<el-dropdown>
<span class="username">
......@@ -62,8 +68,24 @@ const getResourceData = () => {
},
});
};
// 获取未读消息数量
let messageCount = ref(0);
const getMessageCount = () => {
proxy.$post({
url: "/api/message/getMesCount",
data: {},
callback: (data) => {
messageCount.value = data.count;
},
});
};
// 跳转消息列表页
const toMessagePage = () => {
router.push("/message");
}
onMounted(() => {
getResourceData();
getMessageCount();
});
// 处理退出登录
const handleLogout = () => {
......@@ -154,5 +176,24 @@ const handleLogout = () => {
}
.header-right {
display: flex;
align-items: center;
.message-wrap{
position: relative;
margin-right: 10px;
cursor: pointer;
.count{
position: absolute;
top: -5px;
right: -5px;
min-width: 14px;
height: 14px;
border-radius: 50%;
background-color: red;
color: #fff;
font-size: 10px;
text-align: center;
line-height: 14px;
}
}
}
</style>
......@@ -71,7 +71,7 @@ const routes = [
component: () => import("@/views/projectManage/projectAllPage.vue"),
},
{
path: "/addProject/:type",
path: "/addProject",
name: "addProject",
title: "新增项目",
component: () => import("@/views/projectManage/addProject.vue"),
......
......@@ -112,6 +112,7 @@
&-header{
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
&-content{
flex: 1;
......@@ -121,6 +122,12 @@
.tabs-content{
flex: 1;
height: 0;
display: flex;
flex-direction: column;
&>.el-tabs{
flex: 1;
height: 0;
}
}
.el-tabs{
height: 100%;
......
......@@ -338,7 +338,6 @@
import { useRouter, useRoute } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import { useUserStore } from "@/stores/user.js";
import moment from "moment";
const userStore = useUserStore();
const router = useRouter();
const route = useRoute();
......
This diff is collapsed.
......@@ -181,9 +181,6 @@
const previewProject = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlingxuan"
},
query: {
isPreview: true,
projectId: item.id
......
......@@ -113,9 +113,6 @@
const fillProject = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlz"
},
query: {
projectId: item.id
}
......
......@@ -24,7 +24,7 @@
<template #operations="{ row, index }">
<el-button link type="primary" size="small"
:loading="row.loading" @click="getResult(row)"
>查询决策结果</el-button>
>查询</el-button>
</template>
</common-table>
</div>
......
......@@ -113,14 +113,11 @@
getProjectData();
}
const addProject = () => {
router.push("/addProject/xmlingxuan");
router.push("/addProject");
};
const editProject = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlingxuan"
},
query: {
projectId: item.id
}
......@@ -129,9 +126,6 @@
const previewProject = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlingxuan"
},
query: {
isPreview: true,
projectId: item.id
......
......@@ -22,16 +22,16 @@
@current-page-change="handleCurrentPageChange"
>
<template #operations="{ row, index }">
<!-- 立项审批中 -->
<el-button link type="primary" size="small"
v-if="row.projectLzType === '3'"
:loading="row.loading" @click="getResult(row)"
>查询审批结果</el-button>
<!-- 已立项 -->
<el-button link type="primary" size="small"
v-if="row.projectLzType === '5'"
@click="fillDecision(row)"
>决策填报</el-button>
<!-- 立项审批中 -->
<el-button link type="primary" size="small"
v-else
:loading="row.loading" @click="viewDecision(row)"
>查看</el-button>
</template>
</common-table>
</div>
......@@ -116,33 +116,18 @@
currentPage.value = page;
getProjectData();
}
const getResult = (item) => {
item.loading = true;
proxy.$post({
url: "/api/project/queryLixiangResult",
data: {
id: item.id
},
callback: (data) => {
item.loading = false;
const viewDecision = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlx"
},
query: {
projectId: item.id
projectId: item.id,
isPreview: true
}
});
}
})
};
const fillDecision = (item) => {
router.push({
name: "addProject",
params: {
type: "xmlx"
},
query: {
projectId: item.id
}
......
......@@ -26,13 +26,40 @@
</template>
</common-table>
</div>
<el-dialog v-model="messageDialogVisible" title="" width="500" align-center
@close="closeDialog"
>
<div class="message-wrap">
<div class="message-title">{{ messageInfo.title }}</div>
<div class="message-content">
<div class="label">消息类型:</div>
<div class="info">{{ messageInfo.type === 2 ? "项目初步审核" : messageInfo.type === 3 ? "项目终审" : "系统消息" }}</div>
</div>
<div class="message-content">
<div class="label">时间:</div>
<div class="info">{{ proxy.moment(messageInfo.createdAt).format("YYYY-MM-DD HH:mm:SS") }}</div>
</div>
<div class="message-content">
<div class="label">备注:</div>
<div class="info">{{ messageInfo.content }}</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="closeDialog">关闭</el-button>
<!-- <el-button type="primary" @click="toProjectPage">去处理</el-button> -->
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, reactive, onMounted, getCurrentInstance, computed, nextTick } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import CommonTable from "@/components/common/commonTable.vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
const loading = ref(false);
// 表格数据
......@@ -43,10 +70,37 @@ const pageSize = ref(10);
// 表格列配置
const tableColumns = [
{
prop: "name",
prop: "title",
label: "标题",
minWidth: 100
},
{
prop: "type",
label: "消息类型",
width: 120,
align: "center",
formatter: (data) => {
return data.type === 2 ? "项目初步审核" : data.type === 3 ? "项目终审" : "系统消息";
}
},
{
prop: "isRead",
label: "状态",
width: 90,
align: "center",
formatter: (data) => {
return data.isRead ? "已读" : "未读";
}
},
{
prop: "createdAt",
label: "时间",
width: 180,
align: "center",
formatter: (data) => {
return proxy.moment(data.createdAt).format("YYYY-MM-DD HH:mm:SS");
}
},
{
prop: "operations",
label: "操作",
......@@ -88,8 +142,81 @@ const handleCurrentPageChange = (page) => {
onMounted(() => {
loadTableData();
});
// 获取信息详情
let messageDialogVisible = ref(false);
let messageInfo = ref({});
const handlePreview = (item) => {
proxy.$post({
url: "/api/message/getMessageInfo",
data: {
id: item.id
},
callback: (data) => {
messageDialogVisible.value = true;
messageInfo.value = data;
},
error: (err) => {
ElMessage.error("加载数据失败");
},
});
}
const closeDialog = () => {
messageInfo.value = {};
messageDialogVisible.value = false;
}
// 跳转到对应项目
const toProjectPage = () => {
router.push({
name: "addProject",
query: {
projectId: messageInfo.value.projectId,
isPreview: true
}
});
}
// 删除
const handleDelete = (row) => {
ElMessageBox.confirm(`确定删除该条消息?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
proxy.$post({
url: "/api/message/deleteMessage",
data: { id: row.id },
callback: (data) => {
ElMessage.success("删除成功");
loadTableData();
},
error: (err) => {
ElMessage.error("删除失败:", err);
},
});
});
}
</script>
<style lang="less">
@import "@/styles/manage.less";
.message-wrap{
.message-title{
font-size: 16px;
font-weight: 600;
margin: 10px 0;
}
.message-content{
display: flex;
align-items: flex-start;
margin-bottom: 10px;
.label{
width: 80px;
text-align: justify;
text-align-last: justify;
}
.info{
flex: 1;
width: 0;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment