<template>
|
<el-dialog v-model="dialogVisible" :fullscreen="full" title="用户选择" width="60%" draggable>
|
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
|
<el-row>
|
<el-col :span="6">
|
<div class="userTree">
|
<el-input v-model="filterText" placeholder="请输入组织机构过滤"></el-input>
|
<div class="tree">
|
<el-tree ref="treeRef" :data="data" :props="propse" @node-click="handleNodeClick" :filter-node-method="filterNode" />
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="14" style="padding: 20px">
|
<el-form ref="ruleFormRef" :model="ruleForm" status-icon>
|
<el-row>
|
<!-- <el-col :span="10" :offset="1">
|
<el-form-item size="default">
|
<el-input v-model="ruleForm.pass" placeholder="登录名" />
|
</el-form-item>
|
</el-col> -->
|
<el-col :span="8" :offset="1">
|
<el-form-item>
|
<!-- <el-button size="default" type="primary" >查询</el-button> -->
|
<el-button size="default" @click="clear">清除选择</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-table :data="tableData" style="width: 100%; margin-top: 20px" ref="clearAll" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" v-if="types==0"/>
|
<el-table-column align="center" v-if="types!=0">
|
<template #default="scope">
|
<el-radio-group v-model="radio1">
|
<el-radio :label="scope.row.uid" @click="radio(scope.row)" size="large">{{ null }}</el-radio>
|
</el-radio-group>
|
</template>
|
</el-table-column>
|
<el-table-column align="center" prop="realName" label="登录名" />
|
<el-table-column align="center" prop="username" label="用户名" />
|
<el-table-column align="center" prop="address" label="所属机构" />
|
<el-table-column align="center" prop="address" label="所属部门" />
|
<el-table-column align="center" prop="type" label="状态" />
|
</el-table>
|
<el-pagination
|
style="padding: 20px 0; border-bottom: 1px solid #dedede"
|
v-model:currentPage="currentPage4"
|
v-model:page-size="pageSize4"
|
:page-sizes="[10, 20, 30, 40]"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</el-col>
|
<el-col :span="4">
|
<div v-if="dynamicTags[0]==''?false:true">
|
<el-tag
|
v-for="tag in dynamicTags"
|
:key="tag"
|
class="mx-1"
|
style="margin: 5px"
|
closable
|
:disable-transitions="false"
|
@close="handleClose(tag)"
|
>
|
{{ tag.realName }}
|
</el-tag>
|
</div>
|
</el-col>
|
</el-row>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="dialogVisible = false" size="default">关闭</el-button>
|
<el-button type="primary" @click="submitForm" size="default">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</template>
|
<script lang="ts">
|
import { defineComponent, ref, onMounted, reactive, watch } from 'vue';
|
import { FullScreen } from '@element-plus/icons-vue';
|
import { ElMessageBox, ElTree, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus';
|
import { goalManagementApi } from '/@/api/goalManagement';
|
interface Tree {
|
label: string;
|
children?: Tree[];
|
}
|
export default defineComponent({
|
setup(props, { emit }) {
|
//部门树
|
const department = () => {
|
goalManagementApi()
|
.getTreedepartment()
|
.then((res) => {
|
if (res.data.code == 200) {
|
data.value = res.data.data;
|
} else {
|
ElMessage.error(res.data.msg);
|
}
|
});
|
};
|
const propse = {
|
label: 'depName',
|
children: 'children',
|
value: 'depId',
|
};
|
//部门树查询
|
const filterText = ref('');
|
const treeRef = ref<InstanceType<typeof ElTree>>();
|
watch(filterText, (val) => {
|
treeRef.value!.filter(val);
|
});
|
const filterNode = (depName: string, data: Tree) => {
|
if (!depName) return true;
|
return data.depName.includes(depName);
|
};
|
onMounted(() => {
|
department();
|
});
|
//左边树形部分点击获取回调
|
const names = ref<any>();
|
const handleNodeClick = (data: Tree) => {
|
goalManagementApi()
|
.getManName(data.depId)
|
.then((res) => {
|
if (res.data.code == 200) {
|
tableData.value=res.data.data
|
total.value=tableData.value.length
|
}else{
|
ElMessage.error(res.data.msg);
|
}
|
});
|
};
|
|
const data = ref();
|
//中间表格
|
// 搜索条件
|
const ruleForm = reactive({
|
pass: '',
|
checkPass: '',
|
});
|
// 表格
|
const tableData = ref();
|
const currentPage4 = ref(1);
|
const pageSize4 = ref(10);
|
const total=ref()
|
const handleSizeChange = (val: number) => {
|
// console.log(`${val} items per page`);
|
pageSize4.value=val
|
};
|
const handleCurrentChange = (val: number) => {
|
// console.log(`current page: ${val}`);
|
currentPage4.value=val
|
};
|
// 右方点击添加后显示标签
|
const dynamicTags = ref(['']);
|
const handleClose = (tag: any) => {
|
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
|
radio1.value = '';
|
};
|
const radio1 = ref('');
|
const radio = (data: any) => {
|
dynamicTags.value[0] = data;
|
};
|
const handleSelectionChange = (val:any) => {
|
dynamicTags.value=val
|
}
|
const types=ref()
|
// 开启弹窗
|
const dialogVisible = ref(false);
|
const openDailog = (type:any) => {
|
types.value=type
|
dialogVisible.value = true;
|
};
|
//全屏
|
const full = ref(false);
|
const toggleFullscreen = () => {
|
if (full.value == false) {
|
full.value = true;
|
} else {
|
full.value = false;
|
}
|
};
|
const submitForm = () => {
|
if(types.value==0){
|
emit('SearchUser', dynamicTags.value,types.value);
|
}else {
|
emit('SearchUser', dynamicTags.value[0],types.value);
|
}
|
|
dialogVisible.value = false;
|
clear()
|
};
|
const clearAll=ref()
|
const clear=()=>{
|
dynamicTags.value=[]
|
radio1.value=""
|
clearAll.value.clearSelection()
|
}
|
return {
|
clear,
|
clearAll,
|
total,
|
types,
|
filterText,
|
treeRef,
|
filterNode,
|
propse,
|
dialogVisible,
|
names,
|
data,
|
handleNodeClick,
|
openDailog,
|
ruleForm,
|
tableData,
|
currentPage4,
|
pageSize4,
|
handleSizeChange,
|
handleCurrentChange,
|
handleSelectionChange,
|
radio1,
|
dynamicTags,
|
handleClose,
|
FullScreen,
|
full,
|
toggleFullscreen,
|
radio,
|
submitForm,
|
};
|
},
|
});
|
</script>
|
<style scoped>
|
.userTree {
|
border: 1px solid #ebeef5;
|
}
|
.userTree .el-input {
|
padding: 10px;
|
border-bottom: 1px solid #ebeef5;
|
}
|
.tree {
|
height: 500px;
|
overflow: hidden;
|
overflow-y: auto;
|
}
|
</style>
|