优化外校新增

This commit is contained in:
Qi 2025-05-26 22:57:25 +08:00
parent cbdc977fd6
commit 80338616ee
3 changed files with 87 additions and 45 deletions

View File

@ -34,7 +34,7 @@ function getSex(value: string) {
if (value.length < 17) { if (value.length < 17) {
return ''; return '';
} }
let sex = value.substr(16, 1); const sex = value.substr(16, 1);
if (sex !== '' || sex !== undefined) { if (sex !== '' || sex !== undefined) {
if (parseInt(sex) % 2 == 1) { if (parseInt(sex) % 2 == 1) {
return 0; // 男 return 0; // 男
@ -76,20 +76,49 @@ function validateIdCard(value: string) {
psidno = psidno.toUpperCase(); psidno = psidno.toUpperCase();
// 1.校验身份证号格式和长度 // 1.校验身份证号格式和长度
const regPsidno = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[X])$)$/; const regPsidno =
/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[X])$)$/;
if (!regPsidno.test(psidno)) { if (!regPsidno.test(psidno)) {
return false; return false;
} }
// 2.校验前两位的省份编码 // 2.校验前两位的省份编码
const province = { const province = {
11: '北京', 12: '天津', 13: '河北', 14: '山西', 15: '内蒙古', 11: '北京',
21: '辽宁', 22: '吉林', 23: '黑龙江', 31: '上海', 32: '江苏', 12: '天津',
33: '浙江', 34: '安徽', 35: '福建', 36: '江西', 37: '山东', 13: '河北',
41: '河南', 42: '湖北', 43: '湖南', 44: '广东', 45: '广西', 14: '山西',
46: '海南', 50: '重庆', 51: '四川', 52: '贵州', 53: '云南', 15: '内蒙古',
54: '西藏', 61: '陕西', 62: '甘肃', 63: '青海', 64: '宁夏', 21: '辽宁',
65: '新疆', 71: '台湾', 81: '香港', 82: '澳门', 91: '国外' 22: '吉林',
23: '黑龙江',
31: '上海',
32: '江苏',
33: '浙江',
34: '安徽',
35: '福建',
36: '江西',
37: '山东',
41: '河南',
42: '湖北',
43: '湖南',
44: '广东',
45: '广西',
46: '海南',
50: '重庆',
51: '四川',
52: '贵州',
53: '云南',
54: '西藏',
61: '陕西',
62: '甘肃',
63: '青海',
64: '宁夏',
65: '新疆',
71: '台湾',
81: '香港',
82: '澳门',
91: '国外',
}; };
if (!province[Number(psidno.slice(0, 2))]) { if (!province[Number(psidno.slice(0, 2))]) {
@ -388,14 +417,7 @@ export const formSchema: FormSchema[] = [
// return [{ required: true, message: '请输入开户行!' }]; // return [{ required: true, message: '请输入开户行!' }];
//}, //},
}, },
{
label: '车牌号',
field: 'carNumber',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入车牌号!' }];
//},
},
{ {
label: '饭卡', label: '饭卡',
field: 'mealCard', field: 'mealCard',
@ -414,9 +436,9 @@ export const formSchema: FormSchema[] = [
{ label: '否', value: 0 }, { label: '否', value: 0 },
], ],
}, },
//dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入是否住宿!' }]; return [{ required: true, message: '请输入是否住宿!' }];
//}, },
}, },
{ {
label: '所属分组', label: '所属分组',
@ -440,9 +462,24 @@ export const formSchema: FormSchema[] = [
{ label: '否', value: 0 }, { label: '否', value: 0 },
], ],
}, },
//dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入车辆是否入校!' }]; return [{ required: true, message: '请输入车辆是否入校!' }];
//}, },
},
{
label: '车牌号',
field: 'carNumber',
component: 'Input',
componentProps: {
// 输入时自动转为大写
onInput: (e) => {
e.target.value = e.target.value.toUpperCase();
},
},
dynamicRules: ({ model }) => {
return model.carStatus === 1 ? [{ required: true, message: '请输入车牌号!' }] : [];
},
show: ({ model }) => model.carStatus === 1,
}, },
//{ //{
// label: '住宿信息', // label: '住宿信息',

View File

@ -406,7 +406,6 @@
<select <select
className="custom-select" className="custom-select"
value={record.dormitoryName} value={record.dormitoryName}
disabled={!!record.dormitoryName}
onFocus={() => handleFocus(record)} onFocus={() => handleFocus(record)}
onChange={(e) => handleChange(record.userId, e.target.value, record)} onChange={(e) => handleChange(record.userId, e.target.value, record)}
> >
@ -527,11 +526,11 @@
.qr { .qr {
display: flex; display: flex;
} }
/** 自定义选择框容器 */ /* 自定义选择框容器 */
.custom-select-wrapper { .custom-select-wrapper {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 150px; width: 200px; /* 增加宽度 */
} }
/* 原生select元素美化 */ /* 原生select元素美化 */
@ -540,14 +539,14 @@
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
width: 100%; width: 100%;
padding: 6px 12px; padding: 10px 15px; /* 增加内边距 */
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
color: rgba(0, 0, 0, 0.85); color: #333; /* 深灰色文字 */
background-color: #fff; background-color: #f9f9f9; /* 浅灰色背景 */
background-image: none; background-image: none;
border: 1px solid #d9d9d9; border: 1px solid #ccc; /* 浅灰色边框 */
border-radius: 4px; border-radius: 6px; /* 增加圆角 */
transition: all 0.3s; transition: all 0.3s;
cursor: pointer; cursor: pointer;
} }
@ -556,31 +555,33 @@
.custom-arrow { .custom-arrow {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 12px; right: 15px; /* 增加右边距 */
transform: translateY(-50%); transform: translateY(-50%);
width: 0; width: 0;
height: 0; height: 0;
border-left: 5px solid transparent; border-left: 6px solid transparent; /* 增大箭头大小 */
border-right: 5px solid transparent; border-right: 6px solid transparent;
border-top: 5px solid #999; border-top: 6px solid #666; /* 深灰色箭头 */
pointer-events: none; pointer-events: none;
} }
/* 交互状态 */ /* 交互状态 */
.custom-select:focus { .custom-select:focus {
border-color: #40a9ff; border-color: #40a9ff; /* 蓝色边框 */
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
outline: none; outline: none;
} }
.custom-select:disabled { .custom-select:disabled {
color: rgba(0, 0, 0, 0.25); color: #ccc; /* 浅灰色文字 */
background-color: #f5f5f5; background-color: #f5f5f5; /* 浅灰色背景 */
cursor: not-allowed; cursor: not-allowed;
} }
/* 选项样式 */ /* 选项样式 */
.custom-select option { .custom-select option {
padding: 8px 12px; padding: 10px 15px; /* 增加内边距 */
background-color: #f9f9f9; /* 浅灰色背景 */
color: #333; /* 深灰色文字 */
} }
</style> </style>

View File

@ -42,6 +42,10 @@
try { try {
let values = await validate(); let values = await validate();
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
//
if (values.carNumber) {
values.carNumber = values.carNumber.toUpperCase();
}
// //
await saveOrUpdate(values, isUpdate.value); await saveOrUpdate(values, isUpdate.value);
// //