// 审批管理主页面
|
<template>
|
<view class="sales-account">
|
<!-- 使用通用页面头部组件 -->
|
<PageHeader title="会议发布"
|
@back="goBack" />
|
<!-- 搜索和筛选区域 -->
|
<view class="search-section">
|
<view class="search-bar">
|
<view class="search-input">
|
<up-input class="search-text"
|
placeholder="请输入会议主题"
|
v-model="searchForm.title"
|
clearable />
|
</view>
|
<view class="search-button"
|
@click="getList">
|
<up-icon name="search"
|
size="24"
|
color="#999"></up-icon>
|
</view>
|
</view>
|
</view>
|
<!-- 审批列表 -->
|
<view class="ledger-list"
|
v-if="ledgerList.length > 0">
|
<view v-for="(item, index) in ledgerList"
|
:key="index">
|
<view class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="file-text"
|
size="16"
|
color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">{{ item.title }}</text>
|
</view>
|
<view class="item-tag">
|
<u-tag :type="getTagClass(item.status)">{{ formatReceiptType(item.status) }}</u-tag>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">申请人</text>
|
<text class="detail-value">{{ item.applicant }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">主理人</text>
|
<text class="detail-value">{{ item.host }}</text>
|
</view>
|
<view class="detail-row-approveReason">
|
<text class="detail-label">会议时间</text>
|
<text class="detail-value highlightBlue">{{ formatDateTime(item.meetingTime) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">会议地点</text>
|
<text class="detail-value">{{ item.location }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">参会人数</text>
|
<text class="detail-value">{{ item.participants.length }}</text>
|
</view>
|
<up-divider></up-divider>
|
<view class="actions">
|
<u-button type="primary"
|
size="small"
|
class="action-btn view"
|
@click="viewDetail(item)">
|
详情
|
</u-button>
|
<u-button type="success"
|
size="small"
|
class="action-btn approve"
|
:disabled="item.status != 0"
|
@click="approve(item)">
|
发布
|
</u-button>
|
</view>
|
<!-- <view class="detail-info"
|
style="align-items: flex-end;">
|
<view class="detail-row">
|
|
</view>
|
</view> -->
|
</view>
|
</view>
|
</view>
|
</view>
|
<view v-else
|
class="no-data">
|
<text>暂无数据</text>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref, toRefs, reactive } from "vue";
|
import PageHeader from "@/components/PageHeader.vue";
|
import {
|
getMeetingPublish,
|
getRoomEnum,
|
} from "@/api/managementMeetings/meetExamine";
|
import { getStaffOnJob } from "@/api/personnelManagement/onboarding";
|
import { onShow } from "@dcloudio/uni-app";
|
import useUserStore from "@/store/modules/user";
|
import dayjs from "dayjs";
|
|
const userStore = useUserStore();
|
// 数据
|
const ledgerList = ref([]);
|
const data = reactive({
|
searchForm: {
|
title: "",
|
},
|
});
|
const { searchForm } = toRefs(data);
|
|
// 返回上一页
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
// 房间枚举
|
const roomEnum = ref([]);
|
// 房间枚举查询
|
const getRoomEnumList = () => {
|
return getRoomEnum()
|
.then(res => {
|
console.log(res.data, "res.data");
|
roomEnum.value = res.data;
|
})
|
.catch(() => {
|
closeToast();
|
});
|
};
|
// 员工列表
|
const staffList = ref([]);
|
// 员工列表查询
|
const getStaffOnJobList = () => {
|
return getStaffOnJob()
|
.then(res => {
|
console.log(res.data, "res.data");
|
staffList.value = res.data;
|
})
|
.catch(() => {
|
closeToast();
|
});
|
};
|
// 查询列表
|
const getList = () => {
|
showLoadingToast("加载中...");
|
const page = {
|
current: -1,
|
size: -1,
|
};
|
getMeetingPublish({
|
...page,
|
...searchForm.value,
|
})
|
.then(res => {
|
console.log(res.data.records, "res.data.records");
|
ledgerList.value = res.data.records.map(it => {
|
console.log(it, "it1");
|
let room = roomEnum.value.find(room => it.roomId === room.id);
|
it.location = `${room.name}(${room.location})`;
|
let staffs = JSON.parse(it.participants);
|
it.staffCount = staffs.size;
|
it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format(
|
"HH:mm:ss"
|
)} ~ ${dayjs(it.endTime).format("HH:mm:ss")}`;
|
it.participants = staffList.value
|
.filter(staff => staffs.some(id => id == staff.id))
|
.map(staff => {
|
return {
|
id: staff.id,
|
name: `${staff.staffName}(${staff.postJob})`,
|
};
|
});
|
console.log(it, "it2");
|
|
return it;
|
});
|
|
closeToast();
|
})
|
.catch(() => {
|
closeToast();
|
});
|
};
|
// 显示加载提示
|
const showLoadingToast = message => {
|
uni.showLoading({
|
title: message,
|
mask: true,
|
});
|
};
|
const formatDateTime = dateTime => {
|
if (!dateTime) return "";
|
return dateTime.replace(" ", "\n");
|
};
|
|
// 关闭提示
|
const closeToast = () => {
|
uni.hideLoading();
|
};
|
|
// 格式化回款方式
|
const formatReceiptType = params => {
|
if (params == 0) {
|
return "待发布";
|
} else if (params == 1) {
|
return "已发布";
|
} else if (params == 2) {
|
return "已取消";
|
} else {
|
return "未知";
|
}
|
};
|
// 获取标签样式类
|
const getTagClass = type => {
|
if (type == 0) {
|
return "info";
|
} else if (type == 1) {
|
return "success";
|
} else if (type == 2) {
|
return "danger";
|
} else {
|
return "info";
|
}
|
};
|
|
// 点击审核
|
const approve = item => {
|
// uni.setStorageSync("approveId", item.approveId);
|
uni.navigateTo({
|
url:
|
"/pages/managementMeetings/meetPublish/approve?item=" +
|
JSON.stringify(item) +
|
"&edit=true",
|
});
|
};
|
// 查看详情
|
const viewDetail = item => {
|
uni.navigateTo({
|
url:
|
"/pages/managementMeetings/meetPublish/approve?item=" +
|
JSON.stringify(item) +
|
"&edit=false",
|
});
|
};
|
|
onShow(async () => {
|
// 页面加载完成后的初始化逻辑
|
try {
|
// 等待两个异步方法执行完成
|
await Promise.all([getRoomEnumList(), getStaffOnJobList()]);
|
// 两个方法执行完成后再执行 getList()
|
getList();
|
} catch (error) {
|
console.error("初始化数据失败:", error);
|
// 即使出错也执行 getList(),确保页面能正常加载
|
getList();
|
}
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "../../../styles/sales-common.scss";
|
|
.u-divider {
|
margin: 0 !important;
|
}
|
|
// 文档图标样式 - 覆盖公共样式中的背景色
|
.document-icon {
|
background: #ed8d05;
|
}
|
|
// 浮动按钮样式 - 覆盖公共样式中的背景色
|
.fab-button {
|
background: #ed8d05;
|
}
|
|
// 特有样式
|
.detail-row-user {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
.detail-row-approveReason {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 8px;
|
}
|
|
.detail-value.highlightBlue {
|
color: #2979ff;
|
font-weight: 500;
|
}
|
|
.detail-value.highlightYellow {
|
color: #ed8d05;
|
font-weight: 500;
|
}
|
|
.approver-value {
|
display: flex;
|
justify-content: flex-end;
|
}
|
|
.approver-chip {
|
display: inline-flex;
|
align-items: center;
|
gap: 6px;
|
background: #f0f6ff;
|
color: #2b7cff;
|
border: 1px solid #e0efff;
|
border-radius: 999px;
|
padding: 4px 10px;
|
max-width: 100%;
|
}
|
|
.approver-name {
|
font-size: 12px;
|
color: #2b7cff;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
|
.actions {
|
display: flex;
|
gap: 10px;
|
align-items: center;
|
justify-content: flex-end;
|
margin-top: 18rpx;
|
}
|
|
.action-btn {
|
border-radius: 16px;
|
height: 28px;
|
line-height: 28px;
|
padding: 0 12px;
|
}
|
</style>
|