This commit is contained in:
Silent YANG 2024-01-27 17:26:52 +08:00
parent cb93e4e00b
commit f699b0a673
4 changed files with 60 additions and 342 deletions

View file

@ -22,17 +22,16 @@ const DASHBOARD: AppRouteRecordRaw = {
roles: ['*'],
},
},
// {
// path: 'monitor',
// name: 'Monitor',
// component: () => import('@/views/dashboard/monitor/index.vue'),
// meta: {
// locale: 'menu.dashboard.monitor',
// requiresAuth: true,
// roles: ['*'],
// },
// },
{
path: 'channel',
name: 'Channel',
component: () => import('@/views/list/search-table/index.vue'),
meta: {
locale: '信道管理',
requiresAuth: true,
roles: ['*'],
},
}
],
};

View file

@ -12,16 +12,6 @@ const LIST: AppRouteRecordRaw = {
order: 2,
},
children: [
// {
// path: 'search-table', // The midline path complies with SEO specifications
// name: 'SearchTable',
// component: () => import('@/views/list/search-table/index.vue'),
// meta: {
// locale: 'menu.list.searchTable',
// requiresAuth: true,
// roles: ['*'],
// },
// },
{
path: 'backup',
name: 'Card',

View file

@ -1,104 +1,7 @@
<template>
<div class="container">
<Breadcrumb :items="['menu.list', 'menu.list.searchTable']" />
<a-card class="general-card" :title="$t('menu.list.searchTable')">
<a-row>
<a-col :flex="1">
<a-form
:model="formModel"
:label-col-props="{ span: 6 }"
:wrapper-col-props="{ span: 18 }"
label-align="left"
>
<a-row :gutter="16">
<a-col :span="8">
<a-form-item
field="number"
:label="$t('searchTable.form.number')"
>
<a-input
v-model="formModel.number"
:placeholder="$t('searchTable.form.number.placeholder')"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item field="name" :label="$t('searchTable.form.name')">
<a-input
v-model="formModel.name"
:placeholder="$t('searchTable.form.name.placeholder')"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item
field="contentType"
:label="$t('searchTable.form.contentType')"
>
<a-select
v-model="formModel.contentType"
:options="contentTypeOptions"
:placeholder="$t('searchTable.form.selectDefault')"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item
field="filterType"
:label="$t('searchTable.form.filterType')"
>
<a-select
v-model="formModel.filterType"
:options="filterTypeOptions"
:placeholder="$t('searchTable.form.selectDefault')"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item
field="createdTime"
:label="$t('searchTable.form.createdTime')"
>
<a-range-picker
v-model="formModel.createdTime"
style="width: 100%"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item
field="status"
:label="$t('searchTable.form.status')"
>
<a-select
v-model="formModel.status"
:options="statusOptions"
:placeholder="$t('searchTable.form.selectDefault')"
/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-col>
<a-divider style="height: 84px" direction="vertical" />
<a-col :flex="'86px'" style="text-align: right">
<a-space direction="vertical" :size="18">
<a-button type="primary" @click="search">
<template #icon>
<icon-search />
</template>
{{ $t('searchTable.form.search') }}
</a-button>
<a-button @click="reset">
<template #icon>
<icon-refresh />
</template>
{{ $t('searchTable.form.reset') }}
</a-button>
</a-space>
</a-col>
</a-row>
<a-divider style="margin-top: 0" />
<Breadcrumb :items="['写频', '信道管理']" />
<a-card class="general-card" :title="$t('信道管理')">
<a-row style="margin-bottom: 16px">
<a-col :span="12">
<a-space>
@ -106,139 +9,31 @@
<template #icon>
<icon-plus />
</template>
{{ $t('searchTable.operation.create') }}
从设备读取
</a-button>
<a-upload action="/">
<template #upload-button>
<a-button>
{{ $t('searchTable.operation.import') }}
</a-button>
<a-button>
<template #icon>
<icon-plus />
</template>
</a-upload>
写入设备
</a-button>
</a-space>
</a-col>
<a-col
:span="12"
style="display: flex; align-items: center; justify-content: end"
>
<a-button>
<template #icon>
<icon-download />
</template>
{{ $t('searchTable.operation.download') }}
</a-button>
<a-tooltip :content="$t('searchTable.actions.refresh')">
<div class="action-icon" @click="search"
><icon-refresh size="18"
/></div>
</a-tooltip>
<a-dropdown @select="handleSelectDensity">
<a-tooltip :content="$t('searchTable.actions.density')">
<div class="action-icon"><icon-line-height size="18" /></div>
</a-tooltip>
<template #content>
<a-doption
v-for="item in densityList"
:key="item.value"
:value="item.value"
:class="{ active: item.value === size }"
>
<span>{{ item.name }}</span>
</a-doption>
</template>
</a-dropdown>
<a-tooltip :content="$t('searchTable.actions.columnSetting')">
<a-popover
trigger="click"
position="bl"
@popup-visible-change="popupVisibleChange"
>
<div class="action-icon"><icon-settings size="18" /></div>
<template #content>
<div id="tableSetting">
<div
v-for="(item, index) in showColumns"
:key="item.dataIndex"
class="setting"
>
<div style="margin-right: 4px; cursor: move">
<icon-drag-arrow />
</div>
<div>
<a-checkbox
v-model="item.checked"
@change="
handleChange($event, item as TableColumnData, index)
"
>
</a-checkbox>
</div>
<div class="title">
{{ item.title === '#' ? '序列号' : item.title }}
</div>
</div>
</div>
</template>
</a-popover>
</a-tooltip>
</a-col>
</a-row>
<a-table
row-key="id"
:loading="loading"
:pagination="pagination"
:columns="(cloneColumns as TableColumnData[])"
:data="renderData"
:bordered="false"
:size="size"
@page-change="onPageChange"
>
<template #index="{ rowIndex }">
{{ rowIndex + 1 + (pagination.current - 1) * pagination.pageSize }}
<a-table :columns="columns" :data="renderData" style="margin-top: 20px">
<template #index="{ record, rowIndex }">
{{rowIndex + 1}}
</template>
<template #contentType="{ record }">
<a-space>
<a-avatar
v-if="record.contentType === 'img'"
:size="16"
shape="square"
>
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/581b17753093199839f2e327e726b157.svg~tplv-49unhts6dw-image.image"
/>
</a-avatar>
<a-avatar
v-else-if="record.contentType === 'horizontalVideo'"
:size="16"
shape="square"
>
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/77721e365eb2ab786c889682cbc721c1.svg~tplv-49unhts6dw-image.image"
/>
</a-avatar>
<a-avatar v-else :size="16" shape="square">
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/ea8b09190046da0ea7e070d83c5d1731.svg~tplv-49unhts6dw-image.image"
/>
</a-avatar>
{{ $t(`searchTable.form.contentType.${record.contentType}`) }}
</a-space>
<template #mode="{ record, rowIndex }">
<a-select v-model="record.mode" @change="()=>{record.mode=''}">
<a-option v-for="value of Object.keys({'FM': 'FM', 'AM': 'AM', 'LSB': 'LSB'})">{{value}}</a-option>
</a-select>
</template>
<template #filterType="{ record }">
{{ $t(`searchTable.form.filterType.${record.filterType}`) }}
<template #freq="{ record, rowIndex }">
<a-input v-model="record.freq" />
</template>
<template #status="{ record }">
<span v-if="record.status === 'offline'" class="circle"></span>
<span v-else class="circle pass"></span>
{{ $t(`searchTable.form.status.${record.status}`) }}
</template>
<template #operations>
<a-button v-permission="['admin']" type="text" size="small">
{{ $t('searchTable.columns.operations.view') }}
</a-button>
<template #name="{ record, rowIndex }">
<a-input v-model="record.name" />
</template>
</a-table>
</a-card>
@ -251,7 +46,6 @@
import useLoading from '@/hooks/loading';
import { queryPolicyList, PolicyRecord, PolicyParams } from '@/api/list';
import { Pagination } from '@/types/global';
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import cloneDeep from 'lodash/cloneDeep';
import Sortable from 'sortablejs';
@ -272,7 +66,6 @@
const { loading, setLoading } = useLoading(true);
const { t } = useI18n();
const renderData = ref<PolicyRecord[]>([]);
const formModel = ref(generateFormModel());
const cloneColumns = ref<Column[]>([]);
const showColumns = ref<Column[]>([]);
@ -285,24 +78,6 @@
const pagination = reactive({
...basePagination,
});
const densityList = computed(() => [
{
name: t('searchTable.size.mini'),
value: 'mini',
},
{
name: t('searchTable.size.small'),
value: 'small',
},
{
name: t('searchTable.size.medium'),
value: 'medium',
},
{
name: t('searchTable.size.large'),
value: 'large',
},
]);
const columns = computed<TableColumnData[]>(() => [
{
title: t('searchTable.columns.index'),
@ -310,77 +85,59 @@
slotName: 'index',
},
{
title: t('searchTable.columns.number'),
dataIndex: 'number',
title: '模式',
dataIndex: 'mode',
slotName: 'mode'
},
{
title: t('searchTable.columns.name'),
title: '频率',
dataIndex: 'freq',
slotName: 'freq'
},
{
title: '名称',
dataIndex: 'name',
slotName: 'name'
},
{
title: t('searchTable.columns.contentType'),
dataIndex: 'contentType',
slotName: 'contentType',
title: '亚音模式',
dataIndex: 'tone',
},
{
title: t('searchTable.columns.filterType'),
dataIndex: 'filterType',
title: '发射模拟亚音',
dataIndex: 'tone',
},
{
title: t('searchTable.columns.count'),
dataIndex: 'count',
title: '接收模拟亚音',
dataIndex: 'tone',
},
{
title: t('searchTable.columns.createdTime'),
dataIndex: 'createdTime',
title: '发射数字亚音',
dataIndex: 'tone',
},
{
title: t('searchTable.columns.status'),
dataIndex: 'status',
slotName: 'status',
title: '接收模拟亚音',
dataIndex: 'tone',
},
{
title: t('searchTable.columns.operations'),
dataIndex: 'operations',
slotName: 'operations',
},
]);
const contentTypeOptions = computed<SelectOptionData[]>(() => [
{
label: t('searchTable.form.contentType.img'),
value: 'img',
title: '频差方向',
dataIndex: 'tone',
},
{
label: t('searchTable.form.contentType.horizontalVideo'),
value: 'horizontalVideo',
title: '频差频率',
dataIndex: 'tone',
},
{
label: t('searchTable.form.contentType.verticalVideo'),
value: 'verticalVideo',
},
]);
const filterTypeOptions = computed<SelectOptionData[]>(() => [
{
label: t('searchTable.form.filterType.artificial'),
value: 'artificial',
title: '功率',
dataIndex: 'tone',
},
{
label: t('searchTable.form.filterType.rules'),
value: 'rules',
},
]);
const statusOptions = computed<SelectOptionData[]>(() => [
{
label: t('searchTable.form.status.online'),
value: 'online',
},
{
label: t('searchTable.form.status.offline'),
value: 'offline',
title: '操作',
dataIndex: 'tone',
},
]);
const fetchData = async (
params: PolicyParams = { current: 1, pageSize: 20 }
params: PolicyParams = { current: 1, pageSize: 200 }
) => {
setLoading(true);
try {
@ -395,41 +152,11 @@
}
};
const search = () => {
fetchData({
...basePagination,
...formModel.value,
} as unknown as PolicyParams);
};
const onPageChange = (current: number) => {
fetchData({ ...basePagination, current });
};
fetchData();
const reset = () => {
formModel.value = generateFormModel();
};
const handleSelectDensity = (
val: string | number | Record<string, any> | undefined,
e: Event
) => {
size.value = val as SizeProps;
};
const handleChange = (
checked: boolean | (string | boolean | number)[],
column: Column,
index: number
) => {
if (!checked) {
cloneColumns.value = showColumns.value.filter(
(item) => item.dataIndex !== column.dataIndex
);
} else {
cloneColumns.value.splice(index, 0, column);
}
};
const exchangeArray = <T extends Array<any>>(
array: T,

View file

@ -11,6 +11,8 @@ const data = Mock.mock({
'id|8': /[A-Z][a-z][-][0-9]/,
'number|2-3': /[0-9]/,
'name|4-8': /[A-Z]/,
'mode|1': ['FM', 'AM', 'LSB'],
'freq|1': ['438.500', '438.500', '438.500'],
'contentType|1': ['img', 'horizontalVideo', 'verticalVideo'],
'count|2-3': /[0-9]/,
'status|1': ['online', 'offline'],