| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" title="用户选择" width="60%" draggable> |
| | | <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="names" placeholder="请输入组织机构过滤"></el-input> |
| | | <el-input v-model="filterText" placeholder="请输入组织机构过滤"></el-input> |
| | | <div class="tree"> |
| | | <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" /> |
| | | <el-tree ref="treeRef" :data="data" :props="propse" @node-click="handleNodeClick" :filter-node-method="filterNode" /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="14"> |
| | | <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> |
| | | <!-- <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> --> |
| | | <el-col :span="8" :offset="1"> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm(ruleFormRef)">查询</el-button> |
| | | <el-button @click="resetForm(ruleFormRef)">重置</el-button> |
| | | <!-- <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"> |
| | | <el-table-column align="center" width="50px"> |
| | | <template #default> |
| | | <el-radio-group v-model="radio1" class="ml-4"> |
| | | <el-radio label="1" size="large"> </el-radio> |
| | | <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="date" label="安全目标指标" /> |
| | | <el-table-column align="center" prop="name" label="目标指标编号" /> |
| | | <el-table-column align="center" prop="address" label="年度" /> |
| | | <el-table-column align="center" prop="address" label="指标值" /> |
| | | <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="[100, 200, 300, 400]" |
| | | :small="small" |
| | | :disabled="disabled" |
| | | :background="background" |
| | | :page-sizes="[10, 20, 30, 40]" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="400" |
| | | :total="total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-tag v-for="tag in dynamicTags" :key="tag" class="mx-1" style="margin:5px" closable :disable-transitions="false" @close="handleClose(tag)"> |
| | | {{ tag }} |
| | | <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="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, reactive } from 'vue'; |
| | | 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() { |
| | | //左边树形部分 |
| | | 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) => { |
| | | console.log(data); |
| | | 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: Tree[] = [ |
| | | { |
| | | label: 'Level one 1', |
| | | children: [ |
| | | { |
| | | label: 'Level two 1-1', |
| | | children: [ |
| | | { |
| | | label: 'Level three 1-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: 'Level one 2', |
| | | children: [ |
| | | { |
| | | label: 'Level two 2-1', |
| | | children: [ |
| | | { |
| | | label: 'Level three 2-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: 'Level two 2-2', |
| | | children: [ |
| | | { |
| | | label: 'Level three 2-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: 'Level one 3', |
| | | children: [ |
| | | { |
| | | label: 'Level two 3-1', |
| | | children: [ |
| | | { |
| | | label: 'Level three 3-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: 'Level two 3-2', |
| | | children: [ |
| | | { |
| | | label: 'Level three 3-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | ]; |
| | | const data = ref(); |
| | | //中间表格 |
| | | // 搜索条件 |
| | | const ruleForm = reactive({ |
| | |
| | | checkPass: '', |
| | | }); |
| | | // 表格 |
| | | const tableData = [ |
| | | { |
| | | date: '2016-05-03', |
| | | name: 'Tom', |
| | | address: 'No. 189, Grove St, Los Angeles', |
| | | }, |
| | | { |
| | | date: '2016-05-02', |
| | | name: 'Tom', |
| | | address: 'No. 189, Grove St, Los Angeles', |
| | | }, |
| | | { |
| | | date: '2016-05-04', |
| | | name: 'Tom', |
| | | address: 'No. 189, Grove St, Los Angeles', |
| | | }, |
| | | { |
| | | date: '2016-05-01', |
| | | name: 'Tom', |
| | | address: 'No. 189, Grove St, Los Angeles', |
| | | }, |
| | | ]; |
| | | const pageSize4 = ref(100); |
| | | const tableData = ref(); |
| | | const currentPage4 = ref(1); |
| | | const pageSize4 = ref(10); |
| | | const total=ref() |
| | | const handleSizeChange = (val: number) => { |
| | | console.log(`${val} items per page`); |
| | | // console.log(`${val} items per page`); |
| | | pageSize4.value=val |
| | | }; |
| | | const handleCurrentChange = (val: number) => { |
| | | console.log(`current page: ${val}`); |
| | | // console.log(`current page: ${val}`); |
| | | currentPage4.value=val |
| | | }; |
| | | const radio1 = ref('1'); |
| | | // 右方点击添加后显示标签 |
| | | const dynamicTags = ref(['Tag 1', 'Tag 2', 'Tag 3']); |
| | | const handleClose = (tag: string) => { |
| | | 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 = () => { |
| | | 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, |
| | |
| | | openDailog, |
| | | ruleForm, |
| | | tableData, |
| | | currentPage4, |
| | | pageSize4, |
| | | handleSizeChange, |
| | | handleCurrentChange, |
| | | handleSelectionChange, |
| | | radio1, |
| | | dynamicTags, |
| | | handleClose |
| | | handleClose, |
| | | FullScreen, |
| | | full, |
| | | toggleFullscreen, |
| | | radio, |
| | | submitForm, |
| | | }; |
| | | }, |
| | | }); |