This commit is contained in:
@jyuhsin
2025-09-16 19:34:40 +08:00
parent 20fe55813f
commit 372373a26e
45 changed files with 2637 additions and 2375 deletions
@@ -1,5 +1,5 @@
<!--#include('signForm.js'){}#-->
const info = {
const courseList = {
template: /*language=HTML*/ `
<div>
<el-row :gutter="20">
@@ -15,12 +15,12 @@ const info = {
<el-col class="query-title hidden-xs-only">&emsp;&emsp;</el-col>
<el-col class="query-content">
<el-select
v-model="pageForm.courseTypeId"
placeholder="请选择类型"
filterable
clearable
style="width: 200px"
@change="doSearch"
v-model="pageForm.courseTypeId"
placeholder="请选择类型"
filterable
clearable
style="width: 200px"
@change="doSearch"
>
<el-option v-for="item in courseTypeList" :key="item.id" :label="item.typeName" :value="item.id"></el-option>
</el-select>
@@ -30,12 +30,12 @@ const info = {
<el-col class="query-title hidden-xs-only">分类标识</el-col>
<el-col class="query-content">
<el-tag
:effect="pageForm.assortTypes.includes(item) ? 'dark' : 'plain'"
:key="item"
:type="item"
@click="tagClick('assortTypes', item)"
style="margin-right: 10px; cursor: pointer"
v-for="item in assortList"
:effect="pageForm.assortTypes.includes(item) ? 'dark' : 'plain'"
:key="item"
:type="item"
@click="tagClick('assortTypes', item)"
style="margin-right: 10px; cursor: pointer"
v-for="item in assortList"
>
{{ item }}
</el-tag>
@@ -44,15 +44,15 @@ const info = {
<el-table :data="tableData" class="mt10">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:key="column.prop"
:width="column.width"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:key="column.prop"
:width="column.width"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
<template v-slot="{row}" v-if="column.prop=='courseLocationCoordinates'">
<el-button style="padding: 0" @click="openViewMap(row.courseLocationCoordinates)" type="text">
@@ -67,6 +67,12 @@ const info = {
<template v-slot="{row}" v-else-if="column.prop=='applyNum'">
<span v-html="calcSignUpCount(row)"></span>
</template>
<template v-slot="{row}" v-else-if="column.prop=='introduce'">
<span v-if="!row.introduce?.trim()">暂无</span>
<el-button v-else style="padding: 0" @click="onPreview(row.introduce)" type="text">点击查看</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="{row}">
@@ -102,7 +108,14 @@ const info = {
<el-button @click="viewMapDialog = false"> </el-button>
</el-row>
</el-dialog>
<el-dialog :visible.sync="infoVisible" title="详细信息" append-to-body>
<div v-html="introduce"></div>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="infoVisible = false"> </el-button>
</el-row>
</el-dialog>
<sign-form ref="signFormRef" @refresh="doSearch"></sign-form>
</div>
`,
@@ -123,18 +136,41 @@ const info = {
tableColumns: [
{ prop: "courseName", label: "名称" },
{ prop: "typeName", label: "类型", width: 130},
{ prop: "campus", label: "校区", width: 160 },
{ prop: "courseLocationCoordinates", label: "地点", width: 200 },
{ prop: "courseInstructor", label: "联系人", width: 100 },
{ prop: "courseTime", label: "时间", width: 200 },
{ prop: "courseTime", label: "时间", width: 160 },
{ prop: "introduce", label: "详细信息", width: 100 },
{ prop: "applyNum", label: "已报名人数", width: 200 }
],
activity: {},
courseTypeList: [],
activityType: '',
pdf: false,
infoVisible: false,
introduce: '',
}
},
methods: {
async onPreview(introduce) {
try {
const parser = new DOMParser();
const doc = parser.parseFromString(introduce, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
const id = href.substring(href.indexOf("=") + 1)
const res = await this.$axios.post("/platform/sys/file/previewFileData", { ids: JSON.stringify([id]) })
this.pdf = true
window.open("/assets/platform/plugins/pdfJs/web/viewer.html?file=" + encodeURIComponent(res.data[0].downloadPath), res.data[0].name)
} catch (e) {
this.introduce = introduce
this.pdf = false
this.infoVisible = true
}
},
tagClick(key, val) {
let idx = this.pageForm[key].indexOf(val)
if (idx !== -1) {
@@ -153,7 +189,7 @@ const info = {
},
onSign(row) {
const courseType = this.courseTypeList.find((v) => v.id === row.courseType)
this.$axios.post("/platform/mobile/familyActivity/validateSignUp", {courseId: row.id})
this.$axios.post("/platform/family/apply/validateSignUp", {courseId: row.id})
.then((res) => {
if (res.code !== 0) {
this.$alert(res.msg, "提示", {
@@ -168,7 +204,7 @@ const info = {
type: "warning"
})
}
this.$refs.signFormRef.onOpen(row, courseType)
this.$refs.signFormRef.onOpen(row, courseType, this.activity)
}
})
},
@@ -178,7 +214,7 @@ const info = {
cancelButtonText: "取消",
type: "info"
}).then(async () => {
const resp = await this.$axios.post("/platform/mobile/familyActivity/cancelSignUp", {
const resp = await this.$axios.post("/platform/family/apply/cancelSignUp", {
activityId: row.activityId,
courseId: row.id
})
@@ -191,7 +227,7 @@ const info = {
})
},
async getCourseTypeList() {
const resp = await this.$axios.post("/platform/family/manage/type/getAllType")
const resp = await this.$axios.post("/platform/family/type/getAllType")
if (resp.code === 0) {
this.courseTypeList = resp.data
}
@@ -256,50 +292,6 @@ const info = {
},
style: /*language=CSS*/ `
.glow-box {
min-height: calc(100vh - 56px - 40px - 50px - 80px);
max-height: calc(100vh - 56px - 40px - 50px - 80px);
overflow-y: auto;
background: #F0F2F5;
}
img {
width: 100%;
height: 180px;
}
.title {
background: white;
height: 20px;
}
.query-row {
display: flex;
align-items: center;
padding: 6px 0;
}
.query-row:not(:last-child) {
border-bottom: 1px dashed rgb(230, 230, 230);
}
.query-row > .query-title {
width: 100px;
max-width: 100px;
min-width: 100px;
overflow: hidden;
}
.query-row > .query-content {
min-width: 200px;
overflow: hidden;
}
.query-row > .query-content > .el-tag {
margin-bottom: 5px;
margin-top: 5px;
}
@media screen and (max-width: 992px) {
.query-row:nth-child(4) .query-content .el-col:not(:last-child) {
margin-bottom: 5px;
}
.query-title {
display: none;
}
}
`
}
@@ -3,33 +3,81 @@ layout("/layouts/platform.html"){
#-->
<style>
.info-dialog .el-dialog__body {
max-height: 600px;
overflow-y: auto;
}
.glow-box {
min-height: calc(100vh - 56px - 40px - 50px - 80px);
max-height: calc(100vh - 56px - 40px - 50px - 80px);
overflow-y: auto;
background: #F0F2F5;
}
img {
width: 100%;
height: 180px;
}
.title {
background: white;
height: 20px;
}
.query-row {
display: flex;
align-items: center;
padding: 6px 0;
}
.query-row:not(:last-child) {
border-bottom: 1px dashed rgb(230, 230, 230);
}
.query-row > .query-title {
width: 100px;
max-width: 100px;
min-width: 100px;
overflow: hidden;
}
.query-row > .query-content {
min-width: 200px;
overflow: hidden;
}
.query-row > .query-content > .el-tag {
margin-bottom: 5px;
margin-top: 5px;
}
@media screen and (max-width: 992px) {
.query-row:nth-child(4) .query-content .el-col:not(:last-child) {
margin-bottom: 5px;
}
.query-title {
display: none;
}
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="选择年度"
type="year"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
@change="doSearch"
></el-date-picker>
</search-item>
<search-item label="活动状态:">
<el-radio-group v-model="pageForm.activityType" @change="doSearch">
<el-radio-button :label="1">全部</el-radio-button>
<el-radio-button :label="2">报名中</el-radio-button>
<el-radio-button :label="3">已结束</el-radio-button>
</el-radio-group>
</search-item>
</search>
</el-card>
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="选择年度"
type="year"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
@change="doSearch"
></el-date-picker>
</search-item>
<search-item label="活动状态:">
<el-select v-model="pageForm.activityType" @change="doSearch" style="width: 100%"
placeholder="请选择活动状态" filterable>
<el-option :value="1" label="全部"></el-option>
<el-option :value="4" label="即将开始"></el-option>
<el-option :value="2" label="报名中"></el-option>
<el-option :value="3" label="已结束"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
@@ -58,8 +106,9 @@ layout("/layouts/platform.html"){
<span>{{$moment(row.activityEndTime).format('MM/DD HH:mm')}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<el-table-column label="操作" width="300">
<template v-slot="{row}">
<el-button @click="onView(row)" size="mini" type="primary">查看介绍</el-button>
<el-button @click="onOpen(row)" size="mini" type="primary">去报名</el-button>
</template>
</el-table-column>
@@ -68,24 +117,50 @@ layout("/layouts/platform.html"){
</el-card>
<template #view>
<info ref="infoRef"></info>
<course-list ref="courseListRef"></course-list>
</template>
</guava>
<el-dialog title="详细信息" :visible.sync="infoVisible" width="60%" class="info-dialog">
<activity-info ref="infoRef"></activity-info>
<span slot="footer" class="dialog-footer">
<el-statistic
v-if="time < 0"
format="DD 天 HH 时 mm 分钟 ss 秒"
:value="new Date(infoRow.activitySignUpStartTime)"
time-indices
title="距离开始:"
@finish="time = 0"
>
</el-statistic>
<template v-else>
<el-button @click="infoVisible = false">取消</el-button>
<el-button type="primary" @click="onOpen(infoRow)" :disabled="time < 0">
去报名
</el-button>
</template>
</span>
</el-dialog>
</div>
<script>
<!--#include('info.js'){}#-->
<!--#include('courseList.js'){}#-->
<!--#include('../manage/info.js'){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"info": info,
"course-list": courseList,
"activity-info": info,
},
data() {
return {
pageForm: {
year: this.$moment().format("YYYY"),
activityType: "2"
activityType: 4
},
tableColumns: [
{ label: "活动名称", prop: "activityName", width: 600},
@@ -93,16 +168,32 @@ layout("/layouts/platform.html"){
{ label: "报名时间", prop: "activitySignUpStartTime"},
{ label: "活动时间", prop: "activityStartTime"},
],
time: 0,
infoRow: {},
infoVisible: false,
}
},
methods: {
onView(row) {
this.infoRow = row
this.time = this.$moment().diff(this.$moment(row.activitySignUpStartTime), 'milliseconds')
this.infoVisible = true
this.$nextTick(() => {
this.$refs.infoRef.initData(row.id)
})
},
onOpen(row) {
if(this.$moment().isBefore(this.$moment(row.activitySignUpStartTime))) {
this.onView(row)
return
}
this.infoVisible = false
this.$refs.guava.view(() => {
this.$refs.infoRef.onOpen(row)
this.$refs.courseListRef.onOpen(row)
})
},
pageData() {
this.$axios.post("/platform/family/manage/apply/activityData", this.pageForm).then((res) => {
this.$axios.post("/platform/family/apply/activityPageData", this.pageForm).then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
@@ -61,7 +61,7 @@ const signForm = {
style="display: flex; justify-content: space-between; align-items: center">
<div>家属信息</div>
<div>
<el-button type="primary" size="mini" @click="delFamily">
<el-button type="danger" size="mini" @click="delFamily">
删除家属
</el-button>
<el-button type="primary" size="mini" @click="addFamily">
@@ -76,28 +76,28 @@ const signForm = {
:name="index + ''"
:label="'家属' + (index + 1)"
:key="index">
<el-row>
<el-row class="mt20">
<el-col :span="24">
<el-form-item
v-for="(column, index) in item"
:label="column.columnName"
:key="column.columnCode"
:rules="{ required: column.isRequired,
v-for="(column, index) in item"
:label="column.columnName"
:key="column.columnCode"
:rules="{ required: column.isRequired,
message: (['SELECT', 'FILE'].includes(column.columnFormType) ? '请选择' : '请填写') + column.columnName,
trigger: 'blur'}"
>
<!--文本框-->
<template
v-if="!['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
v-if="!['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-input
v-model="column.columnValue"
:placeholder="'请填写' + column.columnName"
:type="['INT'].includes(column.columnType) ? 'number' : ''"
v-model="column.columnValue"
:placeholder="'请填写' + column.columnName"
:type="['INT'].includes(column.columnType) ? 'number' : ''"
></el-input>
</template>
<!--选择框-->
<template
v-else-if="['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
v-else-if="['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-select v-model="column.columnValue"
:placeholder="'请选择' + column.columnName"
style="width: 100%">
@@ -108,11 +108,11 @@ const signForm = {
<!--时间框-->
<template v-else-if="['DATE', 'DATETIME'].includes(column.columnType)">
<el-date-picker
style="width: 100%"
v-model="column.columnValue"
:type="column.columnType === 'DATE' ? 'date' : 'datetime'"
:placeholder="'请选择' + column.columnName"
:value-format="column.columnType === 'DATE' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss'"
style="width: 100%"
v-model="column.columnValue"
:type="column.columnType === 'DATE' ? 'date' : 'datetime'"
:placeholder="'请选择' + column.columnName"
:value-format="column.columnType === 'DATE' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss'"
></el-date-picker>
</template>
<!--文件-->
@@ -154,12 +154,14 @@ const signForm = {
courseTypeRow: {},
courseTimeSelectList: [],
active: '',
activity: {},
}
},
methods: {
addFamily() {
if(this.formData.mobileColumnsValue.length >= this.courseTypeRow.familyMaxCount) {
this.$message.warning('家属最多人数为' + this.courseTypeRow.familyMaxCount)
if(this.formData.mobileColumnsValue.length >= this.activity.familyMaxCount) {
this.$message.warning('家属最多人数为' + this.activity.familyMaxCount)
return
}
const list = clone(this.courseTypeRow.familyMobileSignColumnList)
@@ -170,53 +172,47 @@ const signForm = {
const ac = (Number(this.active) - 1)
this.active = '' + (ac >= 0 ? ac : 0)
},
validFamilyForm() {
for (let i = 0; i < this.formData.mobileColumnsValue.length; i++) {
const family = this.formData.mobileColumnsValue[i]
for (const familyColumn of family) {
if(familyColumn.isRequired && !familyColumn.columnValue) {
this.$message.error('家属' + (i + 1) + '的' + familyColumn.columnName + '不能为空')
return false
}
}
}
return true
},
async validSignUp() {
//获取家属是多少人
const res = await this.$axios.post("/platform/mobile/familyActivity/validateSignUp", {
const res = await this.$axios.post("/platform/family/apply/validateSignUp", {
courseId: this.formData.courseId,
currentFamilyNumber: this.formData.mobileColumnsValue.length || 0
})
if (res.code !== 0) {
this.$message.warning(res.msg)
this.$alert(res.msg, "提示", {
confirmButtonText: "确定",
type: "warning"
})
return false
}
return true
},
async validateSourceSignUp() {
if (this.courseRow.courseIsLimitApply) {
const resp = await $.post('/platform/mobile/familyActivity/validateSourceSignUp', {
const resp = await $.post('/platform/family/apply/validateSourceSignUp', {
activityCourseId: this.formData.activityCourseId,
courseId: this.courseRow.id
})
if (resp.code !== 0) {
this.$message.warning(resp.msg)
this.$alert(resp.msg, "提示", {
confirmButtonText: "确定",
type: "warning"
})
return false
}
}
return true
},
async getCourseTimeSelectList(o) {
const resp = await $.post('/platform/mobile/familyActivity/getCourseTimeSelectList', {courseId: o.id})
const resp = await $.post('/platform/family/apply/getCourseTimeSelectList', {courseId: o.id})
if (resp.code === 0) {
this.courseTimeSelectList = resp.data
} else {
this.$message.warning('获取时段信息失败,请联系管理员')
}
},
async onOpen(row, courseType) {
this.initData(row, courseType)
async onOpen(row, courseType, activity) {
this.initData(row, courseType, activity)
if (row.courseIsLimitApply) {
await this.getCourseTimeSelectList(row)
}
@@ -229,6 +225,135 @@ const signForm = {
this.courseTypeRow = courseType
this.signDialog = true
},
validateIdCard(idCard) {
if (!idCard) {
return false
}
// 18位身份证号码校验
if (idCard.length === 18) {
const idCardRegex = /^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/
if (!idCardRegex.test(idCard)) {
return false
}
// 校验码计算
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]
let sum = 0
for (let i = 0; i < 17; i++) {
sum += idCard[i] * weights[i]
}
const checksum = checksums[sum % 11]
return checksum === idCard[17].toUpperCase()
}
// 15位身份证号码校验
else if (idCard.length === 15) {
const idCardRegex = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/
return idCardRegex.test(idCard)
}
// 外国人或其他情况
else {
return false
}
},
validFamilyForm() {
// 校验规则映射
const validators = {
idCard: (value) => this.validateIdCard(value),
mobile: (value) => /^1[3-9]\d{9}$/.test(value),
email: (value) => /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value)
};
// 显示提示弹窗(直接传完整的 message)
const showAlert = (message) => {
this.$alert(message, "提示", {
confirmButtonText: "确定",
type: "warning"
})
};
const { mobileColumnsValue } = this.formData;
for (let i = 0; i < mobileColumnsValue.length; i++) {
const family = mobileColumnsValue[i];
for (const col of family) {
const value = col.columnValue?.trim(); // 安全处理空值和空格
// 必填校验
if (col.isRequired && !value) {
const message = this.activity.keyWord + (i + 1) + '的' + col.columnName + '不能为空';
showAlert(message);
return false;
}
// 格式校验
if (col.validRule && value) {
const validator = validators[col.validRule];
if (validator && !validator(value)) {
const message = this.activity.keyWord + (i + 1) + '的' + col.columnName + '格式不正确';
showAlert(message);
return false;
}
}
if(col.validRule === 'idCard' && this.courseRow.familyAgeLimit) {
const parseCard = this.parseIdCard(value)
if(this.courseRow.minAge && parseCard.age < this.courseRow.minAge) {
const message = '限制报名最小年龄为' + this.courseRow.minAge;
showAlert(message);
return false;
}
if(this.courseRow.maxAge && parseCard.age > this.courseRow.maxAge) {
const message = '限制报名最大年龄为' + this.courseRow.maxAge;
showAlert(message);
return false;
}
}
if(col.validRule === 'idCard' && this.courseRow.familySexLimit) {
const parseCard = this.parseIdCard(value)
if(this.courseRow.familySex && parseCard.sex !== this.courseRow.familySex) {
const message = '限制报名性别为' + this.courseRow.familySex;
showAlert(message);
return false;
}
}
}
}
return true;
},
parseIdCard(idCard) {
if (!idCard || (idCard.length !== 18 && idCard.length !== 15)) {
return null;
}
let birthStr = '';
let sexCode = '';
if (idCard.length === 15) {
birthStr = '19' + idCard.substring(6, 12);
sexCode = idCard.substring(14, 15); // 15位:第15位是性别
} else {
birthStr = idCard.substring(6, 14);
sexCode = idCard.substring(16, 17); // 18位:第17位是性别
}
const birthYear = parseInt(birthStr.substring(0, 4), 10);
const birthMonth = parseInt(birthStr.substring(4, 6), 10) - 1;
const birthDay = parseInt(birthStr.substring(6, 8), 10);
const birthDate = new Date(birthYear, birthMonth, birthDay);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
const sex = parseInt(sexCode, 10) % 2 === 1 ? '男' : '女';
return { age, sex, };
},
async onSubmit() {
//验证家属表单
if (!this.validFamilyForm()) return
@@ -241,8 +366,9 @@ const signForm = {
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
const formData = clone(this.formData)
let array = []
this.formData.mobileColumnsValue.forEach(item => {
formData.mobileColumnsValue.forEach(item => {
const o = item.map((v) => {
return {
columnName: v.columnName,
@@ -253,11 +379,14 @@ const signForm = {
})
array.push(o)
})
this.formData.mobileColumnsValue = JSON.stringify(clone(array))
const resp = await this.$axios.post("/platform/mobile/familyActivity/doSignUp", this.formData)
formData.mobileColumnsValue = JSON.stringify(clone(array))
const resp = await this.$axios.post("/platform/family/apply/doSignUp", formData)
if (resp.code === 0) {
this.$alert(resp.msg, "提示", {
confirmButtonText: "确定",
type: "warning"
})
this.signDialog = false
this.$message.success(resp.msg)
this.$emit('refresh')
} else {
this.$message.warning(resp.msg)
@@ -266,7 +395,8 @@ const signForm = {
}
})
},
initData(row, courseType) {
initData(row, courseType, activity) {
this.activity = activity
this.formData = {
activityId: row.activityId,
courseId: row.id,
@@ -284,7 +414,7 @@ const signForm = {
},
},
style: /*language=CSS*/ `
.el-tabs__header {
::v-deep .el-tabs__header {
margin: 0 0 15px !important;
}
`
@@ -41,28 +41,28 @@ const basicForm = {
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请选择活动时间', trigger: 'blur'}" label="活动时间" prop="activityTime">
<el-date-picker
:picker-options="pickerOptions"
end-placeholder="请选择活动结束日期"
range-separator="至"
start-placeholder="请选择活动开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activityTime"
value-format="yyyy-MM-dd HH:mm"
:picker-options="pickerOptions"
end-placeholder="请选择活动结束日期"
range-separator="至"
start-placeholder="请选择活动开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activityTime"
value-format="yyyy-MM-dd HH:mm"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请选择报名时间', trigger: 'blur'}" label="报名时间" prop="activitySignTime">
<el-date-picker
:disabled="false"
end-placeholder="请选择报名结束日期"
range-separator="至"
start-placeholder="请选择报名开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activitySignTime"
value-format="yyyy-MM-dd HH:mm"
:disabled="false"
end-placeholder="请选择报名结束日期"
range-separator="至"
start-placeholder="请选择报名开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activitySignTime"
value-format="yyyy-MM-dd HH:mm"
></el-date-picker>
</el-form-item>
</el-col>
@@ -73,18 +73,18 @@ const basicForm = {
<div style="display: flex; justify-content: space-between">
<div style="width: 99%">
<el-select
@change="changeActivity"
clearable
filterable
placeholder="请选择可报名人员范围"
style="width: 99%"
v-model="formData.activityGroupId"
@change="changeActivity"
clearable
filterable
placeholder="请选择可报名人员范围"
style="width: 99%"
v-model="formData.activityGroupId"
>
<el-option
:key="item.groupId"
:label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"
:key="item.groupId"
:label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"
></el-option>
</el-select>
</div>
@@ -102,29 +102,41 @@ const basicForm = {
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" type="flex">
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请输入关键词', trigger: 'blur'}" label="关键词" prop="keyWord">
<el-input maxlength="50" v-model="formData.keyWord" placeholder="请输入关键词"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请输入家属最多数', trigger: 'blur'}" label="家属最多数" prop="familyMaxCount">
<el-input maxlength="50" v-model="formData.familyMaxCount" placeholder="请输入家属最多数" type="number"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item :rules="{required:true,message: '请输入活动介绍', trigger: 'blur'}" label="活动介绍" prop="introduce">
<text-editor v-model="formData.introduce"></text-editor>
</el-form-item>
<el-form-item label="封面图片" prop="cover" :rules="{required:true,message: '请上传活动移动端封面图片', trigger: 'blur'}">
<el-col :span="12">
<file-upload
:upload_number="1"
:value.sync="formData.cover"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
:upload_number="1"
:value.sync="formData.cover"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
></file-upload>
</el-col>
<el-col :span="12">
<el-form-item label="微信群二维码" prop="wechat">
<file-upload
:upload_number="1"
:value.sync="formData.wechat"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
:upload_number="1"
:value.sync="formData.wechat"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
></file-upload>
</el-form-item>
</el-col>
@@ -141,17 +153,17 @@ const basicForm = {
<el-table-column label="序号" prop="orderNum" width="100px">
<template v-slot="{row}">
<el-input-number
v-model="row.orderNum"
@change="courseOrderNumChange"
:min="1"
:max="formData.courseList.length"
:step="1"
step-strictly
:precision="0"
controls-position="right"
style="width: 76px"
size="small"
label="序号"
v-model="row.orderNum"
@change="courseOrderNumChange"
:min="1"
:max="formData.courseList.length"
:step="1"
step-strictly
:precision="0"
controls-position="right"
style="width: 76px"
size="small"
label="序号"
></el-input-number>
</template>
</el-table-column>
@@ -173,32 +185,32 @@ const basicForm = {
<el-table-column :label="activityType + '人数'" prop="coursePeopleNumber" width="110px">
<template v-slot="{row}">
<el-input-number
:controls="false"
:max="9999"
size="small"
:min="0"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, null)"
v-model="row.coursePeopleNumber"
placeholder="请输入人数"
:controls="false"
:max="9999"
size="small"
:min="0"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, null)"
v-model="row.coursePeopleNumber"
placeholder="请输入人数"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="预留名额" prop="courseReservedNumber" width="110px">
<template v-slot="{row}">
<el-input-number
:controls="false"
:max="1000"
:min="0"
size="small"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, o)"
v-model="row.courseReservedNumber"
placeholder="请输入预留名额"
:controls="false"
:max="1000"
:min="0"
size="small"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, o)"
v-model="row.courseReservedNumber"
placeholder="请输入预留名额"
></el-input-number>
</template>
</el-table-column>
@@ -265,6 +277,13 @@ const basicForm = {
</div>
</div>
</el-form-item>
<div class="left-span-label" style="margin-top: 20px">判断家属数量唯一标识</div>
<el-form-item label="唯一标识" prop="onlyKey">
<el-select @focus="keyFocus" v-model="formData.onlyKey" placeholder="请选择唯一标识">
<el-option v-for="item in typeArray" :key="item.columnCode" :label="item.columnName" :value="item.columnCode"></el-option>
</el-select>
</el-form-item>
</div>
</el-form>
<div style="float: right; margin: 20px 0">
@@ -292,12 +311,12 @@ const basicForm = {
</el-row>
</el-dialog>
<drawer-user-scope
@group_change="getActivityGroup"
ref="drawerUserScope"
:group_id.sync="formData.activityGroupId">
<drawer-user-scope
@group_change="getActivityGroup"
ref="drawerUserScope"
:group_id.sync="formData.activityGroupId">
</drawer-user-scope>
<course-time ref="courseTimeRef"></course-time>
<custom-form ref="customFormRef"></custom-form>
</div>
@@ -310,7 +329,17 @@ const basicForm = {
formData: {
notice: false,
courseList: [
{ orderNum: 1, courseName: "", courseTimeList: [], isMobileSign: false, isReceiveGift: false, reserveMode: 1, courseIsLimitApply: false },
{
orderNum: 1,
courseName: "",
courseTimeList: [],
isMobileSign: false,
isReceiveGift: false,
reserveMode: 1,
courseIsLimitApply: false,
familyAgeLimit: false,
familySexLimit: false,
},
],
conditionStructure: {
method: "AND",
@@ -318,7 +347,8 @@ const basicForm = {
},
restrictLimit: 1,
limitNum: 1,
typeLimits: []
typeLimits: [],
keyWord: '家属'
},
historicalActList: [],
trainTypeList: [],
@@ -331,6 +361,8 @@ const basicForm = {
},
campusList: [],
courseTypeList: [],
typeArray: [],
}
},
components: {
@@ -339,6 +371,28 @@ const basicForm = {
"custom-form": customForm,
},
methods: {
keyFocus() {
const types = this.formData.courseList.filter(o => o.courseType !== undefined).map(o => o.courseType)
if(types.length === 0) {
this.$message.warning('请先设置' + this.activityType + '类型')
return
}
const typeList = this.courseTypeList.filter(o => types.includes(o.id))
let array = []
typeList.forEach(item => {
array = array.concat(item.familyMobileSignColumnList)
})
// 根据 columnCode 去重
const uniqueMap = new Map()
array.forEach(item => {
if (item.columnCode) {
uniqueMap.set(item.columnCode, item)
}
})
// 可选:保留没有 columnCode 的项
const withoutCode = array.filter(item => !item.columnCode)
this.typeArray = [...uniqueMap.values(), ...withoutCode]
},
async validNumber(row, old) {
if (GetQueryString("id") === "") {
if (row.courseReservedNumber > row.coursePeopleNumber && row.reserveMode === 1) {
@@ -371,7 +425,7 @@ const basicForm = {
}
},
async getRegisterUserCount(courseId) {
const resp = await this.$axios.post("/platform/family/manage/activity/getRegisterUserCount", { courseId })
const resp = await this.$axios.post("/platform/family/manage/getRegisterUserCount", { courseId })
return resp.code === 0 ? resp.data : 0
},
courseTypeChange(val, row) {
@@ -444,7 +498,7 @@ const basicForm = {
this.formData.courseList.push({ courseTimeList: [], isMobileSign: false, isReceiveGift: false, reserveMode: 1, courseIsLimitApply: false })
},
async historicalActChange(val) {
const resp = await this.$axios.post("/platform/family/manage/activity/findOne", {id: val})
const resp = await this.$axios.post("/platform/family/manage/findOne", {id: val})
if (resp.code === 0) {
this.formData = resp.data
this.typeChange(this.formData.trainType)
@@ -468,7 +522,7 @@ const basicForm = {
return data
},
async getHistoricalActList() {
const resp = await this.$axios.post("/platform/family/manage/activity/getHistoricalActList", {})
const resp = await this.$axios.post("/platform/family/manage/getHistoricalActList", {})
return resp.data
},
async onSave() {
@@ -508,6 +562,18 @@ const basicForm = {
this.$message.warning("第" + (i + 1) + "行签到方式填写有误,请核查")
return true
}
if(v.familyAgeLimit === true && !v.minAge) {
this.$message.warning("第" + (i + 1) + "行最小年龄不能为空,请核查")
return true
}
if(v.familyAgeLimit === true && !v.maxAge) {
this.$message.warning("第" + (i + 1) + "行最大年龄不能为空,请核查")
return true
}
if(v.familySexLimit === true && !v.familySex) {
this.$message.warning("第" + (i + 1) + "行性别不能为空,请核查")
return true
}
return false
})
if (courseValid) return
@@ -543,7 +609,7 @@ const basicForm = {
type: "warning"
})
if (confirm !== "confirm") return
const resp = await this.$axios.post("/platform/family/manage/activity/doHandle", cloneData)
const resp = await this.$axios.post("/platform/family/manage/doHandle", cloneData)
if (resp.code === 0) {
this.$message.success(resp.msg)
this.step = 1
@@ -554,15 +620,16 @@ const basicForm = {
}
},
async getAllType() {
const resp = await this.$axios.post("/platform/family/manage/type/getAllType", {})
const resp = await this.$axios.post("/platform/family/type/getAllType", {})
return resp.data
},
async init(row) {
if (row && row.id) {
const resp = await this.$axios.post("/platform/family/manage/activity/findOne", {id: row.id})
const resp = await this.$axios.post("/platform/family/manage/findOne", {id: row.id})
if (resp.code === 0) {
this.formData = resp.data
this.typeChange(this.formData.trainType)
if(this.formData.onlyKey) this.keyFocus()
}
}
},
@@ -588,6 +655,6 @@ const basicForm = {
},
},
style: /*language=CSS*/ `
`
}
@@ -50,6 +50,69 @@ const customForm = {
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否限制年龄</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].familyAgeLimit" size="small">
<el-radio border :label="true">限制</el-radio>
<el-radio border :label="false">不限制</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familyAgeLimit === true">
<el-col :span="4">
<span>最小年龄</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
step-strictly
placeholder="请输入最小年龄"
v-model="formData.courseList[moreInfoIndex].minAge"></el-input-number>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familyAgeLimit === true">
<el-col :span="4">
<span>最大年龄</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
step-strictly
placeholder="请输入最大年龄"
v-model="formData.courseList[moreInfoIndex].maxAge"></el-input-number>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否限制性别</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].familySexLimit" size="small">
<el-radio border :label="true">限制</el-radio>
<el-radio border :label="false">不限制</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familySexLimit === true">
<el-col :span="4">
<span>限制性别</span>
</el-col>
<el-col :span="20">
<el-select v-model="formData.courseList[moreInfoIndex].familySex" placeholder="请选择性别"
style="width: 100%" clearable>
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否签到</span>
@@ -132,7 +195,7 @@ const customForm = {
<span>候补数量</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" size="small" style="width: 100%"
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
@@ -140,6 +203,16 @@ const customForm = {
v-model="formData.courseList[moreInfoIndex].waitingNum"></el-input-number>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>详细信息</span>
</el-col>
<el-col :span="20">
<text-editor v-model="formData.courseList[moreInfoIndex].introduce"></text-editor>
</el-col>
</el-row>
<div style="text-align: right">
<el-button @click="moreInfoDrawer = false">取 消</el-button>
<el-button type="primary" @click="moreInfoDrawer = false">保 存</el-button>
@@ -195,17 +268,6 @@ const customForm = {
}
},
style: /*language=CSS*/ `
.my-drawer .el-col-4 {
text-align: right;
}
.my-drawer .el-row {
margin-bottom: 20px;
}
.el-drawer__body {
padding: 20px;
}
.el-row--flex {
align-items: center;
}
`
}
@@ -3,7 +3,18 @@ layout("/layouts/platform.html"){
#-->
<style>
.my-drawer .el-col-4 {
text-align: right;
}
.my-drawer .el-row {
margin-bottom: 20px;
}
.el-drawer__body {
padding: 20px;
}
.el-row--flex {
align-items: center;
}
</style>
<div id="app" v-cloak>
@@ -164,8 +175,7 @@ layout("/layouts/platform.html"){
})
},
openActivityCode(id) {
this.activityUrl = location.origin + "/platform/mobile/familyActivity/activityInfo?activityId="
+ id + '&isMySign=0'
this.activityUrl = location.origin + "/platform/family/apply/h5?id=" + id
this.codeDialogVisible = true
},
makeCode(row) {
@@ -11,6 +11,9 @@ const info = {
<el-descriptions-item label="活动结束时间">{{viewData.activityEndTime}}</el-descriptions-item>
<el-descriptions-item label="报名开始时间">{{viewData.activitySignUpStartTime}}</el-descriptions-item>
<el-descriptions-item label="报名结束时间">{{viewData.activitySignUpEndTime}}</el-descriptions-item>
<el-descriptions-item label="详细信息" :span="2">
<div v-html="viewData.introduce"></div>
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane :label="activityType + '信息'">
@@ -66,7 +69,7 @@ const info = {
},
methods: {
initData(id) {
this.$axios.post(loc() + "/findOne", { id: id })
this.$axios.post("/platform/family/manage/findOne", { id: id })
.then((resp) => {
if (resp.code === 0) {
this.viewData = resp.data
@@ -104,7 +107,7 @@ const info = {
},
},
style: /*language=CSS*/ `
.el-button--text {
::v-deep .el-button--text {
padding: 0;
}
`
@@ -66,8 +66,10 @@ const makeQrcode = {
this.courseDialog = true
},
makeCourseCode(row) {
const o = {courseId: row.id}
const content = jrQrcode.getQrBase64(JSON.stringify(o))
const url = '/platform/family/mine/drivingScan'
const data = url + '?courseId=' + row.id
console.log(data)
const content = jrQrcode.getQrBase64(data)
let image = new Image()
image.src = content
let viewer = new Viewer(image, {
@@ -150,7 +150,7 @@ const unionForm = {
!this.formData.courseList[this.unionLimitIndex].unionLimit ||
this.formData.courseList[this.unionLimitIndex].unionLimit.length === 0
) {
const resp = await this.$axios.get("/platform/family/manage/activity/getUnionLimit", {
const resp = await this.$axios.get("/platform/family/manage/getUnionLimit", {
activityScopeId: this.formData.activityGroupId
})
if (resp.code === 0) {
@@ -73,6 +73,16 @@ const basicForm = {
</template>
</el-table-column>
<el-table-column label="验证规则" prop="validRule">
<template v-slot="{row}">
<el-select v-model="row.validRule" style="width: 100%" filterable placeholder="请选择验证规则" clearable>
<el-option label="身份证" value="idCard"></el-option>
<el-option label="手机号" value="mobile"></el-option>
<el-option label="邮箱" value="email"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="控件类型" prop="columnFormType">
<template v-slot="{row, $index}">
<el-select
@@ -213,10 +213,10 @@ const userInfo = {
this.unitList = await this.$businessTool.listUnit(this.registerForm.unionId)
},
style: /*language=CSS*/ `
.adjustDialog .el-radio__label {
::v-deep .adjustDialog .el-radio__label {
display: none;
}
.adjustDialog .el-dialog__body {
::v-deep .adjustDialog .el-dialog__body {
max-height: 600px;
overflow-y: auto;
}
@@ -212,7 +212,7 @@ layout("/layouts/platform.html"){
await this.doSearch()
},
async getActivityList() {
const resp = await this.$axios.post("/platform/family/statistics/activity/activityList", { year: this.pageForm.year })
const resp = await this.$axios.post("/platform/family/statistics/activityList", { year: this.pageForm.year })
this.activityList = resp.data
if (this.activityList && this.activityList.length > 0) {
this.pageForm.activityId = this.activityList[0].id
@@ -69,7 +69,7 @@ const courseList = {
</template>
<template v-slot="{row}" v-else-if="column.prop=='introduce'">
<span v-if="!row.introduce">暂无</span>
<span v-if="!row.introduce?.trim()">暂无</span>
<el-button v-else style="padding: 0" @click="onPreview(row.introduce)" type="text">点击查看</el-button>
</template>
</el-table-column>
@@ -107,6 +107,13 @@ const courseList = {
<el-button @click="viewMapDialog = false">取 消</el-button>
</el-row>
</el-dialog>
<el-dialog :visible.sync="infoVisible" title="详细信息" append-to-body>
<div v-html="introduce"></div>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="infoVisible = false">取 消</el-button>
</el-row>
</el-dialog>
<apply-form ref="formRef" @refresh="doSearch"></apply-form>
</div>
@@ -128,29 +135,40 @@ const courseList = {
tableColumns: [
{ prop: "courseName", label: "名称" },
{ prop: "typeName", label: "类型", width: 130},
{ prop: "campus", label: "校区", width: 160 },
{ prop: "courseLocationCoordinates", label: "地点", width: 200 },
{ prop: "courseInstructor", label: "联系人", width: 100 },
{ prop: "introduce", label: "详细介绍", width: 100 },
{ prop: "courseTime", label: "时间", width: 200 },
{ prop: "courseTime", label: "时间", width: 160 },
{ prop: "introduce", label: "详细信息", width: 100 },
{ prop: "applyNum", label: "已报名人数", width: 200 }
],
activity: {},
courseTypeList: [],
trainType: '',
pdf: false,
infoVisible: false,
introduce: '',
}
},
methods: {
async onPreview(introduce) {
const parser = new DOMParser();
const doc = parser.parseFromString(introduce, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
try {
const parser = new DOMParser();
const doc = parser.parseFromString(introduce, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
const id = href.substring(href.indexOf("=") + 1)
const res = await this.$axios.post("/platform/sys/file/previewFileData", { ids: JSON.stringify([id]) })
const id = href.substring(href.indexOf("=") + 1)
const res = await this.$axios.post("/platform/sys/file/previewFileData", { ids: JSON.stringify([id]) })
window.open("/assets/platform/plugins/pdfJs/web/viewer.html?file=" + encodeURIComponent(res.data[0].downloadPath), res.data[0].name)
this.pdf = true
window.open("/assets/platform/plugins/pdfJs/web/viewer.html?file=" + encodeURIComponent(res.data[0].downloadPath), res.data[0].name)
} catch (e) {
this.introduce = introduce
this.pdf = false
this.infoVisible = true
}
},
tagClick(key, val) {
let idx = this.pageForm[key].indexOf(val)
@@ -76,22 +76,22 @@ layout("/layouts/platform.html"){
<activity-info ref="infoRef"></activity-info>
<el-statistic
v-if="time < 0"
format="DD 天 HH 时 mm 分钟 ss 秒"
:value="new Date(infoRow.activitySignUpStartTime)"
time-indices
title="距离开始:"
@finish="time = 0"
style="margin-top: 30px"
>
</el-statistic>
<span slot="footer" class="dialog-footer">
<el-button @click="infoVisible = false">取消</el-button>
<el-button type="primary" @click="onOpen(infoRow)" :disabled="time < 0">
去报名
</el-button>
<el-statistic
v-if="time < 0"
format="DD 天 HH 时 mm 分钟 ss 秒"
:value="new Date(infoRow.activitySignUpStartTime)"
time-indices
title="距离开始:"
@finish="time = 0"
>
</el-statistic>
<template v-else>
<el-button @click="infoVisible = false">取消</el-button>
<el-button type="primary" @click="onOpen(infoRow)" :disabled="time < 0">
去报名
</el-button>
</template>
</span>
</el-dialog>
@@ -111,7 +111,7 @@ layout("/layouts/platform.html"){
return {
pageForm: {
year: this.$moment().format("YYYY"),
activityType: 2
activityType: 4
},
tableColumns: [
{ label: "活动名称", prop: "activityName", width: 600},
@@ -132,7 +132,7 @@ const customForm = {
<span>候补数量</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" size="small" style="width: 100%"
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
@@ -3,18 +3,7 @@ layout("/layouts/platform.html"){
#-->
<style>
.my-drawer .el-col-4 {
text-align: right;
}
.my-drawer .el-row {
margin-bottom: 20px;
}
.el-drawer__body {
padding: 20px;
}
.el-row--flex {
align-items: center;
}
</style>
<div id="app" v-cloak>