领料申请发布

This commit is contained in:
bb_pan 2025-07-05 13:32:02 +08:00
parent eb5fe96f1c
commit 7a89dfbeef
4 changed files with 85 additions and 9 deletions

View File

@ -44,6 +44,22 @@ export function getListUnite(data) {
data: 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) { export function getListProject(data) {

View File

@ -281,3 +281,9 @@ export function toChineseAmount(n) {
.replace(/^整$/, '零元整') .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)
}

View File

@ -143,6 +143,7 @@
noOptionsText="没有数据" noOptionsText="没有数据"
noResultsText="没有搜索结果" noResultsText="没有搜索结果"
placeholder="请选择领用单位" placeholder="请选择领用单位"
@select="uniteChange"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -176,11 +177,28 @@
<el-col :span="20"> <el-col :span="20">
<el-form-item label="领料人" prop="leasePerson"> <el-form-item label="领料人" prop="leasePerson">
<el-input <el-input
v-if="leasePersonList.length === 0"
v-model="maForm.leasePerson" v-model="maForm.leasePerson"
placeholder="请输入领料人" placeholder="请输入领料人"
maxlength="10" maxlength="10"
style="width: 240px"
> >
</el-input> </el-input>
<el-select
v-else
v-model="maForm.leasePerson"
placeholder="请选择领料人"
style="width: 240px"
filterable
>
<el-option
v-for="(item, index) in leasePersonList"
:key="index"
:label="item.leasePerson"
:value="item.leasePerson"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -191,6 +209,7 @@
v-model="maForm.phone" v-model="maForm.phone"
placeholder="请输入联系电话" placeholder="请输入联系电话"
maxlength="11" maxlength="11"
style="width: 240px"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -209,7 +228,7 @@
import { import {
getApplyInfo,getTypeOptions,applySubmit getApplyInfo,getTypeOptions,applySubmit
} from "@/api/leasePublish/index"; } from "@/api/leasePublish/index";
import { getListUnite } from '@/api/lease/apply' import { getUnitListLeaseApi, getListLeasePersonApi } from '@/api/lease/apply'
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -277,6 +296,7 @@ export default {
leasePerson: "", leasePerson: "",
phone: "", phone: "",
}, },
leasePersonList: [],
// //
leaseApplyData: {}, leaseApplyData: {},
openView: false, openView: false,
@ -300,11 +320,11 @@ export default {
{ {
required: true, required: true,
message: '请输入领料人', message: '请输入领料人',
trigger: 'blur' trigger: 'change'
} }
], ],
phone: [ phone: [
{ required: true, message: '联系电话不能为空', trigger: 'blur' }, // { required: true, message: '', trigger: 'blur' },
{ {
pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/, pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
message: '请输入正确的手机号码', message: '请输入正确的手机号码',
@ -327,6 +347,19 @@ export default {
} }
}, },
methods: { 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) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
@ -341,7 +374,7 @@ export default {
/** 选择单位 */ /** 选择单位 */
async getUnit(){ async getUnit(){
getListUnite({ projectId: this.leaseApplyData.leaseProjectId }).then(response => { getUnitListLeaseApi({ projectId: this.leaseApplyData.leaseProjectId, leaseId: this.id }).then(response => {
this.uniteList = response.data this.uniteList = response.data
}) })
}, },
@ -409,6 +442,7 @@ export default {
}, },
handleSign(){ handleSign(){
this.closeView()
this.$router.push({ path: '/lease/protocol' }) this.$router.push({ path: '/lease/protocol' })
}, },

View File

@ -106,13 +106,14 @@
@pagination="getList" @pagination="getList"
/> />
<el-dialog :title="dialogTitle" :visible.sync="authDialogVisible" width="800px" append-to-body> <el-dialog :title="dialogTitle" :visible.sync="authDialogVisible" width="850px" append-to-body>
<el-form :model="authForm" ref="authFormRef" label-width="110px" class="auth-dialog-form"> <el-form :model="authForm" ref="authFormRef" label-width="110px" class="auth-dialog-form" :rules="authFormRules">
<el-form-item label="选择班组:" prop="teamId" required> <el-form-item label="选择班组:" prop="teamId">
<el-select <el-select
v-model="authForm.teamId" v-model="authForm.teamId"
placeholder="请选择班组" placeholder="请选择班组"
clearable clearable
filterable
style="width: 40%" style="width: 40%"
:disabled="isEditMode" :disabled="isEditMode"
> >
@ -153,12 +154,12 @@
<el-table-column label="序号" type="index" width="60" align="center"></el-table-column> <el-table-column label="序号" type="index" width="60" align="center"></el-table-column>
<el-table-column label="姓名" prop="name" align="center"> <el-table-column label="姓名" prop="name" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.name" placeholder="请上传身份证识别" :disabled="true"></el-input> <el-input v-model="scope.row.name" placeholder="请上传身份证识别" maxlength="30"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="身份证号码" prop="idNumber" align="center"> <el-table-column label="身份证号码" prop="idNumber" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.idNumber" placeholder="请上传身份证识别" :disabled="true"></el-input> <el-input v-model="scope.row.idNumber" placeholder="请上传身份证识别" maxlength="18" @blur="handleIdCard(scope.row)"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="身份证照片" prop="idPhotos" align="center" width="200"> <el-table-column label="身份证照片" prop="idPhotos" align="center" width="200">
@ -316,6 +317,7 @@ import {
uploadIdCard uploadIdCard
} from "@/api/materialsStation/auth"; } from "@/api/materialsStation/auth";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import { validateIdCard } from "@/utils/bonus"
export default { export default {
name: 'IdCardUploadComponent', name: 'IdCardUploadComponent',
data() { data() {
@ -369,6 +371,9 @@ export default {
titles:'', titles:'',
authDialogVisible: false, authDialogVisible: false,
teamList: [], // teamList: [], //
authFormRules: {
teamId: [{ required: true, message: '请选择班组', trigger: 'change' }],
},
authForm: { authForm: {
teamId: '', teamId: '',
teamName: '', teamName: '',
@ -410,6 +415,7 @@ export default {
if (!newVal) { if (!newVal) {
// //
this.resetUploadState(); this.resetUploadState();
this.$refs.authFormRef.resetFields(); //
} }
} }
}, },
@ -418,6 +424,14 @@ export default {
selectable(row) { selectable(row) {
return row.authId === null; return row.authId === null;
}, },
//
handleIdCard(row) {
const idCard = row.idNumber;
const isValid = validateIdCard(idCard)
if (!isValid) {
this.$message.error('身份证号码格式不正确')
}
},
// //
beforeIdPhotoUpload(file) { beforeIdPhotoUpload(file) {
const isImage = file.type.startsWith('image/'); const isImage = file.type.startsWith('image/');
@ -709,6 +723,12 @@ export default {
this.$message.error(`${i + 1} 个领料人请上传身份证正反面照片`); this.$message.error(`${i + 1} 个领料人请上传身份证正反面照片`);
return false; return false;
} }
//
if (!validateIdCard(receiver.idNumber)) {
this.$message.error(`${i + 1} 个领料人身份证号码格式不正确`);
return false
}
} }
// //