fix: hostId 变更类型和字段名
This commit is contained in:
@@ -16,7 +16,7 @@ const props = defineProps({
|
||||
},
|
||||
/**连接主机ID,必传 */
|
||||
hostId: {
|
||||
type: String,
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
/**初始发送命令 */
|
||||
|
||||
@@ -15,7 +15,7 @@ const props = defineProps({
|
||||
},
|
||||
/**连接主机ID,必传 */
|
||||
hostId: {
|
||||
type: String,
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
/**窗口单行字符数 */
|
||||
|
||||
@@ -16,7 +16,7 @@ const props = defineProps({
|
||||
},
|
||||
/**连接主机ID,必传 */
|
||||
hostId: {
|
||||
type: String,
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
/**窗口单行字符数 */
|
||||
|
||||
@@ -277,6 +277,7 @@ let dict: {
|
||||
});
|
||||
|
||||
let timer: any;
|
||||
let timerFlag: boolean = false;
|
||||
onMounted(() => {
|
||||
// 初始字典数据
|
||||
Promise.allSettled([getDict('ne_info_status'), getDict('index_status')])
|
||||
@@ -292,7 +293,7 @@ onMounted(() => {
|
||||
fnLocale();
|
||||
await fnGetList(false);
|
||||
timer = setInterval(() => {
|
||||
if (!timer) return;
|
||||
if (timerFlag) return;
|
||||
fnGetList(true);
|
||||
}, 10_000); // 每隔10秒执行一次
|
||||
});
|
||||
@@ -302,6 +303,7 @@ onMounted(() => {
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
timerFlag = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ let queryParams = reactive({
|
||||
/**任务组名 */
|
||||
jobGroup: undefined,
|
||||
/**任务状态 */
|
||||
status: undefined,
|
||||
statusFlag: undefined,
|
||||
/**当前页数 */
|
||||
pageNum: 1,
|
||||
/**每页条数 */
|
||||
@@ -64,7 +64,7 @@ function fnQueryReset() {
|
||||
queryParams = Object.assign(queryParams, {
|
||||
jobName: '',
|
||||
jobGroup: undefined,
|
||||
status: undefined,
|
||||
statusFlag: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
});
|
||||
@@ -130,8 +130,8 @@ let tableColumns: ColumnsType = [
|
||||
},
|
||||
{
|
||||
title: t('views.monitor.job.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
dataIndex: 'statusFlag',
|
||||
key: 'statusFlag',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
},
|
||||
@@ -217,7 +217,7 @@ let modalState: ModalStateType = reactive({
|
||||
misfirePolicy: '3',
|
||||
concurrent: '0',
|
||||
jobGroup: 'DEFAULT',
|
||||
status: '0',
|
||||
statusFlag: '0',
|
||||
saveLog: '0',
|
||||
targetParams: '',
|
||||
remark: '',
|
||||
@@ -375,7 +375,7 @@ function fnModalCron(opt: boolean, cronStr?: string) {
|
||||
*/
|
||||
function fnRecordStatus(row: Record<string, string>) {
|
||||
const text =
|
||||
row.status === '1'
|
||||
row.statusFlag === '1'
|
||||
? dict.sysJobStatus.find(s => s.value === '1')?.label
|
||||
: dict.sysJobStatus.find(s => s.value === '0')?.label;
|
||||
Modal.confirm({
|
||||
@@ -384,7 +384,7 @@ function fnRecordStatus(row: Record<string, string>) {
|
||||
onOk() {
|
||||
const key = 'changeJobStatus';
|
||||
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) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: `${row.jobName} ${text}` }),
|
||||
@@ -403,10 +403,10 @@ function fnRecordStatus(row: Record<string, string>) {
|
||||
},
|
||||
onCancel() {
|
||||
const value =
|
||||
row.status === '1'
|
||||
row.statusFlag === '1'
|
||||
? dict.sysJobStatus.find(s => s.value === '0')?.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-col>
|
||||
<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
|
||||
v-model:value="queryParams.status"
|
||||
v-model:value="queryParams.statusFlag"
|
||||
allow-clear
|
||||
:placeholder="t('common.selectPlease')"
|
||||
:options="dict.sysJobStatus"
|
||||
@@ -765,13 +765,13 @@ onMounted(() => {
|
||||
<template v-if="column.key === 'jobGroup'">
|
||||
<DictTag :options="dict.sysJobGroup" :value="record.jobGroup" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<template v-if="column.key === 'statusFlag'">
|
||||
<a-switch
|
||||
v-if="
|
||||
dict.sysJobStatus.length > 0 &&
|
||||
hasPermissions(['monitor:job:changeStatus'])
|
||||
"
|
||||
v-model:checked="record.status"
|
||||
v-model:checked="record.statusFlag"
|
||||
checked-value="1"
|
||||
:checked-children="dict.sysJobStatus[0].label"
|
||||
un-checked-value="0"
|
||||
@@ -782,7 +782,7 @@ onMounted(() => {
|
||||
<DictTag
|
||||
v-else
|
||||
:options="dict.sysJobStatus"
|
||||
:value="record.status"
|
||||
:value="record.statusFlag"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'saveLog'">
|
||||
@@ -862,9 +862,9 @@ onMounted(() => {
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<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
|
||||
}}
|
||||
</a-form-item>
|
||||
@@ -992,9 +992,9 @@ onMounted(() => {
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<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
|
||||
v-model:value="modalState.from.status"
|
||||
v-model:value="modalState.from.statusFlag"
|
||||
default-value="0"
|
||||
:placeholder="t('common.selectPlease')"
|
||||
:options="dict.sysJobStatus"
|
||||
|
||||
@@ -52,7 +52,7 @@ let queryParams = reactive({
|
||||
/**任务组名 */
|
||||
jobGroup: undefined,
|
||||
/**执行状态 */
|
||||
status: undefined,
|
||||
statusFlag: undefined,
|
||||
/**记录开始时间 */
|
||||
beginTime: '',
|
||||
/**记录结束时间 */
|
||||
@@ -67,7 +67,7 @@ let queryParams = reactive({
|
||||
function fnQueryReset() {
|
||||
if (jobId && jobId !== '0') {
|
||||
queryParams = Object.assign(queryParams, {
|
||||
status: undefined,
|
||||
statusFlag: undefined,
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
pageNum: 1,
|
||||
@@ -78,7 +78,7 @@ function fnQueryReset() {
|
||||
jobId: '',
|
||||
jobName: '',
|
||||
jobGroup: undefined,
|
||||
status: undefined,
|
||||
statusFlag: undefined,
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
pageNum: 1,
|
||||
@@ -142,9 +142,9 @@ let tableColumns: ColumnsType = [
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: t('views.monitor.jobLog.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
title: t('views.monitor.jobLog.statusFlag'),
|
||||
dataIndex: 'statusFlag',
|
||||
key: 'statusFlag',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
},
|
||||
@@ -234,7 +234,7 @@ let modalState: ModalStateType = reactive({
|
||||
jobGroup: 'DEFAULT',
|
||||
invokeTarget: '',
|
||||
targetParams: '',
|
||||
status: '0',
|
||||
statusFlag: '0',
|
||||
jobMsg: '',
|
||||
createTime: 0,
|
||||
},
|
||||
@@ -457,10 +457,10 @@ onMounted(() => {
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
:label="t('views.monitor.jobLog.status')"
|
||||
name="status"
|
||||
name="statusFlag"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="queryParams.status"
|
||||
v-model:value="queryParams.statusFlag"
|
||||
allow-clear
|
||||
:placeholder="t('common.selectPlease')"
|
||||
:options="dict.sysCommonStatus"
|
||||
@@ -605,13 +605,13 @@ onMounted(() => {
|
||||
<template v-if="column.key === 'jobGroup'">
|
||||
<DictTag :options="dict.sysJobGroup" :value="record.jobGroup" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag :color="+record.status ? 'success' : 'error'">
|
||||
<template v-if="column.key === 'statusFlag'">
|
||||
<a-tag :color="+record.statusFlag ? 'success' : 'error'">
|
||||
{{
|
||||
[
|
||||
t('views.monitor.jobLog.status0'),
|
||||
t('views.monitor.jobLog.status1'),
|
||||
][+record.status]
|
||||
][+record.statusFlag]
|
||||
}}
|
||||
</a-tag>
|
||||
</template>
|
||||
@@ -651,14 +651,14 @@ onMounted(() => {
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
: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.status1'),
|
||||
][+modalState.from.status]
|
||||
][+modalState.from.statusFlag]
|
||||
}}
|
||||
</a-tag>
|
||||
</a-form-item>
|
||||
|
||||
@@ -21,8 +21,8 @@ const props = defineProps({
|
||||
},
|
||||
/**记录ID */
|
||||
editId: {
|
||||
type: String,
|
||||
default: '',
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
/**分组可选网元 */
|
||||
neGroup: {
|
||||
@@ -62,7 +62,7 @@ let modalState: ModalStateType = reactive({
|
||||
openByEdit: false,
|
||||
title: '信息',
|
||||
from: {
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'ssh',
|
||||
groupId: '0',
|
||||
title: '',
|
||||
@@ -149,7 +149,7 @@ function fnModalOk() {
|
||||
.validate(validateArr)
|
||||
.then(() => {
|
||||
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);
|
||||
neHost
|
||||
.then(res => {
|
||||
@@ -194,7 +194,7 @@ function fnModalCancel() {
|
||||
* 对话框弹出显示为 ID编辑
|
||||
* @param id id
|
||||
*/
|
||||
function fnModalVisibleById(id: string) {
|
||||
function fnModalVisibleById(id: number) {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
@@ -322,7 +322,7 @@ onMounted(() => {
|
||||
v-model:value="modalState.from.hostType"
|
||||
default-value="ssh"
|
||||
:options="dict.neHostType"
|
||||
:disabled="!!modalState.from.hostId"
|
||||
:disabled="modalState.from.id > 0"
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
@@ -333,7 +333,7 @@ onMounted(() => {
|
||||
v-model:value="modalState.from.groupId"
|
||||
default-value="0"
|
||||
:options="dict.neHostGroupId"
|
||||
:disabled="!!modalState.from.hostId"
|
||||
:disabled="modalState.from.id > 0"
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
@@ -10,6 +10,7 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { delNeHost, listNeHost } from '@/api/ne/neHost';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { number } from 'echarts';
|
||||
const { getDict } = useDictStore();
|
||||
const { t } = useI18n();
|
||||
const EditModal = defineAsyncComponent(
|
||||
@@ -82,7 +83,7 @@ let tableState: TabeStateType = reactive({
|
||||
let tableColumns: ColumnsType = [
|
||||
{
|
||||
title: t('common.rowId'),
|
||||
dataIndex: 'hostId',
|
||||
dataIndex: 'id',
|
||||
align: 'center',
|
||||
width: 50,
|
||||
},
|
||||
@@ -142,7 +143,7 @@ let tableColumns: ColumnsType = [
|
||||
},
|
||||
{
|
||||
title: t('common.operate'),
|
||||
key: 'hostId',
|
||||
key: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
@@ -210,7 +211,7 @@ type ModalStateType = {
|
||||
/**新增框或修改框是否显示 */
|
||||
openByEdit: boolean;
|
||||
/**记录ID */
|
||||
hostId: string;
|
||||
id: number | undefined;
|
||||
/**确定按钮 loading */
|
||||
confirmLoading: boolean;
|
||||
};
|
||||
@@ -218,7 +219,7 @@ type ModalStateType = {
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
openByEdit: false,
|
||||
hostId: '',
|
||||
id: undefined,
|
||||
confirmLoading: false,
|
||||
});
|
||||
|
||||
@@ -226,12 +227,8 @@ let modalState: ModalStateType = reactive({
|
||||
* 对话框弹出显示为 新增或者修改
|
||||
* @param roleId 角色编号ID, 不传为新增
|
||||
*/
|
||||
function fnModalVisibleByEdit(roleId?: string) {
|
||||
if (!roleId) {
|
||||
modalState.hostId = '';
|
||||
} else {
|
||||
modalState.hostId = roleId;
|
||||
}
|
||||
function fnModalVisibleByEdit(id?: undefined) {
|
||||
modalState.id = id;
|
||||
modalState.openByEdit = true;
|
||||
}
|
||||
|
||||
@@ -250,20 +247,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: number) {
|
||||
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({
|
||||
@@ -420,7 +417,7 @@ onMounted(() => {
|
||||
<!-- 表格列表 -->
|
||||
<a-table
|
||||
class="table"
|
||||
row-key="hostId"
|
||||
row-key="id"
|
||||
:columns="tableColumns"
|
||||
:loading="tableState.loading"
|
||||
:data-source="tableState.data"
|
||||
@@ -435,13 +432,13 @@ onMounted(() => {
|
||||
<template v-if="column.key === 'authMode'">
|
||||
<DictTag :options="dict.neHostAuthMode" :value="record.authMode" />
|
||||
</template>
|
||||
<template v-if="column.key === 'hostId'">
|
||||
<template v-if="column.key === 'id'">
|
||||
<a-space :size="8" align="center">
|
||||
<a-tooltip>
|
||||
<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>
|
||||
@@ -450,7 +447,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>
|
||||
@@ -463,7 +460,7 @@ onMounted(() => {
|
||||
<!-- 新增框或修改框 -->
|
||||
<EditModal
|
||||
v-model:open="modalState.openByEdit"
|
||||
:edit-id="modalState.hostId"
|
||||
:edit-id="modalState.id"
|
||||
@ok="fnModalOk"
|
||||
@cancel="fnModalCancel"
|
||||
></EditModal>
|
||||
|
||||
@@ -118,7 +118,7 @@ let modalState: ModalStateType = reactive({
|
||||
// 主机
|
||||
hosts: [
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'ssh',
|
||||
groupId: '1',
|
||||
title: 'SSH_NE_22',
|
||||
@@ -132,7 +132,7 @@ let modalState: ModalStateType = reactive({
|
||||
remark: '',
|
||||
},
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_4100',
|
||||
@@ -292,7 +292,7 @@ function fnNeTypeChange(v: any) {
|
||||
// UPF标准版本可支持5002
|
||||
if (hostsLen === 2 && v === 'UPF') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_5002',
|
||||
@@ -307,7 +307,7 @@ function fnNeTypeChange(v: any) {
|
||||
// UDM可支持6379
|
||||
if (hostsLen === 2 && v === 'UDM') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'redis',
|
||||
groupId: '1',
|
||||
title: 'REDIS_NE_6379',
|
||||
|
||||
@@ -58,7 +58,7 @@ let modalState: ModalStateType = reactive({
|
||||
// 主机
|
||||
hosts: [
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'ssh',
|
||||
groupId: '1',
|
||||
title: 'SSH_NE_22',
|
||||
@@ -72,7 +72,7 @@ let modalState: ModalStateType = reactive({
|
||||
remark: '',
|
||||
},
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_4100',
|
||||
@@ -154,8 +154,8 @@ function fnModalOk() {
|
||||
from.hostIds = res.data.hostIds;
|
||||
const hostIds = res.data.hostIds.split(',');
|
||||
if (hostIds.length == 2) {
|
||||
from.hosts[0].hostId = hostIds[0];
|
||||
from.hosts[1].hostId = hostIds[1];
|
||||
from.hosts[0].id = parseInt(hostIds[0]);
|
||||
from.hosts[1].id = parseInt(hostIds[1]);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -163,7 +163,7 @@ function fnModalOk() {
|
||||
from.id = undefined;
|
||||
from.hostIds = '';
|
||||
for (let index = 0; index < from.hosts.length; index++) {
|
||||
from.hosts[index].hostId = undefined;
|
||||
from.hosts[index].id = undefined;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ function fnModalOk() {
|
||||
from.id = undefined;
|
||||
from.hostIds = '';
|
||||
for (let index = 0; index < from.hosts.length; index++) {
|
||||
from.hosts[index].hostId = undefined;
|
||||
from.hosts[index].id = undefined;
|
||||
}
|
||||
},
|
||||
onOk: () => {
|
||||
@@ -237,7 +237,7 @@ function fnNeTypeChange(v: any) {
|
||||
// UPF标准版本可支持5002
|
||||
if (hostsLen === 2 && v === 'UPF') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_5002',
|
||||
@@ -252,7 +252,7 @@ function fnNeTypeChange(v: any) {
|
||||
// UDM可支持6379
|
||||
if (hostsLen === 2 && v === 'UDM') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'redis',
|
||||
groupId: '1',
|
||||
title: 'REDIS_NE_6379',
|
||||
|
||||
@@ -43,7 +43,7 @@ let state: StateType = reactive({
|
||||
sudo: false,
|
||||
},
|
||||
from: {
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'ssh',
|
||||
groupId: '1',
|
||||
title: 'SSH_NE_22',
|
||||
|
||||
@@ -196,7 +196,7 @@ function fnNeTypeChange(v: any, data: any) {
|
||||
// UPF标准版本可支持5002
|
||||
if (hostsLen === 2 && v === 'UPF') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_5002',
|
||||
@@ -211,7 +211,7 @@ function fnNeTypeChange(v: any, data: any) {
|
||||
// UDM可支持6379
|
||||
if (hostsLen === 2 && v === 'UDM') {
|
||||
modalState.from.hosts.push({
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'redis',
|
||||
groupId: '1',
|
||||
title: 'REDIS_NE_6379',
|
||||
@@ -248,7 +248,7 @@ function fnModalVisibleByEdit(record?: any) {
|
||||
// 主机
|
||||
hosts: [
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'ssh',
|
||||
groupId: '1',
|
||||
title: 'SSH_NE_22',
|
||||
@@ -262,7 +262,7 @@ function fnModalVisibleByEdit(record?: any) {
|
||||
remark: '',
|
||||
},
|
||||
{
|
||||
hostId: undefined,
|
||||
id: undefined,
|
||||
hostType: 'telnet',
|
||||
groupId: '1',
|
||||
title: 'Telnet_NE_4100',
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user