From d2bc6e096f0806b78ea92d4b90a21d3627d406c7 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 08 三月 2024 18:28:42 +0800
Subject: [PATCH] mrshi
---
company/src/components/enterprise/addEmployee.vue | 66 +++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/company/src/components/enterprise/addEmployee.vue b/company/src/components/enterprise/addEmployee.vue
index 075e407..e2039e2 100644
--- a/company/src/components/enterprise/addEmployee.vue
+++ b/company/src/components/enterprise/addEmployee.vue
@@ -9,10 +9,10 @@
<el-form :inline="true" class="demo-form-inline">
<div v-for="(item, index) in list" :key="index">
<el-form-item label="濮撳悕" required>
- <el-input v-model="item.name" placeholder="璇疯緭鍏�"></el-input>
+ <el-input v-model="item.memberName" placeholder="璇疯緭鍏�"></el-input>
</el-form-item>
<el-form-item label="韬唤璇佸彿" required>
- <el-input v-model="item.idcardNo" maxlength="18" placeholder="璇疯緭鍏�"></el-input>
+ <el-input v-model="item.idCard" maxlength="18" placeholder="璇疯緭鍏�"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="index === 0" @click="add">娣诲姞</el-button>
@@ -34,61 +34,89 @@
return {
list: [
{
- name: '',
- idcardNo: ''
+ memberName: '',
+ idCard: '',
+ workTypeName: '',
+ worktypeId: '',
+ duName: '',
+ duId: '',
+ fee: ''
}
],
+ price: 0,
arr: []
}
},
methods: {
- open (title, arr) {
+ open (title, obj) {
this.title = title
this.visible = true
this.list = [
{
- name: '',
- idcardNo: ''
+ memberName: '',
+ idCard: '',
+ workTypeName: '',
+ worktypeId: '',
+ duName: '',
+ duId: '',
+ fee: ''
}
]
- this.arr = arr
+ this.arr = obj.arr
+ this.price = obj.price
},
add() {
this.list.push({
- name: '',
- idCard: ''
+ memberName: '',
+ idCard: '',
+ workTypeName: '',
+ worktypeId: '',
+ duName: '',
+ duId: '',
+ fee: ''
})
},
dele(index) {
- this.form.list.splice(index, 1)
+ this.list.splice(index, 1)
},
hasDuplicates(arr) {
return arr.some((value, index) => arr.indexOf(value) !== index);
},
confirm() {
// 鍒ゆ柇鍒楄〃鍚︽槸鏈夌┖鍊�
- for (let i = 0; this.list.length; i++) {
- if (!this.list[i].name || !this.list[i].idcardNo) {
- this.$message.warning('璇峰厛瀹屽杽淇℃伅鍚庡啀鎻愪氦')
- return
- }
- }
+ // for (let i = 0; this.list.length; i++) {
+ // if (!this.list[i].memberName || !this.list[i].idCard) {
+ // this.$message.warning('璇峰厛瀹屽杽淇℃伅鍚庡啀鎻愪氦')
+ // return
+ // }
+ // }
// 鍒ゆ柇鏂板綍鍏ユ暟鎹韩浠借瘉鏄惁鏈夐噸澶�
- let idcardList = this.list.map(item => item.idcardNo)
+ let idcardList = this.list.map(item => item.idCard)
if (this.hasDuplicates(idcardList)) {
this.$message.warning('韬唤璇佹湁閲嶅')
return
+ }
+ // 鍒ゆ柇韬唤璇佹槸鍚︽湁鏁�
+ for (let i = 0; i < this.list.length; i++) {
+ const regExp = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
+ if (!regExp.test(this.list[i].idCard)) {
+ this.$message.warning(`绗�${i + 1}椤瑰憳宸ヨ韩浠借瘉涓嶅悎娉昤)
+ return
+ }
}
// 鍒ゆ柇璇︽儏鍒楄〃鏁版嵁韬唤璇佹槸鍚︽湁閲嶅
let next = true
this.list.forEach(item => {
this.arr.forEach(child => {
- if (item.idcardNo === child.idcardNo) {
+ if (item.idCard === child.idCard) {
next = false
}
})
})
if (next) {
+ this.list.forEach(item => {
+ item.fee = this.price
+ })
this.$emit('result', this.list)
this.visible = false
} else {
--
Gitblit v1.9.3