| | |
| | | <template> |
| | | <div class="app-container"> |
| | | |
| | | <el-form :model="form" ref="form" label-width="100px" v-loading="formLoading"> |
| | | <el-form-item label="部门:" required> |
| | | <el-input v-model="form.name"></el-input> |
| | | <el-form :model="form" ref="form" label-width="120px" label-position="top" v-loading="formLoading"> |
| | | <el-form-item label="部门名称:" required> |
| | | <el-input v-model="form.name" style="width: 450px"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="上级部门:"> |
| | | <el-cascader |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="可管理三级单位:"> |
| | | <el-switch |
| | | style="display: block" |
| | | v-model="form.special" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949" |
| | | active-text="允许" |
| | | inactive-text="禁止"> |
| | | </el-switch> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm">提交</el-button> |
| | | <el-button type="primary" @click="submitForm">保存</el-button> |
| | | <el-button @click="resetForm">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | id: null, |
| | | name: '', |
| | | parentId: null, |
| | | adminId: null |
| | | adminId: null, |
| | | special: false, |
| | | // level: 1, |
| | | // levelName: '' |
| | | }, |
| | |
| | | if (id && parseInt(id) !== 0) { |
| | | _this.formLoading = true |
| | | departmentApi.select(id).then(re => { |
| | | re.response.parentId = re.response.parentIds |
| | | _this.form = re.response |
| | | _this.formLoading = false |
| | | }) |
| | |
| | | // let obj = { |
| | | // name: this.form.name |
| | | // } |
| | | _this.form.parentId = _this.form.parentId[0] |
| | | if (_this.form.parentId) { |
| | | _this.form.parentId = _this.form.parentId[_this.form.parentId.length - 1]; |
| | | } |
| | | if (_this.fig === 1) { |
| | | departmentApi.addData(this.form.name).then(res => { |
| | | departmentApi.addData(this.form).then(res => { |
| | | console.log(res) |
| | | if (res.code === 1) { |
| | | _this.$message.success(res.message) |
| | |
| | | id: null, |
| | | name: '', |
| | | level: 1, |
| | | levelName: '' |
| | | parentId: null, |
| | | levelName: '', |
| | | special: false |
| | | } |
| | | this.form.id = lastId |
| | | }, |