| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <!-- 项目申报 -->
- <div class="about main-background main-background-type0">
- <div class="nav-placeholder"></div>
- <!-- 表单 -->
- <section class="main-section ">
- <div class="content">
- <div class="title">
- <h2>项目申报</h2>
- </div>
- <DynamicForm
- ref="form"
- :model="formModel"
- :options="formOptions"
- />
- <a-button type="primary" block @click="handleSubmit">提交</a-button>
- </div>
- </section>
- </div>
- </template>
- <script setup lang="ts">
- import CommonContent from '@/api/CommonContent';
- import { RecommendForm } from '@/api/inheritor/SubmitApi';
- import type { IdAsValueDropdownProps } from '@/components/dynamicf/Dropdown/IdAsValueDropdown';
- import type { DataModel } from '@imengyu/js-request-transform';
- import { DynamicForm, type IDynamicFormOptions, type IDynamicFormRef } from '@imengyu/vue-dynamic-form';
- import { Modal, type FormInstance } from 'ant-design-vue';
- import { ref } from 'vue';
- const form = ref<IDynamicFormRef>();
- const formModel = ref(new RecommendForm());
- const formOptions = ref<IDynamicFormOptions>({
- formLabelCol: { span: 6 },
- formWrapperCol: { span: 24 },
- formAdditionaProps: {
- layout: 'vertical'
- },
- formItems: [
- {
- label: '证件照',
- name: 'idPhoto',
- type: 'single-image',
- additionalProps: {
- },
- },
- {
- label: '传承人姓名',
- name: 'name',
- type: 'text',
- additionalProps: {
- placeholder: '请输入姓名'
- },
- },
- {
- label: '项目名称',
- name: 'ichName',
- type: 'text',
- additionalProps: {
- placeholder: '请输入项目名称'
- }
- },
- {
- label: '类型',
- name: 'type',
- type: 'select-id',
- additionalProps: {
- placeholder: '请选择类型',
- loadData: async () =>
- (await CommonContent.getCategoryList(4)).map(p => ({
- label: p.title,
- value: p.id,
- raw: p
- }))
- } as IdAsValueDropdownProps<DataModel>,
- },
- {
- label: '保护单位',
- name: 'unit',
- type: 'text',
- additionalProps: {
- placeholder: '请输入保护单位'
- }
- },
- {
- label: '性别',
- name: 'gender',
- type: 'select',
- additionalProps: {
- options: [
- { text: '男', value: '男' },
- { text: '女', value: '女' },
- ]
- },
- },
- {
- label: '生日',
- name: 'birthday',
- type: 'date',
- additionalProps: {
- placeholder: '请输入出生日期'
- }
- },
- {
- label: '民族',
- name: 'nation',
- type: 'text',
- additionalProps: {
- placeholder: '请输入民族'
- }
- },
- {
- label: '传承人姓名',
- name: 'name',
- type: 'text',
- additionalProps: {
- placeholder: '请输入姓名'
- }
- },
- {
- label: '职业',
- name: 'job',
- type: 'text',
- additionalProps: {
- placeholder: '请输入职业'
- }
- },
- {
- label: '职务职称',
- name: 'jobTitle',
- type: 'text',
- additionalProps: {
- placeholder: '请输入职务职称'
- }
- },
- ],
- formRules: {
- name: [
- { required: true, message: '请输入姓名' },
- { min: 2, max: 5, message: '长度在 2 到 5 个字符' }
- ],
- // idPhoto: [
- // { required: true, message: '请上传证件照' }
- // ],
- ichName: [
- { required: true, message: '请输入项目名称' }
- ],
- type: [
- { required: true, message: '请选择类型' }
- ],
- unit: [
- { required: true, message: '请输入保护单位' }
- ],
- gender: [
- { required: true, message: '请选择性别' }
- ],
- birthday: [
- { required: true, message: '请输入出生日期' }
- ],
- job: [
- { required: true, message: '请输入职业' }
- ],
- jobTitle: [
- { required: true, message: '请输入职业' }
- ],
- nation: [
- { required: true, message: '请输入民族' }
- ]
- },
- });
- function handleSubmit() {
- (form.value?.getFormRef() as FormInstance).validate().then(() => {
- Modal.success({
- title: '提交成功',
- content: '您的项目申报已提交成功。请耐心等待审核!',
- });
- });
- }
- </script>
|