💄 修改表格样式.

This commit is contained in:
lijiahang
2024-07-09 10:34:39 +08:00
parent 7ba278d210
commit a7f86bf62a
20 changed files with 85 additions and 23 deletions

View File

@@ -6,7 +6,7 @@ const columns = [
title: 'id', title: 'id',
dataIndex: 'id', dataIndex: 'id',
slotName: 'id', slotName: 'id',
width: 100, width: 80,
align: 'left', align: 'left',
fixed: 'left', fixed: 'left',
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){ }, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
@@ -15,6 +15,7 @@ const columns = [
slotName: '${field.propertyName}', slotName: '${field.propertyName}',
align: 'left', align: 'left',
#if(${field.propertyType} == 'String') #if(${field.propertyType} == 'String')
minWidth: 238,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
#elseif(${field.propertyType} == 'Date') #elseif(${field.propertyType} == 'Date')

View File

@@ -3,7 +3,22 @@
:options="optionData" :options="optionData"
:loading="loading" :loading="loading"
placeholder="请选择主机身份" placeholder="请选择主机身份"
allow-clear /> allow-clear>
<!-- label -->
<template #label="{ data }">
<span class="option-wrapper">
<span class="label">{{ data.label }}</span>
<span class="username">{{ data.username }}</span>
</span>
</template>
<!-- 选项 -->
<template #option="{ data }">
<span class="option-wrapper">
<span class="label">{{ data.label }}</span>
<span class="username">{{ data.username }}</span>
</span>
</template>
</a-select>
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -53,8 +68,9 @@
: await cacheStore.loadHostIdentities(); : await cacheStore.loadHostIdentities();
optionData.value = hostIdentities.map(s => { optionData.value = hostIdentities.map(s => {
return { return {
label: `${s.name} (${s.username})`, label: s.name,
value: s.id, value: s.id,
username: s.username,
}; };
}); });
} catch (e) { } catch (e) {
@@ -66,5 +82,18 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.option-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
.label {
margin-right: 8px;
}
.username {
font-size: 12px;
color: var(--color-text-3);
}
}
</style> </style>

View File

@@ -37,6 +37,7 @@
:allow-clear="true" :allow-clear="true"
:data="filterOptions" :data="filterOptions"
:filter-option="tagLabelFilter"> :filter-option="tagLabelFilter">
<!-- 选项 -->
<template #option="{ data: { raw: { label, isTag } } }"> <template #option="{ data: { raw: { label, isTag } } }">
<!-- tag --> <!-- tag -->
<a-tag v-if="isTag" :color="dataColor(label, tagColor)"> <a-tag v-if="isTag" :color="dataColor(label, tagColor)">

View File

@@ -8,6 +8,7 @@
@exceed-limit="() => { emits('onLimited', limit, `最多选择${limit}个tag`) }" @exceed-limit="() => { emits('onLimited', limit, `最多选择${limit}个tag`) }"
multiple multiple
allow-clear> allow-clear>
<!-- 选项 -->
<template #option="{ data: { label } }"> <template #option="{ data: { label } }">
<a-tag :color="dataColor(label, tagColor)"> <a-tag :color="dataColor(label, tagColor)">
{{ label }} {{ label }}

View File

@@ -34,7 +34,7 @@
readonly: boolean; readonly: boolean;
}>>(), { }>>(), {
width: '60%', width: '60%',
height: 'calc(100vh - 240px)', height: 'calc(100vh - 242px)',
readonly: true, readonly: true,
}); });

View File

@@ -139,6 +139,15 @@
{{ record.extra?.address }} {{ record.extra?.address }}
</span> </span>
</template> </template>
<!-- 连接时间 -->
<template #connectTime="{ record }">
<div>
从: {{ record.startTime && dateFormat(new Date(record.startTime)) }}
</div>
<div class="mt4">
至: {{ (record.endTime && dateFormat(new Date(record.endTime)) || '现在') }}
</div>
</template>
<!-- 操作 --> <!-- 操作 -->
<template #handle="{ record }"> <template #handle="{ record }">
<div class="table-handle-wrapper"> <div class="table-handle-wrapper">
@@ -201,6 +210,7 @@
import columns from '../types/table.columns'; import columns from '../types/table.columns';
import useLoading from '@/hooks/loading'; import useLoading from '@/hooks/loading';
import { copy } from '@/hooks/copy'; import { copy } from '@/hooks/copy';
import { dateFormat } from '@/utils';
import UserSelector from '@/components/user/user/selector/index.vue'; import UserSelector from '@/components/user/user/selector/index.vue';
import HostSelector from '@/components/asset/host/selector/index.vue'; import HostSelector from '@/components/asset/host/selector/index.vue';
import ConnectLogClearModal from './connect-log-clear-modal.vue'; import ConnectLogClearModal from './connect-log-clear-modal.vue';

View File

@@ -46,12 +46,7 @@ const columns = [
dataIndex: 'connectTime', dataIndex: 'connectTime',
slotName: 'connectTime', slotName: 'connectTime',
align: 'left', align: 'left',
width: 318, width: 192,
render: ({ record }) => {
return (record.startTime && dateFormat(new Date(record.startTime)))
+ ' - '
+ (record.endTime && dateFormat(new Date(record.endTime)) || '现在');
},
}, { }, {
title: '操作', title: '操作',
slotName: 'handle', slotName: 'handle',

View File

@@ -34,6 +34,7 @@ const columns = [
dataIndex: 'paths', dataIndex: 'paths',
slotName: 'paths', slotName: 'paths',
align: 'left', align: 'left',
minWidth: 238,
}, { }, {
title: '执行结果', title: '执行结果',
dataIndex: 'result', dataIndex: 'result',

View File

@@ -84,7 +84,7 @@
:hide-asterisk="true"> :hide-asterisk="true">
<host-identity-selector v-model="formModel.identityId" /> <host-identity-selector v-model="formModel.identityId" />
</a-form-item> </a-form-item>
<!-- 用户名 --> <!-- 连接超时时间 -->
<a-form-item field="connectTimeout" <a-form-item field="connectTimeout"
label="连接超时时间" label="连接超时时间"
:hide-asterisk="true"> :hide-asterisk="true">

View File

@@ -179,13 +179,15 @@
// 选择公钥文件 // 选择公钥文件
const selectPublicFile = async (fileList: FileItem[]) => { const selectPublicFile = async (fileList: FileItem[]) => {
formModel.value.publicKey = await readFileText(fileList[0].file as File); formModel.value.publicKey = await readFileText(fileList[fileList.length - 1].file as File);
fileList.length = 0;
formRef.value.clearValidate('publicKey'); formRef.value.clearValidate('publicKey');
}; };
// 选择私钥文件 // 选择私钥文件
const selectPrivateFile = async (fileList: FileItem[]) => { const selectPrivateFile = async (fileList: FileItem[]) => {
formModel.value.privateKey = await readFileText(fileList[0].file as File); formModel.value.privateKey = await readFileText(fileList[fileList.length - 1].file as File);
fileList.length = 0;
formRef.value.clearValidate('privateKey'); formRef.value.clearValidate('privateKey');
}; };

View File

@@ -22,6 +22,7 @@ const columns = [
slotName: 'command', slotName: 'command',
align: 'left', align: 'left',
ellipsis: true, ellipsis: true,
minWidth: 238,
}, { }, {
title: '执行用户', title: '执行用户',
dataIndex: 'username', dataIndex: 'username',

View File

@@ -31,6 +31,7 @@ const columns = [
align: 'left', align: 'left',
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
minWidth: 238,
}, { }, {
title: '上传状态', title: '上传状态',
dataIndex: 'status', dataIndex: 'status',

View File

@@ -18,6 +18,7 @@
:allow-clear="true" :allow-clear="true"
:data="filterOptions" :data="filterOptions"
:filter-option="tagLabelFilter"> :filter-option="tagLabelFilter">
<!-- 选项 -->
<template #option="{ data: { raw: { label, isTag } } }"> <template #option="{ data: { raw: { label, isTag } } }">
<!-- tag --> <!-- tag -->
<a-tag v-if="isTag" :color="dataColor(label, tagColor)"> <a-tag v-if="isTag" :color="dataColor(label, tagColor)">
@@ -107,7 +108,7 @@
.host-view-container { .host-view-container {
width: 100%; width: 100%;
height: calc(100vh - 240px); height: calc(100vh - 242px);
position: relative; position: relative;
} }
} }

View File

@@ -22,10 +22,12 @@
:options="toOptions(fontFamilyKey)" :options="toOptions(fontFamilyKey)"
:allow-create="true" :allow-create="true"
:filter-option="labelFilter"> :filter-option="labelFilter">
<template #option="{ data }"> <!-- label -->
<template #label="{ data }">
<span :style="{ fontFamily: data.value }">{{ data.label }}</span> <span :style="{ fontFamily: data.value }">{{ data.label }}</span>
</template> </template>
<template #label="{ data }"> <!-- 选项 -->
<template #option="{ data }">
<span :style="{ fontFamily: data.value }">{{ data.label }}</span> <span :style="{ fontFamily: data.value }">{{ data.label }}</span>
</template> </template>
</a-select> </a-select>

View File

@@ -10,7 +10,9 @@
<a-skeleton v-if="loading" <a-skeleton v-if="loading"
class="skeleton-wrapper" class="skeleton-wrapper"
:animation="true"> :animation="true">
<a-skeleton-line :rows="8" /> <a-skeleton-line :rows="6"
:line-height="64"
:line-spacing="24" />
</a-skeleton> </a-skeleton>
<!-- 内容区域 --> <!-- 内容区域 -->
<div v-else class="terminal-setting-body terminal-theme-container"> <div v-else class="terminal-setting-body terminal-theme-container">
@@ -18,9 +20,9 @@
<a-alert class="mb16">选择后会立刻保存, 刷新页面后生效</a-alert> <a-alert class="mb16">选择后会立刻保存, 刷新页面后生效</a-alert>
<!-- 终端主题 --> <!-- 终端主题 -->
<div class="theme-row" <div class="theme-row"
v-for="rowIndex in themes.length / 2" v-for="(themeArr, index) in themes"
:key="rowIndex"> :key="index">
<a-card v-for="(theme, colIndex) in [themes[(rowIndex - 1) * 2], themes[(rowIndex - 1) * 2 + 1]]" <a-card v-for="(theme, colIndex) in themeArr"
:key="theme.name" :key="theme.name"
class="terminal-theme-card simple-card" class="terminal-theme-card simple-card"
:class="{ :class="{
@@ -67,7 +69,7 @@
const { loading, setLoading } = useLoading(); const { loading, setLoading } = useLoading();
const currentThemeName = ref(); const currentThemeName = ref();
const themes = ref<Array<TerminalTheme>>([]); const themes = ref<Array<Array<TerminalTheme>>>([]);
// 选择主题 // 选择主题
const selectTheme = async (theme: TerminalTheme) => { const selectTheme = async (theme: TerminalTheme) => {
@@ -90,7 +92,12 @@
try { try {
// 加载全部主题 // 加载全部主题
const { data } = await getTerminalThemes(); const { data } = await getTerminalThemes();
themes.value = data; const result = [];
for (let i = 0; i < data.length; i += 2) {
const subArray = data.slice(i, i + 2);
result.push(subArray);
}
themes.value = result;
} catch (e) { } catch (e) {
} finally { } finally {
setLoading(false); setLoading(false);

View File

@@ -20,6 +20,7 @@ const columns = [
dataIndex: 'command', dataIndex: 'command',
slotName: 'command', slotName: 'command',
align: 'left', align: 'left',
minWidth: 238,
ellipsis: true, ellipsis: true,
}, { }, {
title: '执行状态', title: '执行状态',

View File

@@ -29,6 +29,7 @@ const columns = [
dataIndex: 'command', dataIndex: 'command',
slotName: 'command', slotName: 'command',
align: 'left', align: 'left',
minWidth: 238,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {

View File

@@ -32,12 +32,14 @@ const columns = [
title: '权限标识', title: '权限标识',
dataIndex: 'permission', dataIndex: 'permission',
slotName: 'permission', slotName: 'permission',
minWidth: 138,
ellipsis: true, ellipsis: true,
tooltip: true tooltip: true
}, { }, {
title: '组件名称', title: '组件名称',
dataIndex: 'component', dataIndex: 'component',
slotName: 'component', slotName: 'component',
minWidth: 138,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {

View File

@@ -30,6 +30,8 @@ const columns = [
title: '操作日志', title: '操作日志',
dataIndex: 'originLogInfo', dataIndex: 'originLogInfo',
slotName: 'originLogInfo', slotName: 'originLogInfo',
minWidth: 238,
align: 'left',
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {

View File

@@ -6,31 +6,35 @@ const columns = [
title: 'id', title: 'id',
dataIndex: 'id', dataIndex: 'id',
slotName: 'id', slotName: 'id',
width: 100, width: 80,
align: 'left', align: 'left',
fixed: 'left', fixed: 'left',
}, { }, {
title: '用户名', title: '用户名',
dataIndex: 'username', dataIndex: 'username',
slotName: 'username', slotName: 'username',
minWidth: 138,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {
title: '花名', title: '花名',
dataIndex: 'nickname', dataIndex: 'nickname',
slotName: 'nickname', slotName: 'nickname',
minWidth: 138,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {
title: '手机号', title: '手机号',
dataIndex: 'mobile', dataIndex: 'mobile',
slotName: 'mobile', slotName: 'mobile',
minWidth: 88,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {
title: '邮箱', title: '邮箱',
dataIndex: 'email', dataIndex: 'email',
slotName: 'email', slotName: 'email',
minWidth: 88,
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
}, { }, {