BAOLH
2026-04-03 dd8e042ebc1dbfe62ec5ceba8e03773d44951f84
Merge branch 'wcd-2411-update' into wcd
1 files modified
19 ■■■■■ changed files
eladmin-web-master/src/views/system/user/index.vue 19 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/system/user/index.vue
@@ -154,8 +154,8 @@
                />
              </el-select>
            </el-form-item>
            <el-form-item label="二级岗位" prop="jobSecond.id">
              <el-select v-model="form.jobSecond.id" clearable style="width: 184px" placeholder="请选择">
            <el-form-item label="二级岗位" prop="jobSecondId">
              <el-select v-model="form.jobSecondId" clearable style="width: 184px" placeholder="请选择">
                <el-option
                  v-for="item in jobSeconds"
                  :key="item.name"
@@ -328,7 +328,7 @@
let userRoles = []
let userJobs = []
let userCompanys = []
const defaultForm = { id: null, username: null, company: { id: null }, internshipTime: null, nickName: null, gender: '男', email: null, enabled: 'false', loginEnabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, weComId: null, sysRostering: { id: null }, levelId: null, companys: [], jobSecond: { id: null }}
const defaultForm = { id: null, username: null, company: { id: null }, internshipTime: null, nickName: null, gender: '男', email: null, enabled: 'false', loginEnabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, weComId: null, sysRostering: { id: null }, levelId: null, companys: [], jobSecond: { id: null }, jobSecondId: null }
export default {
  name: 'User',
  components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
@@ -446,11 +446,14 @@
    },
    // 钩子:在添加/编辑之前执行
    [CRUD.HOOK.beforeSubmit]() {
      console.log(this.form)
      // 未选择二级岗位时清空jobSecond对象,防止后端对象异常
      if (!this.form.jobSecond || this.form.jobSecond.id == null || this.form.jobSecond.id === '') {
        this.form.jobSecond = undefined
      }
      // 未选择二级岗位时清空jobSecond对象(不能传{},只可传null或undefined),防止后端对象异常
      this.form.jobSecond = this.form.jobSecondId && this.form.jobSecondId !== '' ? { id: this.form.jobSecondId } : null
      return true
    },
    // 钩子:在开启添加/编辑之前执行
    [CRUD.HOOK.beforeToCU]() {
      // 使用jobSecondId对象代替jobSecond.id绑定表单,防止值变化导致的前端表单异常
      this.form.jobSecondId = this.form.jobSecond ? this.form.jobSecond.id : null
      return true
    },
    // 禁止输入空格