luoyb
2021-03-06 deb42cf1c3b3fc80c579b140939bc459d4262604
fix(bug修复): 在职员工录入身份证校验

1.如果存在身份证则根据员工状态做不同的操作
2.去掉了档案信息中的debugger语句
4个文件已修改
164 ■■■■ 已修改文件
src/utils/myUtil.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/archivesChange.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/inemployees.vue 146 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/outemployess.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/myUtil.js
@@ -53,6 +53,13 @@
  return age
}
/**
 * 计算日期时间间隔
 * @param begin 起始时间
 * @param end 结束时间
 * @param flag 间隔单位
 * @returns {*}
 */
export function dateDifference(begin, end, flag) {
  let dateSpan
  let iReturn
@@ -70,3 +77,11 @@
  }
  return iReturn
}
export function dateToString(val) {
  val = new Date(val)
  const year = val.getFullYear()
  const month = val.getMonth() + 1
  const day = val.getDate()
  return year + '-' + month + '-' + day
}
src/views/user/archivesChange.vue
@@ -3181,7 +3181,6 @@
      this.$get('hr/empInsurance/list', {
        ...params
      }).then((r) => {
        debugger
        const data = r.data.data
        this.insuranceDatatotal = data.total
        this.insuranceData = data.rows
src/views/user/inemployees.vue
@@ -834,7 +834,7 @@
import Pagination from '@/components/Pagination'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { calculateSeniority, toCardGetUserInfo } from '@/utils/myUtil'
import { calculateSeniority, toCardGetUserInfo, dateToString } from '@/utils/myUtil'
import ArchivesEdit from './archivesEdit'
import { pages } from '@/settings'
@@ -894,7 +894,7 @@
        birthdate: '',
        politics: '13',
        entryDate: '',
        education: '61',
        education: '17',
        seniority: '',
        nativePlace: '',
        nativePlaceName: '',
@@ -1088,7 +1088,8 @@
      changeTypeOptions: [],
      dimissionTypeOptions: [],
      ageStrOptions: [],
      sexOptions: []
      sexOptions: [],
      openArchivesForm: {}
    }
  },
  mounted() {
@@ -1416,6 +1417,7 @@
      this.empBaseInfoImageUrl = ''
    },
    editEmpBase(row) {
      console.log(row)
      this.isAdd = false
      this.empBaseInfoForm.empId = row.empId
      this.empBaseInfoForm.customerId = row.customerId
@@ -1471,26 +1473,52 @@
    putEmpBase(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.isAdd) {
            this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then((r) => {
              r.data
              this.buttonLoading = false
              this.$message({
                message: this.$t('tips.createSuccess'),
                type: 'success'
              })
              this.cleanEmpBase()
            })
          } else {
            this.$put('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
              this.$message({
                message: this.$t('tips.updateSuccess'),
                type: 'success'
              })
              this.$emit('success')
              this.cleanEmpBase()
            })
          }
          this.submitEmpInfo()
          // if (this.isAdd) {
          //   this.$post('hr/empBaseInfo/addInEmp', { ...this.empBaseInfoForm }).then((r) => {
          //     if (r.data != null) {
          //       if (r.data.data.empStatus === '0') {
          //         this.$confirm('该员工已存在,是否修改?', '提示', {
          //           confirmButtonText: '确定',
          //           cancelButtonText: '取消',
          //           type: 'warning'
          //         }).then(() => {
          //           this.editEmpBase(r.data.data)
          //         })
          //       } else {
          //         this.$confirm('该员工已离职,是否重新打开档案?', '提示', {
          //           confirmButtonText: '确定',
          //           cancelButtonText: '取消',
          //           type: 'warning'
          //         }).then(() => {
          //           this.openArchivesForm = {
          //             empId: r.data.data.empId,
          //             empName: r.data.data.empName,
          //             certificateNumb: r.data.data.certificateNumb,
          //             openType: 2,
          //             openDate: this.getDateString(),
          //             remark: ''
          //           }
          //           this.$post('hr/empOpenArchives', { ...this.openArchivesForm }).then(() => {
          //             this.$message({
          //               message: this.$t('员工档案打开成功'),
          //               type: 'success'
          //             })
          //           })
          //         })
          //       }
          //     }
          //   })
          // } else {
          //   this.$put('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
          //     this.$message({
          //       message: this.$t('tips.updateSuccess'),
          //       type: 'success'
          //     })
          //     this.$emit('success')
          //     this.cleanEmpBase()
          //   })
          // }
          this.fetch({
            ...this.queryParams,
            ...this.sort
@@ -1503,16 +1531,17 @@
    putEmpBaseContinue(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.isAdd) {
            this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
              this.buttonLoading = false
              this.$message({
                message: this.$t('tips.createSuccess'),
                type: 'success'
              })
              this.cleanEmpBase()
            })
          }
          this.submitEmpInfo()
          // if (this.isAdd) {
          //   this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
          //     this.buttonLoading = false
          //     this.$message({
          //       message: this.$t('tips.createSuccess'),
          //       type: 'success'
          //     })
          //     this.cleanEmpBase()
          //   })
          // }
          this.cleanEmpBase()
          this.fetch({
            ...this.queryParams,
@@ -1554,6 +1583,7 @@
    },
    showXzyg(val) {
      if (val === 0) {
        // this.cleanEmpBase()
        this.isAdd = true
      }
      if (!this.dialogShowXzyg) {
@@ -1883,6 +1913,56 @@
      } else {
        return null
      }
    },
    getDateString() {
      return dateToString(new Date())
    },
    submitEmpInfo() {
      if (this.isAdd) {
        this.$post('hr/empBaseInfo/addInEmp', { ...this.empBaseInfoForm }).then((r) => {
          if (r.data != null) {
            if (r.data.data.empStatus === '0') {
              this.$confirm('该员工已存在,是否修改?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.editEmpBase(r.data.data)
              })
            } else {
              this.$confirm('该员工已离职,是否重新打开档案?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.openArchivesForm = {
                  empId: r.data.data.empId,
                  empName: r.data.data.empName,
                  certificateNumb: r.data.data.certificateNumb,
                  openType: 2,
                  openDate: this.getDateString(),
                  remark: ''
                }
                this.$post('hr/empOpenArchives', { ...this.openArchivesForm }).then(() => {
                  this.$message({
                    message: this.$t('员工档案打开成功'),
                    type: 'success'
                  })
                })
              })
            }
          }
        })
      } else {
        this.$put('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
          this.$message({
            message: this.$t('tips.updateSuccess'),
            type: 'success'
          })
          this.$emit('success')
          this.cleanEmpBase()
        })
      }
    }
  }
}
src/views/user/outemployess.vue
@@ -976,7 +976,7 @@
<script>
import Pagination from '@/components/Pagination'
import ArchivesChange from './archivesChange'
import { dateToString } from '@/utils/myUtil'
export default {
  components: {
    ArchivesChange,