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

@@ -16,7 +16,7 @@ const props = defineProps({
}, },
/**连接主机ID必传 */ /**连接主机ID必传 */
hostId: { hostId: {
type: String, type: Number,
required: true, required: true,
}, },
/**初始发送命令 */ /**初始发送命令 */

View File

@@ -15,7 +15,7 @@ const props = defineProps({
}, },
/**连接主机ID必传 */ /**连接主机ID必传 */
hostId: { hostId: {
type: String, type: Number,
required: true, required: true,
}, },
/**窗口单行字符数 */ /**窗口单行字符数 */

View File

@@ -16,7 +16,7 @@ const props = defineProps({
}, },
/**连接主机ID必传 */ /**连接主机ID必传 */
hostId: { hostId: {
type: String, type: Number,
required: true, required: true,
}, },
/**窗口单行字符数 */ /**窗口单行字符数 */

View File

@@ -277,6 +277,7 @@ let dict: {
}); });
let timer: any; let timer: any;
let timerFlag: boolean = false;
onMounted(() => { onMounted(() => {
// 初始字典数据 // 初始字典数据
Promise.allSettled([getDict('ne_info_status'), getDict('index_status')]) Promise.allSettled([getDict('ne_info_status'), getDict('index_status')])
@@ -292,7 +293,7 @@ onMounted(() => {
fnLocale(); fnLocale();
await fnGetList(false); await fnGetList(false);
timer = setInterval(() => { timer = setInterval(() => {
if (!timer) return; if (timerFlag) return;
fnGetList(true); fnGetList(true);
}, 10_000); // 每隔10秒执行一次 }, 10_000); // 每隔10秒执行一次
}); });
@@ -302,6 +303,7 @@ onMounted(() => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearInterval(timer); clearInterval(timer);
timer = null; timer = null;
timerFlag = true;
}); });
</script> </script>

View File

@@ -52,7 +52,7 @@ let queryParams = reactive({
/**任务组名 */ /**任务组名 */
jobGroup: undefined, jobGroup: undefined,
/**任务状态 */ /**任务状态 */
status: undefined, statusFlag: undefined,
/**当前页数 */ /**当前页数 */
pageNum: 1, pageNum: 1,
/**每页条数 */ /**每页条数 */
@@ -64,7 +64,7 @@ function fnQueryReset() {
queryParams = Object.assign(queryParams, { queryParams = Object.assign(queryParams, {
jobName: '', jobName: '',
jobGroup: undefined, jobGroup: undefined,
status: undefined, statusFlag: undefined,
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
}); });
@@ -130,8 +130,8 @@ let tableColumns: ColumnsType = [
}, },
{ {
title: t('views.monitor.job.status'), title: t('views.monitor.job.status'),
dataIndex: 'status', dataIndex: 'statusFlag',
key: 'status', key: 'statusFlag',
align: 'center', align: 'center',
width: 100, width: 100,
}, },
@@ -217,7 +217,7 @@ let modalState: ModalStateType = reactive({
misfirePolicy: '3', misfirePolicy: '3',
concurrent: '0', concurrent: '0',
jobGroup: 'DEFAULT', jobGroup: 'DEFAULT',
status: '0', statusFlag: '0',
saveLog: '0', saveLog: '0',
targetParams: '', targetParams: '',
remark: '', remark: '',
@@ -375,7 +375,7 @@ function fnModalCron(opt: boolean, cronStr?: string) {
*/ */
function fnRecordStatus(row: Record<string, string>) { function fnRecordStatus(row: Record<string, string>) {
const text = const text =
row.status === '1' row.statusFlag === '1'
? dict.sysJobStatus.find(s => s.value === '1')?.label ? dict.sysJobStatus.find(s => s.value === '1')?.label
: dict.sysJobStatus.find(s => s.value === '0')?.label; : dict.sysJobStatus.find(s => s.value === '0')?.label;
Modal.confirm({ Modal.confirm({
@@ -384,7 +384,7 @@ function fnRecordStatus(row: Record<string, string>) {
onOk() { onOk() {
const key = 'changeJobStatus'; const key = 'changeJobStatus';
message.loading({ content: t('common.loading'), key }); message.loading({ content: t('common.loading'), key });
changeJobStatus(row.jobId, row.status).then(res => { changeJobStatus(row.jobId, row.statusFlag).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
content: t('common.msgSuccess', { msg: `${row.jobName} ${text}` }), content: t('common.msgSuccess', { msg: `${row.jobName} ${text}` }),
@@ -403,10 +403,10 @@ function fnRecordStatus(row: Record<string, string>) {
}, },
onCancel() { onCancel() {
const value = const value =
row.status === '1' row.statusFlag === '1'
? dict.sysJobStatus.find(s => s.value === '0')?.value ? dict.sysJobStatus.find(s => s.value === '0')?.value
: dict.sysJobStatus.find(s => s.value === '1')?.value; : dict.sysJobStatus.find(s => s.value === '1')?.value;
row.status = value || '0'; row.statusFlag = value || '0';
}, },
}); });
} }
@@ -622,9 +622,9 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.monitor.job.status')" name="status"> <a-form-item :label="t('views.monitor.job.status')" name="statusFlag">
<a-select <a-select
v-model:value="queryParams.status" v-model:value="queryParams.statusFlag"
allow-clear allow-clear
:placeholder="t('common.selectPlease')" :placeholder="t('common.selectPlease')"
:options="dict.sysJobStatus" :options="dict.sysJobStatus"
@@ -765,13 +765,13 @@ onMounted(() => {
<template v-if="column.key === 'jobGroup'"> <template v-if="column.key === 'jobGroup'">
<DictTag :options="dict.sysJobGroup" :value="record.jobGroup" /> <DictTag :options="dict.sysJobGroup" :value="record.jobGroup" />
</template> </template>
<template v-if="column.key === 'status'"> <template v-if="column.key === 'statusFlag'">
<a-switch <a-switch
v-if=" v-if="
dict.sysJobStatus.length > 0 && dict.sysJobStatus.length > 0 &&
hasPermissions(['monitor:job:changeStatus']) hasPermissions(['monitor:job:changeStatus'])
" "
v-model:checked="record.status" v-model:checked="record.statusFlag"
checked-value="1" checked-value="1"
:checked-children="dict.sysJobStatus[0].label" :checked-children="dict.sysJobStatus[0].label"
un-checked-value="0" un-checked-value="0"
@@ -782,7 +782,7 @@ onMounted(() => {
<DictTag <DictTag
v-else v-else
:options="dict.sysJobStatus" :options="dict.sysJobStatus"
:value="record.status" :value="record.statusFlag"
/> />
</template> </template>
<template v-if="column.key === 'saveLog'"> <template v-if="column.key === 'saveLog'">
@@ -862,9 +862,9 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item :label="t('views.monitor.job.status')" name="status"> <a-form-item :label="t('views.monitor.job.status')" name="statusFlag">
{{ {{
dict.sysJobStatus.find(s => s.value === modalState.from.status) dict.sysJobStatus.find(s => s.value === modalState.from.statusFlag)
?.label ?.label
}} }}
</a-form-item> </a-form-item>
@@ -992,9 +992,9 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item :label="t('views.monitor.job.status')" name="status"> <a-form-item :label="t('views.monitor.job.status')" name="statusFlag">
<a-select <a-select
v-model:value="modalState.from.status" v-model:value="modalState.from.statusFlag"
default-value="0" default-value="0"
:placeholder="t('common.selectPlease')" :placeholder="t('common.selectPlease')"
:options="dict.sysJobStatus" :options="dict.sysJobStatus"

View File

@@ -52,7 +52,7 @@ let queryParams = reactive({
/**任务组名 */ /**任务组名 */
jobGroup: undefined, jobGroup: undefined,
/**执行状态 */ /**执行状态 */
status: undefined, statusFlag: undefined,
/**记录开始时间 */ /**记录开始时间 */
beginTime: '', beginTime: '',
/**记录结束时间 */ /**记录结束时间 */
@@ -67,7 +67,7 @@ let queryParams = reactive({
function fnQueryReset() { function fnQueryReset() {
if (jobId && jobId !== '0') { if (jobId && jobId !== '0') {
queryParams = Object.assign(queryParams, { queryParams = Object.assign(queryParams, {
status: undefined, statusFlag: undefined,
beginTime: '', beginTime: '',
endTime: '', endTime: '',
pageNum: 1, pageNum: 1,
@@ -78,7 +78,7 @@ function fnQueryReset() {
jobId: '', jobId: '',
jobName: '', jobName: '',
jobGroup: undefined, jobGroup: undefined,
status: undefined, statusFlag: undefined,
beginTime: '', beginTime: '',
endTime: '', endTime: '',
pageNum: 1, pageNum: 1,
@@ -142,9 +142,9 @@ let tableColumns: ColumnsType = [
width: 100, width: 100,
}, },
{ {
title: t('views.monitor.jobLog.status'), title: t('views.monitor.jobLog.statusFlag'),
dataIndex: 'status', dataIndex: 'statusFlag',
key: 'status', key: 'statusFlag',
align: 'center', align: 'center',
width: 100, width: 100,
}, },
@@ -234,7 +234,7 @@ let modalState: ModalStateType = reactive({
jobGroup: 'DEFAULT', jobGroup: 'DEFAULT',
invokeTarget: '', invokeTarget: '',
targetParams: '', targetParams: '',
status: '0', statusFlag: '0',
jobMsg: '', jobMsg: '',
createTime: 0, createTime: 0,
}, },
@@ -457,10 +457,10 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item <a-form-item
:label="t('views.monitor.jobLog.status')" :label="t('views.monitor.jobLog.status')"
name="status" name="statusFlag"
> >
<a-select <a-select
v-model:value="queryParams.status" v-model:value="queryParams.statusFlag"
allow-clear allow-clear
:placeholder="t('common.selectPlease')" :placeholder="t('common.selectPlease')"
:options="dict.sysCommonStatus" :options="dict.sysCommonStatus"
@@ -605,13 +605,13 @@ onMounted(() => {
<template v-if="column.key === 'jobGroup'"> <template v-if="column.key === 'jobGroup'">
<DictTag :options="dict.sysJobGroup" :value="record.jobGroup" /> <DictTag :options="dict.sysJobGroup" :value="record.jobGroup" />
</template> </template>
<template v-if="column.key === 'status'"> <template v-if="column.key === 'statusFlag'">
<a-tag :color="+record.status ? 'success' : 'error'"> <a-tag :color="+record.statusFlag ? 'success' : 'error'">
{{ {{
[ [
t('views.monitor.jobLog.status0'), t('views.monitor.jobLog.status0'),
t('views.monitor.jobLog.status1'), t('views.monitor.jobLog.status1'),
][+record.status] ][+record.statusFlag]
}} }}
</a-tag> </a-tag>
</template> </template>
@@ -651,14 +651,14 @@ onMounted(() => {
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item <a-form-item
:label="t('views.monitor.jobLog.status')" :label="t('views.monitor.jobLog.status')"
name="status" name="statusFlag"
> >
<a-tag :color="+modalState.from.status ? 'success' : 'error'"> <a-tag :color="+modalState.from.statusFlag ? 'success' : 'error'">
{{ {{
[ [
t('views.monitor.jobLog.status0'), t('views.monitor.jobLog.status0'),
t('views.monitor.jobLog.status1'), t('views.monitor.jobLog.status1'),
][+modalState.from.status] ][+modalState.from.statusFlag]
}} }}
</a-tag> </a-tag>
</a-form-item> </a-form-item>

View File

@@ -21,8 +21,8 @@ const props = defineProps({
}, },
/**记录ID */ /**记录ID */
editId: { editId: {
type: String, type: Number,
default: '', default: 0,
}, },
/**分组可选网元 */ /**分组可选网元 */
neGroup: { neGroup: {
@@ -62,7 +62,7 @@ let modalState: ModalStateType = reactive({
openByEdit: false, openByEdit: false,
title: '信息', title: '信息',
from: { from: {
hostId: undefined, id: undefined,
hostType: 'ssh', hostType: 'ssh',
groupId: '0', groupId: '0',
title: '', title: '',
@@ -149,7 +149,7 @@ function fnModalOk() {
.validate(validateArr) .validate(validateArr)
.then(() => { .then(() => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const neHost = form.hostId ? updateNeHost(form) : addNeHost(form); const neHost = form.id > 0 ? updateNeHost(form) : addNeHost(form);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
neHost neHost
.then(res => { .then(res => {
@@ -194,7 +194,7 @@ function fnModalCancel() {
* 对话框弹出显示为 ID编辑 * 对话框弹出显示为 ID编辑
* @param id id * @param id id
*/ */
function fnModalVisibleById(id: string) { function fnModalVisibleById(id: number) {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
modalState.confirmLoading = true; modalState.confirmLoading = true;
@@ -322,7 +322,7 @@ onMounted(() => {
v-model:value="modalState.from.hostType" v-model:value="modalState.from.hostType"
default-value="ssh" default-value="ssh"
:options="dict.neHostType" :options="dict.neHostType"
:disabled="!!modalState.from.hostId" :disabled="modalState.from.id > 0"
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
@@ -333,7 +333,7 @@ onMounted(() => {
v-model:value="modalState.from.groupId" v-model:value="modalState.from.groupId"
default-value="0" default-value="0"
:options="dict.neHostGroupId" :options="dict.neHostGroupId"
:disabled="!!modalState.from.hostId" :disabled="modalState.from.id > 0"
> >
</a-select> </a-select>
</a-form-item> </a-form-item>

View File

@@ -10,6 +10,7 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { delNeHost, listNeHost } from '@/api/ne/neHost'; import { delNeHost, listNeHost } from '@/api/ne/neHost';
import useDictStore from '@/store/modules/dict'; import useDictStore from '@/store/modules/dict';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { number } from 'echarts';
const { getDict } = useDictStore(); const { getDict } = useDictStore();
const { t } = useI18n(); const { t } = useI18n();
const EditModal = defineAsyncComponent( const EditModal = defineAsyncComponent(
@@ -82,7 +83,7 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [ let tableColumns: ColumnsType = [
{ {
title: t('common.rowId'), title: t('common.rowId'),
dataIndex: 'hostId', dataIndex: 'id',
align: 'center', align: 'center',
width: 50, width: 50,
}, },
@@ -142,7 +143,7 @@ let tableColumns: ColumnsType = [
}, },
{ {
title: t('common.operate'), title: t('common.operate'),
key: 'hostId', key: 'id',
align: 'left', align: 'left',
}, },
]; ];
@@ -210,7 +211,7 @@ type ModalStateType = {
/**新增框或修改框是否显示 */ /**新增框或修改框是否显示 */
openByEdit: boolean; openByEdit: boolean;
/**记录ID */ /**记录ID */
hostId: string; id: number | undefined;
/**确定按钮 loading */ /**确定按钮 loading */
confirmLoading: boolean; confirmLoading: boolean;
}; };
@@ -218,7 +219,7 @@ type ModalStateType = {
/**对话框对象信息状态 */ /**对话框对象信息状态 */
let modalState: ModalStateType = reactive({ let modalState: ModalStateType = reactive({
openByEdit: false, openByEdit: false,
hostId: '', id: undefined,
confirmLoading: false, confirmLoading: false,
}); });
@@ -226,12 +227,8 @@ let modalState: ModalStateType = reactive({
* 对话框弹出显示为 新增或者修改 * 对话框弹出显示为 新增或者修改
* @param roleId 角色编号ID, 不传为新增 * @param roleId 角色编号ID, 不传为新增
*/ */
function fnModalVisibleByEdit(roleId?: string) { function fnModalVisibleByEdit(id?: undefined) {
if (!roleId) { modalState.id = id;
modalState.hostId = '';
} else {
modalState.hostId = roleId;
}
modalState.openByEdit = true; modalState.openByEdit = true;
} }
@@ -250,20 +247,20 @@ function fnModalOk() {
*/ */
function fnModalCancel() { function fnModalCancel() {
modalState.openByEdit = false; modalState.openByEdit = false;
modalState.hostId = ''; modalState.id = undefined;
} }
/** /**
* 网元主机删除 * 网元主机删除
* @param hostId 网元主机编号ID * @param id 网元主机编号ID
*/ */
function fnRecordDelete(hostId: string) { function fnRecordDelete(id: number) {
Modal.confirm({ Modal.confirm({
title: t('common.tipTitle'), title: t('common.tipTitle'),
content: t('views.ne.neHost.delTip', { num: hostId }), content: t('views.ne.neHost.delTip', { num: id }),
onOk() { onOk() {
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
delNeHost(hostId).then(res => { delNeHost(id).then(res => {
hide(); hide();
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
@@ -420,7 +417,7 @@ onMounted(() => {
<!-- 表格列表 --> <!-- 表格列表 -->
<a-table <a-table
class="table" class="table"
row-key="hostId" row-key="id"
:columns="tableColumns" :columns="tableColumns"
:loading="tableState.loading" :loading="tableState.loading"
:data-source="tableState.data" :data-source="tableState.data"
@@ -435,13 +432,13 @@ onMounted(() => {
<template v-if="column.key === 'authMode'"> <template v-if="column.key === 'authMode'">
<DictTag :options="dict.neHostAuthMode" :value="record.authMode" /> <DictTag :options="dict.neHostAuthMode" :value="record.authMode" />
</template> </template>
<template v-if="column.key === 'hostId'"> <template v-if="column.key === 'id'">
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.editText') }}</template> <template #title>{{ t('common.editText') }}</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnModalVisibleByEdit(record.hostId)" @click.prevent="fnModalVisibleByEdit(record.id)"
> >
<template #icon><FormOutlined /></template> <template #icon><FormOutlined /></template>
</a-button> </a-button>
@@ -450,7 +447,7 @@ onMounted(() => {
<template #title>{{ t('common.deleteText') }}</template> <template #title>{{ t('common.deleteText') }}</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnRecordDelete(record.hostId)" @click.prevent="fnRecordDelete(record.id)"
> >
<template #icon><DeleteOutlined /></template> <template #icon><DeleteOutlined /></template>
</a-button> </a-button>
@@ -463,7 +460,7 @@ onMounted(() => {
<!-- 新增框或修改框 --> <!-- 新增框或修改框 -->
<EditModal <EditModal
v-model:open="modalState.openByEdit" v-model:open="modalState.openByEdit"
:edit-id="modalState.hostId" :edit-id="modalState.id"
@ok="fnModalOk" @ok="fnModalOk"
@cancel="fnModalCancel" @cancel="fnModalCancel"
></EditModal> ></EditModal>

View File

@@ -118,7 +118,7 @@ let modalState: ModalStateType = reactive({
// 主机 // 主机
hosts: [ hosts: [
{ {
hostId: undefined, id: undefined,
hostType: 'ssh', hostType: 'ssh',
groupId: '1', groupId: '1',
title: 'SSH_NE_22', title: 'SSH_NE_22',
@@ -132,7 +132,7 @@ let modalState: ModalStateType = reactive({
remark: '', remark: '',
}, },
{ {
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_4100', title: 'Telnet_NE_4100',
@@ -292,7 +292,7 @@ function fnNeTypeChange(v: any) {
// UPF标准版本可支持5002 // UPF标准版本可支持5002
if (hostsLen === 2 && v === 'UPF') { if (hostsLen === 2 && v === 'UPF') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_5002', title: 'Telnet_NE_5002',
@@ -307,7 +307,7 @@ function fnNeTypeChange(v: any) {
// UDM可支持6379 // UDM可支持6379
if (hostsLen === 2 && v === 'UDM') { if (hostsLen === 2 && v === 'UDM') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'redis', hostType: 'redis',
groupId: '1', groupId: '1',
title: 'REDIS_NE_6379', title: 'REDIS_NE_6379',

View File

@@ -58,7 +58,7 @@ let modalState: ModalStateType = reactive({
// 主机 // 主机
hosts: [ hosts: [
{ {
hostId: undefined, id: undefined,
hostType: 'ssh', hostType: 'ssh',
groupId: '1', groupId: '1',
title: 'SSH_NE_22', title: 'SSH_NE_22',
@@ -72,7 +72,7 @@ let modalState: ModalStateType = reactive({
remark: '', remark: '',
}, },
{ {
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_4100', title: 'Telnet_NE_4100',
@@ -154,8 +154,8 @@ function fnModalOk() {
from.hostIds = res.data.hostIds; from.hostIds = res.data.hostIds;
const hostIds = res.data.hostIds.split(','); const hostIds = res.data.hostIds.split(',');
if (hostIds.length == 2) { if (hostIds.length == 2) {
from.hosts[0].hostId = hostIds[0]; from.hosts[0].id = parseInt(hostIds[0]);
from.hosts[1].hostId = hostIds[1]; from.hosts[1].id = parseInt(hostIds[1]);
} }
return true; return true;
} else { } else {
@@ -163,7 +163,7 @@ function fnModalOk() {
from.id = undefined; from.id = undefined;
from.hostIds = ''; from.hostIds = '';
for (let index = 0; index < from.hosts.length; index++) { for (let index = 0; index < from.hosts.length; index++) {
from.hosts[index].hostId = undefined; from.hosts[index].id = undefined;
} }
return false; return false;
} }
@@ -183,7 +183,7 @@ function fnModalOk() {
from.id = undefined; from.id = undefined;
from.hostIds = ''; from.hostIds = '';
for (let index = 0; index < from.hosts.length; index++) { for (let index = 0; index < from.hosts.length; index++) {
from.hosts[index].hostId = undefined; from.hosts[index].id = undefined;
} }
}, },
onOk: () => { onOk: () => {
@@ -237,7 +237,7 @@ function fnNeTypeChange(v: any) {
// UPF标准版本可支持5002 // UPF标准版本可支持5002
if (hostsLen === 2 && v === 'UPF') { if (hostsLen === 2 && v === 'UPF') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_5002', title: 'Telnet_NE_5002',
@@ -252,7 +252,7 @@ function fnNeTypeChange(v: any) {
// UDM可支持6379 // UDM可支持6379
if (hostsLen === 2 && v === 'UDM') { if (hostsLen === 2 && v === 'UDM') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'redis', hostType: 'redis',
groupId: '1', groupId: '1',
title: 'REDIS_NE_6379', title: 'REDIS_NE_6379',

View File

@@ -43,7 +43,7 @@ let state: StateType = reactive({
sudo: false, sudo: false,
}, },
from: { from: {
hostId: undefined, id: undefined,
hostType: 'ssh', hostType: 'ssh',
groupId: '1', groupId: '1',
title: 'SSH_NE_22', title: 'SSH_NE_22',

View File

@@ -196,7 +196,7 @@ function fnNeTypeChange(v: any, data: any) {
// UPF标准版本可支持5002 // UPF标准版本可支持5002
if (hostsLen === 2 && v === 'UPF') { if (hostsLen === 2 && v === 'UPF') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_5002', title: 'Telnet_NE_5002',
@@ -211,7 +211,7 @@ function fnNeTypeChange(v: any, data: any) {
// UDM可支持6379 // UDM可支持6379
if (hostsLen === 2 && v === 'UDM') { if (hostsLen === 2 && v === 'UDM') {
modalState.from.hosts.push({ modalState.from.hosts.push({
hostId: undefined, id: undefined,
hostType: 'redis', hostType: 'redis',
groupId: '1', groupId: '1',
title: 'REDIS_NE_6379', title: 'REDIS_NE_6379',
@@ -248,7 +248,7 @@ function fnModalVisibleByEdit(record?: any) {
// 主机 // 主机
hosts: [ hosts: [
{ {
hostId: undefined, id: undefined,
hostType: 'ssh', hostType: 'ssh',
groupId: '1', groupId: '1',
title: 'SSH_NE_22', title: 'SSH_NE_22',
@@ -262,7 +262,7 @@ function fnModalVisibleByEdit(record?: any) {
remark: '', remark: '',
}, },
{ {
hostId: undefined, id: undefined,
hostType: 'telnet', hostType: 'telnet',
groupId: '1', groupId: '1',
title: 'Telnet_NE_4100', title: 'Telnet_NE_4100',

View File

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

View File

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