refactor(property): 重构能源管理和通行记录模块

This commit is contained in:
2025-08-28 15:05:10 +08:00
parent d2102ac20a
commit 4a4cbb6075
4 changed files with 231 additions and 307 deletions

View File

@@ -1,34 +1,19 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
import type { FormSchemaGetter } from '#/adapter/form'
import type { VxeGridProps } from '#/adapter/vxe-table'
import { getDictOptions } from '#/utils/dict'
import { renderDict } from '#/utils/render'
export const querySchema: FormSchemaGetter = () => [
// {
// component: 'Input',
// fieldName: 'actionTime',
// label: '通行时间',
// },
{
component: 'RangePicker',
fieldName: 'dateRange',
label: '通行时间',
},
{
component: 'Input',
fieldName: 'customerName',
label: '人员姓名',
},
// {
// component: 'Input',
// fieldName: 'organFullPath',
// label: '组织机构',
// },
// {
// component: 'Input',
// fieldName: 'doorName',
// label: '门/电梯名称',
// },
// {
// component: 'Input',
// fieldName: 'deviceName',
// label: '设备名称',
// },
{
component: 'Select',
componentProps: {
@@ -37,16 +22,15 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'recordType',
label: '记录类型',
},
];
]
export const columns: VxeGridProps['columns'] = [
// { type: 'checkbox', width: 60 },
{
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
return (rowIndex + 1).toString()
},
},
width: 60,
@@ -66,16 +50,11 @@ export const columns: VxeGridProps['columns'] = [
field: 'deviceType',
slots: {
default: ({ row }) => {
return renderDict(row.deviceType, 'wy_txjlsblb');
return renderDict(row.deviceType, 'wy_txjlsblb')
},
},
width: 150,
},
{
title: '读头名称',
field: 'readerName',
width: 100,
},
{
title: '人员姓名',
field: 'customerName',
@@ -84,14 +63,13 @@ export const columns: VxeGridProps['columns'] = [
{
title: '所属组织',
field: 'organFullPath',
width: 150,
},
{
title: '门卡类别',
field: 'cardType',
slots: {
default: ({ row }) => {
return renderDict(row.cardType, 'wy_txjlmklb');
return renderDict(row.cardType, 'wy_txjlmklb')
},
},
width: 100,
@@ -101,7 +79,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'gatewayType',
slots: {
default: ({ row }) => {
return renderDict(row.gatewayType, 'wy_txjlcrlx');
return renderDict(row.gatewayType, 'wy_txjlcrlx')
},
},
width: 100,
@@ -116,7 +94,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'recordType',
slots: {
default: ({ row }) => {
return renderDict(row.recordType, 'wy_txjllx');
return renderDict(row.recordType, 'wy_txjllx')
},
},
width: 100,
@@ -126,6 +104,6 @@ export const columns: VxeGridProps['columns'] = [
fixed: 'right',
slots: { default: 'action' },
title: '抓拍图片',
minWidth: 180,
width: 140,
},
];
]

View File

@@ -1,16 +1,14 @@
<script setup lang="ts">
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { Space } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
import { columns, querySchema } from './data';
import { getVisitorList } from '#/api/property/resident/passRecordManagement';
import recordDetailModal from './record-detail-modal.vue';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVisitorList } from '#/api/property/resident/passRecordManagement';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 120,
labelWidth: 80,
componentProps: {
allowClear: true,
},
@@ -35,10 +33,14 @@ const gridOptions: VxeGridProps = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
console.log('query', page, formValues);
return await getVisitorList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
begTime: typeof formValues.dateRange === 'undefined' ? '' : formValues.dateRange[0],
endTime: typeof formValues.dateRange === 'undefined' ? '' : formValues.dateRange[1],
personName: typeof formValues.personName === 'undefined' ? '' : formValues.personName,
recordType: typeof formValues.recordType === 'undefined' ? '' : formValues.recordType,
});
},
},
@@ -55,16 +57,6 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
gridOptions,
});
function handleDownloadExcel() {
// commonDownloadExcel(
// resident_unitExport,
// '入驻单位数据',
// tableApi.formApi.form.values,
// {
// fieldMappingTime: formOptions.fieldMappingTime,
// },
// );
}
const [RecordDetailModal, recordDetailModalApi] = useVbenModal({
connectedComponent: recordDetailModal,
});
@@ -77,13 +69,6 @@ async function handleInfo(row: any) {
<template>
<Page :auto-content-height="true">
<BasicTable table-title="通行记录列表">
<template #toolbar-tools>
<Space>
<a-button @click="handleDownloadExcel">
{{ $t('pages.common.export') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button @click.stop="handleInfo(row)"> 查看 </ghost-button>

View File

@@ -1,11 +1,13 @@
<script setup lang="ts">
import { ref } from 'vue';
import { Empty } from "ant-design-vue";
import { useVbenModal } from '@vben/common-ui';
const emit = defineEmits<{ reload: [] }>();
const picture1 = ref('')
const picture2 = ref('')
// const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
// {
// initializedGetter: defaultFormValueGetter(formApi),
@@ -24,8 +26,8 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
const {data} = modalApi.getData() as { data:any };
console.log(data)
picture1.value = data.pictureUrl;
picture1.value = data.voucherUrl;
picture2.value = data.pictureUrl
// detail.value = await meetInfo(id);
// if (detail.value?.picture) {
// const res = await ossInfo([conferenceSettingsDetail.value?.picture]);
@@ -66,11 +68,12 @@ async function handleClosed() {}
<div class="detail-caption">人脸凭证照片</div>
</div>
<div class="detail-card">
<img class="detail-thumb" :src="picture1"></img>
<Empty class="detail-thumb" :image="Empty.PRESENTED_IMAGE_SIMPLE"
description="暂无数据" />
<div class="detail-caption">监控设备抓拍</div>
</div>
<div class="detail-card">
<img class="detail-thumb" :src="picture1"></img>
<img class="detail-thumb" :src="picture2"></img>
<div class="detail-caption">人脸门禁抓拍</div>
</div>
</div>