|
|
@@ -5,7 +5,7 @@
|
|
|
:loading="loading"
|
|
|
:pagination="pagination"
|
|
|
:columns="cloneColumns"
|
|
|
- :data="data.data"
|
|
|
+ :data="tableData"
|
|
|
:bordered="false"
|
|
|
:size="size"
|
|
|
:scrollbar="true"
|
|
|
@@ -70,10 +70,17 @@ import { STATIONKEY, StationKey } from '@/utils/const';
|
|
|
|
|
|
interface ListPageProps {
|
|
|
data: AlarmTotalRes;
|
|
|
+ pageObj: Pagination;
|
|
|
+}
|
|
|
+interface ListPageEmits {
|
|
|
+ (e: 'paginationFun', val: number): void;
|
|
|
}
|
|
|
const props = withDefaults(defineProps<ListPageProps>(), {
|
|
|
data: () => ({}) as AlarmTotalRes,
|
|
|
+ pageObj: () => ({}) as Pagination,
|
|
|
});
|
|
|
+
|
|
|
+const emit = defineEmits<ListPageEmits>();
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
const { loading, setLoading } = useLoading(true);
|
|
|
@@ -129,22 +136,8 @@ const basePagination: Pagination = {
|
|
|
const pagination = reactive({
|
|
|
...basePagination,
|
|
|
});
|
|
|
-const generateFormModel = () => {
|
|
|
- return {
|
|
|
- pageIndex: 1,
|
|
|
- pageSize: 20,
|
|
|
- name: null,
|
|
|
- address: null,
|
|
|
- status: null,
|
|
|
- startTime: null,
|
|
|
- endTime: null,
|
|
|
- time: ['', ''],
|
|
|
- entityType: null,
|
|
|
- } as DeviceParams;
|
|
|
-};
|
|
|
const tableData = ref<Data[]>([] as Data[]);
|
|
|
const size = ref<SizeProps>('medium');
|
|
|
-const formModel = ref<DeviceParams>(generateFormModel());
|
|
|
const visible = shallowRef<boolean>(false);
|
|
|
const this_ = getCurrentInstance()?.appContext.config.globalProperties;
|
|
|
const deviceInfo = ref<DeviceInfo[]>([] as DeviceInfo[]);
|
|
|
@@ -161,11 +154,12 @@ watch(
|
|
|
newVal => {
|
|
|
if (newVal && newVal.data) {
|
|
|
const { totalCount, data } = newVal;
|
|
|
+ const { current, pageSize } = props.pageObj;
|
|
|
// 更新表格数据
|
|
|
tableData.value.length = 0;
|
|
|
tableData.value.push(...newVal.data);
|
|
|
- pagination.current = 1;
|
|
|
- pagination.pageSize = totalCount;
|
|
|
+ pagination.current = current;
|
|
|
+ pagination.pageSize = pageSize;
|
|
|
pagination.total = totalCount;
|
|
|
setLoading(false);
|
|
|
}
|
|
|
@@ -174,7 +168,7 @@ watch(
|
|
|
);
|
|
|
|
|
|
const onPageChange = (current: number) => {
|
|
|
- formModel.value.pageIndex = current;
|
|
|
+ emit('paginationFun', current);
|
|
|
};
|
|
|
|
|
|
const handleClick = (value: DataList) => {
|