This commit is contained in:
lai
2024-09-09 19:25:26 +08:00

View File

@@ -5,6 +5,7 @@ import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table';
import useDictStore from '@/store/modules/dict';
import useI18n from '@/hooks/useI18n';
import {
RESULT_CODE_ERROR,
@@ -16,14 +17,23 @@ import {
exportSMSCDataCDR,
listSMSCDataCDR,
} from '@/api/neData/smsc';
import { parseDateToStr, parseDuration } from '@/utils/date-utils';
import { parseDateToStr } from '@/utils/date-utils';
import { OptionsType, WS } from '@/plugins/ws-websocket';
import saveAs from 'file-saver';
import PQueue from 'p-queue';
const { getDict } = useDictStore();
const { t } = useI18n();
const ws = new WS();
const queue = new PQueue({ concurrency: 1, autoStart: true });
/**字典数据 */
let dict: {
/**CDR 响应原因代码类别类型 */
cdrCauseCode: DictType[];
} = reactive({
cdrCauseCode: [],
});
/**网元可选 */
let neOtions = ref<Record<string, any>[]>([]);
@@ -158,12 +168,6 @@ let tableColumns: ColumnsType = [
key: 'cause',
align: 'left',
width: 120,
customRender(opt) {
const cdrJSON = opt.value;
return +cdrJSON.result
? t('views.dashboard.cdr.resultOk')
: t('views.dashboard.cdr.resultFail');
},
},
{
title: t('views.dashboard.cdr.time'),
@@ -426,6 +430,12 @@ function wsMessage(res: Record<string, any>) {
}
onMounted(() => {
// 初始字典数据
Promise.allSettled([getDict('cdr_cause_code')]).then(resArr => {
if (resArr[0].status === 'fulfilled') {
dict.cdrCauseCode = resArr[0].value;
}
});
// 获取网元网元列表
useNeInfoStore()
.fnNelist()
@@ -661,6 +671,18 @@ onBeforeUnmount(() => {
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'cause'">
<span v-if="record.cdrJSON.result === 0">
<DictTag
:options="dict.cdrCauseCode"
:value="record.cdrJSON.cause"
value-default="0"
/>
</span>
<span v-else>
{{ t('views.dashboard.cdr.resultOk') }}
</span>
</template>
<template v-if="column.key === 'id'">
<a-space :size="8" align="center">
<a-tooltip>
@@ -711,12 +733,15 @@ onBeforeUnmount(() => {
</div>
<div>
<span>{{ t('views.dashboard.cdr.result') }}: </span>
<span>
{{
+record.cdrJSON.result
? t('views.dashboard.cdr.resultOk')
: t('views.dashboard.cdr.resultFail')
}}
<span v-if="record.cdrJSON.result === 0">
<DictTag
:options="dict.cdrCauseCode"
:value="record.cdrJSON.cause"
value-default="0"
/>
</span>
<span v-else>
{{ t('views.dashboard.cdr.resultOk') }}
</span>
</div>
</div>