|
|
@@ -35,6 +35,21 @@
|
|
|
@update:pageSize="handleSizeChange"
|
|
|
@update:pageNumber="handleCurrentChange"
|
|
|
>
|
|
|
+ <template #carNum="scope">
|
|
|
+ <span>{{ scope.row.carNum ? scope.row.carNum : '-' }}</span>
|
|
|
+ </template>
|
|
|
+ <template #carOwnerName="scope">
|
|
|
+ <span>{{ scope.row.carOwnerName || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ <template #deptName="scope">
|
|
|
+ <span>{{ scope.row.deptName || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ <template #entryLocation="scope">
|
|
|
+ <span>{{ scope.row.entryLocation || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ <template #eventTime="scope">
|
|
|
+ <span>{{ scope.row.eventTime || '-' }}</span>
|
|
|
+ </template>
|
|
|
</BasicTable>
|
|
|
</div>
|
|
|
</main>
|
|
|
@@ -46,24 +61,35 @@
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import SelectableInput from '@/components/formItems/selectableInput/SelectableInput.vue';
|
|
|
+ import { downloadFile } from '@/views/disaster/utils';
|
|
|
+ import dayjs from 'dayjs';
|
|
|
+ import { ElMessage } from 'element-plus';
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
- import { Plus } from '@element-plus/icons-vue';
|
|
|
- import { VEHICLE_TABLE_SEARCH_OPTIONS } from './constant';
|
|
|
+ import { VEHICLE_TABLE_SEARCH_OPTIONS } from './constants';
|
|
|
import { TABLE_OPTIONS, VEHICLE_TABEL_COLUMNS } from './configs/tables';
|
|
|
+ import { getVehicleRecordList, exportVehicleRecordList } from '@/api/security-confidentiality-vehicle';
|
|
|
import type { VehicleTableData, VehicleTableQuery } from './types';
|
|
|
import type { QueryPageRequest } from '@/types/basic-query';
|
|
|
|
|
|
- const searchData = reactive<VehicleTableQuery>({});
|
|
|
- const searchTime = ref<string[]>([]);
|
|
|
+ const searchTime = ref<string[]>([
|
|
|
+ dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ ]);
|
|
|
const selectableInputRef = ref<InstanceType<typeof SelectableInput>>();
|
|
|
function getQuery() {
|
|
|
- // TODO
|
|
|
+ const selectableSearch = selectableInputRef.value?.getValue();
|
|
|
+ tableQuery.queryParam = {
|
|
|
+ fieldType: selectableSearch?.key as number | null,
|
|
|
+ fieldContent: selectableSearch?.value,
|
|
|
+ startTime: searchTime.value ? searchTime.value[0] : undefined,
|
|
|
+ endTime: searchTime.value ? searchTime.value[1] : undefined,
|
|
|
+ };
|
|
|
}
|
|
|
async function getTableData() {
|
|
|
tableConfig.loading = true;
|
|
|
- // const res = await getInnerPersonRecordList(tableQuery);
|
|
|
- // tableData.value = res.records;
|
|
|
- // pagination.total = res.totalRow;
|
|
|
+ const res = await getVehicleRecordList(tableQuery);
|
|
|
+ tableData.value = res.records;
|
|
|
+ pagination.total = res.totalRow;
|
|
|
tableConfig.loading = false;
|
|
|
}
|
|
|
function handleSearch() {
|
|
|
@@ -73,49 +99,56 @@
|
|
|
|
|
|
function handleReset() {
|
|
|
selectableInputRef.value?.clearValue();
|
|
|
- for (const key in searchData) {
|
|
|
- if (searchData.hasOwnProperty(key)) {
|
|
|
- searchData[key] = undefined;
|
|
|
+ for (const key in tableQuery.queryParam) {
|
|
|
+ if (tableQuery.queryParam.hasOwnProperty(key)) {
|
|
|
+ tableQuery.queryParam[key] = undefined;
|
|
|
}
|
|
|
}
|
|
|
- searchTime.value = [];
|
|
|
+ searchTime.value = [
|
|
|
+ dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ ];
|
|
|
handleSearch();
|
|
|
}
|
|
|
|
|
|
async function handleDownload() {
|
|
|
- // getQuery();
|
|
|
- // try {
|
|
|
- // const res = await exportInnerPersonRecordList(tableQuery.queryParam);
|
|
|
- // if (res.size === 0) return;
|
|
|
- // const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
- // const url = window.URL.createObjectURL(blob);
|
|
|
- // downloadFile(url, '内部人员门禁出入记录.xlsx');
|
|
|
- // } catch (e) {
|
|
|
- // ElMessage.error('下载失败');
|
|
|
- // console.log(e);
|
|
|
- // }
|
|
|
+ getQuery();
|
|
|
+ try {
|
|
|
+ const res = await exportVehicleRecordList(tableQuery.queryParam);
|
|
|
+ if (res.size === 0) return;
|
|
|
+ const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
+ const url = window.URL.createObjectURL(blob);
|
|
|
+ downloadFile(url, '车辆出入记录.xlsx');
|
|
|
+ } catch (e) {
|
|
|
+ ElMessage.error('下载失败');
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 表格
|
|
|
const { tableConfig, pagination } = useTableConfig(VEHICLE_TABEL_COLUMNS, TABLE_OPTIONS);
|
|
|
const tableData = ref<VehicleTableData[]>([]);
|
|
|
|
|
|
- const tableQuery = ref<QueryPageRequest<VehicleTableQuery>>({
|
|
|
+ const tableQuery = reactive<QueryPageRequest<VehicleTableQuery>>({
|
|
|
pageNumber: pagination.pageNumber,
|
|
|
pageSize: pagination.pageSize,
|
|
|
- queryParam: searchData,
|
|
|
+ queryParam: {},
|
|
|
});
|
|
|
|
|
|
const handleSizeChange = (value: number) => {
|
|
|
pagination.pageSize = value;
|
|
|
- tableQuery.value.pageSize = value;
|
|
|
+ tableQuery.pageSize = value;
|
|
|
getTableData();
|
|
|
};
|
|
|
const handleCurrentChange = (value: number) => {
|
|
|
pagination.pageNumber = value;
|
|
|
- tableQuery.value.pageNumber = value;
|
|
|
+ tableQuery.pageNumber = value;
|
|
|
getTableData();
|
|
|
};
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ handleSearch();
|
|
|
+ });
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|