| | |
| | | label="所属部门:" |
| | | prop="departmentId" |
| | | > |
| | | <el-select |
| | | v-model="user.departmentId" |
| | | placeholder="请选择所属部门" |
| | | @change="getDepartName" |
| | | > |
| | | <el-option :value="mylabel"> |
| | | <el-tree |
| | | ref="tree" |
| | | :check-strictly="true" |
| | | :data="departList" |
| | | :props="defaultProps" |
| | | show-checkbox |
| | | @check-change="handleCheck" |
| | | @node-click="nodeClick" |
| | | default-expand-all |
| | | node-key="id" |
| | | > |
| | | </el-tree> |
| | | </el-option> |
| | | </el-select> |
| | | <departTree |
| | | :depart="userDepart" |
| | | @selectDepart="selectDepart" |
| | | ></departTree> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="item-right"></div> |
| | |
| | | </template> |
| | | <script> |
| | | import { getTypeList } from "@/utils/helper"; |
| | | import departTree from "@/components/departTree/index.vue"; |
| | | export default { |
| | | components: { |
| | | departTree, |
| | | }, |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | |
| | | jobTitle: null, |
| | | mac: "", |
| | | ip: "", |
| | | }, |
| | | }, |
| | | userDepart: {}, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | |
| | | } |
| | | }, |
| | | }, |
| | | selectOrg: { |
| | | orgsid: [], |
| | | }, |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | this.getRoleList(); |
| | | // 获取用户类型 |
| | | this.getUserTypeList(); |
| | | // 获取部门 |
| | | this.getDepartList(); |
| | | }, |
| | | methods: { |
| | | // 提交注册 |
| | |
| | | this.$refs["user"].validate((valid) => { |
| | | console.log(valid); |
| | | if (valid) { |
| | | const { user, selectOrg } = this; |
| | | const { user } = this; |
| | | console.log(user); |
| | | this.$axios |
| | | .post("sccg/admin/register", { |
| | | departmentId: selectOrg.orgsid[0], |
| | | departmentId: user.departmentId, |
| | | email: user.email, |
| | | icon: "", |
| | | isDy: `${user.isDy}`, |
| | |
| | | async getUserTypeList() { |
| | | this.typeList = await getTypeList(1, "07"); |
| | | }, |
| | | // 获取部门树 |
| | | getDepartList() { |
| | | this.$axios({ |
| | | method: "get", |
| | | url: "sccg/depart/tree", |
| | | }).then((res) => { |
| | | this.departList = res.data; |
| | | }); |
| | | }, |
| | | nodeClick(data, checked) { |
| | | this.checkedId = data.comcode; |
| | | this.$refs.tree.setCheckedNodes([data]); |
| | | this.user.departmentId = data.departName; |
| | | this.selectOrg.orgsid = []; |
| | | this.selectOrg.orgsid.push(data.id); |
| | | }, |
| | | handleCheck(data, checked) { |
| | | if (checked == true) { |
| | | this.checkedId = data.comcode; |
| | | this.$refs.tree.setCheckedNodes([data]); |
| | | this.user.departmentId = data.departName; |
| | | this.selectOrg.orgsid = []; |
| | | this.selectOrg.orgsid.push(data.id); |
| | | } else { |
| | | // 再次直接进行赋值为空操作 |
| | | this.selectOrg.orgsid = []; |
| | | this.user.departmentId = ""; |
| | | selectDepart(depart) { |
| | | if (depart) { |
| | | this.user.departmentId = depart.departId; |
| | | this.user.departName = depart.departName; |
| | | } |
| | | }, |
| | | }, |