first commit
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
const COMMON_QUERY = {
|
||||
template: /*language=HTML*/ `
|
||||
<div class="search birthday-search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">校区</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.campus" style="width: 100%">
|
||||
<el-option :key="item.campus_id"
|
||||
:label="item.campus_name"
|
||||
:value="item.campus_name"
|
||||
v-for="item in campusList"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">姓名/工号</div>
|
||||
<div class="search-item-option">
|
||||
<el-input placeholder="请输入姓名或工号查询" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属工会</div>
|
||||
<div class="search-item-option">
|
||||
<el-select @change="flushUnits" @clear="flushUnits" clearable filterable
|
||||
placeholder="请选择所属工会" style="width: 100%;" v-model="pageForm.unionId">
|
||||
<el-option :key="item.id" :label="item.unionname" :value="item.id"
|
||||
v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属单位</div>
|
||||
<div class="search-item-option">
|
||||
<el-select clearable filterable placeholder="请选择所属单位" style="width: 100%"
|
||||
v-model="pageForm.unitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in units"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">在职状态</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.userStates" style="width: 100%" placeholder="在职状态" @change="doSearch"
|
||||
clearable filterable multiple>
|
||||
<el-option :key="item.code" :label="item.name" :value="item.name"
|
||||
v-for="item in userStateOptions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">人员类型</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.personTypes" style="width: 100%" placeholder="人员类型" @change="doSearch"
|
||||
clearable filterable multiple>
|
||||
<el-option :key="item.code" :label="item.name" :value="item.name"
|
||||
v-for="item in personTypeOptions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">生日日期</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker :picker-options="pickerOptions" @change="changeDateRangeChange"
|
||||
align="right" end-placeholder="结束日期" format="yyyy-MM-dd"
|
||||
range-separator="-" start-placeholder="开始日期" style="width: 100%"
|
||||
type="datetimerange" v-model="pageForm.changeDateRange"
|
||||
value-format="yyyy-MM-dd"></el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: "未来一周",
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
end.setTime(start.getTime() + 3600 * 1000 * 24 * 7)
|
||||
picker.$emit("pick", [start, end])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "未来一个月",
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30)
|
||||
picker.$emit("pick", [start, end])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "未来三个月",
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
end.setTime(start.getTime() + 3600 * 1000 * 24 * 90)
|
||||
picker.$emit("pick", [start, end])
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
unions: [],
|
||||
units: [],
|
||||
userStateOptions: [],
|
||||
personTypeOptions: [],
|
||||
pageForm: {
|
||||
searchKeyword: '',
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
userStates: [],
|
||||
personTypes: [],
|
||||
changeDateRange: [],
|
||||
},
|
||||
campusList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSearch(){
|
||||
const pageForm = clone(this.pageForm)
|
||||
pageForm.userStates = JSON.stringify(this.pageForm.userStates)
|
||||
pageForm.personTypes = JSON.stringify(this.pageForm.personTypes)
|
||||
this.$emit('search', pageForm)
|
||||
},
|
||||
changeDateRangeChange(val){
|
||||
if (val && val.length > 0) {
|
||||
this.pageForm.startDate = val[0]
|
||||
this.pageForm.endDate = val[1]
|
||||
} else {
|
||||
this.pageForm.startDate = null
|
||||
this.pageForm.endDate = null
|
||||
}
|
||||
this.doSearch()
|
||||
},
|
||||
async initData(){
|
||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('SchoolUnionMemberAdmin')}" === 'true') {
|
||||
this.unions = await getUnions(null, false)
|
||||
this.units = await getUnits()
|
||||
} else {
|
||||
this.unions = await getUnions(null, true)
|
||||
this.$set(this.pageForm, 'unionId', this.unions && this.unions.length ? this.unions[0].id : null)
|
||||
await this.flushUnits()
|
||||
}
|
||||
this.userStateOptions = await getDictOptions("UserState")
|
||||
this.personTypeOptions = await getDictOptions("UserType")
|
||||
},
|
||||
async flushUnits(){
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.units = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.initData()
|
||||
this.campusList = await getCampus()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.birthday-search {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.birthday-search .search-item,
|
||||
.birthday-search .search-query {
|
||||
box-sizing: border-box;
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
|
||||
.birthday-search .search-item-label {
|
||||
min-width: 70px;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<common-query ref="commonQueryRef" @search="search"></common-query>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool :app="this" :label="tableToolLabel">
|
||||
<template #func>
|
||||
<el-button type="primary" size="small" @click="openSendMsgByQuery">发送通知</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table"
|
||||
row-key="id" style="width: 100%">
|
||||
<el-table-column :index="indexMethod"
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column :label="column.label"
|
||||
align="center"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
header-align="center"
|
||||
min-width="100px"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="250px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">人员信息</el-button>
|
||||
<el-button @click="openSendMsgByUser(row)" size="mini" type="primary">发送通知</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<template #view>
|
||||
<member-info ref="memberInfoRef"></member-info>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="sendMsgByQueryDialogVisible"
|
||||
title="请在下方填写需要发送的内容"
|
||||
width="50%"
|
||||
>
|
||||
<el-form :model="sendMsgByQueryFormData" label-width="80px" ref="sendMsgByQueryForm">
|
||||
|
||||
<el-form-item
|
||||
:rules="[{required: true, message: '请输入发送标题', trigger: ['blur', 'change']}]"
|
||||
label="发送标题"
|
||||
prop="title">
|
||||
<el-input
|
||||
:rows="6"
|
||||
placeholder="请输入发送标题"
|
||||
v-model="sendMsgByQueryFormData.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:rules="[{required: true, message: '请选择发送内容', trigger: ['blur', 'change']}]"
|
||||
label="发送内容"
|
||||
prop="content">
|
||||
<el-input
|
||||
:rows="6"
|
||||
placeholder="请输入内容"
|
||||
type="textarea"
|
||||
v-model="sendMsgByQueryFormData.content">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="sendMsgByQueryDialogVisible = false">取 消</el-button>
|
||||
<el-button @click="sendMsgByQueryUsers" type="primary">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 根据行内数据发送消息 -->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="sendMsgByUserDialogVisible"
|
||||
title="请在下方填写需要发送的内容"
|
||||
width="50%"
|
||||
>
|
||||
<el-form :model="sendMsgByUserFormData" label-width="80px" ref="sendForm">
|
||||
<el-form-item label="发送对象" prop="userInfo">
|
||||
<el-input placeholder="请输入发送对象" readonly v-model="sendMsgByUserFormData.userInfo"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:rules="[{required: true, message: '请输入发送标题', trigger: ['blur', 'change']}]"
|
||||
label="发送标题"
|
||||
prop="title">
|
||||
<el-input
|
||||
placeholder="请输入发送标题"
|
||||
v-model="sendMsgByUserFormData.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:rules="[{required: true, message: '请选择发送内容', trigger: ['blur', 'change']}]"
|
||||
label="发送内容"
|
||||
prop="content">
|
||||
<el-input
|
||||
:rows="6"
|
||||
placeholder="请输入内容"
|
||||
type="textarea"
|
||||
v-model="sendMsgByUserFormData.content">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="sendMsgByUserDialogVisible = false">取 消</el-button>
|
||||
<el-button @click="sendMsgByUser" type="primary">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogVisible"
|
||||
title="生日贺卡图片设置"
|
||||
width="50%"
|
||||
>
|
||||
<el-form :model="formData" label-width="80px" ref="formRef">
|
||||
<el-form-item label="背景图片" prop="picUrl">
|
||||
<image-Upload :file-size="5"
|
||||
:file-type="['png','jpg']"
|
||||
:height="100"
|
||||
:limit="1"
|
||||
:width="100"
|
||||
ref="imageUpload"
|
||||
v-model="formData.picUrl"></image-Upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="贺卡图片" prop="birthdayUrl">
|
||||
<image-Upload :file-size="5"
|
||||
:file-type="['png','jpg']"
|
||||
:height="100"
|
||||
:limit="1"
|
||||
:width="100"
|
||||
ref="imageUpload"
|
||||
v-model="formData.birthdayUrl"></image-Upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button @click="doSubmit" type="primary">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--#include("commonQuery.js"){}#-->
|
||||
<!--#include("/platform/member/common/memberInfo.js"){}#-->
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {},
|
||||
|
||||
tableColumns: [
|
||||
{ prop: "loginname", label: "工号", sortable: true },
|
||||
{ prop: "username", label: "姓名", sortable: true },
|
||||
{ prop: "sex", label: "性别", sortable: true },
|
||||
{ prop: "mobile", label: "联系方式", sortable: true },
|
||||
{ prop: "birthday", label: "出生年月", sortable: true },
|
||||
{ prop: "daysUntilBirthday", label: "生日倒计时(天)", sortable: true },
|
||||
{ prop: "userState", label: "在职状态", sortable: true, width: "100px" },
|
||||
{ prop: "personType", label: "人员类型", sortable: true, width: "120px" },
|
||||
{ prop: "unionname", label: "所属工会", sortable: true, width: "160px" },
|
||||
{ prop: "unitname", label: "所属单位", sortable: true, width: "160px" }
|
||||
],
|
||||
|
||||
// 根据查询条件推送消息相关
|
||||
sendMsgByQueryDialogVisible: false,
|
||||
sendMsgByQueryFormData: {},
|
||||
|
||||
// 根据行内发送消息相关
|
||||
sendMsgByUserDialogVisible: false,
|
||||
sendMsgByUserFormData: {},
|
||||
|
||||
// 图片配置
|
||||
dialogVisible: false,
|
||||
formData: {
|
||||
picUrl: '',
|
||||
birthdayUrl: ''
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'common-query': COMMON_QUERY,
|
||||
'member-info': MEMBER_INFO,
|
||||
},
|
||||
computed: {
|
||||
tableToolLabel() {
|
||||
return '数据列表(默认展示当月的数据,搜索会忽略年份)'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async openPicSet() {
|
||||
const resp = await $.post('/platform/staffManage/birthday/manage/getConfig')
|
||||
if (resp.code === 0) {
|
||||
this.formData = resp.data
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
|
||||
doSubmit() {
|
||||
this.$confirm('确定要提交吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await $.post('/platform/staffManage/birthday/manage/saveOrModifyConfig', this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success('保存成功')
|
||||
this.dialogVisible = false
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
openSendMsgByUser(row) {
|
||||
this.sendMsgByUserFormData.userId = row.id
|
||||
this.sendMsgByUserFormData.userInfo = row.username
|
||||
this.fillSendMsgConfig(this.sendMsgByUserFormData)
|
||||
this.sendMsgByUserDialogVisible = true
|
||||
},
|
||||
async sendMsgByUser() {
|
||||
const valid = await this.$refs['sendForm'].validate()
|
||||
if (!valid) return
|
||||
const confirm = await this.$confirm('您确定要向' + this.sendMsgByUserFormData.userInfo + '数据发送信息吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonTest: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const resp = await $.post('/platform/staffManage/birthday/manage/sendMsgByUser',
|
||||
this.sendMsgByUserFormData
|
||||
)
|
||||
if (resp.code === 0) {
|
||||
this.sendMsgByUserDialogVisible = false
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
openSendMsgByQuery() {
|
||||
this.sendMsgByQueryFormData = JSON.parse(JSON.stringify(this.pageForm))
|
||||
this.fillSendMsgConfig(this.sendMsgByQueryFormData)
|
||||
this.sendMsgByQueryDialogVisible = true
|
||||
},
|
||||
fillSendMsgConfig(formData) {
|
||||
$.post('/platform/staffManage/birthday/manage/getSendMsgConfig')
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
const data = resp.data || {}
|
||||
this.$set(formData, 'title', data.title || '')
|
||||
this.$set(formData, 'content', data.content || '')
|
||||
}
|
||||
})
|
||||
.always(() => {
|
||||
})
|
||||
},
|
||||
async sendMsgByQueryUsers() {
|
||||
const valid = await this.$refs['sendMsgByQueryForm'].validate()
|
||||
if (!valid) return
|
||||
const confirm = await this.$confirm('您确定根据查询条件发送信息吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonTest: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const resp = await $.post('/platform/staffManage/birthday/manage/sendMsgByQueryUsers', this.sendMsgByQueryFormData)
|
||||
if (resp.code === 0) {
|
||||
this.sendMsgByQueryDialogVisible = false
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
doExport() {
|
||||
const query = $.param(this.pageForm)
|
||||
window.location.href = "/platform/staffManage/birthday/manage/doExport" + (query ? "?" + query : "")
|
||||
},
|
||||
openView(row) {
|
||||
this.$refs.guava.view()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.memberInfoRef.onOpen(row.id)
|
||||
})
|
||||
},
|
||||
search(pageForm){
|
||||
this.pageForm = { ...this.pageForm, ...pageForm }
|
||||
this.pageData()
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
},
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user