This commit is contained in:
@jyuhsin
2025-09-05 18:01:54 +08:00
parent 91be38bb52
commit 267dcfa738
7 changed files with 194 additions and 132 deletions
@@ -0,0 +1,50 @@
// 劫持 validate:失败时先提示 + 滚动,再抛出异常(保持原有行为)
if (typeof Vue !== 'undefined') {
Vue.mixin({
mounted() {
this.$nextTick(() => {
const formRefs = Object.keys(this.$refs).filter(ref => {
const comp = this.$refs[ref];
return comp &&
comp.$options &&
comp.$options._componentTag === 'van-form';
});
formRefs.forEach(refName => {
const form = this.$refs[refName];
if (!form || form._validatedEnhanced) return;
const originalValidate = form.validate;
form.validate = function () {
// 保留原 validate 的返回值(Promise
const promise = originalValidate.call(this);
return promise.catch(errorInfo => {
if (errorInfo?.length > 0) {
const firstError = errorInfo[0];
if(firstError.message) {
Vue.prototype.$toast?.fail(firstError.message);
} else {
const fieldName = firstError.name;
// 滚动到字段
this.scrollToField(fieldName);
// 获取 label
const field = this.fields?.find(f => f.name === fieldName);
const label = field?.label;
// 提示用户
Vue.prototype.$toast?.fail(`${label} 必填`);
}
}
return new Promise(() => {});
});
};
form._validatedEnhanced = true;
});
});
}
});
}
@@ -44,6 +44,7 @@
<script src="${base!}/assets/platform/js/main.js"></script>
<script src="${base!}/assets/platform/js/mixin/styleMixin.js"></script>
<script src="${base!}/assets/platform/js/tool/businessTool.js"></script>
<script src="${base!}/assets/platform/js/util/h5AutoShowError.js"></script>
<!--富文本编辑器-->
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wangEditor4/wangEditor.css"/>
@@ -195,14 +195,16 @@ layout("/layouts/platform.html"){
this.$message.warning("请先阅读并同意协议")
return
}
this.$axios.post('/platform/club/join/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
location.href = '/platform/club/join/mine'
}
this.$confirm("您确定要提交申请吗?", "提示", { type: "warning" }).then(() => {
this.$axios.post('/platform/club/join/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
location.href = '/platform/club/join/mine'
}
})
})
}
})
@@ -92,7 +92,7 @@ layout("/layouts/platform.html"){
})
},
onEdit(row) {
location.href = '/platform/club/join/apply?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id
location.href = '/platform/club/join/apply?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id + '&clubId=' + row.clubId
},
onDelete(id) {
this.$confirm("确定要删除此申请吗?", "提示", {
@@ -8,6 +8,7 @@ layout("/layouts/platform_h5.html"){
height: 100vh;
overflow-y: auto;
}
/* 同意条款样式 */
.agree-section {
padding: 16px;
@@ -15,6 +16,7 @@ layout("/layouts/platform_h5.html"){
border-radius: 12px;
margin-top: 16px;
}
.agree-section .van-checkbox__label {
font-size: 13px;
line-height: 1.5;
@@ -27,38 +29,40 @@ layout("/layouts/platform_h5.html"){
<van-nav-bar title="文体协会会员申请" left-text="返回" left-arrow @click-left="historyBack"></van-nav-bar>
<!-- 表单容器 -->
<van-form ref="formRef" class="form-container">
<van-form ref="formRef" class="form-container" :show-error-message="false">
<!-- 协会信息 -->
<van-cell-group title="协会信息" class="form-section">
<van-field
:rules="[{ required: true }]"
v-model="formData.clubName"
label="协会"
placeholder="请选择协会"
required
is-link
readonly
name="clubName"
@click="showClubPopup = true"
:rules="[{ required: true }]"
v-model="formData.clubName"
label="协会"
placeholder="请选择协会"
required
is-link
readonly
name="clubName"
@click="showClubPopup = true"
></van-field>
<van-popup v-model:show="showClubPopup" position="bottom">
<van-picker
show-toolbar
:columns="clubOptions.map(i => i.clubName)"
@confirm="onClubConfirm"
@cancel="showClubPopup = false"
class="picker-style"
show-toolbar
:columns="clubOptions.map(i => i.clubName)"
@confirm="onClubConfirm"
@cancel="showClubPopup = false"
class="picker-style"
></van-picker>
</van-popup>
</van-cell-group>
<!-- 基本信息 -->
<van-cell-group title="基本信息" class="form-section">
<van-field label="姓名" :rules="[{ required: true }]" v-model="formData.userName" readonly required></van-field>
<van-field label="工号" :rules="[{ required: true }]" v-model="formData.loginName" readonly required></van-field>
<van-field label="姓名" :rules="[{ required: true }]" v-model="formData.userName" readonly
required name="userName"></van-field>
<van-field label="工号" :rules="[{ required: true }]" v-model="formData.loginName" readonly
required name="loginName"></van-field>
<van-field label="性别" :rules="[{ required: true }]" v-model="formData.sex" readonly required></van-field>
<van-field label="出生年月" v-model="formData.birthday" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="联系电话" v-model="formData.mobile" placeholder="请输入联系电话"></van-field>
<van-field label="联系电话" :rules="[{ required: true }]" name="mobile" name="mobile" v-model="formData.mobile" placeholder="请输入联系电话"></van-field>
<van-field label="电子信箱" v-model="formData.email" placeholder="请输入电子信箱"></van-field>
</van-cell-group>
@@ -66,31 +70,34 @@ layout("/layouts/platform_h5.html"){
<van-cell-group title="工作信息" class="form-section">
<van-field label="分工会" v-model="formData.unionName" readonly></van-field>
<van-field label="单位" v-model="formData.unitName" readonly></van-field>
<van-field label="职务" v-model="formData.governmentPosition" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="职称" v-model="formData.technicalTitle" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="职务" v-model="formData.governmentPosition" readonly
placeholder="读取信息中心数据"></van-field>
<van-field label="职称" v-model="formData.technicalTitle" readonly
placeholder="读取信息中心数据"></van-field>
<van-field label="学历" v-model="formData.education" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="学位" v-model="formData.academicDegree" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="学位" v-model="formData.academicDegree" readonly
placeholder="读取信息中心数据"></van-field>
</van-cell-group>
<!-- 其他信息 -->
<van-cell-group title="其他信息" class="form-section">
<van-field
class="more-text"
v-model="formData.sameTimeJoinOtherClubSituation"
label="同时参加其他协会情况"
type="textarea"
rows="4"
autosize
placeholder="请填写同时参加其他协会情况"
class="direction-column-field"
v-model="formData.sameTimeJoinOtherClubSituation"
label="同时参加其他协会情况"
type="textarea"
rows="4"
autosize
placeholder="请填写同时参加其他协会情况"
></van-field>
<van-field
class="more-text"
v-model="formData.awardsExperience"
label="文化、体育方面的活动经历、获奖情况"
type="textarea"
rows="4"
autosize
placeholder="请填写相关经历及获奖情况"
class="direction-column-field"
v-model="formData.awardsExperience"
label="文化、体育方面的活动经历、获奖情况"
type="textarea"
rows="4"
autosize
placeholder="请填写相关经历及获奖情况"
></van-field>
</van-cell-group>
@@ -99,13 +106,13 @@ layout("/layouts/platform_h5.html"){
<van-field class="more-text" name="avatar" label="">
<template #input>
<h5-file-upload
slot="input"
:value.sync="formData.avatar"
:upload_number="1"
upload_mode="image"
upload_result_category="interval"
upload_result_type="url"
complete_result
slot="input"
:value.sync="formData.avatar"
:upload_number="1"
upload_mode="image"
upload_result_category="interval"
upload_result_type="url"
complete_result
></h5-file-upload>
</template>
</van-field>
@@ -128,10 +135,10 @@ layout("/layouts/platform_h5.html"){
</van-cell-group>
<!-- 提交按钮 -->
<div class="submit-many-btn">
<van-button native-type="button" @click="onSave" round type="info">保存申请</van-button>
<van-button native-type="submit" @click="onSubmit" round type="info" v-if="!taskId">提交申请</van-button>
<van-button native-type="submit" @click="onFinishTask" round type="info" v-else>提交申请</van-button>
<div class="form-actions">
<van-button @click="onSave" round type="info">保存申请</van-button>
<van-button @click="onSubmit" round type="info" v-if="!taskId">提交申请</van-button>
<van-button @click="onFinishTask" round type="info" v-else>提交申请</van-button>
</div>
</van-form>
</div>
@@ -176,74 +183,77 @@ layout("/layouts/platform_h5.html"){
title: "提示",
message: "您确定保存吗?"
}).then(() => {
this.$axios.post('/platform/club/join/apply/save', {data: JSON.stringify(this.formData)}).then(res => {
this.$axios.post("/platform/club/join/apply/save", { data: JSON.stringify(this.formData) }).then(res => {
if (res.code === 0) {
this.$toast(res.msg);
this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
})
})
},
async onSubmit() {
if (!this.isAgree) {
this.$toast.fail("请先阅读并同意协议");
return;
}
await this.$refs.formRef.validate()
if (!this.isAgree) {
this.$message.warning("请先阅读并同意协议")
return
}
this.$dialog.confirm({
title: "提示",
message: "您确定要提交申请吗?"
}).then(() => {
this.$axios.post("/platform/club/join/apply/submit", this.formData).then(res => {
if (res.code === 0) {
this.$toast(res.msg);
this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
});
});
})
})
},
onFinishTask() {
this.$refs.formRef.validate((valid) => {
if (valid) {
if (!this.isAgree) {
this.$message.warning("请先阅读并同意协议")
return
}
this.$axios.post('/platform/club/join/apply/submitAgain', {
async onFinishTask() {
this.$refs.formRef.validate().then(() => {
if (!this.isAgree) {
this.$message.warning("请先阅读并同意协议")
return
}
this.$dialog.confirm({
title: "提示",
message: "您确定要提交申请吗?"
}).then(() => {
this.$axios.post("/platform/club/join/apply/submitAgain", {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
this.$toast(res.msg);
this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
})
}
})
})
}).catch()
},
checkApplyClub(clubId) {
this.$axios.post("/platform/club/join/apply/checkApplyClub", { clubId }).then(res => {
if (res.code === 0 && res.data) {
this.$toast.warning("您已申请加入该协会,请勿重复申请");
this.formData.clubId = "";
this.formData.clubName = "";
this.$toast.warning("您已申请加入该协会,请勿重复申请")
this.formData.clubId = ""
this.formData.clubName = ""
}
});
})
},
onClubConfirm(value, index) {
this.formData.clubId = this.clubOptions[index].id;
this.formData.clubName = value;
this.showClubPopup = false;
this.formData.clubId = this.clubOptions[index].id
this.formData.clubName = value
this.showClubPopup = false
// 检查是否已申请该协会
this.checkApplyClub(this.formData.clubId);
this.checkApplyClub(this.formData.clubId)
},
listClub() {
this.$axios.post("/platform/club/common/listClub").then(res => {
if (res.code === 0) {
this.clubOptions = res.data;
this.clubOptions = res.data
}
});
})
},
init() {
this.bizId = GetQueryString("bizId")
@@ -275,11 +285,11 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "position", user.position)
this.$set(this.formData, "academicDegree", user.academicDegree)
}
},
}
},
created() {
this.listClub();
this.init();
this.listClub()
this.init()
}
})
</script>
@@ -2,13 +2,8 @@ const clubUserJoin = {
template:
/*language=HTML*/
`
<div>
<van-cell-group>
<van-cell>
<div slot="title" class="font-size4 bold">
申请信息
</div>
</van-cell>
<div class="form-container">
<van-cell-group title="申请信息" class="form-section">
<van-cell title="姓名">{{ viewData.userName }}</van-cell>
<van-cell title="工号">{{ viewData.loginName }}</van-cell>
<van-cell title="性别">{{ viewData.sex }}</van-cell>
@@ -21,9 +16,9 @@ const clubUserJoin = {
<van-cell title="职称">{{ viewData.technicalTitle }}</van-cell>
<van-cell title="学历">{{ viewData.education }}</van-cell>
<van-cell title="学位">{{ viewData.academicDegree }}</van-cell>
<van-cell class="more-text" title="同时参加其他协会情况">{{ viewData.sameTimeJoinOtherClubSituation }}</van-cell>
<van-cell class="more-text" title="文化、体育方面的活动经历、获奖情况">{{ viewData.awardsExperience }}</van-cell>
<van-cell class="more-text" title="照片" v-if="viewData.avatar">
<van-cell class="direction-column-field" title="同时参加其他协会情况">{{ viewData.sameTimeJoinOtherClubSituation }}</van-cell>
<van-cell class="direction-column-field" title="文化、体育方面的活动经历、获奖情况">{{ viewData.awardsExperience }}</van-cell>
<van-cell class="direction-column-field" title="照片" v-if="viewData.avatar">
<template slot="default">
<van-image :src="viewData.avatar"></van-image>
</template>
@@ -48,14 +43,6 @@ const clubUserJoin = {
}
},
style: /*language=CSS*/ `
.more-text .van-field__label{
width: 100%;
}
.more-text {
display: inline-block;
}
.more-text .van-cell__value{
text-align: left;
}
`
`
}
@@ -9,38 +9,49 @@ layout("/layouts/platform_h5.html"){
</style>
<div id="app">
<van-sticky>
<van-nav-bar title="我的申请" left-text="返回" left-arrow @click-left="historyBack"></van-nav-bar>
<van-nav-bar title="我的申请" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<div>
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了" @load="pageData">
<van-list v-if="tableData.length>0" v-model="tableLoading" :finished="tableFinished" finished-text="没有更多了"
@load="pageData">
<div class="list-card" v-for="row in tableData" :key="row.id">
<div class="list-card-body">
<van-cell title="姓名" :value="row.userName"></van-cell>
<van-cell title="工号" :value="row.loginName"></van-cell>
<van-cell title="协会名称" :value="row.clubName"></van-cell>
<van-cell title="申请模式" :value="row.mode ? '加入' : '退出'"></van-cell>
<van-cell title="申请时间" :value="row.applyDate"></van-cell>
<van-cell title="当前节点" :value="row.taskName"></van-cell>
<van-cell title="流程状态">
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum" mode="h5" label_key="message" size="small"></enum-tag>
</van-cell>
<div class="list-card-body-content">
<van-cell title="姓名" :value="row.userName"></van-cell>
<van-cell title="工号" :value="row.loginName"></van-cell>
<van-cell title="协会名称" :value="row.clubName"></van-cell>
<van-cell title="申请模式" :value="row.mode ? '加入' : '退出'"></van-cell>
<van-cell title="申请时间" :value="row.applyDate"></van-cell>
<van-cell title="当前节点" :value="row.taskName"></van-cell>
<van-cell title="流程状态">
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum"
label_key="message" size="small"></enum-tag>
</van-cell>
</div>
</div>
<div class="list-card-footer">
<van-button type="info" size="small" @click="openView(row)">查看</van-button>
<van-button type="info" v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)" size="small">编辑</van-button>
<van-button type="danger" v-if="row.canRevoke" @click="openRevoke(row)" size="small">撤销</van-button>
<van-button type="danger" v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" size="small" >
<van-button type="info" v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)"
size="small">编辑
</van-button>
<van-button type="danger" v-if="row.canRevoke" @click="onRevoke(row)" size="small">撤销
</van-button>
<van-button type="danger" v-if="row.taskKey === 'startTask' || !row.instanceId"
@click="onDelete(row.id)" size="small">
删除
</van-button>
</div>
</div>
</van-list>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据"></van-empty>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png"
description="暂无数据"></van-empty>
</div>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom v-model="viewShow">
@@ -69,11 +80,11 @@ layout("/layouts/platform_h5.html"){
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: "",
year: ""
},
tableLoading: false,
tableFinished: false,
tableData: [],
tableData: []
}
},
methods: {
@@ -84,11 +95,11 @@ layout("/layouts/platform_h5.html"){
}).then(() => {
this.$axios.post("/flow/common/revokeTask", { taskId: row.startTaskId }).then((res) => {
if (res.code === 0) {
this.$toast(res.msg);
this.pageData()
this.$toast(res.msg)
this.doSearch()
}
});
});
})
})
},
openView(row) {
this.viewShow = true
@@ -97,7 +108,7 @@ layout("/layouts/platform_h5.html"){
})
},
onEdit(row) {
this.$pjaxReplace('/platform/h5/club/apply?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id)
this.$pjaxReplace("/platform/h5/club/apply?taskId=" + (row.startTaskId || "") + "&bizId=" + row.id + "&clubId=" + row.clubId)
},
onDelete(row) {
this.$dialog.confirm({
@@ -114,7 +125,8 @@ layout("/layouts/platform_h5.html"){
}
})
})
.catch(() => {})
.catch(() => {
})
},
doSearch() {
this.pageForm.pageNumber = 1