| | |
| | | </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-group v-model="checkedUser"> |
| | | <el-checkbox v-for="user in userList" :label="user.id" :key="user.id"> |
| | | {{user.username}} |
| | | </el-checkbox> |
| | |
| | | departList: [], |
| | | checkedUser: [], |
| | | openUser: false, |
| | | departTypeList: [], |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.getDepartTree(); |
| | | // 获取用户列表 |
| | | this.getUserList(); |
| | | // 获取部门类型列表 |
| | | this.getDepartTypeList(); |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { depart, checkedUser } = this; |
| | | const { depart, checkedUser, userList } = this; |
| | | console.log(depart); |
| | | console.log(checkedUser); |
| | | this.$axios.post('/sccg/depart/create', { |
| | | 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 |
| | | parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes, |
| | | departManagerList: arr |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | |
| | | }, |
| | | // 获取所有用户信息 |
| | | 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; |
| | | console.log(this.userList); |
| | | } |
| | | }) |
| | | }, |
| | | 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() { |
| | | console.log(this.checkedUser); |
| | |
| | | }, |
| | | 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','changMyDialog'] |