From 7a89dfbeefeb6dbaa71a2d67454c3c261375c18c Mon Sep 17 00:00:00 2001 From: bb_pan Date: Sat, 5 Jul 2025 13:32:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=94=B3=E8=AF=B7=E5=8F=91?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/lease/apply.js | 16 +++++++ src/utils/bonus.js | 6 +++ .../leasePublish/component/addToolsApply.vue | 42 +++++++++++++++++-- .../materialStation/authorize/index.vue | 30 ++++++++++--- 4 files changed, 85 insertions(+), 9 deletions(-) diff --git a/src/api/lease/apply.js b/src/api/lease/apply.js index 6b8cbfba..25791e39 100644 --- a/src/api/lease/apply.js +++ b/src/api/lease/apply.js @@ -44,6 +44,22 @@ export function getListUnite(data) { data: data, }) } +export function getUnitListLeaseApi(data) { + return request({ + url: '/material/select/getUnitListLease', + method: 'post', + data + }) +} + +// 班组领料人-下拉 +export function getListLeasePersonApi(data) { + return request({ + url: '/material/select/getUnitListLeasePerson', + method: 'post', + data + }) +} // 领料申请租赁工程下拉框 export function getListProject(data) { diff --git a/src/utils/bonus.js b/src/utils/bonus.js index efeb96e3..bad49a84 100644 --- a/src/utils/bonus.js +++ b/src/utils/bonus.js @@ -281,3 +281,9 @@ export function toChineseAmount(n) { .replace(/^整$/, '零元整') ) } + +// 身份证-正则校验 +export function validateIdCard(idCard) { + const idCardRegex = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/ + return idCardRegex.test(idCard) +} \ No newline at end of file diff --git a/src/views/business/leasePublish/component/addToolsApply.vue b/src/views/business/leasePublish/component/addToolsApply.vue index 7c269494..5b5d468e 100644 --- a/src/views/business/leasePublish/component/addToolsApply.vue +++ b/src/views/business/leasePublish/component/addToolsApply.vue @@ -143,6 +143,7 @@ noOptionsText="没有数据" noResultsText="没有搜索结果" placeholder="请选择领用单位" + @select="uniteChange" /> @@ -176,11 +177,28 @@ + + + + @@ -191,6 +209,7 @@ v-model="maForm.phone" placeholder="请输入联系电话" maxlength="11" + style="width: 240px" > @@ -209,7 +228,7 @@ import { getApplyInfo,getTypeOptions,applySubmit } from "@/api/leasePublish/index"; -import { getListUnite } from '@/api/lease/apply' +import { getUnitListLeaseApi, getListLeasePersonApi } from '@/api/lease/apply' import { getToken } from "@/utils/auth"; import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' @@ -277,6 +296,7 @@ export default { leasePerson: "", phone: "", }, + leasePersonList: [], //上层信息 leaseApplyData: {}, openView: false, @@ -300,11 +320,11 @@ export default { { required: true, message: '请输入领料人', - trigger: 'blur' + trigger: 'change' } ], phone: [ - { required: true, message: '联系电话不能为空', trigger: 'blur' }, + // { required: true, message: '联系电话不能为空', trigger: 'blur' }, { pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/, message: '请输入正确的手机号码', @@ -327,6 +347,19 @@ export default { } }, methods: { + uniteChange(e) { + this.getLeasePersonList(e.id) + }, + // 获取领料人列表 + async getLeasePersonList(teamId) { + try { + const res = await getListLeasePersonApi({ leaseId: this.id, teamId}) + this.leasePersonList = res.data || [] + if (this.leasePersonList.length == 0) this.maForm.leasePerson = '' + } catch (error) { + console.log('🚀 ~ 获取领料人列表失败 ~ error:', error) + } + }, /** 转换菜单数据结构 */ normalizer(node) { if (node.children && !node.children.length) { @@ -341,7 +374,7 @@ export default { /** 选择单位 */ async getUnit(){ - getListUnite({ projectId: this.leaseApplyData.leaseProjectId }).then(response => { + getUnitListLeaseApi({ projectId: this.leaseApplyData.leaseProjectId, leaseId: this.id }).then(response => { this.uniteList = response.data }) }, @@ -409,6 +442,7 @@ export default { }, handleSign(){ + this.closeView() this.$router.push({ path: '/lease/protocol' }) }, diff --git a/src/views/material/materialStation/authorize/index.vue b/src/views/material/materialStation/authorize/index.vue index bc0942b3..515f67b7 100644 --- a/src/views/material/materialStation/authorize/index.vue +++ b/src/views/material/materialStation/authorize/index.vue @@ -106,13 +106,14 @@ @pagination="getList" /> - - - + + + @@ -153,12 +154,12 @@ @@ -316,6 +317,7 @@ import { uploadIdCard } from "@/api/materialsStation/auth"; import {getToken} from "@/utils/auth"; +import { validateIdCard } from "@/utils/bonus" export default { name: 'IdCardUploadComponent', data() { @@ -369,6 +371,9 @@ export default { titles:'', authDialogVisible: false, teamList: [], // 班组列表 + authFormRules: { + teamId: [{ required: true, message: '请选择班组', trigger: 'change' }], + }, authForm: { teamId: '', teamName: '', @@ -410,6 +415,7 @@ export default { if (!newVal) { // 弹框关闭时重置上传相关状态 this.resetUploadState(); + this.$refs.authFormRef.resetFields(); // 重置表单 } } }, @@ -418,6 +424,14 @@ export default { selectable(row) { return row.authId === null; }, + // 身份证号码校验 + handleIdCard(row) { + const idCard = row.idNumber; + const isValid = validateIdCard(idCard) + if (!isValid) { + this.$message.error('身份证号码格式不正确') + } + }, // 上传前验证 beforeIdPhotoUpload(file) { const isImage = file.type.startsWith('image/'); @@ -709,6 +723,12 @@ export default { this.$message.error(`第 ${i + 1} 个领料人请上传身份证正反面照片`); return false; } + + // 身份证号码格式验证 + if (!validateIdCard(receiver.idNumber)) { + this.$message.error(`第 ${i + 1} 个领料人身份证号码格式不正确`); + return false + } } // 批量模式下额外验证