| | |
| | | </el-form-item> |
| | | <!-- 上级部门 --> |
| | | <el-form-item class="optionItems" label="上级部门:" prop="parentId"> |
| | | <el-select v-model="depart.parentId" placeholder="请输入上级部门"> |
| | | <el-option :value="mylabel"> |
| | | <el-select ref="projectApplicant" v-model="depart.parentId" placeholder="请输入上级部门"> |
| | | <el-option :value="mylabel"> |
| | | <el-tree |
| | | ref="tree" |
| | | :check-strictly="true" |
| | | :data="departList" |
| | | :props="defaultProps" |
| | | show-checkbox |
| | | @node-click="handleCheck" |
| | | @check-change="handleCheck" |
| | | default-expand-all |
| | | node-key="id" |
| | |
| | | <li class="li-btn"> |
| | | <i class="el-icon-plus" @click="openUser = true"></i> |
| | | </li> |
| | | <li class="li-btn"> |
| | | <el-tooltip class="item" effect="light" content="清除选中人员" placement="top" :enterable="false"> |
| | | <i class="el-icon-minus" @click="clrarUser"></i> |
| | | </el-tooltip> |
| | | |
| | | </li> |
| | | </ul> |
| | | <div class="card" v-if="openUser"> |
| | | <el-card class="box-card"> |
| | | <div slot="header" class="myclear"> |
| | | <span>工作人员</span> |
| | | <div @click="addUser">确认</div> |
| | | <div class="box-card-sub" @click="addUser">确认</div> |
| | | </div> |
| | | <div class="scrollWrap"> |
| | | <el-checkbox-group v-model="checkedUser"> |
| | |
| | | if (this.checkedList.length > 0) this.checkedList[0].leader = true; |
| | | this.openUser = false; |
| | | }, |
| | | // 清除选中用户 |
| | | clrarUser(){ |
| | | this.checkedUser=[] |
| | | }, |
| | | handleClose() { |
| | | this.$emit("changMyDialog", { flag: false }); |
| | | }, |
| | |
| | | this.departTypeList = await getTypeList(1, "08"); |
| | | }, |
| | | handleCheck(data, checked) { |
| | | this.depart.parentId = data.departName; |
| | | // 获取当前选择的id在数组中的索引 |
| | | const indexs = this.selectOrg.orgsid.indexOf(data.id); |
| | | // 如果不存在数组中,并且数组中已经有一个id并且checked为true的时候,代表不能再次选择。 |
| | | if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) { |
| | | this.$message({ |
| | | message: "只能选择一个部门!", |
| | | type: "warning", |
| | | showClose: true, |
| | | }); |
| | | // 设置已选择的节点为false 很重要 |
| | | this.$refs.tree.setChecked(data, false); |
| | | } else if (this.selectOrg.orgsid.length === 0 && checked) { |
| | | // 发现数组为空 并且是已选择 |
| | | // 防止数组有值,首先清空,再push |
| | | this.selectOrg.orgsid = []; |
| | | this.selectOrg.orgsid.push(data.id); |
| | | } else if ( |
| | | indexs >= 0 && |
| | | this.selectOrg.orgsid.length === 1 && |
| | | !checked |
| | | ) { |
| | | // 再次直接进行赋值为空操作 |
| | | this.selectOrg.orgsid = []; |
| | | this.depart.parentId = ""; |
| | | if(checked.childNodes.length == 0){ |
| | | this.depart.parentId = data.departName; |
| | | let _this = this; |
| | | _this.$refs.projectApplicant.blur(); |
| | | this.selectOrg.orgsid = [] |
| | | this.selectOrg.orgsid.push(data.id) |
| | | }else { |
| | | return |
| | | } |
| | | |
| | | // this.depart.parentId = data.departName; |
| | | // // 获取当前选择的id在数组中的索引 |
| | | // const indexs = this.selectOrg.orgsid.indexOf(data.id); |
| | | // // 如果不存在数组中,并且数组中已经有一个id并且checked为true的时候,代表不能再次选择。 |
| | | // if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) { |
| | | // this.$message({ |
| | | // message: "只能选择一个部门!", |
| | | // type: "warning", |
| | | // showClose: true, |
| | | // }); |
| | | // // 设置已选择的节点为false 很重要 |
| | | // this.$refs.tree.setChecked(data, false); |
| | | // } else if (this.selectOrg.orgsid.length === 0 && checked) { |
| | | // // 发现数组为空 并且是已选择 |
| | | // // 防止数组有值,首先清空,再push |
| | | // this.selectOrg.orgsid = []; |
| | | // this.selectOrg.orgsid.push(data.id); |
| | | // } else if ( |
| | | // indexs >= 0 && |
| | | // this.selectOrg.orgsid.length === 1 && |
| | | // !checked |
| | | // ) { |
| | | // // 再次直接进行赋值为空操作 |
| | | // this.selectOrg.orgsid = []; |
| | | // this.depart.parentId = ""; |
| | | // } |
| | | }, |
| | | // 设置领导 |
| | | setLeader(idx) { |
| | |
| | | width: 36px; |
| | | height: 36px; |
| | | border-radius: 50%; |
| | | .el-icon-plus{ |
| | | cursor: pointer; |
| | | } |
| | | .el-icon-minus{ |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .el-form-item__content { |
| | | width: 400px; |
| | |
| | | // color: #4b9bb7; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .box-card-sub{ |
| | | color: #2f54eb; |
| | | margin-left: 5px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .hidebar { |
| | |
| | | padding-right: 20px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |