feat: 软件版本勾选多升级
This commit is contained in:
@@ -18,6 +18,9 @@ const { t } = useI18n();
|
|||||||
const EditModal = defineAsyncComponent(
|
const EditModal = defineAsyncComponent(
|
||||||
() => import('../neSoftware/components/EditModal.vue')
|
() => import('../neSoftware/components/EditModal.vue')
|
||||||
);
|
);
|
||||||
|
const UploadMoreFile = defineAsyncComponent(
|
||||||
|
() => import('../neSoftware/components/UploadMoreFile.vue')
|
||||||
|
);
|
||||||
|
|
||||||
/**网元参数 */
|
/**网元参数 */
|
||||||
let neOtions = ref<Record<string, any>[]>([]);
|
let neOtions = ref<Record<string, any>[]>([]);
|
||||||
@@ -56,12 +59,10 @@ type TabeStateType = {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
/**紧凑型 */
|
/**紧凑型 */
|
||||||
size: SizeType;
|
size: SizeType;
|
||||||
/**斑马纹 */
|
|
||||||
striped: boolean;
|
|
||||||
/**搜索栏 */
|
/**搜索栏 */
|
||||||
seached: boolean;
|
seached: boolean;
|
||||||
/**记录数据 */
|
/**记录数据 */
|
||||||
data: object[];
|
data: any[];
|
||||||
/**勾选记录 */
|
/**勾选记录 */
|
||||||
selectedRowKeys: (string | number)[];
|
selectedRowKeys: (string | number)[];
|
||||||
};
|
};
|
||||||
@@ -70,7 +71,6 @@ type TabeStateType = {
|
|||||||
let tableState: TabeStateType = reactive({
|
let tableState: TabeStateType = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
size: 'middle',
|
size: 'middle',
|
||||||
striped: false,
|
|
||||||
seached: false,
|
seached: false,
|
||||||
data: [],
|
data: [],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
@@ -179,13 +179,8 @@ function fnTableSize({ key }: MenuInfo) {
|
|||||||
tableState.size = key as SizeType;
|
tableState.size = key as SizeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**表格斑马纹 */
|
|
||||||
function fnTableStriped(_record: unknown, index: number): any {
|
|
||||||
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**表格多选 */
|
/**表格多选 */
|
||||||
function fnTableSelectedRowKeys(keys: (string | number)[]) {
|
function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
|
||||||
tableState.selectedRowKeys = keys;
|
tableState.selectedRowKeys = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,8 +217,14 @@ function fnGetList(pageNum?: number) {
|
|||||||
|
|
||||||
/**对话框对象信息状态类型 */
|
/**对话框对象信息状态类型 */
|
||||||
type ModalStateType = {
|
type ModalStateType = {
|
||||||
/**新增框或修改框是否显示 */
|
/**单文件上传 */
|
||||||
visibleByEdit: boolean;
|
visibleByEdit: boolean;
|
||||||
|
/**多文件上传 */
|
||||||
|
visibleByMoreFile: boolean;
|
||||||
|
/**勾选升级情况 */
|
||||||
|
visibleByUpgrade: boolean;
|
||||||
|
/**操作数据进行版本升级 */
|
||||||
|
operateDataUpgrade: any[];
|
||||||
/**确定按钮 loading */
|
/**确定按钮 loading */
|
||||||
confirmLoading: boolean;
|
confirmLoading: boolean;
|
||||||
};
|
};
|
||||||
@@ -231,23 +232,21 @@ type ModalStateType = {
|
|||||||
/**对话框对象信息状态 */
|
/**对话框对象信息状态 */
|
||||||
let modalState: ModalStateType = reactive({
|
let modalState: ModalStateType = reactive({
|
||||||
visibleByEdit: false,
|
visibleByEdit: false,
|
||||||
|
visibleByMoreFile: false,
|
||||||
|
visibleByUpgrade: false,
|
||||||
|
operateDataUpgrade: [],
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* 对话框弹出显示为 新增或者修改
|
|
||||||
* @param noticeId 网元id, 不传为新增
|
|
||||||
*/
|
|
||||||
function fnModalVisibleByEdit() {
|
|
||||||
modalState.visibleByEdit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对话框弹出确认执行函数
|
* 对话框弹出确认执行函数
|
||||||
* 进行表达规则校验
|
* 进行表达规则校验
|
||||||
*/
|
*/
|
||||||
function fnModalEditOk() {
|
function fnModalEditOk() {
|
||||||
fnGetList(1);
|
fnGetList(1);
|
||||||
|
if (modalState.visibleByUpgrade) {
|
||||||
|
fnModalEditCancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,6 +255,9 @@ function fnModalEditOk() {
|
|||||||
*/
|
*/
|
||||||
function fnModalEditCancel() {
|
function fnModalEditCancel() {
|
||||||
modalState.visibleByEdit = false;
|
modalState.visibleByEdit = false;
|
||||||
|
modalState.visibleByMoreFile = false;
|
||||||
|
modalState.visibleByUpgrade = false;
|
||||||
|
modalState.operateDataUpgrade = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**版本控制升级回退 */
|
/**版本控制升级回退 */
|
||||||
@@ -321,6 +323,7 @@ function fnRecordVersion(
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
fnGetList(1);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
@@ -334,16 +337,80 @@ function fnRecordVersion(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**版本升级 */
|
||||||
* 记录更多操作
|
function fnRecordUpgrade() {
|
||||||
*/
|
Modal.confirm({
|
||||||
function fnRecordMore(type: string | number, row: Record<string, any>) {
|
title: t('common.tipTitle'),
|
||||||
if (type === 'download') {
|
content: `check upgrade version?`,
|
||||||
return;
|
onOk() {
|
||||||
}
|
if (modalState.confirmLoading) return;
|
||||||
if (type === 'delete') {
|
modalState.confirmLoading = true;
|
||||||
return;
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
}
|
// 操作升级的网元数据
|
||||||
|
const selectRows = tableState.data.filter(item =>
|
||||||
|
tableState.selectedRowKeys.includes(item.id)
|
||||||
|
);
|
||||||
|
for (const row of selectRows) {
|
||||||
|
if (row.neType.toUpperCase() === 'OMC') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let preinput = {};
|
||||||
|
if (row.neType.toUpperCase() === 'IMS') {
|
||||||
|
preinput = { pisCSCF: 'n' };
|
||||||
|
}
|
||||||
|
modalState.operateDataUpgrade.push({
|
||||||
|
neType: row.neType,
|
||||||
|
neId: row.neId,
|
||||||
|
action: 'upgrade',
|
||||||
|
preinput: preinput,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// operateNeVersion({
|
||||||
|
// neType: 'row.neType',
|
||||||
|
// neId: 'row.neId',
|
||||||
|
// action: 'upgrade',
|
||||||
|
// preinput: 'preinput',
|
||||||
|
// })
|
||||||
|
// .then(res => {
|
||||||
|
// if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
// console.log(res);
|
||||||
|
// } else {
|
||||||
|
// message.error(res.msg, 3);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// hide();
|
||||||
|
// modalState.confirmLoading = false;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// 发请求信息
|
||||||
|
modalState.visibleByUpgrade = true;
|
||||||
|
Promise.allSettled(
|
||||||
|
modalState.operateDataUpgrade.map(s => operateNeVersion(s))
|
||||||
|
)
|
||||||
|
.then(resArr => {
|
||||||
|
console.log(resArr);
|
||||||
|
resArr.forEach((s, i) => {
|
||||||
|
if (s.status === 'rejected') {
|
||||||
|
message.error(s.reason, 3);
|
||||||
|
} else {
|
||||||
|
const res = s.value;
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
modalState.operateDataUpgrade[i].status = 'done';
|
||||||
|
modalState.operateDataUpgrade[i].log = res.data;
|
||||||
|
} else {
|
||||||
|
modalState.operateDataUpgrade[i].status = 'fail';
|
||||||
|
modalState.operateDataUpgrade[i].log = res.msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hide();
|
||||||
|
modalState.confirmLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -426,10 +493,37 @@ onMounted(() => {
|
|||||||
<a-card :bordered="false" :body-style="{ padding: '0px' }">
|
<a-card :bordered="false" :body-style="{ padding: '0px' }">
|
||||||
<!-- 插槽-卡片左侧侧 -->
|
<!-- 插槽-卡片左侧侧 -->
|
||||||
<template #title>
|
<template #title>
|
||||||
<a-button type="primary" @click.prevent="fnModalVisibleByEdit()">
|
<a-space :size="8" align="center">
|
||||||
<template #icon><PlusOutlined /></template>
|
<a-button
|
||||||
Upload Software
|
type="primary"
|
||||||
</a-button>
|
@click.prevent="
|
||||||
|
() => (modalState.visibleByEdit = !modalState.visibleByEdit)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #icon><PlusOutlined /></template>
|
||||||
|
Upload Software
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
@click.prevent="
|
||||||
|
() =>
|
||||||
|
(modalState.visibleByMoreFile = !modalState.visibleByMoreFile)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #icon><PlusOutlined /></template>
|
||||||
|
Upload More Software
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="default"
|
||||||
|
danger
|
||||||
|
:disabled="tableState.selectedRowKeys.length <= 0"
|
||||||
|
:loading="modalState.confirmLoading"
|
||||||
|
@click.prevent="fnRecordUpgrade()"
|
||||||
|
>
|
||||||
|
<template #icon><ThunderboltOutlined /></template>
|
||||||
|
Check Upgrade
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 插槽-卡片右侧 -->
|
<!-- 插槽-卡片右侧 -->
|
||||||
@@ -444,15 +538,6 @@ onMounted(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
|
||||||
<template #title>{{ t('common.zebra') }}</template>
|
|
||||||
<a-switch
|
|
||||||
v-model:checked="tableState.striped"
|
|
||||||
:checked-children="t('common.switch.show')"
|
|
||||||
:un-checked-children="t('common.switch.hide')"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>{{ t('common.reloadText') }}</template>
|
<template #title>{{ t('common.reloadText') }}</template>
|
||||||
<a-button type="text" @click.prevent="fnGetList()">
|
<a-button type="text" @click.prevent="fnGetList()">
|
||||||
@@ -494,7 +579,6 @@ onMounted(() => {
|
|||||||
:loading="tableState.loading"
|
:loading="tableState.loading"
|
||||||
:data-source="tableState.data"
|
:data-source="tableState.data"
|
||||||
:size="tableState.size"
|
:size="tableState.size"
|
||||||
:row-class-name="fnTableStriped"
|
|
||||||
:pagination="tablePagination"
|
:pagination="tablePagination"
|
||||||
:scroll="{ y: 'calc(100vh - 480px)' }"
|
:scroll="{ y: 'calc(100vh - 480px)' }"
|
||||||
@resizeColumn="(w:number, col:any) => (col.width = w)"
|
@resizeColumn="(w:number, col:any) => (col.width = w)"
|
||||||
@@ -532,12 +616,36 @@ onMounted(() => {
|
|||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 新增框或修改框 -->
|
<!-- 新增单文件上传 -->
|
||||||
<EditModal
|
<EditModal
|
||||||
v-model:visible="modalState.visibleByEdit"
|
v-model:visible="modalState.visibleByEdit"
|
||||||
@ok="fnModalEditOk"
|
@ok="fnModalEditOk"
|
||||||
@cancel="fnModalEditCancel"
|
@cancel="fnModalEditCancel"
|
||||||
></EditModal>
|
></EditModal>
|
||||||
|
|
||||||
|
<!-- 新增多文件上传框 -->
|
||||||
|
<UploadMoreFile
|
||||||
|
v-model:visible="modalState.visibleByMoreFile"
|
||||||
|
@ok="fnModalEditOk"
|
||||||
|
@cancel="fnModalEditCancel"
|
||||||
|
></UploadMoreFile>
|
||||||
|
|
||||||
|
<!-- 新增多文件上传框 -->
|
||||||
|
<a-modal
|
||||||
|
width="800px"
|
||||||
|
:keyboard="false"
|
||||||
|
:mask-closable="false"
|
||||||
|
:visible="modalState.visibleByUpgrade"
|
||||||
|
title="Upgrade Version"
|
||||||
|
:confirm-loading="modalState.confirmLoading"
|
||||||
|
@ok="fnModalEditOk"
|
||||||
|
@cancel="fnModalEditCancel"
|
||||||
|
>
|
||||||
|
<p v-for="o in modalState.operateDataUpgrade">
|
||||||
|
{{ o.neType }} - {{ o.neId }} - {{ o.status }}
|
||||||
|
<TerminalText id="installLog" :rows="12" :value="o.log"></TerminalText>
|
||||||
|
</p>
|
||||||
|
</a-modal>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -545,8 +653,4 @@ onMounted(() => {
|
|||||||
.table :deep(.ant-pagination) {
|
.table :deep(.ant-pagination) {
|
||||||
padding: 0 24px;
|
padding: 0 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table :deep(.table-striped) td {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user