| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="departmentForm.depLevel !== 1"> |
| | | <el-form-item label="上级部门" prop="parentDepId"> |
| | | <el-cascader :options="deptData" class="input-add" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请选择部门" clearable v-model="departmentForm.parentDepId"> </el-cascader> |
| | | </el-form-item> |
| | |
| | | depName: string; |
| | | depCode: string; |
| | | depInfo: string; |
| | | parentDepId: string; |
| | | parentDepId: null | number |
| | | depLevel:null | number |
| | | }; |
| | | deptData: Array<TableDataRow>; |
| | |
| | | departmentForm: { |
| | | depName: '', |
| | | depCode: '', |
| | | parentDepId: '', |
| | | parentDepId: null, |
| | | depInfo: '', |
| | | depLevel:null, |
| | | }, |
| | |
| | | state.departmentForm = { |
| | | depName: '', |
| | | depCode: '', |
| | | parentDepId: '', |
| | | parentDepId: null, |
| | | depLevel:null, |
| | | depInfo: '' |
| | | }; |
| | |
| | | await formEl.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | if (state.title === '新增部门') { |
| | | if(state.departmentForm.depLevel == 1){ |
| | | state.departmentForm.parentDepId = null |
| | | } |
| | | let res = await departmentApi().addDepartment(state.departmentForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | |
| | | }); |
| | | } |
| | | } else { |
| | | if(state.departmentForm.depLevel == 1){ |
| | | state.departmentForm.parentDepId = null |
| | | } |
| | | let res = await departmentApi().modDepartment(state.departmentForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |