|
@@ -2,25 +2,24 @@
|
|
|
<hc-body split>
|
|
|
<template #left>
|
|
|
<hc-card scrollbar>
|
|
|
- <hc-lazy-tree :is-root-expand="false" :h-props="treeProps" @load="treeLoadNode">
|
|
|
+ <hc-lazy-tree :is-root-expand="false" :h-props="treeProps" tree-key="id" @load="treeLoadNode" @node-tap="treeNodeTap">
|
|
|
<template #default="{ node }">{{ node.label }}</template>
|
|
|
</hc-lazy-tree>
|
|
|
</hc-card>
|
|
|
</template>
|
|
|
<hc-card w-to="1800">
|
|
|
<template #headerToSearch>
|
|
|
- <div class="w-200px">
|
|
|
+ <div class="w-140px">
|
|
|
<el-select v-model="searchForm.type" placeholder="用户平台" filterable clearable block>
|
|
|
- <el-option label="字典编号" value="code" />
|
|
|
- <el-option label="字典名称" value="dictValue" />
|
|
|
+ <el-option v-for="item in userTypeData" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div class="ml-3 w-340px">
|
|
|
- <hc-search-input v-model="searchForm.name" placeholder="请输入关键字" @search="searchClick">
|
|
|
+ <div class="ml-2 w-340px">
|
|
|
+ <hc-search-input v-model="searchFormName" placeholder="请输入关键字" @search="searchClick">
|
|
|
<template #prepend>
|
|
|
- <el-select v-model="searchForm.year" placeholder="类型" clearable style="width: 100px">
|
|
|
- <el-option label="登录账号" value="2023" />
|
|
|
- <el-option label="用户姓名" value="2024" />
|
|
|
+ <el-select v-model="searchFormType" placeholder="类型" clearable style="width: 100px">
|
|
|
+ <el-option label="登录账号" value="account" />
|
|
|
+ <el-option label="用户姓名" value="realName" />
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</hc-search-input>
|
|
@@ -37,20 +36,45 @@
|
|
|
<el-button hc-btn type="success" plain>导入</el-button>
|
|
|
<el-button hc-btn type="warning" plain>导出</el-button>
|
|
|
</template>
|
|
|
- 其它内容
|
|
|
+ <hc-table
|
|
|
+ :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }"
|
|
|
+ is-check :check-style="{ width: 29 }" @selection-change="tableCheckChange"
|
|
|
+ >
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-link type="warning" @click="editRowClick(row)">修改</el-link>
|
|
|
+ <el-link v-del-com:[delRowClick]="row" type="danger">删除</el-link>
|
|
|
+ </template>
|
|
|
+ </hc-table>
|
|
|
+ <template #action>
|
|
|
+ <hc-pages :pages="searchForm" @change="pageChange" />
|
|
|
+ </template>
|
|
|
</hc-card>
|
|
|
</hc-body>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { onActivated, ref } from 'vue'
|
|
|
import { getArrValue } from 'js-fast-way'
|
|
|
-import { nextTick, onActivated, ref } from 'vue'
|
|
|
import deptApi from '~api/system/dept'
|
|
|
+import { getDictionaryData } from '~uti/tools.js'
|
|
|
+import mainApi from '~api/system/user'
|
|
|
|
|
|
onActivated(()=> {
|
|
|
-
|
|
|
+ getUserTypeData()
|
|
|
+ searchClick()
|
|
|
})
|
|
|
|
|
|
+//搜索表单
|
|
|
+const searchFormType = ref('account')
|
|
|
+const searchFormName = ref('')
|
|
|
+const searchForm = ref({ deptId: null, current: 1, size: 30, total: 0 })
|
|
|
+
|
|
|
+//获取用户平台
|
|
|
+const userTypeData = ref([])
|
|
|
+const getUserTypeData = async () => {
|
|
|
+ userTypeData.value = await getDictionaryData('user_type')
|
|
|
+}
|
|
|
+
|
|
|
//数据格式
|
|
|
const treeProps = {
|
|
|
label: 'title',
|
|
@@ -65,9 +89,11 @@ const treeLoadNode = async ({ item, level }, resolve) => {
|
|
|
resolve(getArrValue(data))
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//搜索表单
|
|
|
-const searchForm = ref({ current: 1, size: 30, total: 0 })
|
|
|
+//树节点被点击
|
|
|
+const treeNodeTap = ({ data }) => {
|
|
|
+ searchForm.value.deptId = data.id
|
|
|
+ searchClick()
|
|
|
+}
|
|
|
|
|
|
//搜索
|
|
|
const searchClick = () => {
|
|
@@ -75,9 +101,56 @@ const searchClick = () => {
|
|
|
getTableData()
|
|
|
}
|
|
|
|
|
|
+//分页
|
|
|
+const pageChange = ({ current, size }) => {
|
|
|
+ searchForm.value.current = current
|
|
|
+ searchForm.value.size = size
|
|
|
+ getTableData()
|
|
|
+}
|
|
|
+
|
|
|
+//表格数据
|
|
|
+const tableColumn = ref([
|
|
|
+ { key: 'account', name: '登录账号', width: 140, align: 'center' },
|
|
|
+ { key: 'tenantName', name: '所属租户', width: 100, align: 'center' },
|
|
|
+ { key: 'realName', name: '用户姓名', width: 100, align: 'center' },
|
|
|
+ { key: 'roleName', name: '所属角色', width: 180, align: 'center' },
|
|
|
+ { key: 'deptName', name: '所属部门' },
|
|
|
+ { key: 'userTypeName', name: '用户平台' },
|
|
|
+ { key: 'action', name: '操作', width: 100, align: 'center' },
|
|
|
+])
|
|
|
+const tableData = ref([])
|
|
|
|
|
|
//获取用户数据
|
|
|
+const tableLoading = ref(false)
|
|
|
const getTableData = async () => {
|
|
|
+ tableData.value = []
|
|
|
+ tableLoading.value = true
|
|
|
+ const form = {
|
|
|
+ ...searchForm.value,
|
|
|
+ total: null,
|
|
|
+ }
|
|
|
+ if (searchFormName.value) {
|
|
|
+ form[searchFormType.value] = searchFormName.value
|
|
|
+ }
|
|
|
+ const { data } = await mainApi.page(form)
|
|
|
+ tableLoading.value = false
|
|
|
+ tableData.value = getArrValue(data?.records)
|
|
|
+ searchForm.value.total = data?.total ?? 0
|
|
|
+}
|
|
|
+
|
|
|
+//表格被选择
|
|
|
+const tableCheckKeys = ref([])
|
|
|
+const tableCheckChange = (rows) => {
|
|
|
+ tableCheckKeys.value = rows
|
|
|
+}
|
|
|
+
|
|
|
+//修改账号
|
|
|
+const editRowClick = (row) => {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//删除账号
|
|
|
+const delRowClick = () => {
|
|
|
|
|
|
}
|
|
|
</script>
|