feat: BMS 项目初始化(前端+后端)

- 前端 bms-front:基于 RuoYi-Vue3,封装 BasicForm/BasicTable 公共组件,替换 18 个业务页面表格
- 后端 bms-back:基于 RuoYi-Vue,包含 system/quartz/generator 等模块
- 项目标题由若依管理系统改为 BMS
This commit is contained in:
wuweihua
2026-08-28 11:45:11 +08:00
commit 6081a98bcc
626 changed files with 71650 additions and 0 deletions
@@ -0,0 +1,111 @@
<template>
<el-dialog v-model="visible" :title="`「${noticeTitle}」已读用户`" width="760px" top="6vh" append-to-body @close="handleClose">
<basic-table
ref="tableRef"
:columns="columns"
:search-columns="searchColumns"
:query="queryList"
:extra-params="extraParams"
row-key="userId"
size="small"
height="340px"
stripe
:show-toolbar="false"
:selection="false"
:show-index="true"
:auto-load="false"
>
<template #search-extra>
<span class="read-stat">共 <strong>{{ readTotal }}</strong> 人已读</span>
</template>
</basic-table>
</el-dialog>
</template>
<script setup name="ReadUsers">
import { Search } from "@element-plus/icons-vue"
import { listNoticeReadUsers } from "@/api/system/notice"
const { proxy } = getCurrentInstance()
const tableRef = ref()
const visible = ref(false)
const noticeTitle = ref("")
const readTotal = ref(0)
// 固定参数:公告 ID(每次请求合并,不参与搜索重置)
const extraParams = reactive({ noticeId: undefined })
// 搜索项配置
const searchColumns = [
{
label: "",
prop: "searchValue",
component: "input",
placeholder: "登录名称 / 用户名称",
width: "220px",
formItemProps: { labelWidth: "0px" },
props: {
prefixIcon: Search,
clearable: true,
onKeyup: (e) => { if (e.key === "Enter") tableRef.value?.handleQuery() },
onClear: () => tableRef.value?.handleQuery()
}
}
]
// 表格列配置
const columns = [
{ label: "登录名称", prop: "userName", align: "center" },
{ label: "用户名称", prop: "nickName", align: "center" },
{ label: "所属部门", prop: "deptName", align: "center" },
{ label: "手机号码", prop: "phonenumber", align: "center", width: 120 },
{ label: "阅读时间", prop: "readTime", align: "center", width: 160, parseTime: true }
]
// 查询函数(BasicTable 调用,返回 { rows, total });同时记录已读总数用于统计
function queryList(params) {
return listNoticeReadUsers(params).then(res => {
readTotal.value = res.total
return res
})
}
/** 打开弹框 */
function open(row) {
extraParams.noticeId = row.noticeId
noticeTitle.value = row.noticeTitle
visible.value = true
nextTick(() => {
tableRef.value?.setQueryParams({ searchValue: undefined })
tableRef.value?.reload()
})
}
/** 关闭弹框 */
function handleClose() {
tableRef.value?.clearSelection()
tableRef.value?.setQueryParams({ searchValue: undefined })
}
defineExpose({
open
})
</script>
<style scoped>
.read-stat {
font-size: 13px;
color: #606266;
line-height: 28px;
}
.read-stat strong {
color: #409eff;
font-size: 15px;
margin: 0 2px;
}
/* 将搜索栏操作区(搜索/重置 + 已读统计)浮动到右侧 */
:deep(.basic-form > .el-form-item:last-of-type) {
float: right;
}
</style>
+225
View File
@@ -0,0 +1,225 @@
<template>
<div class="app-container">
<basic-table
ref="tableRef"
:columns="columns"
:search-columns="searchColumns"
:query="queryList"
row-key="noticeId"
>
<template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:notice:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="selection.length !== 1"
@click="handleUpdate(selection[0])"
v-hasPermi="['system:notice:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="!selection.length"
@click="handleDelete(ids)"
v-hasPermi="['system:notice:remove']"
>删除</el-button>
</el-col>
</template>
<template #col-noticeTitle="{ row }">
<a class="link-type" style="cursor:pointer" @click="handleViewData(row)">{{ row.noticeTitle }}</a>
</template>
<template #col-action="{ row }">
<el-button link type="primary" icon="User" @click="handleReadUsers(row)" v-hasPermi="['system:notice:list']">阅读用户</el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(row)" v-hasPermi="['system:notice:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(row.noticeId)" v-hasPermi="['system:notice:remove']">删除</el-button>
</template>
</basic-table>
<!-- 添加或修改公告对话框 -->
<el-dialog :title="title" v-model="open" width="780px" append-to-body>
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公告类型" prop="noticeType">
<el-select v-model="form.noticeType" placeholder="请选择">
<el-option
v-for="dict in sys_notice_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in sys_notice_status"
:key="dict.value"
:value="dict.value"
>{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="内容">
<editor v-model="form.noticeContent" :min-height="192"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
<notice-detail-view ref="noticeViewRef" />
<read-users-dialog ref="readUsersRef" />
</div>
</template>
<script setup name="Notice">
import NoticeDetailView from "@/layout/components/HeaderNotice/DetailView"
import ReadUsersDialog from "./ReadUsers"
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
const { proxy } = getCurrentInstance()
const { sys_notice_status, sys_notice_type } = useDict("sys_notice_status", "sys_notice_type")
const tableRef = ref()
const open = ref(false)
const title = ref("")
// 搜索项配置
const searchColumns = [
{ label: "公告标题", prop: "noticeTitle", component: "input", placeholder: "请输入公告标题", width: "200px" },
{ label: "操作人员", prop: "createBy", component: "input", placeholder: "请输入操作人员", width: "200px" },
{ label: "类型", prop: "noticeType", component: "select", dict: "sys_notice_type", placeholder: "公告类型", width: "200px" }
]
// 表格列配置
const columns = [
{ label: "序号", prop: "noticeId", align: "center", width: 100 },
{ label: "公告标题", prop: "noticeTitle", align: "center" },
{ label: "公告类型", prop: "noticeType", align: "center", width: 100, dict: "sys_notice_type" },
{ label: "状态", prop: "status", align: "center", width: 100, dict: "sys_notice_status" },
{ label: "创建者", prop: "createBy", align: "center", width: 100 },
{ label: "创建时间", prop: "createTime", align: "center", width: 100, parseTime: "{y}-{m}-{d}" },
{ label: "操作", prop: "action", align: "center", width: 220, showInToolbar: false }
]
// 查询函数(BasicTable 调用,返回 { rows, total })
function queryList(params) {
return listNotice(params)
}
const data = reactive({
form: {},
rules: {
noticeTitle: [{ required: true, message: "公告标题不能为空", trigger: "blur" }],
noticeType: [{ required: true, message: "公告类型不能为空", trigger: "change" }]
}
})
const { form, rules } = toRefs(data)
/** 取消按钮 */
function cancel() {
open.value = false
reset()
}
/** 表单重置 */
function reset() {
form.value = {
noticeId: undefined,
noticeTitle: undefined,
noticeType: undefined,
noticeContent: undefined,
status: "0"
}
proxy.resetForm("noticeRef")
}
/** 新增按钮操作 */
function handleAdd() {
reset()
open.value = true
title.value = "添加公告"
}
/**修改按钮操作 */
function handleUpdate(row) {
reset()
const noticeId = row.noticeId
getNotice(noticeId).then(response => {
form.value = response.data
open.value = true
title.value = "修改公告"
})
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["noticeRef"].validate(valid => {
if (valid) {
if (form.value.noticeId != undefined) {
updateNotice(form.value).then(() => {
proxy.$modal.msgSuccess("修改成功")
open.value = false
tableRef.value.refresh()
})
} else {
addNotice(form.value).then(() => {
proxy.$modal.msgSuccess("新增成功")
open.value = false
tableRef.value.refresh()
})
}
}
})
}
/** 查看公告详情 */
function handleViewData(row) {
proxy.$refs["noticeViewRef"].open(row)
}
/** 查看已读用户 */
function handleReadUsers(row) {
proxy.$refs["readUsersRef"].open(row)
}
/** 删除按钮操作 */
function handleDelete(noticeIds) {
proxy.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
return delNotice(noticeIds)
}).then(() => {
tableRef.value.refresh()
proxy.$modal.msgSuccess("删除成功")
}).catch(() => {})
}
</script>