|
@@ -0,0 +1,169 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="User">
|
|
|
|
|
+ <div class="left">
|
|
|
|
|
+ <div class="filter-title">
|
|
|
|
|
+ <el-input v-model="queryContent" placeholder="请输入搜索的内容" clearable>
|
|
|
|
|
+ <template #prepend>
|
|
|
|
|
+ <el-select v-model="selectType" class="select-type">
|
|
|
|
|
+ <el-option v-for="item in searchOptions" :key="item.value" :value="item.value" :label="item.label" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <el-button type="primary" @click="handleSearch">搜 索</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="filter-result" v-loading="loading">
|
|
|
|
|
+ <div class="empty" v-if="nodeData[0].children.length === 0">
|
|
|
|
|
+ <img :src="empty" alt="" />
|
|
|
|
|
+ <div>暂无数据</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-tree
|
|
|
|
|
+ v-else
|
|
|
|
|
+ ref="treeRef"
|
|
|
|
|
+ :data="nodeData"
|
|
|
|
|
+ show-checkbox
|
|
|
|
|
+ node-key="id"
|
|
|
|
|
+ :props="defaultProps"
|
|
|
|
|
+ :default-expand-all="true"
|
|
|
|
|
+ style="padding: 10px 0"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="right">
|
|
|
|
|
+ <!-- <div class="head">
|
|
|
|
|
+ <span style="font-weight: 400; font-size: 16px; color: rgba(0, 0, 0, 0.88); line-height: 22px"
|
|
|
|
|
+ >已选择:{{ selectedPersonList.length }}人</span
|
|
|
|
|
+ >
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ <!-- <div class="selected">
|
|
|
|
|
+ <el-tag
|
|
|
|
|
+ v-for="person in selectedPersonList"
|
|
|
|
|
+ :key="person.id"
|
|
|
|
|
+ closable
|
|
|
|
|
+ @close="handleRemoveSelectedPerson(person.id)"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ person.staffNo + '-' + person.realname }}
|
|
|
|
|
+ </el-tag>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ <div class="footer">
|
|
|
|
|
+ <el-button @click="emit('cancel')">取消</el-button>
|
|
|
|
|
+ <el-button type="primary">确定</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
|
+ import { nextTick, ref } from 'vue';
|
|
|
|
|
+ import empty from 'assets/images/empty@1X.png';
|
|
|
|
|
+ import { queryAvailableUserList } from '@/api/push-object';
|
|
|
|
|
+ import type { TreeNodeData } from '@/views/disaster/types';
|
|
|
|
|
+ const loading = ref(false);
|
|
|
|
|
+ const queryContent = ref('');
|
|
|
|
|
+ const nodeData = ref<TreeNodeData[]>([
|
|
|
|
|
+ {
|
|
|
|
|
+ id: -1,
|
|
|
|
|
+ name: '全部',
|
|
|
|
|
+ children: [],
|
|
|
|
|
+ },
|
|
|
|
|
+ ]);
|
|
|
|
|
+ const searchResult = ref<TreeNodeData[]>([]);
|
|
|
|
|
+ const defaultProps = {
|
|
|
|
|
+ children: 'children',
|
|
|
|
|
+ label: 'name',
|
|
|
|
|
+ };
|
|
|
|
|
+ const searchOptions = ref([
|
|
|
|
|
+ { value: 'realname', label: '姓名' },
|
|
|
|
|
+ { value: 'staffNo', label: '工号' },
|
|
|
|
|
+ { value: 'deptName', label: '部门' },
|
|
|
|
|
+ ]);
|
|
|
|
|
+ const selectType = ref(searchOptions.value[0].value);
|
|
|
|
|
+ const getUserList = async () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ const res = await queryAvailableUserList();
|
|
|
|
|
+ searchResult.value = res.map((user) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: user.id,
|
|
|
|
|
+ name: `${user.realname}-${user.deptName}`,
|
|
|
|
|
+ children: [],
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ nodeData.value[0].children = searchResult.value;
|
|
|
|
|
+ console.log(nodeData.value);
|
|
|
|
|
+ await nextTick();
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ };
|
|
|
|
|
+ const handleSearch = () => {
|
|
|
|
|
+ console.log(queryContent.value, selectType.value);
|
|
|
|
|
+ getUserList();
|
|
|
|
|
+ };
|
|
|
|
|
+ const emit = defineEmits(['cancel', 'submit']);
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+ .User {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ .left {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ width: 50%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ padding: 0 5px;
|
|
|
|
|
+ border-right: 1px solid rgba($text-color, 0.1);
|
|
|
|
|
+ }
|
|
|
|
|
+ .filter-title {
|
|
|
|
|
+ @include flex-center;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ }
|
|
|
|
|
+ .filter-result {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ .empty,
|
|
|
|
|
+ img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ .empty {
|
|
|
|
|
+ @include flex-center;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ gap: 5px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .select-type {
|
|
|
|
|
+ width: 75px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .right {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ margin-left: 16px;
|
|
|
|
|
+ .head {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ color: rgba(0, 0, 0, 0.88);
|
|
|
|
|
+ line-height: 22px;
|
|
|
|
|
+ margin: 6px 0 6px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .selected {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ max-height: calc(100% - 120px);
|
|
|
|
|
+ }
|
|
|
|
|
+ .footer {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ right: 24px;
|
|
|
|
|
+ bottom: 20px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|