format: DataTable funcation
This commit is contained in:
@@ -155,10 +155,6 @@ const tablePagination = reactive<PaginationProps>({
|
||||
|
||||
const tableData = ref<DataTableRowData[]>([]);
|
||||
|
||||
const exportTableData = () => {
|
||||
downloadTableData();
|
||||
};
|
||||
|
||||
const onAfterModalEnter = () => {
|
||||
getStaionAlarmList();
|
||||
};
|
||||
@@ -183,7 +179,7 @@ const onUpdateFilters: DataTableProps['onUpdateFilters'] = (filterState) => {
|
||||
getStaionAlarmList();
|
||||
};
|
||||
|
||||
const { mutate: getStaionAlarmList, isPending: isTableLoading } = useMutation({
|
||||
const { mutate: getStaionAlarmList, isPending: tableLoading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const now = dayjs();
|
||||
const res = await postNdmDeviceAlarmLogPage(station.value?.code ?? '', {
|
||||
@@ -218,7 +214,7 @@ const { mutate: getStaionAlarmList, isPending: isTableLoading } = useMutation({
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const now = dayjs();
|
||||
const data = await ndmDeviceAlarmLogDefaultExportByTemplate(station.value?.code ?? '', {
|
||||
@@ -275,12 +271,12 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
<div style="flex: 0 0 auto; display: flex; align-items: center; padding: 8px 0">
|
||||
<div style="font-size: medium">今日设备告警列表</div>
|
||||
<NSpace style="margin-left: auto">
|
||||
<NButton type="primary" :loading="isDownloading" @click="exportTableData">导出</NButton>
|
||||
<NButton type="primary" :loading="exporting" @click="() => exportTableData()">导出</NButton>
|
||||
</NSpace>
|
||||
</div>
|
||||
<div style="flex: 1 1 auto; min-height: 0">
|
||||
<NDataTable
|
||||
:loading="isTableLoading"
|
||||
:loading="tableLoading"
|
||||
:columns="tableColumns"
|
||||
:data="tableData"
|
||||
:pagination="tablePagination"
|
||||
|
||||
@@ -192,7 +192,7 @@ const tablePagination = reactive<PaginationProps>({
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: getAlarmList, isPending: isTableLoading } = useMutation({
|
||||
const { mutate: getAlarmList, isPending: tableLoading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const res = await postNdmDeviceAlarmLogPage('', {
|
||||
model: {},
|
||||
@@ -252,7 +252,7 @@ const { mutate: confirmAlarm } = useMutation({
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const data = await ndmDeviceAlarmLogDefaultExportByTemplate('', {
|
||||
model: {},
|
||||
@@ -274,8 +274,6 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
},
|
||||
});
|
||||
|
||||
const exportTableData = () => downloadTableData();
|
||||
|
||||
onBeforeMount(() => getAlarmList());
|
||||
</script>
|
||||
|
||||
@@ -349,7 +347,7 @@ onBeforeMount(() => getAlarmList());
|
||||
<NGridItem>
|
||||
<NSpace>
|
||||
<NButton @click="onClickReset">重置</NButton>
|
||||
<NButton type="primary" :loading="isTableLoading" @click="onClickQuery">查询</NButton>
|
||||
<NButton type="primary" :loading="tableLoading" @click="onClickQuery">查询</NButton>
|
||||
</NSpace>
|
||||
</NGridItem>
|
||||
</NGrid>
|
||||
@@ -360,13 +358,13 @@ onBeforeMount(() => getAlarmList());
|
||||
<div style="flex: 0 0 auto; display: flex; align-items: center; padding: 8px">
|
||||
<div style="font-size: medium">设备告警列表</div>
|
||||
<NSpace style="margin-left: auto">
|
||||
<NButton type="primary" :loading="isDownloading" @click="exportTableData">导出</NButton>
|
||||
<NButton type="primary" :loading="exporting" @click="() => exportTableData()">导出</NButton>
|
||||
</NSpace>
|
||||
</div>
|
||||
|
||||
<!-- 表格区域:填满剩余空间 -->
|
||||
<div style="flex: 1 1 auto; min-height: 0; padding: 8px">
|
||||
<NDataTable :loading="isTableLoading" :columns="tableColumns" :data="tableData" :pagination="tablePagination" :single-line="false" remote flex-height style="height: 100%" />
|
||||
<NDataTable :loading="tableLoading" :columns="tableColumns" :data="tableData" :pagination="tablePagination" :single-line="false" remote flex-height style="height: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -185,7 +185,7 @@ const tablePagination = reactive<PaginationProps>({
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: getVimpLogList, isPending: isTableLoading } = useMutation({
|
||||
const { mutate: getVimpLogList, isPending: tableLoading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!searchFields.stationCode) throw Error('请选择车站');
|
||||
const res = await postNdmVimpLogPage(searchFields.stationCode, {
|
||||
@@ -226,7 +226,7 @@ const onClickQuery = () => {
|
||||
getVimpLogList();
|
||||
};
|
||||
|
||||
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!searchFields.stationCode) throw Error('请选择车站');
|
||||
const data = await ndmVimpLogDefaultExportByTemplate(searchFields.stationCode, {
|
||||
@@ -249,8 +249,6 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
},
|
||||
});
|
||||
|
||||
const exportTableData = () => downloadTableData();
|
||||
|
||||
// 进入页面时选择首个在线的车站
|
||||
onMounted(() => {
|
||||
// if (onlineStationList.value.length > 0) {
|
||||
@@ -314,7 +312,7 @@ watchEffect(() => {
|
||||
<NGridItem>
|
||||
<NSpace>
|
||||
<NButton @click="onClickReset">重置</NButton>
|
||||
<NButton type="primary" :loading="isTableLoading" @click="onClickQuery">查询</NButton>
|
||||
<NButton type="primary" :loading="tableLoading" @click="onClickQuery">查询</NButton>
|
||||
</NSpace>
|
||||
</NGridItem>
|
||||
</NGrid>
|
||||
@@ -325,13 +323,13 @@ watchEffect(() => {
|
||||
<div style="flex: 0 0 auto; display: flex; align-items: center; padding: 8px">
|
||||
<div style="font-size: medium">视频平台日志</div>
|
||||
<NSpace style="margin-left: auto">
|
||||
<NButton type="primary" :loading="isDownloading" @click="exportTableData">导出</NButton>
|
||||
<NButton type="primary" :loading="exporting" @click="() => exportTableData()">导出</NButton>
|
||||
</NSpace>
|
||||
</div>
|
||||
|
||||
<!-- 表格区域:填满剩余空间 -->
|
||||
<div style="flex: 1 1 auto; min-height: 0; padding: 8px">
|
||||
<NDataTable remote :columns="tableColumns" :data="tableData" :pagination="tablePagination" :loading="isTableLoading" :single-line="false" flex-height style="height: 100%" />
|
||||
<NDataTable remote :columns="tableColumns" :data="tableData" :pagination="tablePagination" :loading="tableLoading" :single-line="false" flex-height style="height: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user