Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
fyy
2025-07-23 14:27:36 +08:00
15 changed files with 1308 additions and 96 deletions

View File

@@ -0,0 +1,61 @@
import type { FeedbacksVO, FeedbacksForm, FeedbacksQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询意见反馈列表
* @param params
* @returns 意见反馈列表
*/
export function feedbacksList(params?: FeedbacksQuery) {
return requestClient.get<PageResult<FeedbacksVO>>('/system/feedbacks/list', { params });
}
/**
* 导出意见反馈列表
* @param params
* @returns 意见反馈列表
*/
export function feedbacksExport(params?: FeedbacksQuery) {
return commonExport('/system/feedbacks/export', params ?? {});
}
/**
* 查询意见反馈详情
* @param id id
* @returns 意见反馈详情
*/
export function feedbacksInfo(id: ID) {
return requestClient.get<FeedbacksVO>(`/system/feedbacks/${id}`);
}
/**
* 新增意见反馈
* @param data
* @returns void
*/
export function feedbacksAdd(data: FeedbacksForm) {
return requestClient.postWithMsg<void>('/system/feedbacks', data);
}
/**
* 更新意见反馈
* @param data
* @returns void
*/
export function feedbacksUpdate(data: FeedbacksForm) {
return requestClient.putWithMsg<void>('/system/feedbacks', data);
}
/**
* 删除意见反馈
* @param id id
* @returns void
*/
export function feedbacksRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/system/feedbacks/${id}`);
}

View File

@@ -0,0 +1,159 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface FeedbacksVO {
/**
* 主键
*/
id: string | number;
/**
* 反馈类型(0保修1保洁2会议)
*/
feedbackType: string;
/**
* 反馈人
*/
feedbackPersion: number;
/**
* 反馈人电话
*/
feedbackPersionPhone: string;
/**
* 反馈内容
*/
feedbackContent: string;
/**
* 反馈位置
*/
feedbackLocation: string;
/**
* 反馈图片
*/
feedbackImg: string;
/**
* 是否转至工单
*/
isWorkOrder: string;
/**
* 状态(1待处理2处理中3处理完成)
*/
status: string;
/**
* 客服电话
*/
serviceName: string;
}
export interface FeedbacksForm extends BaseEntity {
/**
* 主键
*/
id?: string | number;
/**
* 反馈类型(0保修1保洁2会议)
*/
feedbackType?: string;
/**
* 反馈人
*/
feedbackPersion?: number;
/**
* 反馈人电话
*/
feedbackPersionPhone?: string;
/**
* 反馈内容
*/
feedbackContent?: string;
/**
* 反馈位置
*/
feedbackLocation?: string;
/**
* 反馈图片
*/
feedbackImg?: string;
/**
* 是否转至工单
*/
isWorkOrder?: string;
/**
* 状态(1待处理2处理中3处理完成)
*/
status?: string;
/**
* 客服电话
*/
serviceName?: string;
}
export interface FeedbacksQuery extends PageQuery {
/**
* 反馈类型(0保修1保洁2会议)
*/
feedbackType?: string;
/**
* 反馈人
*/
feedbackPersion?: number;
/**
* 反馈人电话
*/
feedbackPersionPhone?: string;
/**
* 反馈内容
*/
feedbackContent?: string;
/**
* 反馈位置
*/
feedbackLocation?: string;
/**
* 反馈图片
*/
feedbackImg?: string;
/**
* 是否转至工单
*/
isWorkOrder?: string;
/**
* 状态(1待处理2处理中3处理完成)
*/
status?: string;
/**
* 客服电话
*/
serviceName?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -1,70 +1,75 @@
import type { PageQuery, BaseEntity } from '#/api/common';
import type { PageQuery, BaseEntity } from '#/api/common'
export interface PersonVO {
/**
* 主键id
*/
id: string | number;
id: string | number
/**
* 用户id
*/
userId: string | number;
userId: string | number
/**
* 用户名称
*/
userName: string;
userName: string
/**
* 联系电话
*/
phone: string;
phone: string
/**
* 性别
*/
gender: number;
gender: number
/**
* 人脸图片
*/
img: string;
img: string
/**
* 所属单位id
*/
unitId: string | number;
unitId: string | number
/**
* 所属单位名称
*/
unitName: string;
unitName: string
/**
* 入驻位置
*/
locathon: string;
locathon: string
/**
* 入驻时间
*/
time: string;
time: string
/**
* 车牌号码
*/
carNumber: string;
carNumber: string
/**
* 状态
*/
state: number|string;
state: number | string
/**
* 备注
*/
remark: string;
remark: string
/**
* 权限组id
*/
authGroupId?: string | number
}
@@ -72,67 +77,72 @@ export interface PersonForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
id?: string | number
/**
* 用户id
*/
userId?: string | number;
userId?: string | number
/**
* 用户名称
*/
userName?: string;
userName?: string
/**
* 联系电话
*/
phone?: string;
phone?: string
/**
* 性别
*/
gender?: number;
gender?: number
/**
* 人脸图片
*/
img?: string;
img?: string
/**
* 所属单位id
*/
unitId?: string | number;
unitId?: string | number
/**
* 所属单位名称
*/
unitName?: string;
unitName?: string
/**
* 入驻位置
*/
locathon?: string;
locathon?: string
/**
* 入驻时间
*/
time?: string;
time?: string
/**
* 车牌号码
*/
carNumber?: string;
carNumber?: string
/**
* 状态
*/
state?: number;
state?: number
/**
* 备注
*/
remark?: string;
remark?: string
/**
* 权限组id
*/
authGroupId?: string | number
}
@@ -140,128 +150,128 @@ export interface PersonQuery extends PageQuery {
/**
* 用户id
*/
userId?: string | number;
userId?: string | number
/**
* 用户名称
*/
userName?: string;
userName?: string
/**
* 联系电话
*/
phone?: string;
phone?: string
/**
* 性别
*/
gender?: number;
gender?: number
/**
* 人脸图片
*/
img?: string;
img?: string
/**
* 所属单位id
*/
unitId?: string | number;
unitId?: string | number
/**
* 所属单位名称
*/
unitName?: string;
unitName?: string
/**
* 入驻位置
*/
locathon?: string;
locathon?: string
/**
* 入驻时间
*/
time?: string;
time?: string
/**
* 车牌号码
*/
carNumber?: string;
carNumber?: string
/**
* 状态
*/
state?: number;
state?: number
/**
* 日期范围参数
*/
params?: any;
params?: any
}
export interface Person extends BaseEntity{
export interface Person extends BaseEntity {
/**
* 主键id
*/
id: string | number;
id: string | number
/**
* 用户id
*/
userId: string | number;
userId: string | number
/**
* 用户名称
*/
userName: string;
userName: string
/**
* 联系电话
*/
phone: string;
phone: string
/**
* 性别
*/
gender: number;
gender: number
/**
* 人脸图片
*/
img: string;
img: string
/**
* 所属单位id
*/
unitId: string | number;
unitId: string | number
/**
* 所属单位名称
*/
unitName: string;
unitName: string
/**
* 入驻位置
*/
locathon: string;
locathon: string
/**
* 入驻时间
*/
time: string;
time: string
/**
* 车牌号码
*/
carNumber: string;
carNumber: string
/**
* 状态
*/
state: number;
state: number
/**
* 备注
*/
remark: string;
remark: string
}

View File

@@ -56,6 +56,16 @@ export interface Resident_unitVO {
*/
remark: string;
/**
* 权限组id
*/
authGroupId?: string | number;
/**
* 权限组名称
*/
authGroupName?: string;
}
export interface Resident_unitForm extends BaseEntity {

View File

@@ -0,0 +1,61 @@
import type { AuthGroupVO, AuthGroupForm, AuthGroupQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询授权组列表
* @param params
* @returns 授权组列表
*/
export function authGroupList(params?: AuthGroupQuery) {
return requestClient.get<PageResult<AuthGroupVO>>('/sis/authGroup/list', { params });
}
/**
* 导出授权组列表
* @param params
* @returns 授权组列表
*/
export function authGroupExport(params?: AuthGroupQuery) {
return commonExport('/sis/authGroup/export', params ?? {});
}
/**
* 查询授权组详情
* @param id id
* @returns 授权组详情
*/
export function authGroupInfo(id: ID) {
return requestClient.get<AuthGroupVO>(`/sis/authGroup/${id}`);
}
/**
* 新增授权组
* @param data
* @returns void
*/
export function authGroupAdd(data: AuthGroupForm) {
return requestClient.postWithMsg<void>('/sis/authGroup', data);
}
/**
* 更新授权组
* @param data
* @returns void
*/
export function authGroupUpdate(data: AuthGroupForm) {
return requestClient.putWithMsg<void>('/sis/authGroup', data);
}
/**
* 删除授权组
* @param id id
* @returns void
*/
export function authGroupRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/sis/authGroup/${id}`);
}

View File

@@ -0,0 +1,69 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface AuthGroupVO {
/**
* 主键id
*/
id: string | number;
/**
* 权限名称
*/
name: string;
/**
* 面向对象(1-单位、2-个人)
*/
groupType: number;
/**
* 是否启用(0禁用1启用)
*/
isEnable: boolean;
}
export interface AuthGroupForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 权限名称
*/
name?: string;
/**
* 面向对象(1-单位、2-个人)
*/
groupType?: number;
/**
* 是否启用(0禁用1启用)
*/
isEnable?: boolean;
}
export interface AuthGroupQuery extends PageQuery {
/**
* 权限名称
*/
name?: string;
/**
* 面向对象(1-单位、2-个人)
*/
groupType?: number;
/**
* 是否启用(0禁用1启用)
*/
isEnable?: boolean;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -0,0 +1,168 @@
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: 'Select',
componentProps: {
options:getDictOptions('wy_yjfklx')
},
fieldName: 'feedbackType',
label: '反馈类型',
},
{
component: 'Select',
componentProps: {
options:getDictOptions('wy_yjclzt')
},
fieldName: 'status',
label: '处理状态',
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '反馈类型',
field: 'feedbackType',
slots:{
default: ({row})=>{
return renderDict(row.feedbackType,'wy_yjfklx')
}
}
},
{
title: '反馈人',
field: 'feedbackPersion',
},
{
title: '反馈人电话',
field: 'feedbackPersionPhone',
},
{
title: '反馈内容',
field: 'feedbackContent',
},
{
title: '反馈位置',
field: 'feedbackLocation',
},
{
title: '反馈图片',
field: 'feedbackImg',
},
{
title: '是否转至工单',
field: 'isWorkOrder',
slots:{
default: ({row})=>{
return renderDict(row.isWorkOrder,'wy_sf')
}
}
},
{
title: '处理状态',
field: 'status',
slots:{
default: ({row})=>{
return renderDict(row.status,'wy_yjclzt')
}
}
},
{
title: '客服电话',
field: 'serviceName',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '反馈类型',
fieldName: 'feedbackType',
component: 'Select',
componentProps: {
options:getDictOptions('wy_yjfklx')
},
rules: 'selectRequired',
},
{
label: '反馈人',
fieldName: 'feedbackPersion',
component: 'Input',
rules: 'required',
},
{
label: '反馈人电话',
fieldName: 'feedbackPersionPhone',
component: 'Input',
rules: 'required',
},
{
label: '反馈内容',
fieldName: 'feedbackContent',
component: 'Textarea',
rules: 'required',
formItemClass:'col-span-2'
},
{
label: '反馈位置',
fieldName: 'feedbackLocation',
component: 'Input',
rules: 'required',
formItemClass:'col-span-2'
},
{
label: '反馈图片',
fieldName: 'feedbackImg',
component: 'ImageUpload',
componentProps: {
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
rules: 'required',
formItemClass:'col-span-2'
},
{
label: '转至工单',
fieldName: 'isWorkOrder',
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
options: getDictOptions('wy_sf'),
},
defaultValue:'0'
},
{
label: '处理状态',
fieldName: 'status',
component: 'Select',
componentProps: {
options: getDictOptions('wy_yjclzt')
},
},
{
label: '客服电话',
fieldName: 'serviceName',
component: 'Input',
},
];

View File

@@ -0,0 +1,101 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { feedbacksAdd, feedbacksInfo, feedbacksUpdate } from '#/api/property/customerService/feedbacks';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
formItemClass: 'col-span-1',
// 默认label宽度 px
labelWidth: 80,
// 通用配置项 会影响到所有表单项
componentProps: {
class: 'w-full',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[70%]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await feedbacksInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? feedbacksUpdate(data) : feedbacksAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -0,0 +1,169 @@
<script setup lang="ts">
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
feedbacksExport,
feedbacksList,
feedbacksRemove,
} from '#/api/property/customerService/feedbacks';
import type { FeedbacksForm } from '#/api/property/customerService/feedbacks/model';
import { commonDownloadExcel } from '#/utils/file/download';
import feedbacksModal from './feedbacks-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
// 高亮
highlight: true,
// 翻页时保留选中状态
reserve: true,
// 点击行选中
// trigger: 'row',
},
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await feedbacksList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'system-feedbacks-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [FeedbacksModal, modalApi] = useVbenModal({
connectedComponent: feedbacksModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<FeedbacksForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<FeedbacksForm>) {
await feedbacksRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<FeedbacksForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await feedbacksRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(feedbacksExport, '意见反馈数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="意见反馈列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['system:feedbacks:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['system:feedbacks:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['system:feedbacks:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['system:feedbacks:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['system:feedbacks:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<FeedbacksModal @reload="tableApi.query()" />
</Page>
</template>

View File

@@ -1,8 +1,10 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
import {resident_unitList} from "#/api/property/resident/unit";
import type { FormSchemaGetter } from '#/adapter/form'
import type { VxeGridProps } from '#/adapter/vxe-table'
import { getDictOptions } from "#/utils/dict"
import { renderDict } from "#/utils/render"
import { resident_unitList } from "#/api/property/resident/unit"
import { authGroupList } from '#/api/sis/authGroup'
import type { AuthGroupVO, AuthGroupQuery } from '#/api/sis/authGroup/model'
export const querySchema: FormSchemaGetter = () => [
@@ -19,7 +21,7 @@ export const querySchema: FormSchemaGetter = () => [
debounceTime: 500,
allowClear: true,
placeholder: '请选择所属单位',
filterOption:true
filterOption: true
},
},
{
@@ -35,7 +37,7 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'state',
label: '状态',
},
];
]
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
@@ -66,9 +68,9 @@ export const columns: VxeGridProps['columns'] = [
{
title: '性别',
field: 'gender',
slots:{
default: ({row})=>{
return renderDict(row.gender,'sys_user_sex')
slots: {
default: ({ row }) => {
return renderDict(row.gender, 'sys_user_sex')
}
},
width: 100
@@ -101,9 +103,9 @@ export const columns: VxeGridProps['columns'] = [
{
title: '状态',
field: 'state',
slots:{
default: ({row})=>{
return renderDict(row.state,'wy_rzryzt')
slots: {
default: ({ row }) => {
return renderDict(row.state, 'wy_rzryzt')
}
},
width: 100
@@ -120,8 +122,9 @@ export const columns: VxeGridProps['columns'] = [
title: '操作',
minWidth: 180,
},
];
]
let authGroupArr: AuthGroupVO[] = []
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键id',
@@ -144,7 +147,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'unitId',
component: 'Select',
formItemClass: 'col-span-2',
rules:'selectRequired',
rules: 'selectRequired',
},
// {
// label: '入驻位置',
@@ -162,7 +165,7 @@ export const modalSchema: FormSchemaGetter = () => [
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules:"required"
rules: "required"
},
{
label: '车牌号码',
@@ -186,7 +189,31 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: {
options: getDictOptions('wy_rzryzt'),
},
rules:'selectRequired'
rules: 'selectRequired'
},
{
label: '通行权限组',
fieldName: 'authGroupId',
component: 'ApiSelect',
componentProps: {
resultField: 'list', // 根据API返回结构调整
labelField: 'name',
valueField: 'id',
// immediate: true,
api: async () => {
if (!authGroupArr || authGroupArr.length == 0) {
const params: AuthGroupQuery = {
groupType: 2,
pageNum: 1,
pageSize: 500,
}
const res = await authGroupList(params)
authGroupArr = res.rows
}
return authGroupArr
},
},
rules: 'required',
},
{
label: '备注',
@@ -194,7 +221,7 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Textarea',
formItemClass: 'col-span-2',
},
];
]
//门禁记录
export const accessControlColumns: VxeGridProps['columns'] = [
@@ -231,7 +258,7 @@ export const accessControlColumns: VxeGridProps['columns'] = [
field: 'locathon',
},
];
]
//车辆记录
export const carColumns: VxeGridProps['columns'] = [
@@ -275,20 +302,20 @@ export const carColumns: VxeGridProps['columns'] = [
title: '备注',
field: 'remark',
},
];
]
export async function getUnitList(): Promise<{ value: number; label: string }[]> {
const queryParam = {
pageNum: 1000,
pageSize: 1,
};
const res = await resident_unitList(queryParam);
const data: { value: number; label: string }[] = [];
}
const res = await resident_unitList(queryParam)
const data: { value: number; label: string }[] = []
res.rows.forEach((r: any) => {
data.push({
value: r.id,
label: r.name,
});
});
return data;
})
})
return data
}

View File

@@ -1,8 +1,10 @@
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
import {z} from "#/adapter/form";
import type { FormSchemaGetter } from '#/adapter/form'
import { authGroupList } from '#/api/sis/authGroup'
import type { AuthGroupVO, AuthGroupQuery } from '#/api/sis/authGroup/model'
import type { VxeGridProps } from '#/adapter/vxe-table'
import { getDictOptions } from "#/utils/dict"
import { renderDict } from "#/utils/render"
import { z } from "#/adapter/form"
export const querySchema: FormSchemaGetter = () => [
{
@@ -23,10 +25,10 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'state',
label: '状态',
},
];
]
export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60},
{ type: 'checkbox', width: 60 },
// {
// title: '序号',
// field: 'id',
@@ -40,10 +42,11 @@ export const columns: VxeGridProps['columns'] = [
{
title: '单位编号',
field: 'unitNumber',
slots:{
slots: {
default: ({ row }) => {
return row.id;
}},
return row.id
}
},
width: 100
},
{
@@ -56,7 +59,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'type',
slots: {
default: ({ row }) => {
return renderDict(row.type, 'wy_qylx');
return renderDict(row.type, 'wy_qylx')
},
},
width: 100
@@ -84,7 +87,7 @@ export const columns: VxeGridProps['columns'] = [
{
title: '状态',
field: 'state',
slots: {default: 'state'},
slots: { default: 'state' },
width: 100,
},
// {
@@ -105,12 +108,13 @@ export const columns: VxeGridProps['columns'] = [
{
field: 'action',
fixed: 'right',
slots: {default: 'action'},
slots: { default: 'action' },
title: '操作',
minWidth: 180,
},
];
]
let authGroupArr: AuthGroupVO[] = []
export const modalSchema: FormSchemaGetter = () => [
{
label: 'id',
@@ -147,7 +151,7 @@ export const modalSchema: FormSchemaGetter = () => [
label: '联系电话',
fieldName: 'phone',
component: 'Input',
rules:z.union([
rules: z.union([
z.string().regex(/^1[3-9]\d{9}$/, { message: '手机号格式错误' }),
z.number().int().min(1000000000).max(19999999999, { message: '手机号格式错误' })
]).transform(val => val.toString()),
@@ -170,10 +174,34 @@ export const modalSchema: FormSchemaGetter = () => [
},
rules: 'required',
},
{
label: '通行权限组',
fieldName: 'authGroupId',
component: 'ApiSelect',
componentProps: {
resultField: 'list', // 根据API返回结构调整
labelField: 'name',
valueField: 'id',
// immediate: true,
api: async () => {
if (!authGroupArr || authGroupArr.length == 0) {
const params: AuthGroupQuery = {
groupType: 1,
pageNum: 1,
pageSize: 500,
}
const res = await authGroupList(params)
authGroupArr = res.rows
}
return authGroupArr
},
},
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
formItemClass: 'col-span-2'
},
];
]

View File

@@ -44,7 +44,7 @@ async function handleOpenChange(open: boolean) {
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="入驻单位信息" class="w-[70%]">
<Descriptions v-if="unitDetail" size="small" :column="2" bordered :labelStyle="{width:'100px'}">
<Descriptions v-if="unitDetail" size="small" :column="2" bordered :labelStyle="{width:'110px'}">
<DescriptionsItem label="单位编号">
{{ unitDetail.id }}
</DescriptionsItem>
@@ -75,6 +75,9 @@ async function handleOpenChange(open: boolean) {
<component
:is="renderDict(unitDetail.state,'wy_state')"
/>
</DescriptionsItem>
<DescriptionsItem label="通行权限组">
{{ unitDetail.authGroupId ?? '-' }}
</DescriptionsItem>
<DescriptionsItem label="备注">
{{ unitDetail.remark ?? '-' }}

View File

@@ -0,0 +1,101 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { authGroupAdd, authGroupInfo, authGroupUpdate } from '#/api/sis/authGroup';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
formItemClass: 'col-span-2',
// 默认label宽度 px
labelWidth: 80,
// 通用配置项 会影响到所有表单项
componentProps: {
class: 'w-full',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await authGroupInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? authGroupUpdate(data) : authGroupAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -0,0 +1,75 @@
import type { FormSchemaGetter } from '#/adapter/form'
import type { VxeGridProps } from '#/adapter/vxe-table'
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'name',
label: '权限名称',
},
{
label: '面向对象',
fieldName: 'groupType',
component: 'Select',
componentProps: {
options: [{ 'value': 1, 'label': '单位' }, { 'value': 2, 'label': '个人' }]
},
}
]
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '权限名称',
field: 'name',
},
{
title: '面向对象',
field: 'groupType',
slots: { default: 'groupType' },
width: 180,
},
{
title: '是否启用',
field: 'isEnable',
slots: { default: 'isEnable' },
width: 180,
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
]
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '权限名称',
fieldName: 'name',
component: 'Input',
rules: 'required',
},
{
label: '面向对象',
fieldName: 'groupType',
component: 'Select',
componentProps: {
options: [{ 'value': 1, 'label': '单位' }, { 'value': 2, 'label': '个人' }]
},
rules: 'selectRequired',
},
]

View File

@@ -0,0 +1,170 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types'
import { ref } from 'vue'
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'
import { getVxePopupContainer } from '@vben/utils'
import { Modal, Popconfirm, Space, Tag } from 'ant-design-vue'
import { TableSwitch } from "#/components/table"
import dayjs from 'dayjs'
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table'
import {
authGroupExport,
authGroupList,
authGroupRemove,
} from '#/api/sis/authGroup'
import type { AuthGroupForm } from '#/api/sis/authGroup/model'
import { commonDownloadExcel } from '#/utils/file/download'
import authGroupModal from './authGroup-modal.vue'
import { columns, querySchema } from './data'
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
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 = {
checkboxConfig: {
// 高亮
highlight: true,
// 翻页时保留选中状态
reserve: true,
// 点击行选中
// trigger: 'row',
},
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await authGroupList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
})
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'sis-authGroup-index'
}
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
})
const [AuthGroupModal, modalApi] = useVbenModal({
connectedComponent: authGroupModal,
})
function handleAdd() {
modalApi.setData({})
modalApi.open()
}
async function handleEdit(row: Required<AuthGroupForm>) {
modalApi.setData({ id: row.id })
modalApi.open()
}
async function handleDelete(row: Required<AuthGroupForm>) {
await authGroupRemove(row.id)
await tableApi.query()
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords()
const ids = rows.map((row: Required<AuthGroupForm>) => row.id)
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await authGroupRemove(ids)
await tableApi.query()
},
})
}
function handleDownloadExcel() {
commonDownloadExcel(authGroupExport, '授权组数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
})
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="授权组列表">
<template #toolbar-tools>
<Space>
<a-button v-access:code="['sis:authGroup:export']" @click="handleDownloadExcel">
{{ $t('pages.common.export') }}
</a-button>
<a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary"
v-access:code="['sis:authGroup:remove']" @click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button type="primary" v-access:code="['sis:authGroup:add']" @click="handleAdd">
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button v-access:code="['sis:authGroup:edit']" @click.stop="handleEdit(row)">
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?"
@confirm="handleDelete(row)">
<ghost-button danger v-access:code="['sis:authGroup:remove']" @click.stop="">
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
<template #isEnable="{ row }">
<TableSwitch :checkedValue=true :unCheckedValue=false :value="row.isEnable" @reload="() => tableApi.query()" />
</template>
<template #groupType="{ row }">
<Tag v-if="row.groupType === 1" color="processing">单位</Tag>
<Tag v-else color="warning">个人</Tag>
</template>
</BasicTable>
<AuthGroupModal @reload="tableApi.query()" />
</Page>
</template>