增加区分租户的列(搜索时没传递userName)

This commit is contained in:
lai
2024-06-17 14:06:51 +08:00
parent d2503348fd
commit 1bae6e55e0
4 changed files with 55 additions and 16 deletions

View File

@@ -569,6 +569,7 @@ export default {
called: "Called", called: "Called",
result: "Result", result: "Result",
delTip: "Confirm deletion of the data item numbered [{msg}]?", delTip: "Confirm deletion of the data item numbered [{msg}]?",
tenantName: "Tenant Name",
}, },
ue: { ue: {
eventType: "Event Type", eventType: "Event Type",

View File

@@ -569,6 +569,7 @@ export default {
called: "被叫", called: "被叫",
result: "结果", result: "结果",
delTip: "确认删除编号为【{msg}】的数据项?", delTip: "确认删除编号为【{msg}】的数据项?",
tenantName: "租户名称",
}, },
ue: { ue: {
eventType: "事件类型", eventType: "事件类型",

View File

@@ -5,6 +5,7 @@ import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider'; import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table'; import { ColumnsType } from 'ant-design-vue/lib/table';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { import {
RESULT_CODE_ERROR, RESULT_CODE_ERROR,
@@ -15,6 +16,7 @@ import { delIMSDataCDR, listIMSDataCDR } from '@/api/neData/ims';
import { parseDateToStr, parseDuration } from '@/utils/date-utils'; import { parseDateToStr, parseDuration } from '@/utils/date-utils';
import { OptionsType, WS } from '@/plugins/ws-websocket'; import { OptionsType, WS } from '@/plugins/ws-websocket';
import PQueue from 'p-queue'; import PQueue from 'p-queue';
import useUserStore from '@/store/modules/user';
const { t } = useI18n(); const { t } = useI18n();
const { getDict } = useDictStore(); const { getDict } = useDictStore();
const ws = new WS(); const ws = new WS();
@@ -39,6 +41,7 @@ let queryParams = reactive({
recordType: 'MOC', recordType: 'MOC',
callerParty: '', callerParty: '',
calledParty: '', calledParty: '',
tenantName: '',
sortField: 'timestamp', sortField: 'timestamp',
sortOrder: 'desc', sortOrder: 'desc',
/**当前页数 */ /**当前页数 */
@@ -54,6 +57,7 @@ function fnQueryReset() {
recordType: 'MOC', recordType: 'MOC',
callerParty: '', callerParty: '',
calledParty: '', calledParty: '',
tenantName: '',
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
}); });
@@ -162,6 +166,13 @@ let tableColumns: ColumnsType = [
align: 'left', align: 'left',
width: 150, width: 150,
}, },
{
title: t('views.dashboard.cdr.tenantName'),
dataIndex: 'tenantName',
align: 'center',
key: 'tenantName',
width: 150,
},
{ {
title: t('views.dashboard.cdr.time'), title: t('views.dashboard.cdr.time'),
dataIndex: 'cdrJSON', dataIndex: 'cdrJSON',
@@ -179,6 +190,9 @@ let tableColumns: ColumnsType = [
}, },
]; ];
/**表格字段列排序 */
let tableColumnsDnd = ref<ColumnsType>([]);
/**表格分页器参数 */ /**表格分页器参数 */
let tablePagination = reactive({ let tablePagination = reactive({
/**当前页数 */ /**当前页数 */
@@ -309,6 +323,7 @@ function fnGetList(pageNum?: number) {
modalState.maxId = Number(res.rows[0].id); modalState.maxId = Number(res.rows[0].id);
} }
} }
tableState.loading = false; tableState.loading = false;
}); });
} }
@@ -394,6 +409,19 @@ onMounted(() => {
}) })
.finally(() => { .finally(() => {
// 获取列表数据 // 获取列表数据
console.log(useUserStore().roles);
if (useUserStore().roles.includes('tenant')) {
const operateColumnIndex = tableColumns.findIndex(
column => column.key === 'tenantName'
);
console.log(operateColumnIndex);
if (operateColumnIndex !== -1) {
tableColumns.splice(operateColumnIndex, 1);
}
console.log(tableColumns);
}
fnGetList(); fnGetList();
}); });
}); });
@@ -431,7 +459,19 @@ onBeforeUnmount(() => {
></a-select> ></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="4" :md="12" :xs="24">
<a-col :lg="8" :md="12" :xs="24" v-roles:has="['administrator']">
<a-form-item
:label="t('views.neUser.sub.tenantName')"
name="tenantName "
>
<a-input
allow-clear
v-model:value="queryParams.tenantName"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item <a-form-item
:label="t('views.dashboard.cdr.called')" :label="t('views.dashboard.cdr.called')"
name="calledParty " name="calledParty "
@@ -443,7 +483,7 @@ onBeforeUnmount(() => {
></a-input> ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="4" :md="12" :xs="24"> <a-col :lg="8" :md="12" :xs="24">
<a-form-item <a-form-item
:label="t('views.dashboard.cdr.caller')" :label="t('views.dashboard.cdr.caller')"
name="callerParty " name="callerParty "
@@ -488,7 +528,11 @@ onBeforeUnmount(() => {
cancel-text="No" cancel-text="No"
@confirm="fnRealTime()" @confirm="fnRealTime()"
> >
<a-button type="primary" :danger="realTimeData"> <a-button
type="primary"
:danger="realTimeData"
v-roles:has="['administrator']"
>
<template #icon><FundOutlined /> </template> <template #icon><FundOutlined /> </template>
{{ {{
!realTimeData !realTimeData
@@ -497,17 +541,6 @@ onBeforeUnmount(() => {
}} }}
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')"
>
<template #icon><DeleteOutlined /></template>
{{ t('common.deleteText') }}
</a-button>
</a-space> </a-space>
</template> </template>
@@ -529,6 +562,11 @@ onBeforeUnmount(() => {
<template #icon><ReloadOutlined /></template> <template #icon><ReloadOutlined /></template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<TableColumnsDnd
cache-id="udmSubData"
:columns="tableColumns"
v-model:columns-dnd="tableColumnsDnd"
></TableColumnsDnd>
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.sizeText') }}</template> <template #title>{{ t('common.sizeText') }}</template>
<a-dropdown trigger="click" placement="bottomRight"> <a-dropdown trigger="click" placement="bottomRight">
@@ -560,7 +598,7 @@ onBeforeUnmount(() => {
<a-table <a-table
class="table" class="table"
row-key="id" row-key="id"
:columns="tableColumns" :columns="tableColumnsDnd"
:loading="tableState.loading" :loading="tableState.loading"
:data-source="tableState.data" :data-source="tableState.data"
:size="tableState.size" :size="tableState.size"

View File

@@ -1215,7 +1215,6 @@ onMounted(() => {
} }
}) })
.finally(() => { .finally(() => {
console.log(useUserStore().roles);
if (useUserStore().roles.includes('tenant')) { if (useUserStore().roles.includes('tenant')) {
const operateColumnIndex = tableColumns.findIndex( const operateColumnIndex = tableColumns.findIndex(
column => column.key === 'tenantName' column => column.key === 'tenantName'