Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
easy 2023-03-15 17:44:52 +08:00
commit 62a405b8cd
8 changed files with 63 additions and 41 deletions

View File

@ -10,12 +10,7 @@
@cancel="_vis = false" @cancel="_vis = false"
:confirmLoading="loading" :confirmLoading="loading"
> >
<pro-search <pro-search :columns="columns" target="media" @search="handleSearch" />
type="simple"
:columns="columns"
target="media"
@search="handleSearch"
/>
<JProTable <JProTable
ref="listRef" ref="listRef"
@ -23,6 +18,7 @@
:columns="columns" :columns="columns"
:request="CascadeApi.queryChannelList" :request="CascadeApi.queryChannelList"
:defaultParams="{ :defaultParams="{
pageSize: 10,
sorts: [{ name: 'name', order: 'desc' }], sorts: [{ name: 'name', order: 'desc' }],
terms: [ terms: [
{ {
@ -46,6 +42,10 @@
onSelectAll: onSelectAllChange, onSelectAll: onSelectAllChange,
}" }"
@cancelSelect="_selectedRowKeys = []" @cancelSelect="_selectedRowKeys = []"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
> >
<template #headerTitle> <template #headerTitle>
<h3>通道列表</h3> <h3>通道列表</h3>
@ -96,6 +96,7 @@ watch(
() => _vis.value, () => _vis.value,
(val) => { (val) => {
if (val) handleSearch({ terms: [] }); if (val) handleSearch({ terms: [] });
else _selectedRowKeys.value = [];
}, },
); );

View File

@ -1,12 +1,7 @@
<!-- 国标级联-通道列表 --> <!-- 国标级联-通道列表 -->
<template> <template>
<page-container> <page-container>
<pro-search <pro-search :columns="columns" target="media" @search="handleSearch" />
type="simple"
:columns="columns"
target="media"
@search="handleSearch"
/>
<JProTable <JProTable
ref="listRef" ref="listRef"
@ -14,6 +9,7 @@
:columns="columns" :columns="columns"
:request="(e:any) => CascadeApi.queryBindChannel(route?.query.id as string, e)" :request="(e:any) => CascadeApi.queryBindChannel(route?.query.id as string, e)"
:defaultParams="{ :defaultParams="{
pageSize: 10,
sorts: [{ name: 'name', order: 'desc' }], sorts: [{ name: 'name', order: 'desc' }],
}" }"
:params="params" :params="params"
@ -23,6 +19,10 @@
onSelectAll: onSelectAllChange, onSelectAll: onSelectAllChange,
}" }"
@cancelSelect="_selectedRowKeys = []" @cancelSelect="_selectedRowKeys = []"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
> >
<template #headerTitle> <template #headerTitle>
<h3>通道列表</h3> <h3>通道列表</h3>
@ -50,9 +50,9 @@
</j-space> </j-space>
</j-tooltip> </j-tooltip>
</template> </template>
<template #gbChannelId="slotProps"> <template #channelId="slotProps">
<j-space> <j-space>
<Ellipsis> <Ellipsis style="width: 150px">
{{ slotProps.gbChannelId }} {{ slotProps.gbChannelId }}
</Ellipsis> </Ellipsis>
<j-popover <j-popover
@ -73,6 +73,7 @@
<j-input <j-input
v-model:value="gbID" v-model:value="gbID"
@change="validField(slotProps)" @change="validField(slotProps)"
placeholder="请输入国标ID"
/> />
<div <div
class="error" class="error"
@ -179,8 +180,8 @@ const columns = [
}, },
{ {
title: '国标ID', title: '国标ID',
dataIndex: 'gbChannelId', dataIndex: 'channelId',
key: 'gbChannelId', key: 'channelId',
scopedSlots: true, scopedSlots: true,
headerCell: 'gbChannelIdHeader', // headerCell: 'gbChannelIdHeader', //
search: { search: {
@ -204,7 +205,7 @@ const columns = [
}, },
}, },
{ {
title: '状态', title: '在线状态',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
scopedSlots: true, scopedSlots: true,

View File

@ -17,8 +17,8 @@
message: '请输入名称', message: '请输入名称',
}, },
{ {
max: 84, max: 64,
message: '最多可输入84个字符', message: '最多可输入64个字符',
}, },
]" ]"
> >
@ -238,6 +238,7 @@
v-model:value="formData.host" v-model:value="formData.host"
placeholder="请选择IP地址" placeholder="请选择IP地址"
:options="allList" :options="allList"
@change="setPorts"
/> />
</j-col> </j-col>
<j-col :span="10"> <j-col :span="10">
@ -301,7 +302,7 @@
<j-radio-group <j-radio-group
button-style="solid" button-style="solid"
v-model:value="formData.transport" v-model:value="formData.transport"
@change="setPorts" @change="handleTransportChange"
> >
<j-radio-button value="UDP"> <j-radio-button value="UDP">
UDP UDP
@ -616,19 +617,29 @@ const getAllList = async () => {
allList.value = result.map((m: any) => ({ allList.value = result.map((m: any) => ({
label: m.host, label: m.host,
value: m.host, value: m.host,
...m,
})); }));
setPorts(); setPorts();
}; };
getAllList(); getAllList();
const handleTransportChange = () => {
formData.value.host = undefined;
formData.value.port = undefined;
setPorts();
};
/** /**
* 传输协议改变, 获取对应的端口 * 获取端口
*/ */
const allListPorts = ref([]); const allListPorts = ref([]);
const setPorts = () => { const setPorts = () => {
allListPorts.value = allList.value.find( if (!formData.value.host) return;
(f: any) => f.host === formData.value.host, allListPorts.value = allList.value
)?.ports[formData.value.transport || '']; .find((f: any) => f.host === formData.value.host)
?.ports[formData.value.transport || '']?.map((m: string) => ({
label: m,
value: m,
}));
}; };
/** /**

View File

@ -237,20 +237,12 @@ const handleSearch = (e: any) => {
const lastValueFrom = async (params: any) => { const lastValueFrom = async (params: any) => {
const res = await CascadeApi.list(params); const res = await CascadeApi.list(params);
res.result.data.forEach(async (item: any) => { res.result.data.forEach(async (item: any) => {
const resp = await queryChannelCount(item.id); const resp = await CascadeApi.queryBindChannel(item.id, {});
item.count = resp.result.total; item.count = resp.result.total;
}); });
return res; return res;
}; };
/**
* 查询通道数量
* @param id
*/
const queryChannelCount = async (id: string) => {
return await CascadeApi.queryBindChannel(id, {});
};
/** /**
* 新增 * 新增
*/ */

View File

@ -3,13 +3,15 @@
<div class="top-card-content"> <div class="top-card-content">
<div class="content-left"> <div class="content-left">
<div class="content-left-title"> <div class="content-left-title">
<span>{{ title }}</span> <j-space>
<j-tooltip placement="top" v-if="tooltip"> <span>{{ title }}</span>
<template #title> <j-tooltip placement="top" v-if="tooltip">
<span>{{ tooltip }}</span> <template #title>
</template> <span>{{ tooltip }}</span>
<AIcon type="QuestionCircleOutlined" /> </template>
</j-tooltip> <AIcon type="QuestionCircleOutlined" />
</j-tooltip>
</j-space>
</div> </div>
<div class="content-left-value">{{ value }}</div> <div class="content-left-value">{{ value }}</div>
</div> </div>

View File

@ -28,13 +28,18 @@
<JProTable <JProTable
ref="listRef" ref="listRef"
model="table"
:columns="columns" :columns="columns"
:request="(e:any) => ChannelApi.list(e, route?.query.id as string)" :request="(e:any) => ChannelApi.list(e, route?.query.id as string)"
:defaultParams="{ :defaultParams="{
pageSize: 10,
sorts: [{ name: 'notifyTime', order: 'desc' }], sorts: [{ name: 'notifyTime', order: 'desc' }],
}" }"
:params="params" :params="params"
model="table" :pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
> >
<template #headerTitle> <template #headerTitle>
<j-tooltip <j-tooltip

View File

@ -13,6 +13,7 @@
sorts: [{ name: 'createTime', order: 'desc' }], sorts: [{ name: 'createTime', order: 'desc' }],
}" }"
:params="params" :params="params"
:gridColumn="3"
> >
<template #headerTitle> <template #headerTitle>
<PermissionButton <PermissionButton

View File

@ -44,6 +44,7 @@
:columns="columns" :columns="columns"
:request="deviceApi.list" :request="deviceApi.list"
:defaultParams="{ :defaultParams="{
pageSize: 10,
sorts: [{ name: 'createTime', order: 'desc' }], sorts: [{ name: 'createTime', order: 'desc' }],
}" }"
:params="params" :params="params"
@ -56,7 +57,14 @@
deviceItem = record; deviceItem = record;
} }
}" }"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
> >
<template #channelNumber="slotProps">
<span>{{ slotProps.channelNumber || 0 }}</span>
</template>
<template #state="slotProps"> <template #state="slotProps">
<a-space> <a-space>
<a-badge <a-badge
@ -166,6 +174,7 @@ const columns = [
title: '通道数量', title: '通道数量',
dataIndex: 'channelNumber', dataIndex: 'channelNumber',
key: 'channelNumber', key: 'channelNumber',
scopedSlots: true,
}, },
{ {
title: '状态', title: '状态',