From 2f919191f1c7739eb0ef54392cd265284b55af9e Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期一, 29 一月 2024 19:58:52 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- company/src/components/enterprise/addEmployee.vue | 64 +++++++++++++++++++++++--------- 1 files changed, 46 insertions(+), 18 deletions(-) diff --git a/company/src/components/enterprise/addEmployee.vue b/company/src/components/enterprise/addEmployee.vue index 075e407..34d6fdb 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,29 +34,46 @@ 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) { @@ -67,28 +84,39 @@ }, 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