添加附件说明

This commit is contained in:
2026-10-10 13:50:41 +08:00
parent e7d7bc53ee
commit 3e2059e634
4 changed files with 34 additions and 5 deletions
@@ -52,6 +52,11 @@ public class CondolenceType extends BaseModel implements Serializable {
@ColDefine(type = ColType.BOOLEAN)
private Boolean need_files;
@Column
@Comment("附件说明,供申请人查看材料要求,最多200字")
@ColDefine(type = ColType.VARCHAR, width = 200)
private String files_desc;
@Column
@Comment("排序字段")
@Prev({
@@ -222,10 +222,10 @@ layout("/mobile/platform.html"){
:min-date="new Date('1999-01-01')"
:color="themeColor"></van-calendar>
<van-field v-model="formData.the_hospital" name="the_hospital" name="type"
<!-- 所在医院暂不采集,连同字段内的必填校验一起停用。 <van-field v-model="formData.the_hospital" name="the_hospital" name="type"
label="所在医院"
placeholder="请填写所在医院" required
:rules="[{ required:true, message: '请填写所在医院' }]"></van-field>
:rules="[{ required:true, message: '请填写所在医院' }]"></van-field> -->
</template>
<!-- <van-field v-model="formData.remark" name="remark" label="申请事由"
@@ -309,7 +309,10 @@ layout("/mobile/platform.html"){
<div class="mb10">附&emsp;&emsp;件</div>
</template>
<template #input>
<vant-file-upload :files.sync="formData.files"></vant-file-upload>
<div style="width: 100%;">
<vant-file-upload :files.sync="formData.files"></vant-file-upload>
<div v-if="attachmentDescription" style="white-space: pre-wrap; overflow-wrap: anywhere; color: #f56c6c; line-height: 20px; margin-top: 8px;">{{ attachmentDescription }}</div>
</div>
</template>
</van-field>
</van-cell-group>
@@ -373,6 +376,13 @@ layout("/mobile/platform.html"){
money: 0
}
},
computed: {
// 按当前类型读取材料说明,无说明时返回空串,避免切换类型后残留旧提示。
attachmentDescription() {
const selectedType = this.typeColumns.find(item => item.value === this.formData.type)
return selectedType ? (selectedType.files_desc || '') : ''
}
},
watch: {
"formData.money"(val) {
if (val > this.money) {
@@ -568,7 +578,7 @@ layout("/mobile/platform.html"){
this.formData.apply_time = moment().format('YYYY-MM-DD')
const {code, data} = await $.get("/platform/condolence/type/getAll")
data.forEach(v => {
this.typeColumns.push({value: v.id, text: v.name + "(" + v.money + ")"})
this.typeColumns.push({value: v.id, text: v.name + "(" + v.money + ")", files_desc: v.files_desc})
})
for (let i in condolence.way) {
this.wayColumns.push({value: condolence.way[i], text: condolence.way[i]})
@@ -104,6 +104,11 @@ layout("/layouts/platform.html"){
<el-radio v-model="formData.need_files" :label="true" border>是</el-radio>
<el-radio v-model="formData.need_files" :label="false" border>否</el-radio>
</el-form-item>
<!-- 附件说明为选填文本,双端申请页在上传框下方展示,最多200字。 -->
<el-form-item label="附件说明" prop="files_desc">
<el-input v-model="formData.files_desc" type="textarea" :rows="3"
maxlength="200" show-word-limit placeholder="请填写附件材料要求,最多200字"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
@@ -130,6 +135,7 @@ layout("/layouts/platform.html"){
searchName: "name",
},
formRules: {
files_desc: [{max: 200, message: '附件说明最多200字', trigger: ['blur', 'change']}],
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
money: [{required: true, message: '必填', trigger: ['blur', 'change']}],
way: [{required: true, message: '必填', trigger: ['blur', 'change']}],
@@ -177,7 +183,7 @@ layout("/layouts/platform.html"){
});
},
openAdd() {
this.formData = {need_files: false}
this.formData = {need_files: false, files_desc: ''}
this.dialogVisible = true
if (this.$refs['form']) {
this.$refs['form'].resetFields()
@@ -348,6 +348,7 @@ layout("/layouts/platform.html"){
<el-col :span="24" v-if="needFiles()">
<el-form-item prop="files" label="附&emsp;&emsp;件" required>
<file-upload :files.sync="formData.files" card></file-upload>
<div v-if="attachmentDescription" style="white-space: pre-wrap; overflow-wrap: anywhere; color: #f56c6c; line-height: 20px; margin-top: 8px;">{{ attachmentDescription }}</div>
</el-form-item>
</el-col>
@@ -443,6 +444,13 @@ layout("/layouts/platform.html"){
typeOptions: [],
}
},
computed: {
// 按当前类型读取材料说明,无说明时返回空串,避免切换类型后残留旧提示。
attachmentDescription() {
const selectedType = this.typeOptions.find(item => item.id === this.formData.type)
return selectedType ? (selectedType.files_desc || '') : ''
}
},
watch: {
"formData.money"(val) {
if (val > this.money) {