| | |
| | | </el-form-item> |
| | | <!-- 部门类型 --> |
| | | <el-form-item class="optionItem" label="部门类型:" prop="departType"> |
| | | <el-input v-model="depart.departType" placeholder="请选择部门类型"></el-input> |
| | | <el-select v-model="depart.departType" placeholder="请选择部门类型"> |
| | | <el-option v-for="item in departTypeList" :key="item.id" :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-input v-model="depart.departType" placeholder="请选择部门类型"></el-input> --> |
| | | </el-form-item> |
| | | <!--添加人员 --> |
| | | <el-form-item class="optionItem add" label="添加人员:"> |
| | |
| | | <div @click="addUser">添加</div> |
| | | </div> |
| | | <div class="scrollWrap"> |
| | | <el-checkbox-group :max="3" v-model="checkedUser" @change="handleCheckedUserChange"> |
| | | <el-checkbox v-for="user in userList" :label="user.username" :key="user.id" :value="user.id"> |
| | | <el-checkbox-group v-model="checkedUser"> |
| | | <el-checkbox v-for="user in userList" :label="user.id" :key="user.id"> |
| | | {{user.username}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | |
| | | </main> |
| | | <footer> |
| | | <div class="optionBtn"> |
| | | <el-button>取消</el-button> |
| | | <el-button @click="handleClose">取消</el-button> |
| | | <el-button type="primary" class="btn submit" @click="handleUser">确定</el-button> |
| | | </div> |
| | | </footer> |
| | |
| | | userList: [], |
| | | departList: [], |
| | | checkedUser: [], |
| | | openUser:false, |
| | | openUser: false, |
| | | departTypeList: [], |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.getDepartTree(); |
| | | // 获取用户列表 |
| | | this.getUserList(); |
| | | // 获取部门类型列表 |
| | | this.getDepartTypeList(); |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { depart } = this; |
| | | const { depart, checkedUser, userList } = this; |
| | | console.log(depart); |
| | | // this.$axios.post('/sccg/depart/create', { |
| | | // departName: depart.departName, |
| | | // parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes |
| | | // }).then(res => { |
| | | // if (res.code === 200) { |
| | | // this.$message({ |
| | | // message:res.message, |
| | | // type:'success' |
| | | // }) |
| | | // this.refresh(); |
| | | // }else if(res.code ===2001){ |
| | | // this.$message({ |
| | | // message:res.message, |
| | | // type:'error' |
| | | // }) |
| | | // this.refresh(); |
| | | // } |
| | | // }) |
| | | console.log(checkedUser); |
| | | const arr = []; |
| | | checkedUser.forEach(item => { |
| | | userList.forEach(child => { |
| | | if (item === child.id) { |
| | | arr.push({ isLeader: 0, userId: item,}); |
| | | } |
| | | }) |
| | | }) |
| | | this.$axios({ |
| | | method: 'post', |
| | | url:'/sccg/depart/create', |
| | | data: { |
| | | departName: depart.departName, |
| | | parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes, |
| | | departManagerList: arr |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | message: res.message, |
| | | type: 'success' |
| | | }) |
| | | this.refresh(); |
| | | } else if (res.code === 2001) { |
| | | this.$message({ |
| | | message: res.message, |
| | | type: 'error' |
| | | }) |
| | | this.refresh(); |
| | | } |
| | | }) |
| | | } else { |
| | | return false; |
| | | } |
| | |
| | | }, |
| | | // 获取所有用户信息 |
| | | getUserList() { |
| | | const that = this; |
| | | const { currentPage, pageSize, search } = this; |
| | | // 获取所有用户信息、用户查询(暂时支持电话号码) |
| | | this.$axios.get(`sccg/admin/list`).then(res => { |
| | | if (res.code === 200) { |
| | | console.log(res) |
| | | this.userList = res.data.records; |
| | | } |
| | | }) |
| | | }, |
| | | handleCheckedUserChange(value) { |
| | | // console.log(value); |
| | | if(value.length>3){ |
| | | console.log(this.checkedUser); |
| | | this.$message({ |
| | | type:'warning', |
| | | message:'最多只能添加三个成员' |
| | | }) |
| | | } |
| | | // let checkedCount = value.length; |
| | | // this.checkAll = checkedCount === this.cities.length; |
| | | // this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length; |
| | | }, |
| | | addUser(){ |
| | | addUser() { |
| | | console.log(this.checkedUser); |
| | | this.openUser = false; |
| | | }, |
| | | handleClose() { |
| | | this.$emit('changMyDialog', { flag: false }); |
| | | }, |
| | | // 获取部门类型 |
| | | getDepartTypeList() { |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/dict/query_depart_type', |
| | | }) |
| | | .then(res => { |
| | | console.log(res); |
| | | this.departTypeList = res.data; |
| | | }) |
| | | } |
| | | }, |
| | | props: ['refresh'] |
| | | props: ['refresh', 'changMyDialog'] |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | |
| | | position: absolute; |
| | | z-index: 2000; |
| | | right: 0; |
| | | |
| | | .box-card { |
| | | max-height: 200px; |
| | | overflow: hidden; |