🔨 查询字段.
This commit is contained in:
@@ -3,12 +3,14 @@
|
|||||||
search-input-placeholder="输入 id / 名称 / 用户名"
|
search-input-placeholder="输入 id / 名称 / 用户名"
|
||||||
:create-card-position="false"
|
:create-card-position="false"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:field-config="fieldConfig"
|
:field-config="cardFieldConfig"
|
||||||
:list="list"
|
:list="list"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:card-layout-cols="cardColLayout"
|
:card-layout-cols="cardColLayout"
|
||||||
:filter-count="filterCount"
|
:filter-count="filterCount"
|
||||||
:add-permission="['asset:host-identity:create']"
|
:add-permission="['asset:host-identity:create']"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
:fields-hook="fieldsHook"
|
||||||
@add="emits('openAdd')"
|
@add="emits('openAdd')"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
@search="fetchCardData"
|
@search="fetchCardData"
|
||||||
@@ -136,17 +138,13 @@
|
|||||||
<!-- 修改 -->
|
<!-- 修改 -->
|
||||||
<a-doption v-permission="['asset:host-identity:update']"
|
<a-doption v-permission="['asset:host-identity:update']"
|
||||||
@click="emits('openUpdate', record)">
|
@click="emits('openUpdate', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">修改</span>
|
||||||
<icon-edit /> 修改
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<a-doption v-permission="['asset:host-identity:delete']"
|
<a-doption v-permission="['asset:host-identity:delete']"
|
||||||
class="span-red"
|
class="span-red"
|
||||||
@click="deleteRow(record.id)">
|
@click="deleteRow(record.id)">
|
||||||
<span class="more-doption error">
|
<span class="more-doption error">删除</span>
|
||||||
<icon-delete /> 删除
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -163,7 +161,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { HostIdentityQueryRequest, HostIdentityQueryResponse } from '@/api/asset/host-identity';
|
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 { computed, reactive, ref, onMounted } from 'vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { objectTruthKeyCount, resetObject } from '@/utils';
|
import { objectTruthKeyCount, resetObject } from '@/utils';
|
||||||
@@ -175,7 +173,8 @@
|
|||||||
import { useCacheStore, useDictStore } from '@/store';
|
import { useCacheStore, useDictStore } from '@/store';
|
||||||
import { copy } from '@/hooks/copy';
|
import { copy } from '@/hooks/copy';
|
||||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
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';
|
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
|
||||||
|
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openKeyView']);
|
const emits = defineEmits(['openAdd', 'openUpdate', 'openKeyView']);
|
||||||
@@ -186,6 +185,8 @@
|
|||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const cardColLayout = useCardColLayout();
|
const cardColLayout = useCardColLayout();
|
||||||
const pagination = useCardPagination();
|
const pagination = useCardPagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { hasAnyPermission } = usePermission();
|
const { hasAnyPermission } = usePermission();
|
||||||
@@ -248,7 +249,7 @@
|
|||||||
const doFetchCardData = async (request: HostIdentityQueryRequest) => {
|
const doFetchCardData = async (request: HostIdentityQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostIdentityPage(request);
|
const { data } = await getHostIdentityPage(queryOrder.markOrderly(request));
|
||||||
list.value = data.rows;
|
list.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -99,6 +99,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
<!-- 调整 -->
|
||||||
|
<table-adjust :columns="columns"
|
||||||
|
:columns-hook="columnsHook"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
@query="fetchTableData" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -107,7 +112,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="tableColumns"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
@@ -193,18 +198,22 @@
|
|||||||
import usePermission from '@/hooks/permission';
|
import usePermission from '@/hooks/permission';
|
||||||
import { copy } from '@/hooks/copy';
|
import { copy } from '@/hooks/copy';
|
||||||
import { useCacheStore, useDictStore } from '@/store';
|
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 { 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 { useRouter } from 'vue-router';
|
||||||
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
|
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 emits = defineEmits(['openAdd', 'openUpdate', 'openKeyView']);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const pagination = useTablePagination();
|
|
||||||
const rowSelection = useRowSelection();
|
const rowSelection = useRowSelection();
|
||||||
|
const pagination = useTablePagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { hasAnyPermission } = usePermission();
|
const { hasAnyPermission } = usePermission();
|
||||||
@@ -265,7 +274,7 @@
|
|||||||
const doFetchTableData = async (request: HostIdentityQueryRequest) => {
|
const doFetchTableData = async (request: HostIdentityQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostIdentityPage(request);
|
const { data } = await getHostIdentityPage(queryOrder.markOrderly(request));
|
||||||
tableRenderData.value = data.rows;
|
tableRenderData.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -10,25 +10,30 @@ const fieldConfig = {
|
|||||||
label: 'id',
|
label: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '用户名',
|
label: '用户名',
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
slotName: 'username',
|
slotName: 'username',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '类型',
|
label: '类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
slotName: 'type',
|
slotName: 'type',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机密钥',
|
label: '主机密钥',
|
||||||
dataIndex: 'keyId',
|
dataIndex: 'keyId',
|
||||||
slotName: 'keyId',
|
slotName: 'keyId',
|
||||||
height: '24px',
|
height: '24px',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '描述',
|
label: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
slotName: 'description',
|
slotName: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
@@ -36,6 +41,27 @@ const fieldConfig = {
|
|||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.createTime));
|
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 CardField[]
|
||||||
} as CardFieldConfig;
|
} as CardFieldConfig;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// 表名称
|
||||||
|
export const TableName = 'host-id';
|
||||||
|
|
||||||
// 身份类型
|
// 身份类型
|
||||||
export const IdentityType = {
|
export const IdentityType = {
|
||||||
PASSWORD: 'PASSWORD',
|
PASSWORD: 'PASSWORD',
|
||||||
|
|||||||
@@ -9,28 +9,33 @@ const columns = [
|
|||||||
width: 100,
|
width: 100,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '名称',
|
title: '名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
slotName: 'name',
|
slotName: 'name',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '用户名',
|
title: '用户名',
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
slotName: 'username',
|
slotName: 'username',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
slotName: 'type',
|
slotName: 'type',
|
||||||
width: 138,
|
width: 138,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机密钥',
|
title: '主机密钥',
|
||||||
dataIndex: 'keyId',
|
dataIndex: 'keyId',
|
||||||
slotName: 'keyId',
|
slotName: 'keyId',
|
||||||
width: 180,
|
width: 180,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '描述',
|
title: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
@@ -38,6 +43,7 @@ const columns = [
|
|||||||
minWidth: 128,
|
minWidth: 128,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
@@ -47,12 +53,40 @@ const columns = [
|
|||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.createTime));
|
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: '操作',
|
title: '操作',
|
||||||
slotName: 'handle',
|
slotName: 'handle',
|
||||||
width: 130,
|
width: 130,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
default: true,
|
||||||
},
|
},
|
||||||
] as TableColumnData[];
|
] as TableColumnData[];
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
search-input-placeholder="输入 id / 名称"
|
search-input-placeholder="输入 id / 名称"
|
||||||
:create-card-position="false"
|
:create-card-position="false"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:field-config="fieldConfig"
|
:field-config="cardFieldConfig"
|
||||||
:list="list"
|
:list="list"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:card-layout-cols="cardColLayout"
|
:card-layout-cols="cardColLayout"
|
||||||
:handle-visible="{disableFilter: true}"
|
:handle-visible="{disableFilter: true}"
|
||||||
:add-permission="['asset:host-key:create']"
|
:add-permission="['asset:host-key:create']"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
:fields-hook="fieldsHook"
|
||||||
@add="emits('openAdd')"
|
@add="emits('openAdd')"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
@search="fetchCardData"
|
@search="fetchCardData"
|
||||||
@@ -54,24 +56,18 @@
|
|||||||
<!-- 详情 -->
|
<!-- 详情 -->
|
||||||
<a-doption v-permission="['asset:host-key:detail', 'asset:host-key:update']"
|
<a-doption v-permission="['asset:host-key:detail', 'asset:host-key:update']"
|
||||||
@click="emits('openView', record)">
|
@click="emits('openView', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">详情</span>
|
||||||
<icon-list /> 详情
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 修改 -->
|
<!-- 修改 -->
|
||||||
<a-doption v-permission="['asset:host-key:update']"
|
<a-doption v-permission="['asset:host-key:update']"
|
||||||
@click="emits('openUpdate', record)">
|
@click="emits('openUpdate', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">修改</span>
|
||||||
<icon-edit /> 修改
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<a-doption v-permission="['asset:host-key:delete']"
|
<a-doption v-permission="['asset:host-key:delete']"
|
||||||
class="span-red"
|
class="span-red"
|
||||||
@click="deleteRow(record.id)">
|
@click="deleteRow(record.id)">
|
||||||
<span class="more-doption error">
|
<span class="more-doption error">删除</span>
|
||||||
<icon-delete /> 删除
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -88,7 +84,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { HostKeyQueryRequest, HostKeyQueryResponse } from '@/api/asset/host-key';
|
import type { HostKeyQueryRequest, HostKeyQueryResponse } from '@/api/asset/host-key';
|
||||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
import { useCardPagination, useCardColLayout, useCardFieldConfig } from '@/hooks/card';
|
||||||
import { reactive, ref, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
@@ -98,6 +94,8 @@
|
|||||||
import { deleteHostKey, getHostKeyPage } from '@/api/asset/host-key';
|
import { deleteHostKey, getHostKeyPage } from '@/api/asset/host-key';
|
||||||
import { Message, Modal } from '@arco-design/web-vue';
|
import { Message, Modal } from '@arco-design/web-vue';
|
||||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||||
|
import { TableName } from '../types/const';
|
||||||
|
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||||
|
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
|
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
|
||||||
|
|
||||||
@@ -105,6 +103,8 @@
|
|||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const cardColLayout = useCardColLayout();
|
const cardColLayout = useCardColLayout();
|
||||||
const pagination = useCardPagination();
|
const pagination = useCardPagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
|
|
||||||
const list = ref<HostKeyQueryResponse[]>([]);
|
const list = ref<HostKeyQueryResponse[]>([]);
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
const doFetchCardData = async (request: HostKeyQueryRequest) => {
|
const doFetchCardData = async (request: HostKeyQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostKeyPage(request);
|
const { data } = await getHostKeyPage(queryOrder.markOrderly(request));
|
||||||
list.value = data.rows;
|
list.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -82,6 +82,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
<!-- 调整 -->
|
||||||
|
<table-adjust :columns="columns"
|
||||||
|
:columns-hook="columnsHook"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
@query="fetchTableData" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -90,7 +95,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="tableColumns"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
@@ -147,15 +152,20 @@
|
|||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/table.columns';
|
||||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
import { TableName } from '../types/const';
|
||||||
|
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||||
|
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||||
|
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||||
|
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
|
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const pagination = useTablePagination();
|
|
||||||
const rowSelection = useRowSelection();
|
const rowSelection = useRowSelection();
|
||||||
|
const pagination = useTablePagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
|
|
||||||
const selectedKeys = ref<Array<number>>([]);
|
const selectedKeys = ref<Array<number>>([]);
|
||||||
@@ -213,7 +223,7 @@
|
|||||||
const doFetchTableData = async (request: HostKeyQueryRequest) => {
|
const doFetchTableData = async (request: HostKeyQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostKeyPage(request);
|
const { data } = await getHostKeyPage(queryOrder.markOrderly(request));
|
||||||
tableRenderData.value = data.rows;
|
tableRenderData.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ const fieldConfig = {
|
|||||||
label: 'id',
|
label: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '描述',
|
label: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
slotName: 'description',
|
slotName: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
@@ -22,6 +24,7 @@ const fieldConfig = {
|
|||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.createTime));
|
return dateFormat(new Date(record.createTime));
|
||||||
},
|
},
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '修改时间',
|
label: '修改时间',
|
||||||
dataIndex: 'updateTime',
|
dataIndex: 'updateTime',
|
||||||
@@ -29,6 +32,19 @@ const fieldConfig = {
|
|||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.updateTime));
|
return dateFormat(new Date(record.updateTime));
|
||||||
},
|
},
|
||||||
|
default: true,
|
||||||
|
}, {
|
||||||
|
label: '创建人',
|
||||||
|
dataIndex: 'creator',
|
||||||
|
slotName: 'creator',
|
||||||
|
ellipsis: true,
|
||||||
|
default: true,
|
||||||
|
}, {
|
||||||
|
label: '修改人',
|
||||||
|
dataIndex: 'updater',
|
||||||
|
slotName: 'updater',
|
||||||
|
ellipsis: true,
|
||||||
|
default: true,
|
||||||
}
|
}
|
||||||
] as CardField[]
|
] as CardField[]
|
||||||
} as CardFieldConfig;
|
} as CardFieldConfig;
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// 表名称
|
||||||
|
export const TableName = 'host-key';
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ const columns = [
|
|||||||
width: 100,
|
width: 100,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '名称',
|
title: '名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
slotName: 'name',
|
slotName: 'name',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '描述',
|
title: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
@@ -22,30 +24,50 @@ const columns = [
|
|||||||
minWidth: 128,
|
minWidth: 128,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
slotName: 'createTime',
|
slotName: 'createTime',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 198,
|
width: 180,
|
||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.createTime));
|
return dateFormat(new Date(record.createTime));
|
||||||
},
|
},
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '修改时间',
|
title: '修改时间',
|
||||||
dataIndex: 'updateTime',
|
dataIndex: 'updateTime',
|
||||||
slotName: 'updateTime',
|
slotName: 'updateTime',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 198,
|
width: 180,
|
||||||
render: ({ record }) => {
|
render: ({ record }) => {
|
||||||
return dateFormat(new Date(record.updateTime));
|
return dateFormat(new Date(record.updateTime));
|
||||||
},
|
},
|
||||||
|
default: true,
|
||||||
|
}, {
|
||||||
|
title: '创建人',
|
||||||
|
dataIndex: 'creator',
|
||||||
|
slotName: 'creator',
|
||||||
|
width: 148,
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
|
}, {
|
||||||
|
title: '修改人',
|
||||||
|
dataIndex: 'updater',
|
||||||
|
slotName: 'updater',
|
||||||
|
width: 148,
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
slotName: 'handle',
|
slotName: 'handle',
|
||||||
width: 180,
|
width: 180,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
default: true,
|
||||||
},
|
},
|
||||||
] as TableColumnData[];
|
] as TableColumnData[];
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
search-input-placeholder="输入 id / 名称 / 编码 / 地址"
|
search-input-placeholder="输入 id / 名称 / 编码 / 地址"
|
||||||
:create-card-position="false"
|
:create-card-position="false"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:field-config="fieldConfig"
|
:field-config="cardFieldConfig"
|
||||||
:list="list"
|
:list="list"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:card-layout-cols="cardColLayout"
|
:card-layout-cols="cardColLayout"
|
||||||
:filter-count="filterCount"
|
:filter-count="filterCount"
|
||||||
:add-permission="['asset:host:create']"
|
:add-permission="['asset:host:create']"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
:fields-hook="fieldsHook"
|
||||||
@add="emits('openAdd')"
|
@add="emits('openAdd')"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
@search="fetchCardData"
|
@search="fetchCardData"
|
||||||
@@ -174,55 +176,43 @@
|
|||||||
<!-- 修改 -->
|
<!-- 修改 -->
|
||||||
<a-doption v-permission="['asset:host:update']"
|
<a-doption v-permission="['asset:host:update']"
|
||||||
@click="emits('openUpdate', record)">
|
@click="emits('openUpdate', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">修改</span>
|
||||||
<icon-edit /> 修改
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 配置 -->
|
<!-- 配置 -->
|
||||||
<a-doption v-permission="['asset:host:update-config']"
|
<a-doption v-permission="['asset:host:update-config']"
|
||||||
@click="emits('openUpdateConfig', record)">
|
@click="emits('openUpdateConfig', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">配置</span>
|
||||||
<icon-settings /> 配置
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 修改状态 -->
|
<!-- 修改状态 -->
|
||||||
<a-doption v-permission="['asset:host:update-status']"
|
<a-doption v-permission="['asset:host:update-status']"
|
||||||
@click="updateStatus(record as HostQueryResponse)">
|
@click="updateStatus(record as HostQueryResponse)">
|
||||||
<span class="more-doption"
|
<span class="more-doption"
|
||||||
:class="[toggleDictValue(hostStatusKey, record.status, 'status')]">
|
:class="[toggleDictValue(hostStatusKey, record.status, 'status')]">
|
||||||
<icon-sync /> {{ toggleDictValue(hostStatusKey, record.status, 'label') }}
|
{{ toggleDictValue(hostStatusKey, record.status, 'label') }}
|
||||||
</span>
|
</span>
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 复制 -->
|
<!-- 复制 -->
|
||||||
<a-doption v-permission="['asset:host:create']"
|
<a-doption v-permission="['asset:host:create']"
|
||||||
@click="emits('openCopy', record)">
|
@click="emits('openCopy', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">复制</span>
|
||||||
<icon-copy /> 复制
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<a-doption v-permission="['asset:host:delete']"
|
<a-doption v-permission="['asset:host:delete']"
|
||||||
class="span-red"
|
class="span-red"
|
||||||
@click="deleteRow(record.id)">
|
@click="deleteRow(record.id)">
|
||||||
<span class="more-doption error">
|
<span class="more-doption error">删除</span>
|
||||||
<icon-delete /> 删除
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- SSH -->
|
<!-- SSH -->
|
||||||
<a-doption v-if="record.type === HostType.SSH.value"
|
<a-doption v-if="record.type === HostType.SSH.value"
|
||||||
v-permission="['asset:terminal:access']"
|
v-permission="['asset:terminal:access']"
|
||||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
|
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">SSH</span>
|
||||||
<icon-thunderbolt /> SSH
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- SFTP -->
|
<!-- SFTP -->
|
||||||
<a-doption v-if="record.type === HostType.SSH.value"
|
<a-doption v-if="record.type === HostType.SSH.value"
|
||||||
v-permission="['asset:terminal:access']"
|
v-permission="['asset:terminal:access']"
|
||||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SFTP' } })">
|
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SFTP' } })">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">SFTP</span>
|
||||||
<icon-folder /> SFTP
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -239,18 +229,19 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
import type { HostQueryRequest, HostQueryResponse } from '@/api/asset/host';
|
||||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
import { useCardPagination, useCardColLayout, useCardFieldConfig } from '@/hooks/card';
|
||||||
import { computed, reactive, ref, onMounted } from 'vue';
|
import { computed, reactive, ref, onMounted } from 'vue';
|
||||||
import { dataColor, objectTruthKeyCount, resetObject } from '@/utils';
|
import { dataColor, objectTruthKeyCount, resetObject } from '@/utils';
|
||||||
import { deleteHost, getHostPage, updateHostStatus } from '@/api/asset/host';
|
import { deleteHost, getHostPage, updateHostStatus } from '@/api/asset/host';
|
||||||
import { Message, Modal } from '@arco-design/web-vue';
|
import { Message, Modal } from '@arco-design/web-vue';
|
||||||
import { getHostOsIcon, hostOsTypeKey, hostStatusKey, HostType, hostTypeKey, tagColor } from '../types/const';
|
import { getHostOsIcon, hostOsTypeKey, hostStatusKey, HostType, hostTypeKey, TableName, tagColor } from '../types/const';
|
||||||
import { copy } from '@/hooks/copy';
|
import { copy } from '@/hooks/copy';
|
||||||
import { useCacheStore, useDictStore } from '@/store';
|
import { useCacheStore, useDictStore } from '@/store';
|
||||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import fieldConfig from '../types/card.fields';
|
import fieldConfig from '../types/card.fields';
|
||||||
|
import { ASC, useQueryOrder } from '@/hooks/query-order';
|
||||||
import { openNewRoute } from '@/router';
|
import { openNewRoute } from '@/router';
|
||||||
import TagMultiSelector from '@/components/meta/tag/multi-selector/index.vue';
|
import TagMultiSelector from '@/components/meta/tag/multi-selector/index.vue';
|
||||||
|
|
||||||
@@ -260,6 +251,8 @@
|
|||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const cardColLayout = useCardColLayout();
|
const cardColLayout = useCardColLayout();
|
||||||
const pagination = useCardPagination();
|
const pagination = useCardPagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { toOptions, getDictValue, toggleDictValue, toggleDict } = useDictStore();
|
const { toOptions, getDictValue, toggleDictValue, toggleDict } = useDictStore();
|
||||||
|
|
||||||
@@ -355,7 +348,7 @@
|
|||||||
const doFetchCardData = async (request: HostQueryRequest) => {
|
const doFetchCardData = async (request: HostQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostPage(request);
|
const { data } = await getHostPage(queryOrder.markOrderly(request));
|
||||||
list.value = data.rows;
|
list.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -127,6 +127,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
<!-- 调整 -->
|
||||||
|
<table-adjust :columns="columns"
|
||||||
|
:columns-hook="columnsHook"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
@query="fetchTableData" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -135,7 +140,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="tableColumns"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
@@ -234,25 +239,19 @@
|
|||||||
<!-- 复制 -->
|
<!-- 复制 -->
|
||||||
<a-doption v-permission="['asset:host:create']"
|
<a-doption v-permission="['asset:host:create']"
|
||||||
@click="emits('openCopy', record)">
|
@click="emits('openCopy', record)">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">复制</span>
|
||||||
复制
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- SSH -->
|
<!-- SSH -->
|
||||||
<a-doption v-if="record.type === HostType.SSH.value"
|
<a-doption v-if="record.type === HostType.SSH.value"
|
||||||
v-permission="['asset:terminal:access']"
|
v-permission="['asset:terminal:access']"
|
||||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
|
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">SSH</span>
|
||||||
SSH
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- SFTP -->
|
<!-- SFTP -->
|
||||||
<a-doption v-if="record.type === HostType.SSH.value"
|
<a-doption v-if="record.type === HostType.SSH.value"
|
||||||
v-permission="['asset:terminal:access']"
|
v-permission="['asset:terminal:access']"
|
||||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SFTP' } })">
|
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SFTP' } })">
|
||||||
<span class="more-doption normal">
|
<span class="more-doption normal">SFTP</span>
|
||||||
SFTP
|
|
||||||
</span>
|
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -273,8 +272,8 @@
|
|||||||
import { reactive, ref, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import { deleteHost, batchDeleteHost, getHostPage, updateHostStatus } from '@/api/asset/host';
|
import { deleteHost, batchDeleteHost, getHostPage, updateHostStatus } from '@/api/asset/host';
|
||||||
import { Message, Modal } from '@arco-design/web-vue';
|
import { Message, Modal } from '@arco-design/web-vue';
|
||||||
import { tagColor, hostTypeKey, hostStatusKey, HostType, hostOsTypeKey, getHostOsIcon } from '../types/const';
|
import { TableName, tagColor, hostTypeKey, hostStatusKey, HostType, hostOsTypeKey, getHostOsIcon } from '../types/const';
|
||||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||||
import { useCacheStore, useDictStore } from '@/store';
|
import { useCacheStore, useDictStore } from '@/store';
|
||||||
import { copy } from '@/hooks/copy';
|
import { copy } from '@/hooks/copy';
|
||||||
import { dataColor } from '@/utils';
|
import { dataColor } from '@/utils';
|
||||||
@@ -282,15 +281,19 @@
|
|||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/table.columns';
|
||||||
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const';
|
||||||
|
import { ASC, useQueryOrder } from '@/hooks/query-order';
|
||||||
import { openNewRoute } from '@/router';
|
import { openNewRoute } from '@/router';
|
||||||
import TagMultiSelector from '@/components/meta/tag/multi-selector/index.vue';
|
import TagMultiSelector from '@/components/meta/tag/multi-selector/index.vue';
|
||||||
|
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||||
|
|
||||||
const emits = defineEmits(['openCopy', 'openAdd', 'openUpdate', 'openUpdateConfig', 'openHostGroup']);
|
const emits = defineEmits(['openCopy', 'openAdd', 'openUpdate', 'openUpdateConfig', 'openHostGroup']);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const cacheStore = useCacheStore();
|
const cacheStore = useCacheStore();
|
||||||
const pagination = useTablePagination();
|
|
||||||
const rowSelection = useRowSelection();
|
const rowSelection = useRowSelection();
|
||||||
|
const pagination = useTablePagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { toOptions, getDictValue, toggleDictValue, toggleDict } = useDictStore();
|
const { toOptions, getDictValue, toggleDictValue, toggleDict } = useDictStore();
|
||||||
|
|
||||||
@@ -383,7 +386,7 @@
|
|||||||
const doFetchTableData = async (request: HostQueryRequest) => {
|
const doFetchTableData = async (request: HostQueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getHostPage(request);
|
const { data } = await getHostPage(queryOrder.markOrderly(request));
|
||||||
tableRenderData.value = data.rows;
|
tableRenderData.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { CardField, CardFieldConfig } from '@/types/card';
|
import type { CardField, CardFieldConfig } from '@/types/card';
|
||||||
|
import { dateFormat } from '@/utils';
|
||||||
|
|
||||||
const fieldConfig = {
|
const fieldConfig = {
|
||||||
rowGap: '10px',
|
rowGap: '10px',
|
||||||
@@ -9,34 +10,69 @@ const fieldConfig = {
|
|||||||
label: 'id',
|
label: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机编码',
|
label: '主机编码',
|
||||||
dataIndex: 'code',
|
dataIndex: 'code',
|
||||||
slotName: 'code',
|
slotName: 'code',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机地址',
|
label: '主机地址',
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
slotName: 'address',
|
slotName: 'address',
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机类型',
|
label: '主机类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
slotName: 'type',
|
slotName: 'type',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机状态',
|
label: '主机状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
slotName: 'status',
|
slotName: 'status',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机标签',
|
label: '主机标签',
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
slotName: 'tags',
|
slotName: 'tags',
|
||||||
rowAlign: 'start',
|
rowAlign: 'start',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
label: '主机描述',
|
label: '主机描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
slotName: 'description',
|
slotName: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
default: true,
|
||||||
|
}, {
|
||||||
|
label: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
slotName: 'createTime',
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.createTime));
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
}, {
|
||||||
|
label: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
slotName: 'updateTime',
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.updateTime));
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
}, {
|
||||||
|
label: '创建人',
|
||||||
|
dataIndex: 'creator',
|
||||||
|
slotName: 'creator',
|
||||||
|
ellipsis: true,
|
||||||
|
default: false,
|
||||||
|
}, {
|
||||||
|
label: '修改人',
|
||||||
|
dataIndex: 'updater',
|
||||||
|
slotName: 'updater',
|
||||||
|
ellipsis: true,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
] as CardField[]
|
] as CardField[]
|
||||||
} as CardFieldConfig;
|
} as CardFieldConfig;
|
||||||
export default fieldConfig;
|
export default fieldConfig;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import WindowsIcon from '@/assets/images/icon/os_windows.svg';
|
import WindowsIcon from '@/assets/images/icon/os_windows.svg';
|
||||||
import LinuxIcon from '@/assets/images/icon/os_linux.svg';
|
import LinuxIcon from '@/assets/images/icon/os_linux.svg';
|
||||||
|
|
||||||
|
// 表名称
|
||||||
|
export const TableName = 'host';
|
||||||
|
|
||||||
// tag 颜色
|
// tag 颜色
|
||||||
export const tagColor = [
|
export const tagColor = [
|
||||||
'arcoblue',
|
'arcoblue',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { TableColumnData } from '@arco-design/web-vue';
|
import type { TableColumnData } from '@arco-design/web-vue';
|
||||||
|
import { dateFormat } from '@/utils';
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
@@ -8,6 +9,7 @@ const columns = [
|
|||||||
width: 68,
|
width: 68,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机名称',
|
title: '主机名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@@ -15,28 +17,33 @@ const columns = [
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
minWidth: 238,
|
minWidth: 238,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机编码',
|
title: '主机编码',
|
||||||
dataIndex: 'code',
|
dataIndex: 'code',
|
||||||
slotName: 'code',
|
slotName: 'code',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机类型',
|
title: '主机类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
slotName: 'type',
|
slotName: 'type',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机地址',
|
title: '主机地址',
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
slotName: 'address',
|
slotName: 'address',
|
||||||
minWidth: 238
|
minWidth: 238,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机标签',
|
title: '主机标签',
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
slotName: 'tags',
|
slotName: 'tags',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
minWidth: 148,
|
minWidth: 148,
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机状态',
|
title: '主机状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
@@ -44,6 +51,7 @@ const columns = [
|
|||||||
width: 88,
|
width: 88,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
default: true,
|
||||||
}, {
|
}, {
|
||||||
title: '主机描述',
|
title: '主机描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
@@ -51,12 +59,50 @@ const columns = [
|
|||||||
minWidth: 128,
|
minWidth: 128,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
|
default: true,
|
||||||
|
}, {
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
slotName: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.createTime));
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
}, {
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
slotName: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
render: ({ record }) => {
|
||||||
|
return dateFormat(new Date(record.updateTime));
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
}, {
|
||||||
|
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: '操作',
|
title: '操作',
|
||||||
slotName: 'handle',
|
slotName: 'handle',
|
||||||
width: 192,
|
width: 192,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
default: true,
|
||||||
},
|
},
|
||||||
] as TableColumnData[];
|
] as TableColumnData[];
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="tableColumns"
|
:columns="logColumns"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
:expandable="expandable"
|
:expandable="expandable"
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
@@ -219,7 +219,7 @@
|
|||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { tableColumns } from '../types/table.columns';
|
import { logColumns } from '../types/table.columns';
|
||||||
import { ExecStatus, execStatusKey } from '@/components/exec/log/const';
|
import { ExecStatus, execStatusKey } from '@/components/exec/log/const';
|
||||||
import { useExpandable, useTablePagination, useRowSelection } from '@/hooks/table';
|
import { useExpandable, useTablePagination, useRowSelection } from '@/hooks/table';
|
||||||
import { useDictStore, useUserStore } from '@/store';
|
import { useDictStore, useUserStore } from '@/store';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TableColumnData } from '@arco-design/web-vue';
|
|||||||
import { isNumber } from '@/utils/is';
|
import { isNumber } from '@/utils/is';
|
||||||
|
|
||||||
// 表格列
|
// 表格列
|
||||||
export const tableColumns = [
|
export const logColumns = [
|
||||||
{
|
{
|
||||||
title: 'id',
|
title: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<a-table row-key="id"
|
<a-table row-key="id"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="tableColumns"
|
:columns="logColumns"
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
const { getDictValue } = useDictStore();
|
const { getDictValue } = useDictStore();
|
||||||
|
|
||||||
const jsonView = ref();
|
const jsonView = ref();
|
||||||
const tableColumns = ref();
|
const logColumns = ref();
|
||||||
const tableRenderData = ref<OperatorLogQueryResponse[]>([]);
|
const tableRenderData = ref<OperatorLogQueryResponse[]>([]);
|
||||||
|
|
||||||
// 查看详情
|
// 查看详情
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
// 不显示操作
|
// 不显示操作
|
||||||
cols = cols.filter(s => s.dataIndex !== 'handle');
|
cols = cols.filter(s => s.dataIndex !== 'handle');
|
||||||
}
|
}
|
||||||
tableColumns.value = cols;
|
logColumns.value = cols;
|
||||||
// 加载数据
|
// 加载数据
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user