fix: 开站软件安装逐个进行避免dpkg look错误
This commit is contained in:
@@ -70,6 +70,8 @@ type StateType = {
|
|||||||
data: any[];
|
data: any[];
|
||||||
/**勾选记录 */
|
/**勾选记录 */
|
||||||
selectedRowKeys: (string | number)[];
|
selectedRowKeys: (string | number)[];
|
||||||
|
/**勾选单行记录 */
|
||||||
|
selectedRowOne: any;
|
||||||
/**多文件上传 */
|
/**多文件上传 */
|
||||||
visibleByMoreFile: boolean;
|
visibleByMoreFile: boolean;
|
||||||
/**勾选安装弹窗 */
|
/**勾选安装弹窗 */
|
||||||
@@ -85,6 +87,7 @@ let state: StateType = reactive({
|
|||||||
loading: false,
|
loading: false,
|
||||||
data: [],
|
data: [],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
|
selectedRowOne: { neType: '' },
|
||||||
visibleByMoreFile: false,
|
visibleByMoreFile: false,
|
||||||
visibleByInstall: false,
|
visibleByInstall: false,
|
||||||
operateDataUpgrade: [],
|
operateDataUpgrade: [],
|
||||||
@@ -92,8 +95,17 @@ let state: StateType = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**表格多选 */
|
/**表格多选 */
|
||||||
function fnTableSelectedRowKeys(keys: (string | number)[]) {
|
function fnTableSelectedRowKeys(
|
||||||
|
keys: (string | number)[],
|
||||||
|
selectedRows: any[]
|
||||||
|
) {
|
||||||
state.selectedRowKeys = keys;
|
state.selectedRowKeys = keys;
|
||||||
|
// 勾选单个上传
|
||||||
|
if (selectedRows.length === 1) {
|
||||||
|
state.selectedRowOne = selectedRows[0];
|
||||||
|
} else {
|
||||||
|
state.selectedRowOne = { neType: '' };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**对话框弹出确认执行函数*/
|
/**对话框弹出确认执行函数*/
|
||||||
@@ -111,81 +123,73 @@ function fnModalCancel() {
|
|||||||
state.operateDataUpgrade = [];
|
state.operateDataUpgrade = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**版本安装 */
|
/**版本安装弹出确认是否安装 */
|
||||||
function fnRecordInstall() {
|
function fnRecordInstallConfirm() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: t('common.tipTitle'),
|
title: t('common.tipTitle'),
|
||||||
content: t('views.system.quickStart.stepInstallTip'),
|
content: t('views.system.quickStart.stepInstallTip'),
|
||||||
onOk() {
|
onOk() {
|
||||||
if (state.confirmLoading) return;
|
fnRecordInstall();
|
||||||
state.confirmLoading = true;
|
|
||||||
const notificationKey = 'NE_Select_Install';
|
|
||||||
notification.info({
|
|
||||||
key: notificationKey,
|
|
||||||
duration: 0,
|
|
||||||
message: t('common.loading'),
|
|
||||||
});
|
|
||||||
// 操作升级的网元数据
|
|
||||||
const selectRows = state.data.filter(item =>
|
|
||||||
state.selectedRowKeys.includes(item.id)
|
|
||||||
);
|
|
||||||
for (const row of selectRows) {
|
|
||||||
if (
|
|
||||||
row.neType.toUpperCase() === 'OMC' ||
|
|
||||||
row.newVersion === '-' ||
|
|
||||||
row.newVersion === ''
|
|
||||||
) {
|
|
||||||
state.operateDataUpgrade.push({
|
|
||||||
neType: row.neType,
|
|
||||||
neId: row.neId,
|
|
||||||
status: 'fail',
|
|
||||||
});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let preinput = {};
|
|
||||||
if (row.neType.toUpperCase() === 'IMS') {
|
|
||||||
preinput = { pisCSCF: 'y' };
|
|
||||||
}
|
|
||||||
state.operateDataUpgrade.push({
|
|
||||||
neType: row.neType,
|
|
||||||
neId: row.neId,
|
|
||||||
action: 'install',
|
|
||||||
preinput: preinput,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发请求信息
|
|
||||||
state.visibleByInstall = true;
|
|
||||||
Promise.allSettled(
|
|
||||||
state.operateDataUpgrade
|
|
||||||
.filter(s => s.status !== 'fail')
|
|
||||||
.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) {
|
|
||||||
state.operateDataUpgrade[i].status = 'done';
|
|
||||||
state.operateDataUpgrade[i].log = res.data;
|
|
||||||
} else {
|
|
||||||
state.operateDataUpgrade[i].status = 'fail';
|
|
||||||
state.operateDataUpgrade[i].log = res.msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
notification.close(notificationKey);
|
|
||||||
state.confirmLoading = false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**版本安装进行 */
|
||||||
|
async function fnRecordInstall() {
|
||||||
|
if (state.confirmLoading) return;
|
||||||
|
state.confirmLoading = true;
|
||||||
|
state.visibleByInstall = true;
|
||||||
|
// 操作升级的网元数据
|
||||||
|
const selectRows = state.data.filter(item =>
|
||||||
|
state.selectedRowKeys.includes(item.id)
|
||||||
|
);
|
||||||
|
for (const row of selectRows) {
|
||||||
|
if (row.newVersion === '-' || row.newVersion === '') {
|
||||||
|
state.operateDataUpgrade.push({
|
||||||
|
neType: row.neType,
|
||||||
|
neId: row.neId,
|
||||||
|
status: 'fail',
|
||||||
|
log: t('views.system.quickStart.stepInstallNotNewVer'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 开始安装
|
||||||
|
let preinput = {};
|
||||||
|
if (row.neType.toUpperCase() === 'IMS') {
|
||||||
|
preinput = { pisCSCF: 'y' };
|
||||||
|
}
|
||||||
|
const installData = {
|
||||||
|
neType: row.neType,
|
||||||
|
neId: row.neId,
|
||||||
|
action: 'install',
|
||||||
|
preinput: preinput,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await operateNeVersion(installData);
|
||||||
|
const operateData = {
|
||||||
|
neType: row.neType,
|
||||||
|
neId: row.neId,
|
||||||
|
status: 'fail',
|
||||||
|
log: t('common.operateErr'),
|
||||||
|
};
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
operateData.status = 'done';
|
||||||
|
operateData.log = t('views.system.quickStart.stepInstallDone')
|
||||||
|
} else {
|
||||||
|
operateData.status = 'fail';
|
||||||
|
operateData.log = t('views.system.quickStart.stepInstallFail')
|
||||||
|
}
|
||||||
|
state.operateDataUpgrade.unshift(operateData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结束
|
||||||
|
state.confirmLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**获取列表 */
|
/**获取列表 */
|
||||||
function fnGetList() {
|
function fnGetList() {
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
@@ -200,6 +204,7 @@ function fnGetList() {
|
|||||||
// 取消勾选
|
// 取消勾选
|
||||||
if (state.selectedRowKeys.length > 0) {
|
if (state.selectedRowKeys.length > 0) {
|
||||||
state.selectedRowKeys = [];
|
state.selectedRowKeys = [];
|
||||||
|
state.selectedRowOne = { neType: '' };
|
||||||
}
|
}
|
||||||
state.data = res.rows.filter(s => s.neType !== 'OMC');
|
state.data = res.rows.filter(s => s.neType !== 'OMC');
|
||||||
}
|
}
|
||||||
@@ -270,32 +275,6 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
|
||||||
<!-- 新增多文件上传框 -->
|
|
||||||
<UploadMoreFile
|
|
||||||
v-model:visible="state.visibleByMoreFile"
|
|
||||||
@ok="fnModalOk"
|
|
||||||
@cancel="fnModalCancel"
|
|
||||||
></UploadMoreFile>
|
|
||||||
|
|
||||||
<!-- 勾选网元版本进行安装框 -->
|
|
||||||
<a-modal
|
|
||||||
width="800px"
|
|
||||||
:keyboard="false"
|
|
||||||
:mask-closable="false"
|
|
||||||
:visible="state.visibleByInstall"
|
|
||||||
:title="t('views.system.quickStart.stepInstallModal')"
|
|
||||||
:confirm-loading="state.confirmLoading"
|
|
||||||
:closable="false"
|
|
||||||
:cancelButtonProps="{ disabled: state.visibleByInstall }"
|
|
||||||
@ok="fnModalOk"
|
|
||||||
@cancel="fnModalCancel"
|
|
||||||
>
|
|
||||||
<p v-for="o in state.operateDataUpgrade">
|
|
||||||
{{ o.neType }} - {{ o.neId }} - {{ o.status }}
|
|
||||||
<!-- <TerminalText id="installLog" :rows="12" :value="o.log"></TerminalText> -->
|
|
||||||
</p>
|
|
||||||
</a-modal>
|
|
||||||
|
|
||||||
<div class="ne-oper">
|
<div class="ne-oper">
|
||||||
<a-space direction="horizontal" :size="18">
|
<a-space direction="horizontal" :size="18">
|
||||||
<a-button @click="fnStepPrev()">
|
<a-button @click="fnStepPrev()">
|
||||||
@@ -304,12 +283,14 @@ onMounted(() => {
|
|||||||
|
|
||||||
<a-button
|
<a-button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
|
:disabled="state.selectedRowKeys.length > 1"
|
||||||
@click.prevent="
|
@click.prevent="
|
||||||
() => (state.visibleByMoreFile = !state.visibleByMoreFile)
|
() => (state.visibleByMoreFile = !state.visibleByMoreFile)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<template #icon><UploadOutlined /></template>
|
<template #icon><UploadOutlined /></template>
|
||||||
{{ t('views.ne.neSoftware.uploadBatch') }}
|
{{ t('views.ne.neSoftware.uploadBatch') }}
|
||||||
|
{{ state.selectedRowOne.neType }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
|
||||||
<a-button
|
<a-button
|
||||||
@@ -317,7 +298,7 @@ onMounted(() => {
|
|||||||
ghost
|
ghost
|
||||||
:disabled="state.selectedRowKeys.length <= 0"
|
:disabled="state.selectedRowKeys.length <= 0"
|
||||||
:loading="state.confirmLoading"
|
:loading="state.confirmLoading"
|
||||||
@click.prevent="fnRecordInstall()"
|
@click.prevent="fnRecordInstallConfirm()"
|
||||||
>
|
>
|
||||||
<template #icon><ThunderboltOutlined /></template>
|
<template #icon><ThunderboltOutlined /></template>
|
||||||
{{ t('views.system.quickStart.stepInstallText') }}
|
{{ t('views.system.quickStart.stepInstallText') }}
|
||||||
@@ -330,6 +311,65 @@ onMounted(() => {
|
|||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增多文件上传框 -->
|
||||||
|
<UploadMoreFile
|
||||||
|
v-model:visible="state.visibleByMoreFile"
|
||||||
|
:ne-type="state.selectedRowOne.neType"
|
||||||
|
@ok="fnModalOk"
|
||||||
|
@cancel="fnModalCancel"
|
||||||
|
></UploadMoreFile>
|
||||||
|
|
||||||
|
<!-- 勾选网元版本进行安装框 -->
|
||||||
|
<a-modal
|
||||||
|
width="800px"
|
||||||
|
:body-style="{ height: '520px', overflowY: 'scroll' }"
|
||||||
|
:keyboard="false"
|
||||||
|
:mask-closable="false"
|
||||||
|
:visible="state.visibleByInstall"
|
||||||
|
:title="t('views.system.quickStart.stepInstallModal')"
|
||||||
|
:closable="false"
|
||||||
|
@ok="fnModalOk"
|
||||||
|
@cancel="fnModalCancel"
|
||||||
|
>
|
||||||
|
<template #footer>
|
||||||
|
<a-button
|
||||||
|
key="submit"
|
||||||
|
type="primary"
|
||||||
|
:loading="state.confirmLoading"
|
||||||
|
@click="fnModalOk"
|
||||||
|
>
|
||||||
|
{{ t('common.close') }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a-alert
|
||||||
|
v-if="state.confirmLoading"
|
||||||
|
:message="t('common.loading')"
|
||||||
|
type="info"
|
||||||
|
show-icon
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<LoadingOutlined />
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p v-for="o in state.operateDataUpgrade" :key="o.neId">
|
||||||
|
<a-alert
|
||||||
|
:message="`${o.neType}-${o.neId}`"
|
||||||
|
:description="o.log"
|
||||||
|
:type="o.status === 'done' ? 'success' : 'error'"
|
||||||
|
show-icon
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<CheckCircleOutlined v-if="o.status === 'done'" />
|
||||||
|
<InfoCircleOutlined v-else />
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
</p>
|
||||||
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user