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