This commit is contained in:
2025-12-18 11:01:13 +08:00
parent aeca307eda
commit fff208f6d1
10 changed files with 1051 additions and 0 deletions
@@ -0,0 +1,398 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.box {
width: 500px;
height: 100px;
margin: 150px auto 0;
}
.inp {
width: 300px !important;
margin-right: 20px;
}
</style>
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">祝福名称:</div>
<div class="search-item-option">
<el-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
<template slot="prepend">祝福名称</template>
</el-input>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="祝福列表">
<el-button icon="el-icon-s-promotion" type="primary" size="small"
@click="openAdd">新建祝福
</el-button>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
ref="table"
:size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template v-if="column.prop==='blessingMode'" scope="{row:{blessingMode}}">
{{blessingMode=='birthday'?'生日祝福':'其它祝福'}}
</template>
<template v-else-if="column.prop==='isSend'" scope="{row:{isSend}}">
{{isSend=='2'?'任务已完成':isSend=='1'?'进行中':'未开启'}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="300px">
<template scope="{row}">
<el-button type="primary" @click="openView(row)" size="mini">
查看
</el-button>
<el-button type="primary" @click="openEdit(row)" size="mini" :disabled="row.isSend!=0">
编辑
</el-button>
<el-button type="danger" @click="doDelete(row)" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit>
<el-form :model="formData" ref="addForm" :rules="formRules" label-width="120px"
style="width: 50%;margin: auto">
<el-row gutter="20">
<el-col :span="24">
<el-form-item prop="blessingName" label="祝福名称">
<el-input v-model="formData.blessingName" style="width: 100%"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="activityGroupId" label="发送范围">
<el-select v-model="formData.activityGroupId" placeholder="请选择发送范围" filterable
clearable
style="width: 100%">
<el-option v-for="item in activityGroupList"
:value="item.groupId"
:key="item.groupId"
:label="item.groupName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="blessingMode" label="祝福模式">
<el-select v-model="formData.blessingMode" placeholder="请选择祝福模式" filterable clearable
style="width: 100%">
<el-option label="生日祝福" value="birthday"></el-option>
<el-option label="其它祝福" value="other"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="isSend" label="是否发送">
<el-switch
v-model="formData.isSend"
active-color="#13ce66"
active-value="1"
inactive-value="0"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="发送方式" prop="sendTypes">
<el-checkbox-group v-model="formData.sendTypes" size="medium">
<el-checkbox border label="msg">短信发送</el-checkbox>
<el-checkbox border label="WeChat">微信发送</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="日期和时间" prop="blessingCron">
<el-input v-for="a in cronExecuteDate" :value="a" readonly></el-input>
<!-- <el-input v-model="formData.blessingCron" placeholder class="inp" readonly></el-input>-->
<el-button type="primary" @click="showDialog">设置日期和时间</el-button>
<sapn style="color: red" v-if="cronExecuteDate.length>2">只展示最近五次执行时间</sapn>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="blessingContent" label="祝福内容">
<el-input v-model="formData.blessingContent" style="width: 100%"
type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-row style="float: right">
<el-button type="primary" @click="formData.id?doEdit():doAdd()">创建</el-button>
</el-row>
</el-form-item>
</el-form>
</template>
<template #view>
<el-form label-suffix="" label-width="140px" label-position="left" style="width: 50%;margin: auto">
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="祝福名称">
<el-input readonly :value="viewData.blessingName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发送范围">
<el-input readonly :value="viewData.groupName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="祝福模式">
<el-input readonly
:value="viewData.blessingMode==='other'?'其它祝福':'生日祝福'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否发送">
<el-input readonly
:value="viewData.isSend==='0'?'未开启':viewData.isSend==='1'?'进行中':'任务已完成'"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="最近五次执行时间">
<el-input readonly v-for="a in viewData.blessingDate" :value="a"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="祝福内容">
<el-input style="width: 100%" readonly :value="viewData.blessingContent" rows="4"
type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
</guava>
<el-dialog title="生成 cron" :visible.sync="showCron">
<vcron :expression="formData.blessingCron"
@hide="showCron=false"
@fill="crontabFill"
ref="cron"></vcron>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
"vcron": vcrontab.default
},
data() {
return {
cronExecuteDate: [],
viewData: {},
formData: {
sendTypes: [],
blessingCron: ''
},
pageForm: {
blessingName: ''
},
activityGroupList: [],
dialogVisible: false,
tableColumns: [
{prop: 'blessingName', label: '祝福名称'},
{prop: 'groupName', label: '发送范围'},
{prop: 'blessingMode', label: '祝福模式'},
{prop: 'sendTypesName', label: '发送方式',},
{prop: 'isSend', label: '是否发送',},
],
formRules: {
blessingName: [{required: true, message: '请填写祝福名称', trigger: ['blur', 'change']}],
activityGroupId: [{required: true, message: '请选择发送范围', trigger: ['blur', 'change']}],
blessingMode: [{required: true, message: '请选择祝福模式', trigger: ['blur', 'change']}],
sendTypes: [{required: true, message: '请选择发送方式', trigger: ['blur', 'change']}],
blessingContent: [{required: true, message: '请填写祝福内容', trigger: ['blur', 'change']}],
},
showCron: false,
}
},
methods: {
async openView(row) {
const {data} = await $.post(loc() + '/findOne', {id: row.id})
this.viewData = row
this.viewData.blessingDate = data.blessingDate
this.$refs.guava.view()
},
async openEdit(row) {
const {data} = await $.post(loc() + '/findOne', {id: row.id})
this.$set(this, "formData", data)
this.$refs.guava.edit()
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async doDelete(row) {
const confirm = await this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post('/platform/blessing/applyList/doDelete', {id: row.id})
if (data.code == 0) {
this.$message.success(data.msg);
this.$refs.guava.index()
this.doSearch()
} else {
this.$message.error(data.msg);
}
}
},
async doEdit() {
this.$refs["addForm"].validate(async valid => {
if (valid) {
const confirm = await this.$confirm('确定要修改吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post(loc() + '/doEdit', {Blessing: JSON.stringify(this.formData)})
if (data.code == 0) {
this.$message.success(data.msg);
this.$refs.guava.index()
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
this.doSearch()
} else {
this.$message.error(data.msg);
}
}
}
})
},
doAdd() {
this.$refs["addForm"].validate(async valid => {
if (valid) {
const confirm = await this.$confirm('确定要创建吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
const data = await $.post(loc() + '/doAdd', {Blessing: JSON.stringify(this.formData)})
if (data.code == 0) {
this.$message.success(data.msg);
window.location.reload();
} else {
this.$message.error(data.msg);
}
}
}
})
},
async getActivityGroup() {
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = data
},
openAdd() {
this.$refs.guava.edit()
this.formData = {
sendTypes: [],
blessingCron: ''
}
},
crontabFill(value) {
this.$set(this.formData, 'blessingCron', value)
this.cronExecuteDate = this.$refs.cron.cronExecuteDate
},
showDialog() {
this.expression = this.input
this.showCron = true
},
pageData() {
this.tableLoading = true
$.post(loc() + "/pageData", this.pageForm, (data) => {
this.tableLoading = false
if (data.code == 0) {
data.data.list.forEach(v => {
if (v.sendTypes) {
const a = JSON.parse(v.sendTypes).map(z => {
if (z == "msg") {
return "短信"
} else {
return "微信"
}
})
v.sendTypesName = a.toString()
}
})
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
}
},
async created() {
await this.getActivityGroup()
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,225 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.box {
width: 500px;
height: 100px;
margin: 150px auto 0;
}
.inp {
width: 300px !important;
margin-right: 20px;
}
</style>
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
<div id="app" class="platform" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">祝福名称:</div>
<div class="search-item-option">
<el-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
<template slot="prepend">祝福名称</template>
</el-input>
</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"
style="width: 100%"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<div class="search-item"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable="true">
<el-option v-for="item in unions" :label="item.unionname" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">祝福时间:</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.data"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
style="width: 100%">
</el-date-picker>
</div>
</div>
<template v-if="searchMore">
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
placeholder="人员类型"
code="UserType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
placeholder="在职状态"
code="UserState"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">&emsp;&emsp;别:</div>
<div class="search-item-option">
<el-select v-model="pageForm.sex" style="width: 100%" clearable
placeholder="请选择">
<el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option>
</el-select>
</div>
</div>
</template>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
<more v-model="searchMore"></more>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="用户列表" :app="this">
<template #func>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
ref="table"
:size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
"vcron": vcrontab.default,
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
},
data() {
return {
pageForm: {
data: moment().format('YYYY-MM-DD'),
searchName: "username",
blessingName: ''
},
sexOptions: ['男', '女'],
unions: [],
units: [],
activityGroupList: [],
dialogVisible: false,
tableColumns: [
{prop: 'blessingName', label: '祝福名称'},
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'birthday', label: '出生日期', sortable: true},
{prop: 'applyDate', label: '发送时间', sortable: true},
],
formRules: {},
showCron: false,
}
},
methods: {
async getActivityGroup() {
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = data
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
}
},
async created() {
await this.getActivityGroup()
this.pageData()
this.unions = await getUnions()
this.flushUnits()
}
})
</script>
<!--#
}
#-->