fix: hostId 变更类型和字段名

This commit is contained in:
TsMask
2025-02-26 09:51:34 +08:00
parent cdc31a9ced
commit 7429a55734
14 changed files with 103 additions and 108 deletions

View File

@@ -65,7 +65,7 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: t('common.rowId'),
dataIndex: 'hostId',
dataIndex: 'id',
align: 'center',
width: 50,
},
@@ -103,7 +103,7 @@ let tableColumns: ColumnsType = [
},
{
title: t('common.operate'),
key: 'hostId',
key: 'id',
align: 'left',
},
];
@@ -166,7 +166,7 @@ type ModalStateType = {
/**新增框或修改框是否显示 */
openByEdit: boolean;
/**记录ID */
hostId: string;
id: number | undefined;
/**确定按钮 loading */
confirmLoading: boolean;
};
@@ -174,7 +174,7 @@ type ModalStateType = {
/**对话框对象信息状态 */
let modalState: ModalStateType = reactive({
openByEdit: false,
hostId: '',
id: undefined,
confirmLoading: false,
});
@@ -182,14 +182,10 @@ let modalState: ModalStateType = reactive({
* 对话框弹出显示为 新增或者修改
* @param roleId 角色编号ID, 不传为新增
*/
function fnModalVisibleByEdit(roleId?: string) {
emit('modal');
if (!roleId) {
modalState.hostId = '';
} else {
modalState.hostId = roleId;
}
function fnModalVisibleByEdit(roleId?: undefined) {
modalState.id = roleId;
modalState.openByEdit = true;
emit('modal');
}
/**
@@ -207,20 +203,20 @@ function fnModalOk() {
*/
function fnModalCancel() {
modalState.openByEdit = false;
modalState.hostId = '';
modalState.id = undefined;
}
/**
* 网元主机删除
* @param hostId 网元主机编号ID
* @param id 网元主机编号ID
*/
function fnRecordDelete(hostId: string) {
function fnRecordDelete(id: string) {
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.ne.neHost.delTip', { num: hostId }),
content: t('views.ne.neHost.delTip', { num: id }),
onOk() {
const hide = message.loading(t('common.loading'), 0);
delNeHost(hostId).then(res => {
delNeHost(id).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
@@ -241,7 +237,7 @@ function fnRecordDelete(hostId: string) {
/**
* 网元主机连接
* @param hostId 网元主机编号ID
* @param id 网元主机编号ID
*/
function fnRecordLink(host: Record<string, any>) {
emit('link', JSON.parse(JSON.stringify(host)));
@@ -295,7 +291,7 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="hostId"
row-key="id"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -310,7 +306,7 @@ onMounted(() => {
<template v-if="column.key === 'hostType'">
<DictTag :options="dict.neHostType" :value="record.hostType" />
</template>
<template v-if="column.key === 'hostId'">
<template v-if="column.key === 'id'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title> Link to host </template>
@@ -322,7 +318,7 @@ onMounted(() => {
<template #title>{{ t('common.editText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.hostId)"
@click.prevent="fnModalVisibleByEdit(record.id)"
>
<template #icon><FormOutlined /></template>
</a-button>
@@ -331,7 +327,7 @@ onMounted(() => {
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.hostId)"
@click.prevent="fnRecordDelete(record.id)"
>
<template #icon><DeleteOutlined /></template>
</a-button>
@@ -344,7 +340,7 @@ onMounted(() => {
<!-- 新增框或修改框 -->
<EditModal
v-model:open="modalState.openByEdit"
:edit-id="modalState.hostId"
:edit-id="modalState.id"
:ne-group="true"
@ok="fnModalOk"
@cancel="fnModalCancel"

View File

@@ -117,7 +117,7 @@ const tabState: TabStateType = reactive({
{
id: '0',
host: {
hostId: '0',
id: 0,
title: t('views.tool.terminal.start'),
type: '0',
},
@@ -252,7 +252,7 @@ function fnTabClose(id: string) {
:tab-bar-gutter="8"
:tab-bar-style="{ margin: '0' }"
v-model:activeKey="tabState.activeKey"
@edit="(hostId:any) => fnTabClose(hostId as string)"
@edit="(id:any) => fnTabClose(id)"
>
<a-tab-pane
v-for="pane in tabState.panes"
@@ -271,7 +271,7 @@ function fnTabClose(id: string) {
<TerminalSSH
v-if="pane.id !== '0' && pane.host.hostType === 'ssh'"
:id="pane.id"
:hostId="pane.host.hostId"
:hostId="pane.host.id"
@connect="fnTerminalConnect"
@close="fnTerminalClose"
>
@@ -281,7 +281,7 @@ function fnTabClose(id: string) {
<TerminalTelnet
v-if="pane.id !== '0' && pane.host.hostType === 'telnet'"
:id="pane.id"
:hostId="pane.host.hostId"
:hostId="pane.host.id"
init-cmd="help"
:disable="true"
@connect="fnTerminalConnect"
@@ -293,7 +293,7 @@ function fnTabClose(id: string) {
<TerminalRedis
v-if="pane.id !== '0' && pane.host.hostType === 'redis'"
:id="pane.id"
:hostId="pane.host.hostId"
:hostId="pane.host.id"
@connect="fnTerminalConnect"
@close="fnTerminalClose"
>