feat: 补充生日模板配置

This commit is contained in:
2026-09-24 16:25:26 +08:00
parent 1d7f8c840e
commit ae37d48657
9 changed files with 329 additions and 29 deletions
@@ -0,0 +1,10 @@
-- 已有生日配置表增加查询和发送配置字段。
ALTER TABLE `user_birthday_config`
ADD COLUMN `birthdayDays` int DEFAULT 15 COMMENT '默认查询未来生日天数',
ADD COLUMN `autoSendEnabled` tinyint(1) DEFAULT 1 COMMENT '是否自动发送生日祝福',
ADD COLUMN `sendTitle` varchar(255) DEFAULT NULL COMMENT '默认发送标题',
ADD COLUMN `sendContent` text COMMENT '默认发送内容';
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('df478143ff1846ddab704616d9fdae41', '93487f22face4e18887d90154b70094a', '01610005', '生日模板配置', null, 'menu', '/platform/staffManage/birthday/config', null, null, true, false, 'staff.birthday.config', null, 1014, false, '17a7f8ad3ee947b4a26175049a9c253d', 1790220577535, '17a7f8ad3ee947b4a26175049a9c253d', 1790220577536, false, null, 'PC', '07d940ba34bd47399cda140894f5d86b', false, '/platform/sys/file/download?id=f71c9e07faf05ac4bf8a5364ae0bfd85', 's', false, false);
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('7f4a820d5a394bb8a0a92d6699afe7c8', 'df478143ff1846ddab704616d9fdae41');
@@ -0,0 +1,122 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<div slot="header">
<span>生日祝福配置</span>
</div>
<el-form ref="configFormRef" :model="configForm" :rules="configRules"
label-width="150px" style="max-width:900px">
<el-form-item label="页面背景图片" prop="picUrl">
<file-upload :value.sync="configForm.picUrl" :upload_number="1" upload_mode="image"
accept=".jpg,.jpeg,.png" upload_result_category="interval"></file-upload>
<div class="text-muted">建议使用竖版生日主题图片。</div>
</el-form-item>
<el-form-item label="福利贺卡图片" prop="birthdayUrl">
<file-upload :value.sync="configForm.birthdayUrl" :upload_number="1" upload_mode="image"
accept=".jpg,.jpeg,.png" upload_result_category="interval"></file-upload>
<div class="text-muted">移动端点击“领取生日福利”后展示该图片。</div>
</el-form-item>
<el-form-item label="默认查询天数" prop="birthdayDays">
<el-input-number v-model="configForm.birthdayDays" :min="1"
controls-position="right"></el-input-number>
<span class="text-muted ml10">生日人员页未选择日期时,默认查询今天起未来N天。</span>
</el-form-item>
<!-- <el-form-item label="自动发送" prop="autoSendEnabled">
<el-switch v-model="configForm.autoSendEnabled"
active-text="开启" inactive-text="关闭"></el-switch>
</el-form-item>-->
<el-form-item label="发送标题" prop="sendTitle">
<el-input v-model="configForm.sendTitle" maxlength="255" show-word-limit
placeholder="请输入发送标题"></el-input>
</el-form-item>
<el-form-item label="发送内容" prop="sendContent">
<el-input v-model="configForm.sendContent" type="textarea" :rows="6"
placeholder="请输入发送内容"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="formLoading" @click="saveConfig">保存配置</el-button>
<el-button @click="previewBirthday">预览生日页面</el-button>
</el-form-item>
</el-form>
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
data() {
return {
formLoading: false,
configForm: {
id: "",
picUrl: "",
birthdayUrl: "",
birthdayDays: 15,
autoSendEnabled: true,
sendTitle: "请点击查收您的生日福利",
sendContent: "校工会祝您:生日快乐!幸福安康"
},
configRules: {
birthdayDays: [
{required:true,message:"请输入默认查询天数",trigger:["blur","change"]}
],
sendTitle: [
{required:true,message:"请输入发送标题",trigger:["blur","change"]}
],
sendContent: [
{required:true,message:"请输入发送内容",trigger:["blur","change"]}
]
}
}
},
methods: {
loadConfig() {
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/getConfig").then((res) => {
if (res.code === 0) {
this.$set(this, "configForm", Object.assign({}, this.configForm, res.data || {}))
} else {
this.$message.warning(res.msg)
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
},
saveConfig() {
this.$refs.configFormRef.validate((valid) => {
if (!valid) return
this.$confirm("确定保存生日祝福配置吗?", "提示", {type:"warning"}).then(() => {
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/saveConfig", this.configForm).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.$set(this, "configForm", res.data)
} else {
this.$message.warning(res.msg)
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
}).catch(() => {})
})
},
previewBirthday() {
let url = "/platform/staffManage/birthday/manage/h5"
if (this.configForm.birthdayUrl) {
url = url + "?id=" + encodeURIComponent(this.configForm.birthdayUrl)
}
window.open(url, "_blank")
}
},
created() {
this.loadConfig()
}
})
</script>
<!--#
}
#-->
@@ -38,7 +38,7 @@ layout("/layouts/platform.html"){
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="生日人员(默认展示未来15天,日期查询忽略年份)"
<table-tool :label="'生日人员(默认展示未来' + birthdayDays + '天,日期查询忽略年份)'"
:columns.sync="tableColumns">
<el-button size="small" type="primary" @click="doExport">导出Excel</el-button>
<el-button size="small" type="primary" @click="openSendByQuery">发送通知</el-button>
@@ -172,6 +172,8 @@ layout("/layouts/platform.html"){
sendQueryForm: {title:"",content:""},
sendUserDialogVisible: false,
sendUserForm: {userId:"",userInfo:"",title:"",content:""},
birthdayDays: 15,
defaultMsgConfig: {title:"",content:""},
configDialogVisible: false,
configForm: {id:"",picUrl:"",birthdayUrl:""}
}
@@ -231,7 +233,7 @@ layout("/layouts/platform.html"){
})
},
openSendByQuery() {
this.$set(this, "sendQueryForm", Object.assign(this.requestParams(), {title:"",content:""}))
this.$set(this, "sendQueryForm", Object.assign(this.requestParams(), {title:this.defaultMsgConfig.title,content:this.defaultMsgConfig.content}))
this.$set(this, "sendQueryDialogVisible", true)
},
closeSendByQuery() {
@@ -259,7 +261,7 @@ layout("/layouts/platform.html"){
})
},
openSendByUser(row) {
this.$set(this, "sendUserForm", {userId:row.id,userInfo:row.username + "(" + row.loginname + ")",title:"",content:""})
this.$set(this, "sendUserForm", {userId:row.id,userInfo:row.username + "(" + row.loginname + ")",title:this.defaultMsgConfig.title,content:this.defaultMsgConfig.content})
this.$set(this, "sendUserDialogVisible", true)
},
closeSendByUser() {
@@ -286,6 +288,16 @@ layout("/layouts/platform.html"){
}).catch(() => {})
})
},
loadBirthdayConfig() {
this.$axios.post(loc() + "/getConfig").then((res) => {
if (res.code !== 0 || !res.data) return
this.$set(this, "birthdayDays", res.data.birthdayDays || 15)
this.$set(this, "defaultMsgConfig", {
title:res.data.sendTitle || "",
content:res.data.sendContent || ""
})
})
},
openConfig() {
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/getConfig").then((res) => {
@@ -321,6 +333,7 @@ layout("/layouts/platform.html"){
},
created() {
this.initOrganizationOptions()
this.loadBirthdayConfig()
this.pageData()
}
})