add search

This commit is contained in:
lai
2025-06-13 11:36:39 +08:00
parent 270f9915dc
commit 42c4e19f84
4 changed files with 159 additions and 24 deletions

View File

@@ -4,25 +4,32 @@ import { PageContainer } from 'antdv-pro-layout';
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 { parseDateToStr,parseStrToDate } from '@/utils/date-utils';
import { parseDateToStr, parseStrToDate } from '@/utils/date-utils';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { listCallBack } from '@/api/agentManage/callback';
import useNeInfoStore from '@/store/modules/neinfo';
import useDictStore from '@/store/modules/dict';
import useI18n from '@/hooks/useI18n';
import { message } from 'ant-design-vue';
const { getDict } = useDictStore();
const { t } = useI18n();
let dictStatus = ref<DictType[]>([]);
/**网元参数 */
let neOtions = ref<Record<string, any>[]>([]);
/**开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
/**查询参数 */
let queryParams = reactive({
/**网元类型 */
neId: '001',
/**记录时间 */
beginTime: '',
startTime: '',
endTime: '',
callerNumber: '',
agentName: '',
status: 'New',
/**当前页数 */
pageNum: 1,
/**每页条数 */
@@ -30,6 +37,24 @@ let queryParams = reactive({
});
/**查询参数重置 */
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
neId: '001',
status: 'New',
beginTime: '',
endTime: '',
callerNumber: '',
agentName: '',
pageNum: 1,
pageSize: 20,
});
queryRangePicker.value = ['', ''];
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList();
}
/**表格状态类型 */
type TabeStateType = {
/**加载等待 */
@@ -76,6 +101,12 @@ let tableColumns: ColumnsType = [
align: 'center',
width: 5,
},
{
title: t('views.agentManage.callback.status'),
dataIndex: 'status',
align: 'center',
width: 4,
},
{
title: t('views.agentManage.callback.startTime'),
dataIndex: 'createdAt',
@@ -83,14 +114,18 @@ let tableColumns: ColumnsType = [
width: 6,
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value/1000);
return parseDateToStr(opt.value / 1000);
},
},
{
title: t('views.agentManage.callback.status'),
dataIndex: 'status',
title: t('views.agentManage.callback.updateTime'),
dataIndex: 'updatedAt',
align: 'center',
width: 4,
width: 6,
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value / 1000);
},
},
{
title: t('views.agentManage.callback.msdData'),
@@ -141,6 +176,11 @@ function fnGetList(pageNum?: number) {
queryParams.pageNum = pageNum;
}
if (!queryRangePicker.value) {
queryRangePicker.value = ['', ''];
}
queryParams.startTime = queryRangePicker.value[0];
queryParams.endTime = queryRangePicker.value[1];
listCallBack(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
@@ -156,14 +196,99 @@ function fnGetList(pageNum?: number) {
}
onMounted(() => {
// 获取列表数据
fnGetList();
getDict('callback_status').then(res => {
dictStatus.value = res;
console.log('dictStatus', dictStatus.value);
});
// 获取网元网元列表
useNeInfoStore()
.fnNelist()
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
let arr: Record<string, any>[] = [];
res.data.forEach(i => {
if (i.neType === 'MF') {
arr.push({ value: i.neId, label: i.neName });
}
});
neOtions.value = arr;
if (arr.length > 0) {
queryParams.neId = arr[0].value;
}
}
} else {
message.warning({
content: t('common.noData'),
duration: 2,
});
}
})
.finally(() => {
// 获取列表数据
fnGetList();
});
});
</script>
<template>
<PageContainer>
<a-card v-show="tableState.seached" :bordered="false" :body-style="{ marginBottom: '24px', paddingBottom: 0 }">
<!-- 表格搜索栏 -->
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="PSAP对象" name="neId ">
<a-select v-model:value="queryParams.neId" :options="neOtions" :placeholder="t('common.selectPlease')"
@change="fnGetList(1)" />
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.agentManage.callback.callerIdNumber')" name="callerNumber">
<a-input v-model:value="queryParams.callerNumber" allow-clear
:placeholder="t('common.inputPlease')"></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.agentManage.callback.agentName')" name="agentName">
<a-input v-model:value="queryParams.agentName" allow-clear
:placeholder="t('common.inputPlease')"></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<template #icon>
<SearchOutlined />
</template>
{{ t('common.search') }}
</a-button>
<a-button type="default" @click.prevent="fnQueryReset">
<template #icon>
<ClearOutlined />
</template>
{{ t('common.reset') }}
</a-button>
</a-space>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.agentManage.callback.status')" name="status">
<a-select v-model:value="queryParams.status" :options="dictStatus">
</a-select>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item :label="t('views.agentManage.callback.startTime')" name="queryRangePicker">
<a-range-picker v-model:value="queryRangePicker" allow-clear bordered :show-time="{ format: 'HH:mm:ss' }"
format="YYYY-MM-DD HH:mm:ss" value-format="x" style="width: 100%"></a-range-picker>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" :body-style="{ padding: '0px' }">
<!-- 插槽-卡片左侧侧 -->