ref: v3变更,,同步v2.2508.4

This commit is contained in:
TsMask
2025-09-01 11:19:01 +08:00
parent 2319cdf36b
commit e943b4dedc
129 changed files with 1876 additions and 3032 deletions

View File

@@ -8,9 +8,11 @@ import { ColumnsType } from 'ant-design-vue/es/table';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeStore from '@/store/modules/ne';
import { listNeInfo, delNeInfo, stateNeInfo } from '@/api/ne/neInfo';
import { listNeInfo, delNeInfo } from '@/api/ne/neInfo';
import { stateNeInfo } from '@/api/ne/neAction';
import useDictStore from '@/store/modules/dict';
import useNeOptions from './hooks/useNeOptions';
import { currentCoreUid } from '@/hooks/useCoreUid';
const { getDict } = useDictStore();
const neStore = useNeStore();
const { t } = useI18n();
@@ -45,6 +47,8 @@ let dict: {
/**查询参数 */
let queryParams = reactive({
/**核心网标识 */
coreUid: currentCoreUid(),
/**网元类型 */
neType: '',
/**带状态信息 */
@@ -79,15 +83,18 @@ type TabeStateType = {
data: Record<string, any>[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
/**勾选记录 */
selectedRows: Record<string, any>[];
};
/**表格状态 */
let tableState: TabeStateType = reactive({
loading: false,
size: 'middle',
seached: false,
seached: true,
data: [],
selectedRowKeys: [],
selectedRows: [],
});
/**表格字段列 */
@@ -98,18 +105,6 @@ let tableColumns: ColumnsType = [
align: 'left',
width: 100,
},
{
title: t('views.ne.common.neId'),
dataIndex: 'neId',
align: 'left',
width: 100,
},
{
title: t('views.ne.common.rmUid'),
dataIndex: 'rmUid',
align: 'left',
width: 150,
},
{
title: t('views.ne.common.neName'),
dataIndex: 'neName',
@@ -118,7 +113,7 @@ let tableColumns: ColumnsType = [
},
{
title: t('views.ne.common.ipAddr'),
dataIndex: 'ip',
dataIndex: 'ipAddr',
align: 'left',
width: 150,
},
@@ -176,8 +171,16 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) {
function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
tableState.selectedRowKeys = keys;
tableState.selectedRows = rows.map(item => {
return {
id: item.id,
coreUid: item.coreUid,
neUid: item.neUid,
neType: item.neType,
};
});
}
/**对话框对象信息状态类型 */
@@ -189,9 +192,9 @@ type ModalStateType = {
/**新增框或修改框是否显示 */
openByEdit: boolean;
/**新增框或修改框ID */
editId: number;
/**OAM框网元类型ID */
neId: string;
/**网元修改框 */
coreUid: string;
neUid: string;
neType: string;
/**确定按钮 loading */
confirmLoading: boolean;
@@ -202,8 +205,8 @@ let modalState: ModalStateType = reactive({
openByBackConf: false,
openByOAM: false,
openByEdit: false,
editId: 0,
neId: '',
coreUid: '',
neUid: '',
neType: '',
confirmLoading: false,
});
@@ -214,9 +217,13 @@ let modalState: ModalStateType = reactive({
*/
function fnModalVisibleByEdit(row?: Record<string, any>) {
if (!row) {
modalState.editId = 0;
modalState.coreUid = '';
modalState.neUid = '';
modalState.neType = '';
} else {
modalState.editId = row.id;
modalState.coreUid = row.coreUid;
modalState.neUid = row.neUid;
modalState.neType = row.neType;
}
modalState.openByEdit = !modalState.openByEdit;
}
@@ -227,7 +234,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
*/
function fnModalEditOk(from: Record<string, any>) {
// 新增时刷新列表
if (!from.id) {
if (!from.neUid) {
fnGetList();
return;
}
@@ -237,16 +244,16 @@ function fnModalEditOk(from: Record<string, any>) {
/**局部更新信息 */
function reloadRowInfo(row: Record<string, any>) {
stateNeInfo(row.neType, row.neId)
stateNeInfo(row.coreUid, row.neUid)
.then(res => {
// 找到编辑更新的网元
const item = tableState.data.find(s => s.id === row.id);
if (item && res.code === RESULT_CODE_SUCCESS) {
item.neType = row.neType;
item.neId = row.neId;
item.rmUid = row.rmUid;
item.neUid = row.neUid;
item.coreUid = row.coreUid;
item.neName = row.neName;
item.ip = row.ip;
item.ipAddr = row.ipAddr;
item.port = row.port;
if (res.data.online) {
item.status = '1';
@@ -271,7 +278,9 @@ function reloadRowInfo(row: Record<string, any>) {
* 进行表达规则校验
*/
function fnModalEditCancel() {
modalState.editId = 0;
modalState.coreUid = '';
modalState.neUid = '';
modalState.neType = '';
modalState.openByEdit = false;
modalState.openByOAM = false;
modalState.openByBackConf = false;
@@ -282,7 +291,7 @@ function fnModalEditCancel() {
* @param id 编号
*/
function fnRecordDelete(id: string) {
if (!id || modalState.confirmLoading) return;
if (modalState.confirmLoading) return;
let msg = t('views.ne.neInfo.delTip');
if (id === '0') {
msg = `${msg} ...${tableState.selectedRowKeys.length}`;
@@ -295,9 +304,29 @@ function fnRecordDelete(id: string) {
onOk() {
modalState.confirmLoading = true;
const hide = message.loading(t('common.loading'), 0);
delNeInfo(id)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
let reqArr: any = [];
if (id === '0') {
tableState.selectedRows.forEach(item => {
reqArr.push(
delNeInfo({ coreUid: item.coreUid, neUid: item.neUid, id: item.id })
);
});
} else {
tableState.data.forEach(item => {
if (item.id === id) {
reqArr.push(
delNeInfo({
coreUid: item.coreUid,
neUid: item.neUid,
id: item.id,
})
);
}
});
}
Promise.all(reqArr)
.then(resArr => {
if (resArr.every((item: any) => item.code === RESULT_CODE_SUCCESS)) {
message.success(t('common.operateOk'), 3);
// 过滤掉删除的id
tableState.data = tableState.data.filter(item => {
@@ -311,7 +340,7 @@ function fnRecordDelete(id: string) {
neStore.fnNelistRefresh();
} else {
message.error({
content: `${res.msg}`,
content: t('common.operateErr'),
duration: 3,
});
}
@@ -348,15 +377,17 @@ function fnRecordMore(type: string | number, row: Record<string, any>) {
fnNeLogFile(row);
break;
case 'oam':
modalState.neId = row.neId;
modalState.coreUid = row.coreUid;
modalState.neUid = row.neUid;
modalState.neType = row.neType;
modalState.openByOAM = !modalState.openByOAM;
break;
case 'backConfExport':
backConf.value.exportConf(row.neType, row.neId);
backConf.value.exportConf(row.coreUid, row.neUid, row.neType);
break;
case 'backConfImport':
modalState.neId = row.neId;
modalState.coreUid = row.coreUid;
modalState.neUid = row.neUid;
modalState.neType = row.neType;
modalState.openByBackConf = !modalState.openByBackConf;
break;
@@ -711,7 +742,9 @@ onMounted(() => {
<!-- 新增框或修改框 -->
<EditModal
v-model:open="modalState.openByEdit"
:edit-id="modalState.editId"
:core-uid="modalState.coreUid"
:ne-uid="modalState.neUid"
:ne-type="modalState.neType"
@ok="fnModalEditOk"
@cancel="fnModalEditCancel"
></EditModal>
@@ -719,7 +752,8 @@ onMounted(() => {
<!-- OAM编辑框 -->
<OAMModal
v-model:open="modalState.openByOAM"
:ne-id="modalState.neId"
:core-uid="modalState.coreUid"
:ne-uid="modalState.neUid"
:ne-type="modalState.neType"
@cancel="fnModalEditCancel"
></OAMModal>
@@ -728,7 +762,8 @@ onMounted(() => {
<BackConfModal
ref="backConf"
v-model:open="modalState.openByBackConf"
:ne-id="modalState.neId"
:core-uid="modalState.coreUid"
:ne-uid="modalState.neUid"
:ne-type="modalState.neType"
@cancel="fnModalEditCancel"
></BackConfModal>