l本校老师删除标识错误修复、
This commit is contained in:
parent
13504e167b
commit
205d11df74
|
@ -39,7 +39,7 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '宿舍人员信息',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitorydata',
|
||||
dataIndex: 'rowUser',
|
||||
width: 300,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
<template>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm"></BasicForm>
|
||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm" />
|
||||
<div style="width: 100%; text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {computed, defineComponent} from 'vue';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import {getBpmFormSchema} from '../CeesLocalTeacher.data';
|
||||
import {saveOrUpdate} from '../CeesLocalTeacher.api';
|
||||
|
||||
export default defineComponent({
|
||||
name: "CeesLocalTeacherForm",
|
||||
components:{
|
||||
BasicForm
|
||||
},
|
||||
props:{
|
||||
formData: propTypes.object.def({}),
|
||||
formBpm: propTypes.bool.def(true),
|
||||
},
|
||||
setup(props){
|
||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { getBpmFormSchema } from '../CeesLocalTeacher.data';
|
||||
import { saveOrUpdate } from '../CeesLocalTeacher.api';
|
||||
|
||||
const formDisabled = computed(()=>{
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
export default defineComponent({
|
||||
name: 'CeesLocalTeacherForm',
|
||||
components: {
|
||||
BasicForm,
|
||||
},
|
||||
props: {
|
||||
formData: propTypes.object.def({}),
|
||||
formBpm: propTypes.bool.def(true),
|
||||
},
|
||||
setup(props) {
|
||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
let formData = {};
|
||||
const queryByIdUrl = '/CEES/ceesLocalTeacher/queryById';
|
||||
async function initFormData(){
|
||||
let params = {id: props.formData.dataId};
|
||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
||||
formData = {...data}
|
||||
//设置表单的值
|
||||
await setFieldsValue(formData);
|
||||
//默认是禁用
|
||||
await setProps({disabled: formDisabled.value})
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
let data = getFieldsValue();
|
||||
let params = Object.assign({}, formData, data);
|
||||
console.log('表单数据', params)
|
||||
await saveOrUpdate(params, true)
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
||||
return {
|
||||
registerForm,
|
||||
formDisabled,
|
||||
submitForm,
|
||||
}
|
||||
const formDisabled = computed(() => {
|
||||
if (props.formData.disabled === false) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
return true;
|
||||
});
|
||||
|
||||
let formData = {};
|
||||
const queryByIdUrl = '/CEES/ceesLocalTeacher/queryById';
|
||||
async function initFormData() {
|
||||
let params = { id: props.formData.dataId };
|
||||
const data = await defHttp.get({ url: queryByIdUrl, params });
|
||||
formData = { ...data };
|
||||
//设置表单的值
|
||||
await setFieldsValue(formData);
|
||||
//默认是禁用
|
||||
await setProps({ disabled: formDisabled.value });
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
let data = getFieldsValue();
|
||||
let params = Object.assign({}, formData, data);
|
||||
console.log('表单数据', params);
|
||||
await saveOrUpdate(params, true);
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
||||
return {
|
||||
registerForm,
|
||||
formDisabled,
|
||||
submitForm,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm"/>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref} from 'vue';
|
||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {formSchema} from '../CeesLocalTeacher.data';
|
||||
import {saveOrUpdate} from '../CeesLocalTeacher.api';
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
//表单配置
|
||||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
|
||||
//labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
import { ref, computed, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../CeesLocalTeacher.data';
|
||||
import { saveOrUpdate } from '../CeesLocalTeacher.api';
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({
|
||||
//labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number){
|
||||
width: 100%
|
||||
}
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker){
|
||||
width: 100%
|
||||
}
|
||||
</style>
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -277,19 +277,13 @@ export const searchFormSchema: FormSchema[] = [
|
|||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
// {
|
||||
// label: '用户ID',
|
||||
// field: 'userId',
|
||||
// component: 'Input',
|
||||
// dynamicRules: ({ model, schema }) => {
|
||||
// return [{ required: true, message: '请输入用户ID!' }];
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: '姓名',
|
||||
field: 'userName',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入姓名!' }];
|
||||
},
|
||||
},
|
||||
|
@ -298,6 +292,8 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'identityId',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [
|
||||
{ required: true, message: '请输入身份证!' },
|
||||
{
|
||||
|
@ -320,7 +316,7 @@ export const formSchema: FormSchema[] = [
|
|||
label: '年龄',
|
||||
field: 'age',
|
||||
component: 'InputNumber',
|
||||
dynamicDisabled: true,
|
||||
dynamicDisabled: false,
|
||||
},
|
||||
{
|
||||
label: '性别',
|
||||
|
@ -332,7 +328,7 @@ export const formSchema: FormSchema[] = [
|
|||
{ label: '女', value: 1 },
|
||||
],
|
||||
},
|
||||
dynamicDisabled: true,
|
||||
dynamicDisabled: false,
|
||||
},
|
||||
{
|
||||
label: '学科',
|
||||
|
@ -347,23 +343,18 @@ export const formSchema: FormSchema[] = [
|
|||
],
|
||||
},
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请选择学科!' }];
|
||||
},
|
||||
},
|
||||
//{
|
||||
// label: '用户专业id',
|
||||
// field: 'userMajorId',
|
||||
// component: 'Input',
|
||||
// dynamicRules: ({ model, schema }) => {
|
||||
// return [{ required: true, message: '请输入用户专业id!' }];
|
||||
// },
|
||||
//},
|
||||
|
||||
{
|
||||
label: '手机号',
|
||||
field: 'phone',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入手机号!' }];
|
||||
},
|
||||
},
|
||||
|
@ -372,6 +363,8 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'jobTitle',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入职称!' }];
|
||||
},
|
||||
},
|
||||
|
@ -380,6 +373,8 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'office',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入办公位!' }];
|
||||
},
|
||||
},
|
||||
|
@ -388,6 +383,8 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'workName',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入单位名称!' }];
|
||||
},
|
||||
},
|
||||
|
@ -404,6 +401,8 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'pyCard',
|
||||
component: 'Input',
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
// 当身份证为7个0时取消验证
|
||||
if (model.identityId === '0000000') return [];
|
||||
return [{ required: true, message: '请输入银行卡号!' }];
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue