diff --git a/src/api/configManage/softwareManage.ts b/src/api/configManage/softwareManage.ts index 4a1ac3ae..69a18984 100644 --- a/src/api/configManage/softwareManage.ts +++ b/src/api/configManage/softwareManage.ts @@ -1,4 +1,8 @@ -import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { + RESULT_CODE_ERROR, + RESULT_CODE_SUCCESS, + RESULT_MSG_ERROR, +} from '@/constants/result-constants'; import { request } from '@/plugins/http-fetch'; import { parseObjLineToHump } from '@/utils/parse-utils'; @@ -95,6 +99,75 @@ export function uploadNeSoftware(data: FormData) { }); } +/** + * 下发文件 + * @param data 数据对象 + * @returns object + */ +export async function sendNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'post', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; +} + +/** + * 激活文件 + * @param data 数据对象 + * @returns object + */ +export async function runNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'put', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; +} + +/** + * 回退文件 + * @param data 数据对象 + * @returns object + */ +export async function backNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'patch', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; +} + /** * 查询版本列表 * @param query 查询参数 @@ -102,7 +175,7 @@ export function uploadNeSoftware(data: FormData) { */ export async function listNeVersion(query: Record) { let totalSQL = 'select count(id) as total from ne_version '; - let rowsSQL = ' select * from ne_version '; + let rowsSQL = 'select * from ne_version '; // 查询 let querySQL = 'where 1=1'; diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 0b36934e..3b4b682b 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -22,6 +22,8 @@ export default { editText: 'Edit', deleteText: 'Delete', downloadText: 'Download', + uploadText: 'Upload', + moreText: 'More', searchBarText: 'Search bar', reloadText: 'Refresh', sizeText: 'Density', @@ -110,16 +112,32 @@ export default { createAt: 'CreateAt', }, softwareManage: { - uploadBtn: '上传', - downBtn: '下发', - actBtn: '激活', - historyBtn: '网元版本历史', - neTypePlease: '查询网元类型', + sendBtn: 'Distribute', + runBtn: 'Activation', + backBtn: 'Back', + historyBtn: 'Distribution Record', + neTypePlease: 'Select network element type', neType: 'Type', fileName: 'FileName', version: 'Version', - softwareLoadTime: '软件加载时间', - description: '功能描述', + versionPlease: 'Version number cannot be empty', + updateTime: 'Uploaded', + description: 'Description', + deleteTip: 'Are you sure to delete the data item with record number [{num}]?', + updateComment: 'software documentation', + updateCommentPlease: 'Please enter the software description', + updateFile: 'Software Files', + updateFilePlease: 'Please upload the updated software file', + verifyFile: 'Verify File', + selectFile: 'SELECT FILE', + sendTitle: 'Distribute software version', + sendContent: 'Are you sure to send the data item file with the number [{num}] to the corresponding network element?', + runTitle: 'Activate software version', + runContent: 'Confirm that the software version with the number [{num}] has been issued for activation on the corresponding network element?', + backTitle: 'Fallback software version', + backContent: 'Confirm that the software version with the number [{num}] has been issued for the corresponding network element rollback?', + neId: 'Corresponding network element', + neIdPlease: 'Please select the corresponding network element', }, }, neUser: { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 056abc7e..c4cee68b 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -22,6 +22,8 @@ export default { editText: '编辑', deleteText: '删除', downloadText: '下载', + uploadText: '上传', + moreText: '更多', searchBarText: '搜索栏', reloadText: '刷新', sizeText: '密度', @@ -110,16 +112,32 @@ export default { createAt: '创建时间', }, softwareManage: { - uploadBtn: '上传', - downBtn: '下发', - actBtn: '激活', - historyBtn: '网元版本历史', - neTypePlease: '查询网元类型', + sendBtn: '下发', + runBtn: '激活', + backBtn: '回退', + historyBtn: '下发记录', + neTypePlease: '选择网元类型', neType: '网元类型', fileName: '文件名', - version: '版本', - softwareLoadTime: '软件加载时间', + version: '版本号', + versionPlease: '版本号不能为空', + updateTime: '上传时间', description: '功能描述', + deleteTip: '确认删除记录编号为 【{num}】 的数据项?', + updateComment: '软件说明', + updateCommentPlease: '请输入软件说明', + updateFile: '软件文件', + updateFilePlease: '请上传更新软件文件', + verifyFile: '校验文件', + selectFile: '选择文件', + sendTitle: '下发软件版本', + sendContent: '确认下发编号为【{num}】的数据项文件到对应网元?', + runTitle: '激活软件版本', + runContent: '确认在对应网元激活已下发编号为【{num}】的软件版本?', + backTitle: '回退软件版本', + backContent: '确认在对应网元回退已下发编号为【{num}】的软件版本?', + neId: '对应网元', + neIdPlease: '请选择对应网元', }, }, neUser: { diff --git a/src/views/configManage/softwareManage/components/software-history.vue b/src/views/configManage/softwareManage/components/software-history.vue index 8884b703..23364b55 100644 --- a/src/views/configManage/softwareManage/components/software-history.vue +++ b/src/views/configManage/softwareManage/components/software-history.vue @@ -1,11 +1,11 @@