luoyb
2021-02-18 450c4b15c755d6d2eef814e4e81d4c92388c313b
feat(在职员工): 关闭档案功能
1个文件已修改
71 ■■■■■ 已修改文件
src/views/user/inemployees.vue 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/inemployees.vue
@@ -1266,6 +1266,18 @@
                <el-radio :label="5">试用期内</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="自离天数" prop="selfLeaveDay">
              <el-input v-model="gbdaForm.selfLeaveDay" onkeyup="value=value.replace(/[^0-9.]/g,'')" />
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="报告人" prop="reporter">
              <el-input v-model="gbdaForm.reporter" />
            </el-form-item>
          </el-col>
          <el-col span="24">
            <el-form-item label="关闭日期" prop="dimissionDate">
              <el-date-picker
                v-model="gbdaForm.dimissionDate"
@@ -1594,6 +1606,8 @@
      gbdaRules: {
        dimissionType: [{ required: true, message: '请选择离职类型', trigger: 'change' }],
        dimissionDate: [{ required: true, message: '请选择关闭日期', trigger: 'change' }],
        selfLeaveDay: [{ required: true, validator: this.validSelfLeaveDay }],
        reporter: [{ required: true, validator: this.validReporter }],
        remark: [{ max: 500, message: '长度不超过500个字符', trigger: 'blur' }]
      },
      restaurants: [{ value: '北京市', code: '110000' },
@@ -2015,6 +2029,48 @@
          break
      }
    },
    validSelfLeaveDay(rule, value, callback) {
      const type = this.gbdaForm.dimissionType
      if (type === 2) {
        if (!value) {
          callback(new Error('自动离职时自离天数不能为空!'))
        } else {
          callback()
        }
      } else {
        callback()
      }
      // if (!value && type === 2) {
      //   callback(new Error('自动离职时自离天数不能为空!'))
      // } else {
      //   callback()
      // }
    },
    validReporter(rule, value, callback) {
      const type = this.gbdaForm.dimissionType
      if (type === 2) {
        if (!value) {
          callback(new Error('自动离职时报告人不能为空!'))
        } else {
          if (value.length > 32) {
            callback(new Error('自动离职时报告人最多32个字符!'))
          } else {
            callback()
          }
        }
      } else {
        callback()
      }
      // if (!value && type === 2) {
      //   callback(new Error('自动离职时报告人不能为空!'))
      // } else {
      //   if (value.length > 32) {
      //     callback(new Error('自动离职时报告人最多32个字符!'))
      //   } else {
      //     callback()
      //   }
      // }
    },
    showGbda(operate, formName) {
      switch (operate) {
        case 0:
@@ -2025,20 +2081,23 @@
              type: 'error'
            })
          } else {
            var empIds = []
            var ids = []
            var names = []
            var dates = []
            for (var i = 0; i < selection.length; i++) {
              var data = selection[i]
              empIds.push(data.empId)
              ids.push(data.empId)
              names.push(data.empName)
              dates.push(data.entryDate)
            }
            const nowDate = new Date()
            const year = nowDate.getFullYear()
            const month = nowDate.getMonth() + 1
            const day = nowDate.getDate()
            this.gbdaForm = {
              dgryIds: empIds.join(','),
              empIds: ids.join(','),
              dgryNames: names.join(','),
              entryDates: dates.join(','),
              dimissionType: '1',
              dimissionDate: year + '-' + month + '-' + day,
              remark: ''
@@ -2058,8 +2117,10 @@
                  message: this.$t('员工档案关闭成功'),
                  type: 'success'
                })
                this.fetch({ ...this.queryParams,
                  ...this.sort })
                this.fetch({
                  ...this.queryParams,
                  ...this.sort
                })
              })
            }
          })