feat: 添加CDR SIP响应代码类别类型字典

This commit is contained in:
TsMask
2025-04-28 14:19:47 +08:00
parent 6d7cde6058
commit ca8f16fb0c
2 changed files with 98 additions and 63 deletions

View File

@@ -5,7 +5,6 @@ import { message, Modal } from 'ant-design-vue/es';
import { SizeType } from 'ant-design-vue/es/config-provider';
import { MenuInfo } from 'ant-design-vue/es/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/es/table';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import useI18n from '@/hooks/useI18n';
import {
RESULT_CODE_ERROR,
@@ -37,9 +36,12 @@ let dict: {
cdrSipCode: DictType[];
/**CDR 呼叫类型 */
cdrCallType: DictType[];
/**CDR SIP响应代码类别类型 */
cdrSipCodeCause: DictType[];
} = reactive({
cdrSipCode: [],
cdrCallType: [],
cdrSipCodeCause: [],
});
/**网元可选 */
@@ -187,13 +189,6 @@ let tableColumns: ColumnsType = [
return cdrJSON.calledParty;
},
},
{
title: t('views.dashboard.cdr.result'),
dataIndex: 'cdrJSON',
key: 'cause',
align: 'left',
width: 150,
},
{
title: t('views.dashboard.cdr.duration'),
dataIndex: 'cdrJSON',
@@ -207,36 +202,50 @@ let tableColumns: ColumnsType = [
: parseDuration(cdrJSON.callDuration);
},
},
{
title: t('views.dashboard.cdr.resultCode'),
dataIndex: 'cdrJSON',
key: 'code',
align: 'left',
width: 150,
},
{
title: t('views.dashboard.cdr.resultCause'),
dataIndex: 'cdrJSON',
key: 'cause',
align: 'left',
width: 200,
},
{
title: t('views.dashboard.cdr.seizureTime'),
dataIndex: 'cdrJSON',
align: 'left',
width: 200,
width: 250,
customRender(opt) {
const cdrJSON = opt.value;
if (typeof cdrJSON.seizureTime === 'number') {
return parseDateToStr(+cdrJSON.seizureTime * 1000);
}
return cdrJSON.seizureTime;
return parseDateToStr(cdrJSON.seizureTime);
},
},
{
title: t('views.dashboard.cdr.releaseTime'),
dataIndex: 'cdrJSON',
align: 'left',
width: 200,
width: 250,
customRender(opt) {
const cdrJSON = opt.value;
if (typeof cdrJSON.releaseTime === 'number') {
return parseDateToStr(+cdrJSON.releaseTime * 1000);
}
return cdrJSON.releaseTime;
return parseDateToStr(cdrJSON.releaseTime);
},
},
{
title: t('views.dashboard.cdr.tenantName'),
dataIndex: 'tenantName',
align: 'center',
align: 'left',
key: 'tenantName',
width: 150,
},
@@ -247,9 +256,6 @@ let tableColumns: ColumnsType = [
},
];
/**表格字段列排序 */
let tableColumnsDnd = ref<ColumnsType>([]);
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
@@ -510,16 +516,21 @@ function wsMessage(res: Record<string, any>) {
onMounted(() => {
// 初始字典数据
Promise.allSettled([getDict('cdr_sip_code'), getDict('cdr_call_type')]).then(
resArr => {
if (resArr[0].status === 'fulfilled') {
dict.cdrSipCode = resArr[0].value;
}
if (resArr[1].status === 'fulfilled') {
dict.cdrCallType = resArr[1].value;
}
Promise.allSettled([
getDict('cdr_sip_code'),
getDict('cdr_call_type'),
getDict('cdr_sip_code_cause'),
]).then(resArr => {
if (resArr[0].status === 'fulfilled') {
dict.cdrSipCode = resArr[0].value;
}
);
if (resArr[1].status === 'fulfilled') {
dict.cdrCallType = resArr[1].value;
}
if (resArr[2].status === 'fulfilled') {
dict.cdrSipCodeCause = resArr[2].value;
}
});
// 获取网元网元列表
useNeInfoStore()
.fnNelist()
@@ -738,11 +749,6 @@ onBeforeUnmount(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<TableColumnsDnd
cache-id="imsCdrData"
:columns="tableColumns"
v-model:columns-dnd="tableColumnsDnd"
></TableColumnsDnd>
<a-tooltip>
<template #title>{{ t('common.sizeText') }}</template>
<a-dropdown trigger="click" placement="bottomRight">
@@ -774,12 +780,12 @@ onBeforeUnmount(() => {
<a-table
class="table"
row-key="id"
:columns="tableColumnsDnd"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:pagination="tablePagination"
:scroll="{ x: tableColumns.length * 150, y: 'calc(100vh - 480px)' }"
:scroll="{ x: tableColumns.length * 160, y: 'calc(100vh - 480px)' }"
:row-selection="{
type: 'checkbox',
columnWidth: '48px',
@@ -794,7 +800,7 @@ onBeforeUnmount(() => {
:value="record.cdrJSON.callType"
/>
</template>
<template v-if="column.key === 'cause'">
<template v-if="column.key === 'code'">
<span v-if="record.cdrJSON.callType !== 'sms'">
<DictTag
:options="dict.cdrSipCode"
@@ -806,6 +812,16 @@ onBeforeUnmount(() => {
{{ t('views.dashboard.cdr.resultOk') }}
</span>
</template>
<template v-if="column.key === 'cause'">
<span v-if="record.cdrJSON.callType !== 'sms'">
<DictTag
:options="dict.cdrSipCodeCause"
:value="record.cdrJSON.cause"
value-default="0"
/>
</span>
<span v-else> Call failure for other reason </span>
</template>
<template v-if="column.key === 'id'">
<a-space :size="8" align="center">
<a-tooltip>