🔨 查询字段.
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
search-input-placeholder="输入 id / 名称 / 用户名"
|
||||
:create-card-position="false"
|
||||
:loading="loading"
|
||||
:field-config="fieldConfig"
|
||||
:field-config="cardFieldConfig"
|
||||
:list="list"
|
||||
:pagination="pagination"
|
||||
:card-layout-cols="cardColLayout"
|
||||
:filter-count="filterCount"
|
||||
:add-permission="['asset:host-identity:create']"
|
||||
:query-order="queryOrder"
|
||||
:fields-hook="fieldsHook"
|
||||
@add="emits('openAdd')"
|
||||
@reset="reset"
|
||||
@search="fetchCardData"
|
||||
@@ -136,17 +138,13 @@
|
||||
<!-- 修改 -->
|
||||
<a-doption v-permission="['asset:host-identity:update']"
|
||||
@click="emits('openUpdate', record)">
|
||||
<span class="more-doption normal">
|
||||
<icon-edit /> 修改
|
||||
</span>
|
||||
<span class="more-doption normal">修改</span>
|
||||
</a-doption>
|
||||
<!-- 删除 -->
|
||||
<a-doption v-permission="['asset:host-identity:delete']"
|
||||
class="span-red"
|
||||
@click="deleteRow(record.id)">
|
||||
<span class="more-doption error">
|
||||
<icon-delete /> 删除
|
||||
</span>
|
||||
<span class="more-doption error">删除</span>
|
||||
</a-doption>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
@@ -163,7 +161,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { HostIdentityQueryRequest, HostIdentityQueryResponse } from '@/api/asset/host-identity';
|
||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
||||
import { useCardPagination, useCardColLayout, useCardFieldConfig } from '@/hooks/card';
|
||||
import { computed, reactive, ref, onMounted } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { objectTruthKeyCount, resetObject } from '@/utils';
|
||||
@@ -175,7 +173,8 @@
|
||||
import { useCacheStore, useDictStore } from '@/store';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||
import { IdentityType, identityTypeKey } from '../types/const';
|
||||
import { TableName, IdentityType, identityTypeKey } from '../types/const';
|
||||
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openKeyView']);
|
||||
@@ -186,6 +185,8 @@
|
||||
const cacheStore = useCacheStore();
|
||||
const cardColLayout = useCardColLayout();
|
||||
const pagination = useCardPagination();
|
||||
const queryOrder = useQueryOrder(TableName, ASC);
|
||||
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { hasAnyPermission } = usePermission();
|
||||
@@ -248,7 +249,7 @@
|
||||
const doFetchCardData = async (request: HostIdentityQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getHostIdentityPage(request);
|
||||
const { data } = await getHostIdentityPage(queryOrder.markOrderly(request));
|
||||
list.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -99,6 +99,11 @@
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<!-- 调整 -->
|
||||
<table-adjust :columns="columns"
|
||||
:columns-hook="columnsHook"
|
||||
:query-order="queryOrder"
|
||||
@query="fetchTableData" />
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
@@ -107,7 +112,7 @@
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="tableColumns"
|
||||
:row-selection="rowSelection"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
@@ -193,18 +198,22 @@
|
||||
import usePermission from '@/hooks/permission';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { useCacheStore, useDictStore } from '@/store';
|
||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||
import { IdentityType, identityTypeKey } from '../types/const';
|
||||
import { TableName, IdentityType, identityTypeKey } from '../types/const';
|
||||
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||
import { useRouter } from 'vue-router';
|
||||
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openKeyView']);
|
||||
|
||||
const router = useRouter();
|
||||
const cacheStore = useCacheStore();
|
||||
const pagination = useTablePagination();
|
||||
const rowSelection = useRowSelection();
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, ASC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { hasAnyPermission } = usePermission();
|
||||
@@ -265,7 +274,7 @@
|
||||
const doFetchTableData = async (request: HostIdentityQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getHostIdentityPage(request);
|
||||
const { data } = await getHostIdentityPage(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -10,25 +10,30 @@ const fieldConfig = {
|
||||
label: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
default: true,
|
||||
}, {
|
||||
label: '用户名',
|
||||
dataIndex: 'username',
|
||||
slotName: 'username',
|
||||
ellipsis: true,
|
||||
default: true,
|
||||
}, {
|
||||
label: '类型',
|
||||
dataIndex: 'type',
|
||||
slotName: 'type',
|
||||
default: true,
|
||||
}, {
|
||||
label: '主机密钥',
|
||||
dataIndex: 'keyId',
|
||||
slotName: 'keyId',
|
||||
height: '24px',
|
||||
default: true,
|
||||
}, {
|
||||
label: '描述',
|
||||
dataIndex: 'description',
|
||||
slotName: 'description',
|
||||
ellipsis: true,
|
||||
default: true,
|
||||
}, {
|
||||
label: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
@@ -36,6 +41,27 @@ const fieldConfig = {
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.createTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
label: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
slotName: 'updateTime',
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.updateTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
label: '创建人',
|
||||
dataIndex: 'creator',
|
||||
slotName: 'creator',
|
||||
ellipsis: true,
|
||||
default: false,
|
||||
}, {
|
||||
label: '修改人',
|
||||
dataIndex: 'updater',
|
||||
slotName: 'updater',
|
||||
ellipsis: true,
|
||||
default: false,
|
||||
}
|
||||
] as CardField[]
|
||||
} as CardFieldConfig;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// 表名称
|
||||
export const TableName = 'host-id';
|
||||
|
||||
// 身份类型
|
||||
export const IdentityType = {
|
||||
PASSWORD: 'PASSWORD',
|
||||
|
||||
@@ -9,28 +9,33 @@ const columns = [
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
default: true,
|
||||
}, {
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
slotName: 'name',
|
||||
ellipsis: true,
|
||||
tooltip: true
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
slotName: 'username',
|
||||
ellipsis: true,
|
||||
tooltip: true
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
slotName: 'type',
|
||||
width: 138,
|
||||
default: true,
|
||||
}, {
|
||||
title: '主机密钥',
|
||||
dataIndex: 'keyId',
|
||||
slotName: 'keyId',
|
||||
width: 180,
|
||||
default: true,
|
||||
}, {
|
||||
title: '描述',
|
||||
dataIndex: 'description',
|
||||
@@ -38,6 +43,7 @@ const columns = [
|
||||
minWidth: 128,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
@@ -47,12 +53,40 @@ const columns = [
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.createTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
slotName: 'updateTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.updateTime));
|
||||
},
|
||||
default: true,
|
||||
}, {
|
||||
title: '创建人',
|
||||
dataIndex: 'creator',
|
||||
slotName: 'creator',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '修改人',
|
||||
dataIndex: 'updater',
|
||||
slotName: 'updater',
|
||||
width: 148,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
default: false,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
default: true,
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user