|
|
@@ -6,11 +6,16 @@
|
|
|
<el-row :gutter="15">
|
|
|
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
|
|
<el-form-item label="所属机构:">
|
|
|
- <org-select :data="organizationList" placeholder="请选择所属机构" v-model="form.groupId" />
|
|
|
+ <org-select :data="organizationList" placeholder="请选择所属机构" v-model="form.groupId"
|
|
|
+ @checkedKeys="checkedKeys" />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="负责部门:">
|
|
|
- <el-input v-model="form.deptId" readonly @click="openTree"></el-input>
|
|
|
+
|
|
|
+
|
|
|
+ <el-cascader class="ele-block" :options="organizationList" placeholder="请选择负责部门" :props="defaultProps"
|
|
|
+ collapse-tags v-model="deptTree" clearable></el-cascader>
|
|
|
+
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
@@ -92,14 +97,13 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
|
|
|
- <orgDeptTree ref="depRef" :depData="organizationList" :visible.sync="depVisible"></orgDeptTree>
|
|
|
+
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { emailReg, phoneReg } from 'ele-admin';
|
|
|
import OrgSelect from './org-select.vue';
|
|
|
-import orgDeptTree from './org-dept-tree.vue'
|
|
|
import RoleSelect from '@/views/system/user/components/role-select.vue';
|
|
|
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
|
|
import { getNotBoundAccount } from '@/api/system/user';
|
|
|
@@ -109,7 +113,7 @@ import {
|
|
|
checkExistence
|
|
|
} from '@/api/system/organization';
|
|
|
export default {
|
|
|
- components: { OrgSelect, RoleSelect, RegionsSelect, orgDeptTree },
|
|
|
+ components: { OrgSelect, RoleSelect, RegionsSelect },
|
|
|
props: {
|
|
|
// 弹窗是否打开
|
|
|
visible: Boolean,
|
|
|
@@ -123,7 +127,9 @@ export default {
|
|
|
data() {
|
|
|
const defaultForm = {
|
|
|
id: null,
|
|
|
- deptId: null,
|
|
|
+ deptId: [
|
|
|
+ ],
|
|
|
+
|
|
|
groupId: null,
|
|
|
name: '',
|
|
|
sex: null,
|
|
|
@@ -187,8 +193,10 @@ export default {
|
|
|
],
|
|
|
accountList: [],
|
|
|
|
|
|
- depVisible: false,
|
|
|
+ deptTree: [],
|
|
|
defaultProps: {
|
|
|
+ multiple: true,
|
|
|
+ checkStrictly: true,
|
|
|
children: 'children',
|
|
|
value: 'id',
|
|
|
label: 'name'
|
|
|
@@ -215,6 +223,18 @@ export default {
|
|
|
}
|
|
|
this.loading = true;
|
|
|
this.form.addressId = this.city ? this.city[this.city.length - 1] : '';
|
|
|
+
|
|
|
+ if (this.deptTree.length > 0) {
|
|
|
+ this.deptTree.forEach(i => {
|
|
|
+ this.form.deptId.push(i[i.length - 1])
|
|
|
+ })
|
|
|
+
|
|
|
+ this.form['deptTree'] = JSON.stringify(this.deptTree)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const data = {
|
|
|
...this.form
|
|
|
};
|
|
|
@@ -243,11 +263,12 @@ export default {
|
|
|
this.$emit('update:visible', value);
|
|
|
},
|
|
|
|
|
|
- openTree() {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.depVisible = true
|
|
|
- })
|
|
|
+ checkedKeys(value) {
|
|
|
+ this.deptTree = []
|
|
|
+ this.deptTree.push(value)
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
},
|
|
|
watch: {
|
|
|
visible(visible) {
|
|
|
@@ -256,6 +277,15 @@ export default {
|
|
|
if (this.data) {
|
|
|
getUserDetail(this.data.id).then((res) => {
|
|
|
this.form = { ...res };
|
|
|
+
|
|
|
+ this.deptTree = []
|
|
|
+ this.form.deptId = []
|
|
|
+ if (this.form.deptTree) {
|
|
|
+ this.deptTree = JSON.parse(this.form.deptTree)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
this.city = res.addressId ? res.addressId.toString() : null;
|
|
|
this.isUpdate = true;
|
|
|
});
|