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/main.js"></script>
<script src="${base!}/assets/platform/js/mixin/styleMixin.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/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"/> <link rel="stylesheet" href="${base!}/assets/platform/plugins/wangEditor4/wangEditor.css"/>
@@ -195,14 +195,16 @@ layout("/layouts/platform.html"){
this.$message.warning("请先阅读并同意协议") this.$message.warning("请先阅读并同意协议")
return return
} }
this.$axios.post('/platform/club/join/apply/submitAgain', { this.$confirm("您确定要提交申请吗?", "提示", { type: "warning" }).then(() => {
data: JSON.stringify(this.formData), this.$axios.post('/platform/club/join/apply/submitAgain', {
taskId: GetQueryString("taskId") data: JSON.stringify(this.formData),
}).then(res => { taskId: GetQueryString("taskId")
if (res.code === 0) { }).then(res => {
this.$message.success(res.msg) if (res.code === 0) {
location.href = '/platform/club/join/mine' this.$message.success(res.msg)
} location.href = '/platform/club/join/mine'
}
})
}) })
} }
}) })
@@ -92,7 +92,7 @@ layout("/layouts/platform.html"){
}) })
}, },
onEdit(row) { 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) { onDelete(id) {
this.$confirm("确定要删除此申请吗?", "提示", { this.$confirm("确定要删除此申请吗?", "提示", {
@@ -8,6 +8,7 @@ layout("/layouts/platform_h5.html"){
height: 100vh; height: 100vh;
overflow-y: auto; overflow-y: auto;
} }
/* 同意条款样式 */ /* 同意条款样式 */
.agree-section { .agree-section {
padding: 16px; padding: 16px;
@@ -15,6 +16,7 @@ layout("/layouts/platform_h5.html"){
border-radius: 12px; border-radius: 12px;
margin-top: 16px; margin-top: 16px;
} }
.agree-section .van-checkbox__label { .agree-section .van-checkbox__label {
font-size: 13px; font-size: 13px;
line-height: 1.5; 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-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-cell-group title="协会信息" class="form-section">
<van-field <van-field
:rules="[{ required: true }]" :rules="[{ required: true }]"
v-model="formData.clubName" v-model="formData.clubName"
label="协会" label="协会"
placeholder="请选择协会" placeholder="请选择协会"
required required
is-link is-link
readonly readonly
name="clubName" name="clubName"
@click="showClubPopup = true" @click="showClubPopup = true"
></van-field> ></van-field>
<van-popup v-model:show="showClubPopup" position="bottom"> <van-popup v-model:show="showClubPopup" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="clubOptions.map(i => i.clubName)" :columns="clubOptions.map(i => i.clubName)"
@confirm="onClubConfirm" @confirm="onClubConfirm"
@cancel="showClubPopup = false" @cancel="showClubPopup = false"
class="picker-style" class="picker-style"
></van-picker> ></van-picker>
</van-popup> </van-popup>
</van-cell-group> </van-cell-group>
<!-- 基本信息 --> <!-- 基本信息 -->
<van-cell-group title="基本信息" class="form-section"> <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.userName" readonly
<van-field label="工号" :rules="[{ required: true }]" v-model="formData.loginName" readonly required></van-field> 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="性别" :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.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-field label="电子信箱" v-model="formData.email" placeholder="请输入电子信箱"></van-field>
</van-cell-group> </van-cell-group>
@@ -66,31 +70,34 @@ layout("/layouts/platform_h5.html"){
<van-cell-group title="工作信息" class="form-section"> <van-cell-group title="工作信息" class="form-section">
<van-field label="分工会" v-model="formData.unionName" readonly></van-field> <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.unitName" readonly></van-field>
<van-field label="职务" v-model="formData.governmentPosition" readonly placeholder="读取信息中心数据"></van-field> <van-field label="职务" v-model="formData.governmentPosition" readonly
<van-field label="职称" v-model="formData.technicalTitle" readonly placeholder="读取信息中心数据"></van-field> 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.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>
<!-- 其他信息 --> <!-- 其他信息 -->
<van-cell-group title="其他信息" class="form-section"> <van-cell-group title="其他信息" class="form-section">
<van-field <van-field
class="more-text" class="direction-column-field"
v-model="formData.sameTimeJoinOtherClubSituation" v-model="formData.sameTimeJoinOtherClubSituation"
label="同时参加其他协会情况" label="同时参加其他协会情况"
type="textarea" type="textarea"
rows="4" rows="4"
autosize autosize
placeholder="请填写同时参加其他协会情况" placeholder="请填写同时参加其他协会情况"
></van-field> ></van-field>
<van-field <van-field
class="more-text" class="direction-column-field"
v-model="formData.awardsExperience" v-model="formData.awardsExperience"
label="文化、体育方面的活动经历、获奖情况" label="文化、体育方面的活动经历、获奖情况"
type="textarea" type="textarea"
rows="4" rows="4"
autosize autosize
placeholder="请填写相关经历及获奖情况" placeholder="请填写相关经历及获奖情况"
></van-field> ></van-field>
</van-cell-group> </van-cell-group>
@@ -99,13 +106,13 @@ layout("/layouts/platform_h5.html"){
<van-field class="more-text" name="avatar" label=""> <van-field class="more-text" name="avatar" label="">
<template #input> <template #input>
<h5-file-upload <h5-file-upload
slot="input" slot="input"
:value.sync="formData.avatar" :value.sync="formData.avatar"
:upload_number="1" :upload_number="1"
upload_mode="image" upload_mode="image"
upload_result_category="interval" upload_result_category="interval"
upload_result_type="url" upload_result_type="url"
complete_result complete_result
></h5-file-upload> ></h5-file-upload>
</template> </template>
</van-field> </van-field>
@@ -128,10 +135,10 @@ layout("/layouts/platform_h5.html"){
</van-cell-group> </van-cell-group>
<!-- 提交按钮 --> <!-- 提交按钮 -->
<div class="submit-many-btn"> <div class="form-actions">
<van-button native-type="button" @click="onSave" round type="info">保存申请</van-button> <van-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 @click="onSubmit" round type="info" v-if="!taskId">提交申请</van-button>
<van-button native-type="submit" @click="onFinishTask" round type="info" v-else>提交申请</van-button> <van-button @click="onFinishTask" round type="info" v-else>提交申请</van-button>
</div> </div>
</van-form> </van-form>
</div> </div>
@@ -176,74 +183,77 @@ layout("/layouts/platform_h5.html"){
title: "提示", title: "提示",
message: "您确定保存吗?" message: "您确定保存吗?"
}).then(() => { }).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) { if (res.code === 0) {
this.$toast(res.msg); this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine") this.$pjaxReplace("/platform/h5/club/mine")
} }
}) })
}) })
}, },
async onSubmit() { async onSubmit() {
if (!this.isAgree) {
this.$toast.fail("请先阅读并同意协议");
return;
}
await this.$refs.formRef.validate() await this.$refs.formRef.validate()
if (!this.isAgree) {
this.$message.warning("请先阅读并同意协议")
return
}
this.$dialog.confirm({ this.$dialog.confirm({
title: "提示", title: "提示",
message: "您确定要提交申请吗?" message: "您确定要提交申请吗?"
}).then(() => { }).then(() => {
this.$axios.post("/platform/club/join/apply/submit", this.formData).then(res => { this.$axios.post("/platform/club/join/apply/submit", this.formData).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$toast(res.msg); this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine") this.$pjaxReplace("/platform/h5/club/mine")
} }
}); })
}); })
}, },
onFinishTask() { async onFinishTask() {
this.$refs.formRef.validate((valid) => { this.$refs.formRef.validate().then(() => {
if (valid) { if (!this.isAgree) {
if (!this.isAgree) { this.$message.warning("请先阅读并同意协议")
this.$message.warning("请先阅读并同意协议") return
return }
} this.$dialog.confirm({
this.$axios.post('/platform/club/join/apply/submitAgain', { title: "提示",
message: "您确定要提交申请吗?"
}).then(() => {
this.$axios.post("/platform/club/join/apply/submitAgain", {
data: JSON.stringify(this.formData), data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId") taskId: GetQueryString("taskId")
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$toast(res.msg); this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine") this.$pjaxReplace("/platform/h5/club/mine")
} }
}) })
} })
}) }).catch()
}, },
checkApplyClub(clubId) { checkApplyClub(clubId) {
this.$axios.post("/platform/club/join/apply/checkApplyClub", { clubId }).then(res => { this.$axios.post("/platform/club/join/apply/checkApplyClub", { clubId }).then(res => {
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
this.$toast.warning("您已申请加入该协会,请勿重复申请"); this.$toast.warning("您已申请加入该协会,请勿重复申请")
this.formData.clubId = ""; this.formData.clubId = ""
this.formData.clubName = ""; this.formData.clubName = ""
} }
}); })
}, },
onClubConfirm(value, index) { onClubConfirm(value, index) {
this.formData.clubId = this.clubOptions[index].id; this.formData.clubId = this.clubOptions[index].id
this.formData.clubName = value; this.formData.clubName = value
this.showClubPopup = false; this.showClubPopup = false
// 检查是否已申请该协会 // 检查是否已申请该协会
this.checkApplyClub(this.formData.clubId); this.checkApplyClub(this.formData.clubId)
}, },
listClub() { listClub() {
this.$axios.post("/platform/club/common/listClub").then(res => { this.$axios.post("/platform/club/common/listClub").then(res => {
if (res.code === 0) { if (res.code === 0) {
this.clubOptions = res.data; this.clubOptions = res.data
} }
}); })
}, },
init() { init() {
this.bizId = GetQueryString("bizId") this.bizId = GetQueryString("bizId")
@@ -275,11 +285,11 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "position", user.position) this.$set(this.formData, "position", user.position)
this.$set(this.formData, "academicDegree", user.academicDegree) this.$set(this.formData, "academicDegree", user.academicDegree)
} }
}, }
}, },
created() { created() {
this.listClub(); this.listClub()
this.init(); this.init()
} }
}) })
</script> </script>
@@ -2,13 +2,8 @@ const clubUserJoin = {
template: template:
/*language=HTML*/ /*language=HTML*/
` `
<div> <div class="form-container">
<van-cell-group> <van-cell-group title="申请信息" class="form-section">
<van-cell>
<div slot="title" class="font-size4 bold">
申请信息
</div>
</van-cell>
<van-cell title="姓名">{{ viewData.userName }}</van-cell> <van-cell title="姓名">{{ viewData.userName }}</van-cell>
<van-cell title="工号">{{ viewData.loginName }}</van-cell> <van-cell title="工号">{{ viewData.loginName }}</van-cell>
<van-cell title="性别">{{ viewData.sex }}</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.technicalTitle }}</van-cell>
<van-cell title="学历">{{ viewData.education }}</van-cell> <van-cell title="学历">{{ viewData.education }}</van-cell>
<van-cell title="学位">{{ viewData.academicDegree }}</van-cell> <van-cell title="学位">{{ viewData.academicDegree }}</van-cell>
<van-cell class="more-text" title="同时参加其他协会情况">{{ viewData.sameTimeJoinOtherClubSituation }}</van-cell> <van-cell class="direction-column-field" title="同时参加其他协会情况">{{ viewData.sameTimeJoinOtherClubSituation }}</van-cell>
<van-cell class="more-text" title="文化、体育方面的活动经历、获奖情况">{{ viewData.awardsExperience }}</van-cell> <van-cell class="direction-column-field" title="文化、体育方面的活动经历、获奖情况">{{ viewData.awardsExperience }}</van-cell>
<van-cell class="more-text" title="照片" v-if="viewData.avatar"> <van-cell class="direction-column-field" title="照片" v-if="viewData.avatar">
<template slot="default"> <template slot="default">
<van-image :src="viewData.avatar"></van-image> <van-image :src="viewData.avatar"></van-image>
</template> </template>
@@ -48,14 +43,6 @@ const clubUserJoin = {
} }
}, },
style: /*language=CSS*/ ` 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> </style>
<div id="app"> <div id="app">
<van-sticky> <van-nav-bar title="我的申请" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-nav-bar title="我的申请" left-text="返回" left-arrow @click-left="historyBack"></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false"> <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-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu> </van-dropdown-menu>
</van-sticky> </van-sticky>
<div> <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" v-for="row in tableData" :key="row.id">
<div class="list-card-body"> <div class="list-card-body">
<van-cell title="姓名" :value="row.userName"></van-cell> <div class="list-card-body-content">
<van-cell title="工号" :value="row.loginName"></van-cell> <van-cell title="姓名" :value="row.userName"></van-cell>
<van-cell title="协会名称" :value="row.clubName"></van-cell> <van-cell title="工号" :value="row.loginName"></van-cell>
<van-cell title="申请模式" :value="row.mode ? '加入' : '退出'"></van-cell> <van-cell title="协会名称" :value="row.clubName"></van-cell>
<van-cell title="申请时间" :value="row.applyDate"></van-cell> <van-cell title="申请模式" :value="row.mode ? '加入' : '退出'"></van-cell>
<van-cell title="当前节点" :value="row.taskName"></van-cell> <van-cell title="申请时间" :value="row.applyDate"></van-cell>
<van-cell title="流程状态"> <van-cell title="当前节点" :value="row.taskName"></van-cell>
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum" mode="h5" label_key="message" size="small"></enum-tag> <van-cell title="流程状态">
</van-cell> <enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum"
label_key="message" size="small"></enum-tag>
</van-cell>
</div>
</div> </div>
<div class="list-card-footer"> <div class="list-card-footer">
<van-button type="info" size="small" @click="openView(row)">查看</van-button> <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="info" v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)"
<van-button type="danger" v-if="row.canRevoke" @click="openRevoke(row)" size="small">撤销</van-button> size="small">编辑
<van-button type="danger" v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" 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> </van-button>
</div> </div>
</div> </div>
</van-list> </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> </div>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom v-model="viewShow"> <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, pageNumber: 1,
pageSize: 10, pageSize: 10,
totalCount: 0, totalCount: 0,
year: "", year: ""
}, },
tableLoading: false, tableLoading: false,
tableFinished: false, tableFinished: false,
tableData: [], tableData: []
} }
}, },
methods: { methods: {
@@ -84,11 +95,11 @@ layout("/layouts/platform_h5.html"){
}).then(() => { }).then(() => {
this.$axios.post("/flow/common/revokeTask", { taskId: row.startTaskId }).then((res) => { this.$axios.post("/flow/common/revokeTask", { taskId: row.startTaskId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$toast(res.msg); this.$toast(res.msg)
this.pageData() this.doSearch()
} }
}); })
}); })
}, },
openView(row) { openView(row) {
this.viewShow = true this.viewShow = true
@@ -97,7 +108,7 @@ layout("/layouts/platform_h5.html"){
}) })
}, },
onEdit(row) { 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) { onDelete(row) {
this.$dialog.confirm({ this.$dialog.confirm({
@@ -114,7 +125,8 @@ layout("/layouts/platform_h5.html"){
} }
}) })
}) })
.catch(() => {}) .catch(() => {
})
}, },
doSearch() { doSearch() {
this.pageForm.pageNumber = 1 this.pageForm.pageNumber = 1