diff --git a/src/api/cbc/cbe.ts b/src/api/cbc/cbe.ts index 7185bd2c..2c871fa6 100644 --- a/src/api/cbc/cbe.ts +++ b/src/api/cbc/cbe.ts @@ -34,12 +34,8 @@ export function addCBC(data: Record) { -/** - * CBC签约用户修改 - * @param data 签约对象 - * @returns object - */ -export function updateCBC(data:any) { + +export function updateCBCStatus(data:any) { return request({ url: `/psap/v1/cbc/${data.neId}/message/${data.id}/${data.status}`, method: 'put', @@ -47,6 +43,18 @@ export function updateCBC(data:any) { }); } + +export function updateCBC(data:any) { + return request({ + url: `/psap/v1/cbc/${data.neId}/message/${data.id}`, + method: 'put', + data, + timeout: 180_000, + }); +} + + + /** * CBC删除 * @param data 签约对象 diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index e38b08bb..9b38c08e 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -406,6 +406,15 @@ export default { etws:'Earthquake and Tsunami Warning System', cmas:'Commercial Mobile Alert System', createdAt:'Create Time', + eventNameHelp:'If it is CMAS, the recommended prefix is cmas_xxx. If it is ETWS, the recommended prefix is etws_xxx', + repetitionPeriodHelp:'Unit is seconds', + numOfBcastHelp:'Unit is seconds', + cellListTip:'CellId List cannot be empty', + cellListSonTip:'MCC、MNC、 Cannot be empty, and at least one EUTRA CellId/NR CellId must be filled in', + letupSure:'Do you confirm the status of the broadcast event with the modification number 【{id}】?', + tacHelp:'The TAC value is a decimal string, separated by ";" for multiple TAC values.', + cellIdHelp:'The CellId value is a hexadecimal string, separated by ";" for multiple CellId values.', + areaId:'The areaId value is a hexadecimal string.', } }, dashboard: { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index f4c11074..88ca301f 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -410,6 +410,15 @@ export default { etws:'地震海啸预警', cmas:'公共预警广播', createdAt:'创建时间', + eventNameHelp:'如果为CMAS,推荐前缀为cmas_xxx,如果为ETWS,推荐前缀为etws_xxx', + repetitionPeriodHelp:'单位是秒', + numOfBcastHelp:'单位是秒', + cellListTip:'CellId List不能为空', + cellListSonTip:'MCC、MNC、不能为空以及EUTRA CellId/NR CellId至少填写一个', + letupSure:'确认修改编号为 【{id}】 的广播事件的状态嘛?', + tacHelp:'TAC值是十进制字符串,通过";"分隔多个TAC值', + cellIdHelp:'CellId值是十六进制字符串,通过";"分隔多个CellId值', + areaId:'areaId值是十六进制字符串', } }, dashboard: { diff --git a/src/views/cbc/cbe/index.vue b/src/views/cbc/cbe/index.vue index 63670fd3..e32efa56 100644 --- a/src/views/cbc/cbe/index.vue +++ b/src/views/cbc/cbe/index.vue @@ -10,7 +10,13 @@ import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue'; import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { addCBC, delCBC, listCBC, updateCBC } from '@/api/cbc/cbe'; +import { + addCBC, + delCBC, + listCBC, + updateCBCStatus, + updateCBC, +} from '@/api/cbc/cbe'; import { parseDateToStr, parseDuration } from '@/utils/date-utils'; const { t } = useI18n(); @@ -339,7 +345,7 @@ let modalState: ModalStateType = reactive({ }, warningMessageProfile: { language: 'English', - warningMessageText: 'it is CMAS message', + warningMessageText: '', }, warningAreaType: 'tai', // 'tai' | 'eutra' | 'nr' |areaID warningAreaList: { @@ -349,18 +355,11 @@ let modalState: ModalStateType = reactive({ tac: '', }, ], - eutraCellIdList: [ - { - plmnId: { mcc: '', mnc: '' }, - cellId: '', - }, - ], - nrCellIdList: [ - { - plmnId: { mcc: '', mnc: '' }, - cellId: '', - }, + cellIdList: [ + { plmnId: { mcc: '', mnc: '' }, eutraCellId: '', nrCellId: '' }, ], + eutraCellIdList: [], + nrCellIdList: [], emergencyAreaIDList: [ { areaId: '', @@ -405,6 +404,17 @@ function delNr(idx: number) { modalState.from.warningAreaList.nrCellIdList.splice(idx, 1); } +function addCellId() { + modalState.from.warningAreaList.cellIdList.push({ + plmnId: { mcc: '', mnc: '' }, + eutraCellId: '', + nrCellId: '', + }); +} +function delCellId(idx: number) { + modalState.from.warningAreaList.cellIdList.splice(idx, 1); +} + function addArea() { modalState.from.warningAreaList.emergencyAreaIDList.push({ areaId: '', @@ -425,9 +435,8 @@ function fnModalVisibleByEdit(record?: any) { modalState.openByEdit = true; } else { modalStateFrom.resetFields(); - modalState.title = t('common.viewText') + t('views.cbc.cbe.title'); + modalState.title = t('common.editText') + t('views.cbc.cbe.title'); modalState.openByEdit = true; - console.log('record', record); modalState.from = Object.assign(modalState.from, record.messageJson, { id: record.id, status: record.status, @@ -523,33 +532,52 @@ function fnModalOk() { } } } - } else if (areaType === 'eutra') { - if (!areaList.eutraCellIdList || areaList.eutraCellIdList.length === 0) { + } else if (areaType === 'cell') { + if (!areaList.cellIdList || areaList.cellIdList.length === 0) { valid = false; - errMsg = t('views.cbc.cbe.eutraListTip'); + errMsg = t('views.cbc.cbe.cellListTip'); } else { - for (const item of areaList.eutraCellIdList) { - if (!item.plmnId.mcc || !item.plmnId.mnc || !item.cellId) { + for (const item of areaList.cellIdList) { + if ( + !item.plmnId.mcc || + !item.plmnId.mnc || + (!item.eutraCellId && !item.nrCellId) + ) { valid = false; - errMsg = t('views.cbc.cbe.eutraSonTip'); + errMsg = t('views.cbc.cbe.cellListSonTip'); break; } } } - } else if (areaType === 'nr') { - if (!areaList.nrCellIdList || areaList.nrCellIdList.length === 0) { - valid = false; - errMsg = t('views.cbc.cbe.nrTip'); - } else { - for (const item of areaList.nrCellIdList) { - if (!item.plmnId.mcc || !item.plmnId.mnc || !item.cellId) { - valid = false; - errMsg = t('views.cbc.cbe.nrSonTip'); - break; - } - } - } - } else if (areaType === 'area') { + } + // else if (areaType === 'eutra') { + // if (!areaList.eutraCellIdList || areaList.eutraCellIdList.length === 0) { + // valid = false; + // errMsg = t('views.cbc.cbe.eutraListTip'); + // } else { + // for (const item of areaList.eutraCellIdList) { + // if (!item.plmnId.mcc || !item.plmnId.mnc || !item.cellId) { + // valid = false; + // errMsg = t('views.cbc.cbe.eutraSonTip'); + // break; + // } + // } + // } + // } else if (areaType === 'nr') { + // if (!areaList.nrCellIdList || areaList.nrCellIdList.length === 0) { + // valid = false; + // errMsg = t('views.cbc.cbe.nrTip'); + // } else { + // for (const item of areaList.nrCellIdList) { + // if (!item.plmnId.mcc || !item.plmnId.mnc || !item.cellId) { + // valid = false; + // errMsg = t('views.cbc.cbe.nrSonTip'); + // break; + // } + // } + // } + // } + else if (areaType === 'area') { if ( !areaList.emergencyAreaIDList || areaList.emergencyAreaIDList.length === 0 @@ -571,6 +599,26 @@ function fnModalOk() { return; } + if (modalState.from.warningAreaType === 'cell') { + // 清空原有 + modalState.from.warningAreaList.eutraCellIdList = []; + modalState.from.warningAreaList.nrCellIdList = []; + for (const item of modalState.from.warningAreaList.cellIdList) { + if (item.eutraCellId) { + modalState.from.warningAreaList.eutraCellIdList.push({ + plmnId: { ...item.plmnId }, + cellId: item.eutraCellId, + }); + } + if (item.nrCellId) { + modalState.from.warningAreaList.nrCellIdList.push({ + plmnId: { ...item.plmnId }, + cellId: item.nrCellId, + }); + } + } + } + const from = Object.assign({}, toRaw(modalState.from)); from.neId = queryParams.neId; @@ -581,8 +629,10 @@ function fnModalOk() { .then(e => { modalState.confirmLoading = true; + const result = from.id ? updateCBC(from) : addCBC(from); + const hide = message.loading(t('common.loading'), 0); - addCBC(from) + result .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ @@ -621,11 +671,11 @@ function fnModalCancel() { function fnRecordSend(record: any) { Modal.confirm({ title: t('common.tipTitle'), - content: t('views.perfManage.perfThreshold.letupSure', { id: record.id }), + content: t('views.cbc.cbe.letupSure', { id: record.id }), onOk() { const key = 'cbcSend'; message.loading({ content: t('common.loading'), key }); - updateCBC(record).then(res => { + updateCBCStatus(record).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ content: 'Send', @@ -642,6 +692,9 @@ function fnRecordSend(record: any) { } }); }, + onCancel() { + record.status = record.status === '1' ? '0' : '1'; + }, }); } @@ -729,16 +782,23 @@ function fnModalChange(event: any) { tac: '', }, ], - eutraCellIdList: [ + // eutraCellIdList: [ + // { + // plmnId: { mcc: '', mnc: '' }, + // cellId: '', + // }, + // ], + // nrCellIdList: [ + // { + // plmnId: { mcc: '', mnc: '' }, + // cellId: '', + // }, + // ], + cellIdList: [ { plmnId: { mcc: '', mnc: '' }, - cellId: '', - }, - ], - nrCellIdList: [ - { - plmnId: { mcc: '', mnc: '' }, - cellId: '', + eutraCellId: '', + nrCellId: '', }, ], emergencyAreaIDList: [ @@ -752,16 +812,14 @@ function fnModalChange(event: any) { function pwsTypeChange(value: any) { if (value === 'ETWS') { modalState.from.warningTypeProfile.warningType = 'TEST'; - modalState.from.eventName = 'etws_'; modalState.from.serialNumProfile.displayMode = 'immediate'; modalState.from.warningTypeProfile.emergencyUserAlert = true; modalState.from.warningTypeProfile.activatePopup = true; } else if (value === 'CMAS') { modalState.from.warningTypeProfile.warningType = ''; - modalState.from.eventName = 'cmas_'; modalState.from.serialNumProfile.displayMode = 'normal'; modalState.from.warningTypeProfile.emergencyUserAlert = false; - modalState.from.warningTypeProfile.activatePopup = true; + modalState.from.warningTypeProfile.activatePopup = false; } } @@ -833,7 +891,7 @@ onMounted(() => { { - - + @@ -942,7 +995,7 @@ onMounted(() => { {