diff --git a/apps/web-antd/src/api/property/resident/person/model.d.ts b/apps/web-antd/src/api/property/resident/person/model.d.ts index 0d08e829..edab3b11 100644 --- a/apps/web-antd/src/api/property/resident/person/model.d.ts +++ b/apps/web-antd/src/api/property/resident/person/model.d.ts @@ -197,3 +197,71 @@ export interface PersonQuery extends PageQuery { */ params?: any; } + +export interface Person extends BaseEntity{ + /** + * 主键id + */ + id: string | number; + + /** + * 用户id + */ + userId: string | number; + + /** + * 用户名称 + */ + userName: string; + + /** + * 联系电话 + */ + phone: string; + + /** + * 性别 + */ + gender: number; + + /** + * 人脸图片 + */ + img: string; + + /** + * 所属单位id + */ + unitId: string | number; + + /** + * 所属单位名称 + */ + unitName: string; + + /** + * 入驻位置 + */ + locathon: string; + + /** + * 入驻时间 + */ + time: string; + + /** + * 车牌号码 + */ + carNumber: string; + + /** + * 状态 + */ + state: number; + + /** + * 备注 + */ + remark: string; + +} diff --git a/apps/web-antd/src/api/property/resident/unit/model.d.ts b/apps/web-antd/src/api/property/resident/unit/model.d.ts index ac7fe7d4..3ea7c440 100644 --- a/apps/web-antd/src/api/property/resident/unit/model.d.ts +++ b/apps/web-antd/src/api/property/resident/unit/model.d.ts @@ -167,3 +167,61 @@ export interface Resident_unitQuery extends PageQuery { */ params?: any; } + +export interface Unit extends BaseEntity { + /** + * id + */ + id?: string | number; + + /** + * 入驻单位名称 + */ + name?: string; + + /** + * 单位编号 + */ + unitNumber?: number; + + /** + * 企业类型 + */ + type?: number; + + /** + * 联系人 + */ + contactPerson?: string; + + /** + * 联系电话 + */ + phone?: number; + + /** + * 入驻位置 + */ + location?: string; + + /** + * 入驻时间 + */ + time?: string; + + /** + * 状态 + */ + state?: number; + + /** + * 员工人数 + */ + number?: number; + + /** + * 备注 + */ + remark?: string; + +} diff --git a/apps/web-antd/src/utils/render.tsx b/apps/web-antd/src/utils/render.tsx index 419daf31..f97f9c34 100644 --- a/apps/web-antd/src/utils/render.tsx +++ b/apps/web-antd/src/utils/render.tsx @@ -159,6 +159,10 @@ export function renderDict(value: number | string, dictName: string) { const dictInfo = getDictOptions(dictName); return renderDictTag(value, dictInfo); } +export function renderDictValue(value: number | string, dictName: string) { + const dictInfo = getDictOptions(dictName); + return dictInfo[0].label??''; +} export function renderIconSpan( icon: ComponentType, value: string, diff --git a/apps/web-antd/src/views/property/resident/person/data.ts b/apps/web-antd/src/views/property/resident/person/data.ts index 4c6dcf34..26c5ee59 100644 --- a/apps/web-antd/src/views/property/resident/person/data.ts +++ b/apps/web-antd/src/views/property/resident/person/data.ts @@ -1,84 +1,45 @@ import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; - +import {getDictOptions} from "#/utils/dict"; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', - fieldName: 'userId', - label: '用户id', + fieldName: 'unitId', + label: '所属单位', }, { component: 'Input', fieldName: 'userName', - label: '用户名称', + label: '员工名称', }, { - component: 'Input', - fieldName: 'phone', - label: '联系电话', - }, - { - component: 'Input', - fieldName: 'gender', - label: '性别', - }, - { - component: 'Input', - fieldName: 'img', - label: '人脸图片', - }, - { - component: 'Input', - fieldName: 'unitId', - label: '所属单位id', - }, - { - component: 'Input', - fieldName: 'unitName', - label: '所属单位名称', - }, - { - component: 'Input', - fieldName: 'locathon', - label: '入驻位置', - }, - { - component: 'DatePicker', + component: 'Select', componentProps: { - showTime: true, - format: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'YYYY-MM-DD HH:mm:ss', + options: getDictOptions('wy_state'), }, - fieldName: 'time', - label: '入驻时间', - }, - { - component: 'Textarea', - fieldName: 'carNumber', - label: '车牌号码', - }, - { - component: 'Input', fieldName: 'state', label: '状态', }, ]; -// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 -// export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { - title: '主键id', + title: '序号', field: 'id', + slots: { + default: ({ rowIndex }) => { + return (rowIndex + 1).toString(); + }, + }, }, { - title: '用户id', + title: '员工编号', field: 'userId', }, { - title: '用户名称', + title: '员工名称', field: 'userName', }, { @@ -90,15 +51,13 @@ export const columns: VxeGridProps['columns'] = [ field: 'gender', }, { - title: '人脸图片', field: 'img', + title: '人脸图片', + slots: { default: 'img' }, + minWidth: 80, }, { - title: '所属单位id', - field: 'unitId', - }, - { - title: '所属单位名称', + title: '所属单位', field: 'unitName', }, { @@ -116,6 +75,7 @@ export const columns: VxeGridProps['columns'] = [ { title: '状态', field: 'state', + // slots: { default: 'state' }, }, { title: '备注', @@ -141,49 +101,37 @@ export const modalSchema: FormSchemaGetter = () => [ }, }, { - label: '用户id', + label: '入住员工', fieldName: 'userId', - component: 'Input', - rules: 'required', + component: "Select", + rules: 'selectRequired', + formItemClass: 'col-span-2' }, { - label: '用户名称', - fieldName: 'userName', - component: 'Input', - rules: 'required', - }, - { - label: '联系电话', - fieldName: 'phone', - component: 'Input', - rules: 'required', - }, - { - label: '性别', - fieldName: 'gender', - component: 'Input', - rules: 'required', - }, - { - label: '人脸图片', - fieldName: 'img', - component: 'Input', - }, - { - label: '所属单位id', + label: '所属单位', fieldName: 'unitId', - component: 'Input', - }, - { - label: '所属单位名称', - fieldName: 'unitName', - component: 'Input', + component: 'Select', + formItemClass: 'col-span-2', + rules:'selectRequired', }, { label: '入驻位置', fieldName: 'locathon', component: 'Input', + rules:'required', + formItemClass: 'col-span-2', }, + { + label: '人脸图片', + fieldName: 'img', + component: 'ImageUpload', + componentProps: { + // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 + maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 + }, + formItemClass: 'col-span-2', + }, + { label: '入驻时间', fieldName: 'time', @@ -197,17 +145,93 @@ export const modalSchema: FormSchemaGetter = () => [ { label: '车牌号码', fieldName: 'carNumber', - component: 'Textarea', - }, - { - label: '状态', - fieldName: 'state', component: 'Input', - rules: 'required', }, { label: '备注', fieldName: 'remark', component: 'Textarea', + formItemClass: 'col-span-2', + }, +]; + +//门禁记录 +export const accessControlColumns: VxeGridProps['columns'] = [ + { + title: '序号', + field: 'id', + }, + { + title: '通过时间', + field: 'userId', + }, + { + title: '进出类型', + field: 'userName', + }, + { + title: '位置', + field: 'phone', + }, + { + title: '设备名称', + field: 'gender', + }, + { + title: '门禁类型', + field: 'img', + }, + { + title: '识别类型', + field: 'unitName', + }, + { + title: '状态', + field: 'locathon', + }, + +]; + +//车辆记录 +export const carColumns: VxeGridProps['columns'] = [ + { + title: '序号', + field: 'id', + }, + { + title: '通过时间', + field: 'userId', + }, + { + title: '进出类型', + field: 'userName', + }, + { + title: '位置', + field: 'phone', + }, + { + title: '设备名称', + field: 'gender', + }, + { + title: '进出方式', + field: 'img', + }, + { + title: '停车类型', + field: 'unitName', + }, + { + title: '费用(元)', + field: 'locathon', + }, + { + title: '状态', + field: 'state', + }, + { + title: '备注', + field: 'remark', }, ]; diff --git a/apps/web-antd/src/views/property/resident/person/index.vue b/apps/web-antd/src/views/property/resident/person/index.vue index 038fea7b..fffc139b 100644 --- a/apps/web-antd/src/views/property/resident/person/index.vue +++ b/apps/web-antd/src/views/property/resident/person/index.vue @@ -3,7 +3,7 @@ import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { getVxePopupContainer } from '@vben/utils'; -import { Modal, Popconfirm, Space } from 'ant-design-vue'; +import {Avatar, Modal, Popconfirm, Space} from 'ant-design-vue'; import { useVbenVxeGrid, @@ -20,7 +20,9 @@ import type { PersonForm } from '#/api/property/resident/person/model'; import { commonDownloadExcel } from '#/utils/file/download'; import personModal from './person-modal.vue'; +import personDetail from './person-detail.vue'; import { columns, querySchema } from './data'; +// import {TableSwitch} from "#/components/table"; const formOptions: VbenFormProps = { commonConfig: { @@ -31,15 +33,6 @@ const formOptions: VbenFormProps = { }, schema: querySchema(), wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', - // 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到 - // 不需要直接删除 - // fieldMappingTime: [ - // [ - // 'createTime', - // ['params[beginTime]', 'params[endTime]'], - // ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'], - // ], - // ], }; const gridOptions: VxeGridProps = { @@ -83,6 +76,10 @@ const [BasicTable, tableApi] = useVbenVxeGrid({ const [PersonModal, modalApi] = useVbenModal({ connectedComponent: personModal, }); +const [PersonDetail, personDetailApi] = useVbenModal({ + connectedComponent: personDetail, +}); + function handleAdd() { modalApi.setData({}); @@ -118,6 +115,12 @@ function handleDownloadExcel() { fieldMappingTime: formOptions.fieldMappingTime, }); } + +function handleInfo(row: Required) { + personDetailApi.setData({ id: row.id }); + personDetailApi.open(); +} + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/property/resident/person/person-detail.vue b/apps/web-antd/src/views/property/resident/person/person-detail.vue new file mode 100644 index 00000000..d0e2fd81 --- /dev/null +++ b/apps/web-antd/src/views/property/resident/person/person-detail.vue @@ -0,0 +1,105 @@ + + + + diff --git a/apps/web-antd/src/views/property/resident/person/person-modal.vue b/apps/web-antd/src/views/property/resident/person/person-modal.vue index e011117a..4c51aed4 100644 --- a/apps/web-antd/src/views/property/resident/person/person-modal.vue +++ b/apps/web-antd/src/views/property/resident/person/person-modal.vue @@ -1,15 +1,17 @@ diff --git a/apps/web-antd/src/views/property/resident/person/query-unit-list.vue b/apps/web-antd/src/views/property/resident/person/query-unit-list.vue new file mode 100644 index 00000000..19337d82 --- /dev/null +++ b/apps/web-antd/src/views/property/resident/person/query-unit-list.vue @@ -0,0 +1,74 @@ + + + + diff --git a/apps/web-antd/src/views/property/resident/person/query-user-list.vue b/apps/web-antd/src/views/property/resident/person/query-user-list.vue new file mode 100644 index 00000000..e6dafbe5 --- /dev/null +++ b/apps/web-antd/src/views/property/resident/person/query-user-list.vue @@ -0,0 +1,66 @@ + + + + diff --git a/apps/web-antd/src/views/property/resident/unit/data.ts b/apps/web-antd/src/views/property/resident/unit/data.ts index 4b15f7f6..0f47901f 100644 --- a/apps/web-antd/src/views/property/resident/unit/data.ts +++ b/apps/web-antd/src/views/property/resident/unit/data.ts @@ -2,6 +2,7 @@ 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', @@ -30,13 +31,17 @@ export const columns: VxeGridProps['columns'] = [ field: 'id', slots: { default: ({ rowIndex }) => { - return rowIndex + 1; + return (rowIndex + 1).toString(); }, }, }, { title: '单位编号', field: 'unitNumber', + slots:{ + default: ({ row }) => { + return row.id; + }} }, { title: '单位名称', @@ -47,7 +52,7 @@ export const columns: VxeGridProps['columns'] = [ field: 'type', slots: { default: ({ row }) => { - return renderDict(row.type, 'wy_rzdwlx'); + return renderDict(row.type, 'wy_qylx'); }, }, }, @@ -70,11 +75,7 @@ export const columns: VxeGridProps['columns'] = [ { title: '状态', field: 'state', - slots: { - default: ({ row }) => { - return renderDict(row.state, 'wy_state'); - }, - }, + slots: {default: 'state'} }, { title: '员工数量', @@ -112,15 +113,16 @@ export const modalSchema: FormSchemaGetter = () => [ fieldName: 'name', component: 'Input', rules: 'required', + }, { label: '单位类型', fieldName: 'type', component: 'Select', - rules: 'required', componentProps: { - options: getDictOptions('wy_rzdwlx'), + options: getDictOptions('wy_qylx'), }, + rules: 'required', }, { label: '联系人', @@ -134,11 +136,13 @@ export const modalSchema: FormSchemaGetter = () => [ component: 'Input', rules: 'required', }, + { label: '入驻位置', fieldName: 'location', component: 'Input', rules: 'required', + formItemClass: 'col-span-2' }, { label: '入驻时间', diff --git a/apps/web-antd/src/views/property/resident/unit/index.vue b/apps/web-antd/src/views/property/resident/unit/index.vue index 637723d9..f1f080bb 100644 --- a/apps/web-antd/src/views/property/resident/unit/index.vue +++ b/apps/web-antd/src/views/property/resident/unit/index.vue @@ -20,7 +20,11 @@ import type { Resident_unitForm } from '#/api/property/resident/unit/model'; import { commonDownloadExcel } from '#/utils/file/download'; import resident_unitModal from './unit-modal.vue'; +import unitInfoModal from './unit-detail.vue'; import { columns, querySchema } from './data'; +import {userStatusChange} from "#/api/system/user"; +import {TableSwitch} from "#/components/table"; +import {useAccess} from "@vben/access"; const formOptions: VbenFormProps = { commonConfig: { @@ -42,8 +46,6 @@ const gridOptions: VxeGridProps = { // 点击行选中 // trigger: 'row', }, - // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 - // columns: columns(), columns, height: 'auto', keepSource: true, @@ -84,9 +86,12 @@ async function handleEdit(row: Required) { modalApi.setData({ id: row.id }); modalApi.open(); } +const [UnitInfoModal, unitInfoModalApi] = useVbenModal({ + connectedComponent: unitInfoModal, +}); async function handleInfo(row: Required) { - modalApi.setData({ id: row.id }); - modalApi.open(); + unitInfoModalApi.setData({ id: row.id }); + unitInfoModalApi.open(); } async function handleDelete(row: Required) { await resident_unitRemove(row.id); @@ -112,6 +117,7 @@ function handleDownloadExcel() { fieldMappingTime: formOptions.fieldMappingTime, }); } +const { hasAccessByCodes } = useAccess(); + diff --git a/apps/web-antd/src/views/property/resident/unit/unit-detail.vue b/apps/web-antd/src/views/property/resident/unit/unit-detail.vue new file mode 100644 index 00000000..a3c76faf --- /dev/null +++ b/apps/web-antd/src/views/property/resident/unit/unit-detail.vue @@ -0,0 +1,84 @@ + + +