提交 53af950e authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 4bbbfb2b
......@@ -16,7 +16,8 @@ export default {
title: '缴报名费',
visible() {
return this.tabActive !== 'application_info_first'
}
},
show: false
}
]
}
......@@ -12,8 +12,12 @@ export default {
get: {
action: '/api/enrollment/v1.0/application-materials/1005',
callback(data) {
this.form.options.disabled = data.data.material.submission_status === 'SUBMITTED'
const { basic_info: basicInfo = {}, attachments = [] } = data.data.material
const {
basic_info: basicInfo = {},
attachments = [],
submission_stage: submissionStage = 'FILLING'
} = data.data.material
this.form.options.disabled = submissionStage !== 'FILLING'
const attachment = attachments.reduce(
(result, item) => {
const types = ['ID_CARD_FRONT', 'ID_CARD_BACK', 'HK_ID_CARD', 'PASSPORT', 'OTHER_ID_CARD_PHOTO']
......@@ -58,8 +62,8 @@ export default {
}
},
form: {
prev: { to: { query: { active: 'application_info', tab: 'application_info_first' } } },
next: { to: { query: { active: 'application_info', tab: 'application_info_education' } } },
prev: { to: { query: { active: 'application_info', tab: 'application_info_first' } }, isSubmit: true },
next: { to: { query: { active: 'application_info', tab: 'application_info_education' } }, isSubmit: true },
options: { labelWidth: '140px' },
items: [
{
......
......@@ -35,22 +35,32 @@ export default {
prev: { to: { query: { active: 'application_info', tab: 'application_info_honor' } } },
next: { to: { query: { active: 'application_wfzzm' } } },
hasAdd: true,
minLength: 3,
disabled(data) {
return !!data.letter_content
},
aside: {
prepend: {
html: '<p style="color:#33C011;">推荐人已完成</p>',
visible(data) {
console.log(data)
return !!data.letter_content
}
},
prepend: '<p style="color:#33C011;">推荐人已完成</p>',
buttons: [
{
text: '再次邀请',
canShow() {},
visible(data) {
return data.id && !data.letter_content
},
onClick(data) {
console.log(data, this)
}
},
{
text: '更换推荐人',
visible(data) {
return data.id && !data.letter_content
},
onClick(data) {
console.log(data, this)
}
......
{
"name": "@ezijing/vue-form",
"version": "0.2.7",
"version": "2.0.3",
"private": false,
"description": "基于Vue Element-UI的表单",
"scripts": {
......
......@@ -9,6 +9,7 @@
<div class="v-form-group" :key="index">
<div class="v-form-group__inner">
<v-form
:disabled="form.disabled && form.disabled(item)"
:options="form.options"
:items="form.items"
:model="item"
......@@ -19,19 +20,30 @@
class="v-form-group__content"
></v-form>
<template v-if="form.aside">
<div class="v-form-group__aside" v-if="form.aside.visible(item)">
<div v-html="form.aside.prepend"></div>
<div class="v-form-group__aside">
<div
v-html="form.aside.prepend.html"
v-if="form.aside.prepend.visible && form.aside.prepend.visible(item)"
></div>
<div>
<div v-for="(button, index) in form.aside.buttons" :key="index">
<el-button type="primary" size="medium" plain @click="button.onClick(item)">{{
button.text
}}</el-button>
<el-button
type="primary"
size="medium"
plain
@click="button.onClick(item)"
v-if="button.visible && button.visible(item)"
>
{{ button.text }}</el-button
>
</div>
</div>
</div>
</template>
</div>
<template v-if="index > currentForm.minlength - 1">
<div class="v-form-group__remove" @click="handleRemove(index)">删除</div>
</template>
</div>
</template>
<div class="v-form-group__add">
......@@ -97,7 +109,7 @@ export default {
return Array.isArray(this.model)
},
currentForm() {
return Object.assign({ hasSubmit: true, hasButton: true, options: {} }, this.form)
return Object.assign({ minlength: 1, hasSubmit: true, hasButton: true, options: {} }, this.form)
},
that() {
return this
......@@ -168,7 +180,7 @@ export default {
},
// 提交
async handleSubmit() {
if (this.currentForm.options.disabled) {
if (this.currentForm.options.disabled || !this.update) {
return
}
const form = this.$refs.form
......@@ -179,7 +191,10 @@ export default {
})
},
// 上一步
handlePrev() {
async handlePrev() {
if (this.form.prev.isSubmit) {
await this.handleSubmit()
}
this.$emit('prev', this.form.prev.to)
},
// 下一步
......
<template>
<div class="v-form">
<div class="v-form__prepend" v-html="options.prepend"></div>
<el-form v-bind="options" ref="form" :model="ruleForm" @submit.native.prevent v-on="$listeners">
<el-form
:disabled="disabled || options.disabled"
v-bind="options"
ref="form"
:model="ruleForm"
@submit.native.prevent
v-on="$listeners"
>
<template v-for="item in currentItems">
<el-form-item v-bind="item" :prop="item.model" :key="item.model">
<div class="v-form-item__prepend" v-html="item.prepend"></div>
......@@ -23,6 +30,7 @@
export default {
name: 'VForm',
props: {
disabled: { type: Boolean, default: false },
options: {
type: Object,
default() {
......
......@@ -5,6 +5,7 @@
:class="{ 'v-submenu__item': true, 'is-active': item.isActive }"
:key="item.id"
@click="$emit('select', item.id, item)"
v-if="item.show === undefined ? true : item.show"
>
<span>{{ item.title }}</span>
</div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论