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