update: 组织管理优化

This commit is contained in:
easy 2023-03-06 14:02:19 +08:00
parent 93e2d40f2a
commit 1abe6450d3
2 changed files with 162 additions and 98 deletions

View File

@ -1,16 +1,19 @@
<template>
<div class="product-container">
<Search :columns="query.columns" @search="query.search" />
<j-advanced-search
:columns="columns"
@search="(params:any) => (queryParams = params)"
/>
<j-pro-table
ref="tableRef"
:request="table.requestFun"
:gridColumn="2"
model="CARD"
:params="query.params.value"
:params="queryParams"
:rowSelection="{
selectedRowKeys: table._selectedRowKeys.value,
}"
@cancelSelect="table.cancelSelect"
:columns="columns"
>
<template #headerTitle>
<j-space>
@ -130,13 +133,46 @@
</template>
</CardBox>
</template>
<template #permission="slotProps">
{{
table.permissionList.value.length &&
table.getPermissLabel(slotProps.permission)
}}
</template>
<template #state="slotProps">
<BadgeStatus
:status="slotProps.state.value"
:text="slotProps.state.text"
:statusNames="{
online: 'success',
offline: 'error',
notActive: 'warning',
}"
></BadgeStatus>
</template>
<template #action="slotProps">
<a-space :size="16">
<PermissionButton
v-for="i in table.getActions(slotProps, 'table')"
:uhasPermission="i.permission"
type="link"
:tooltip="i?.tooltip"
:pop-confirm="i.popConfirm"
@click="i.onClick"
:disabled="i?.disabled"
>
<AIcon :type="i.icon" />
</PermissionButton>
</a-space>
</template>
</j-pro-table>
<div class="dialogs">
<AddDeviceOrProductDialog
v-if="dialogs.addShow"
v-model:visible="dialogs.addShow"
:query-columns="query.columns"
:query-columns="columns"
:parent-id="props.parentId"
:all-permission="table.permissionList.value"
asset-type="device"
@ -171,7 +207,7 @@ import {
} from '@/api/system/department';
import { intersection } from 'lodash-es';
import type { dictType } from '../typing';
import type { dictType, optionsType } from '../typing';
import { message } from 'ant-design-vue';
const permission = 'system/Department';
@ -181,8 +217,7 @@ const props = defineProps<{
parentId: string;
bindBool: boolean;
}>();
const query = {
columns: [
const columns = [
{
title: 'ID',
dataIndex: 'id',
@ -198,18 +233,17 @@ const query = {
dataIndex: 'name',
key: 'name',
ellipsis: true,
fixed: 'left',
search: {
type: 'string',
},
},
{
title: '所属产品',
dataIndex: 'productId$product-info',
key: 'productId$product-info',
dataIndex: 'productName',
key: 'productName',
ellipsis: true,
fixed: 'left',
search: {
rename: 'productId$product-info',
type: 'select',
options: () =>
new Promise((resolve) => {
@ -228,12 +262,18 @@ const query = {
}),
},
},
{
title: '资产权限',
dataIndex: 'permission',
key: 'permission',
ellipsis: true,
scopedSlots: true,
},
{
title: '注册时间',
dataIndex: 'registryTime',
key: 'registryTime',
ellipsis: true,
fixed: 'left',
search: {
type: 'date',
},
@ -243,31 +283,31 @@ const query = {
dataIndex: 'state',
key: 'state',
ellipsis: true,
fixed: 'left',
search: {
type: 'select',
options: [
{
label: '在线',
value: 'online',
},
{
label: '离线',
value: 'offline',
label: '正常',
value: 1,
},
{
label: '禁用',
value: 'notActive',
value: 0,
},
],
},
scopedSlots: true,
},
],
params: ref({}),
search: (params: any) => {
query.params.value = params;
{
title: '操作',
dataIndex: 'action',
key: 'action',
fixed: 'right',
scopedSlots: true,
},
};
];
const queryParams = ref({});
const tableRef = ref();
const table = {
@ -285,6 +325,32 @@ const table = {
);
},
getActions: (
data: Partial<Record<string, any>>,
type: 'card' | 'table',
) => {
if (!data) return [];
else
return [
{
permission: true,
key: 'edit',
tooltip: { title: '编辑' },
icon: 'EditOutlined',
onClick: () => table.clickEdit(data),
},
{
permission: true,
key: 'unbind',
tooltip: { title: '解除绑定' },
popConfirm: {
title: `是否解除绑定`,
onConfirm: () => table.clickUnBind(data),
},
icon: 'DisconnectOutlined',
},
];
},
//
getPermissionDict: () => {
getPermissionDict_api().then((resp: any) => {

View File

@ -1,11 +1,14 @@
<template>
<div class="product-container">
<j-advanced-search :columns="columns" @search="query.search" />
<j-advanced-search
:columns="columns"
@search="(params:any)=>queryParams = {...params}"
/>
<j-pro-table
ref="tableRef"
:request="table.requestFun"
:gridColumn="2"
:params="query.params.value"
:params="queryParams"
:rowSelection="{
selectedRowKeys: table._selectedRowKeys.value,
}"
@ -325,12 +328,7 @@ const columns = [
scopedSlots: true,
},
];
const query = {
params: ref({}),
search: (params: any) => {
query.params.value = params;
},
};
const queryParams = ref({});
const tableRef = ref();
const table = {