1、通知公告
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-07-23 16:28:30 +08:00
parent db8186d055
commit ae098aa1e0
13 changed files with 842 additions and 129 deletions

View File

@@ -12,7 +12,7 @@ import { requestClient } from '#/api/request';
* @returns 意见反馈列表 * @returns 意见反馈列表
*/ */
export function feedbacksList(params?: FeedbacksQuery) { export function feedbacksList(params?: FeedbacksQuery) {
return requestClient.get<PageResult<FeedbacksVO>>('/system/feedbacks/list', { params }); return requestClient.get<PageResult<FeedbacksVO>>('/property/feedbacks/list', { params });
} }
/** /**
@@ -21,7 +21,7 @@ export function feedbacksList(params?: FeedbacksQuery) {
* @returns 意见反馈列表 * @returns 意见反馈列表
*/ */
export function feedbacksExport(params?: FeedbacksQuery) { export function feedbacksExport(params?: FeedbacksQuery) {
return commonExport('/system/feedbacks/export', params ?? {}); return commonExport('/property/feedbacks/export', params ?? {});
} }
/** /**
@@ -30,7 +30,7 @@ export function feedbacksExport(params?: FeedbacksQuery) {
* @returns 意见反馈详情 * @returns 意见反馈详情
*/ */
export function feedbacksInfo(id: ID) { export function feedbacksInfo(id: ID) {
return requestClient.get<FeedbacksVO>(`/system/feedbacks/${id}`); return requestClient.get<FeedbacksVO>(`/property/feedbacks/${id}`);
} }
/** /**
@@ -39,7 +39,7 @@ export function feedbacksInfo(id: ID) {
* @returns void * @returns void
*/ */
export function feedbacksAdd(data: FeedbacksForm) { export function feedbacksAdd(data: FeedbacksForm) {
return requestClient.postWithMsg<void>('/system/feedbacks', data); return requestClient.postWithMsg<void>('/property/feedbacks', data);
} }
/** /**
@@ -48,7 +48,7 @@ export function feedbacksAdd(data: FeedbacksForm) {
* @returns void * @returns void
*/ */
export function feedbacksUpdate(data: FeedbacksForm) { export function feedbacksUpdate(data: FeedbacksForm) {
return requestClient.putWithMsg<void>('/system/feedbacks', data); return requestClient.putWithMsg<void>('/property/feedbacks', data);
} }
/** /**
@@ -57,5 +57,5 @@ export function feedbacksUpdate(data: FeedbacksForm) {
* @returns void * @returns void
*/ */
export function feedbacksRemove(id: ID | IDS) { export function feedbacksRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/system/feedbacks/${id}`); return requestClient.deleteWithMsg<void>(`/property/feedbacks/${id}`);
} }

View File

@@ -1,4 +1,4 @@
import type { PageQuery, BaseEntity } from '#/api/common'; import type {PageQuery, BaseEntity} from '#/api/common';
export interface FeedbacksVO { export interface FeedbacksVO {
/** /**
@@ -104,6 +104,11 @@ export interface FeedbacksForm extends BaseEntity {
*/ */
serviceName?: string; serviceName?: string;
/**
* 工单id
*/
orderId?: string;
} }
export interface FeedbacksQuery extends PageQuery { export interface FeedbacksQuery extends PageQuery {
@@ -153,7 +158,7 @@ export interface FeedbacksQuery extends PageQuery {
serviceName?: string; serviceName?: string;
/** /**
* 日期范围参数 * 日期范围参数
*/ */
params?: any; params?: any;
} }

View File

@@ -0,0 +1,61 @@
import type { NoticesVO, NoticesForm, NoticesQuery } 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 noticesList(params?: NoticesQuery) {
return requestClient.get<PageResult<NoticesVO>>('/property/notices/list', { params });
}
/**
* 导出客户服务-通知公告列表
* @param params
* @returns 客户服务-通知公告列表
*/
export function noticesExport(params?: NoticesQuery) {
return commonExport('/property/notices/export', params ?? {});
}
/**
* 查询客户服务-通知公告详情
* @param id id
* @returns 客户服务-通知公告详情
*/
export function noticesInfo(id: ID) {
return requestClient.get<NoticesVO>(`/property/notices/${id}`);
}
/**
* 新增客户服务-通知公告
* @param data
* @returns void
*/
export function noticesAdd(data: NoticesForm) {
return requestClient.postWithMsg<void>('/property/notices', data);
}
/**
* 更新客户服务-通知公告
* @param data
* @returns void
*/
export function noticesUpdate(data: NoticesForm) {
return requestClient.putWithMsg<void>('/property/notices', data);
}
/**
* 删除客户服务-通知公告
* @param id id
* @returns void
*/
export function noticesRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/notices/${id}`);
}

View File

@@ -0,0 +1,139 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface NoticesVO {
/**
* 主键
*/
id: string | number;
/**
* 标题
*/
title: string;
/**
* 类型
*/
type: string;
/**
* 备注
*/
remark: string;
/**
* 是否全小区公告
*/
isAll: string;
/**
* 开始时间
*/
startTime: string;
/**
* 结束时间
*/
endTime: string;
/**
* 公告内容
*/
afficheContent: string;
/**
* 发布人
*/
issuers: number;
}
export interface NoticesForm extends BaseEntity {
/**
* 主键
*/
id?: string | number;
/**
* 标题
*/
title?: string;
/**
* 类型
*/
type?: string;
/**
* 备注
*/
remark?: string;
/**
* 是否全小区公告
*/
isAll?: string;
/**
* 开始时间
*/
startTime?: string;
/**
* 结束时间
*/
endTime?: string;
/**
* 公告内容
*/
afficheContent?: string;
/**
* 发布人
*/
issuers?: number;
}
export interface NoticesQuery extends PageQuery {
/**
* 标题
*/
title?: string;
/**
* 类型
*/
type?: string;
/**
* 是否全小区公告
*/
isAll?: string;
/**
* 开始时间
*/
startTime?: string;
/**
* 结束时间
*/
endTime?: string;
/**
* 公告内容
*/
afficheContent?: string;
/**
* 发布人
*/
issuers?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -5,14 +5,6 @@ import {renderDict} from "#/utils/render";
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
componentProps: {
options:getDictOptions('wy_yjfklx')
},
fieldName: 'feedbackType',
label: '反馈类型',
},
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
@@ -26,34 +18,30 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, { type: 'checkbox', width: 60 },
{ // {
title: '反馈类型', // title: '反馈类型',
field: 'feedbackType', // field: 'feedbackType',
slots:{ // width:120
default: ({row})=>{ // },
return renderDict(row.feedbackType,'wy_yjfklx') // {
} // title: '反馈人',
} // field: 'feedbackPersion',
}, // width:120
{ // },
title: '反馈人', // {
field: 'feedbackPersion', // title: '反馈人电话',
}, // field: 'feedbackPersionPhone',
{ // width:120
title: '反馈人电话', // },
field: 'feedbackPersionPhone',
},
{ {
title: '反馈内容', title: '反馈内容',
field: 'feedbackContent', field: 'feedbackContent',
minWidth:180
}, },
{ {
title: '反馈位置', title: '反馈位置',
field: 'feedbackLocation', field: 'feedbackLocation',
}, width:120
{
title: '反馈图片',
field: 'feedbackImg',
}, },
{ {
title: '是否转至工单', title: '是否转至工单',
@@ -62,7 +50,8 @@ export const columns: VxeGridProps['columns'] = [
default: ({row})=>{ default: ({row})=>{
return renderDict(row.isWorkOrder,'wy_sf') return renderDict(row.isWorkOrder,'wy_sf')
} }
} },
width:120
}, },
{ {
title: '处理状态', title: '处理状态',
@@ -71,18 +60,20 @@ export const columns: VxeGridProps['columns'] = [
default: ({row})=>{ default: ({row})=>{
return renderDict(row.status,'wy_yjclzt') return renderDict(row.status,'wy_yjclzt')
} }
} },
width:120
}, },
{ {
title: '客服电话', title: '客服电话',
field: 'serviceName', field: 'serviceName',
width:120
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: { default: 'action' },
title: '操作', title: '操作',
width: 180, width: 200,
}, },
]; ];
@@ -100,22 +91,41 @@ export const modalSchema: FormSchemaGetter = () => [
label: '反馈类型', label: '反馈类型',
fieldName: 'feedbackType', fieldName: 'feedbackType',
component: 'Select', component: 'Select',
componentProps: {
options:getDictOptions('wy_yjfklx')
},
rules: 'selectRequired', rules: 'selectRequired',
}, },
{
label: '反馈人',
fieldName: 'person',
component: 'Input',
slots:{
default:'person'
}
},
{ {
label: '反馈人', label: '反馈人',
fieldName: 'feedbackPersion', fieldName: 'feedbackPersion',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
dependencies: {
show: () => false,
triggerFields: [''],
},
}, },
{ {
label: '反馈人电话', label: '反馈人电话',
fieldName: 'feedbackPersionPhone', fieldName: 'feedbackPersionPhone',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '客服电话',
fieldName: 'serviceName',
component: 'Input',
rules: 'required',
}, },
{ {
label: '反馈内容', label: '反馈内容',
@@ -139,19 +149,8 @@ export const modalSchema: FormSchemaGetter = () => [
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 // maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
}, },
rules: 'required',
formItemClass:'col-span-2' formItemClass:'col-span-2'
}, },
{
label: '转至工单',
fieldName: 'isWorkOrder',
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
options: getDictOptions('wy_sf'),
},
defaultValue:'0'
},
{ {
label: '处理状态', label: '处理状态',
fieldName: 'status', fieldName: 'status',
@@ -159,10 +158,19 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
options: getDictOptions('wy_yjclzt') options: getDictOptions('wy_yjclzt')
}, },
rules:'selectRequired'
}, },
{ {
label: '客服电话', label: '转至工单',//转至工单
fieldName: 'serviceName', fieldName: 'isWorkOrder',
component: 'Input', component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
options: getDictOptions('wy_sf'),
optionType: 'button',
},
defaultValue:'0',
rules:'selectRequired'
}, },
]; ];

View File

@@ -0,0 +1,69 @@
<script setup lang="ts">
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import {renderDict} from "#/utils/render";
dayjs.extend(duration);
dayjs.extend(relativeTime);
import {feedbacksInfo} from "#/api/property/customerService/feedbacks";
import type {FeedbacksVO} from "#/api/property/customerService/feedbacks/model";
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
feedbacksDetail.value = null;
},
});
const feedbacksDetail = shallowRef<null | FeedbacksVO>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
feedbacksDetail.value = await feedbacksInfo(id);
modalApi.modalLoading(false);
}
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="意见反馈详情" class="w-[70%]">
<Descriptions v-if="feedbacksDetail" size="small" :column="2" bordered
:labelStyle="{width:'120px'}">
<DescriptionsItem label="反馈类型">
{{ feedbacksDetail.feedbackType }}
</DescriptionsItem>
<DescriptionsItem label="反馈人">
{{ feedbacksDetail.feedbackPersion+'-'+feedbacksDetail.feedbackPersionPhone }}
</DescriptionsItem>
<DescriptionsItem label="反馈内容" :span="2">
{{ feedbacksDetail.feedbackContent }}
</DescriptionsItem>
<DescriptionsItem label="反馈位置" :span="2">
{{ feedbacksDetail.feedbackLocation }}
</DescriptionsItem>
<DescriptionsItem label="反馈图片" :span="2">
{{feedbacksDetail.feedbackImg}}
</DescriptionsItem>
<DescriptionsItem label="转至工单">
<component
:is="renderDict(feedbacksDetail.isWorkOrder,'wy_sf')"
/>
</DescriptionsItem>
<DescriptionsItem label="处理状态">
<component
:is="renderDict(feedbacksDetail.status,'wy_yjclzt')"
/>
</DescriptionsItem>
<DescriptionsItem label="客服电话">
{{ feedbacksDetail.serviceName }}
</DescriptionsItem>
</Descriptions>
</BasicModal>
</template>

View File

@@ -1,15 +1,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui'; import {useVbenModal} from '@vben/common-ui';
import { $t } from '@vben/locales'; import {$t} from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import {useVbenForm} from '#/adapter/form';
import { feedbacksAdd, feedbacksInfo, feedbacksUpdate } from '#/api/property/customerService/feedbacks'; import {
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; feedbacksAdd,
feedbacksInfo,
feedbacksUpdate
} from '#/api/property/customerService/feedbacks';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import { modalSchema } from './data'; import {modalSchema} from './data';
import type {FeedbacksVO} from "#/api/property/customerService/feedbacks/model";
import {workOrdersTypeList} from "#/api/property/businessManagement/workOrdersType";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@@ -34,13 +40,14 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff( const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
}, },
); );
const detail = ref<FeedbacksVO>()
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度 // 在这里更改宽度
class: 'w-[70%]', class: 'w-[70%]',
@@ -54,11 +61,12 @@ const [BasicModal, modalApi] = useVbenModal({
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
await initWorkOrderTypeOption()
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await feedbacksInfo(id); const record = await feedbacksInfo(id);
detail.value = record
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
@@ -70,7 +78,7 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
const { valid } = await formApi.validate(); const {valid} = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
@@ -91,11 +99,32 @@ async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
resetInitialized(); resetInitialized();
} }
async function initWorkOrderTypeOption() {
let params = {
pageSize: 1000,
pageNum: 1
}
const res = await workOrdersTypeList(params)
formApi.updateSchema([{
componentProps: () => ({
options: res.rows,
showSearch: true,
optionFilterProp: 'orderTypeName',
fieldNames: {label: 'orderTypeName', value: 'id'},
}),
fieldName: 'feedbackType',
}])
}
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm /> <BasicForm>
<template #person>
<span v-if="detail">{{ detail.feedbackPersion + '-' + detail.feedbackPersionPhone }}</span>
</template>
</BasicForm>
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -1,25 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Space } from 'ant-design-vue';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
feedbacksExport, feedbacksExport,
feedbacksList, feedbacksList,
feedbacksRemove,
} from '#/api/property/customerService/feedbacks'; } from '#/api/property/customerService/feedbacks';
import type { FeedbacksForm } from '#/api/property/customerService/feedbacks/model'; import type { FeedbacksForm } from '#/api/property/customerService/feedbacks/model';
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import feedbacksModal from './feedbacks-modal.vue'; import feedbacksModal from './feedbacks-modal.vue';
import feedbacksDetail from './feedbacks-detail.vue';
import workOrdersDetail from '../../businessManagement/workOrders/work-orders-detail.vue'
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
@@ -42,8 +40,6 @@ const gridOptions: VxeGridProps = {
// 点击行选中 // 点击行选中
// trigger: 'row', // trigger: 'row',
}, },
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// columns: columns(),
columns, columns,
height: 'auto', height: 'auto',
keepSource: true, keepSource: true,
@@ -63,7 +59,7 @@ const gridOptions: VxeGridProps = {
keyField: 'id', keyField: 'id',
}, },
// 表格全局唯一表示 保存列配置需要用到 // 表格全局唯一表示 保存列配置需要用到
id: 'system-feedbacks-index' id: 'property-feedbacks-index'
}; };
const [BasicTable, tableApi] = useVbenVxeGrid({ const [BasicTable, tableApi] = useVbenVxeGrid({
@@ -75,35 +71,34 @@ const [FeedbacksModal, modalApi] = useVbenModal({
connectedComponent: feedbacksModal, connectedComponent: feedbacksModal,
}); });
function handleAdd() { const [WorkOrdersDetail, orderDetailApi] = useVbenModal({
modalApi.setData({}); connectedComponent: workOrdersDetail,
modalApi.open(); });
}
const [FeedbacksDetail, detailApi] = useVbenModal({
connectedComponent: feedbacksDetail,
});
async function handleEdit(row: Required<FeedbacksForm>) { async function handleEdit(row: Required<FeedbacksForm>) {
modalApi.setData({ id: row.id }); modalApi.setData({ id: row.id });
modalApi.open(); modalApi.open();
} }
async function handleDelete(row: Required<FeedbacksForm>) { async function handleInfo(row: Required<FeedbacksForm>) {
await feedbacksRemove(row.id); detailApi.setData({ id: row.id });
await tableApi.query(); detailApi.open();
} }
function handleMultiDelete() { async function handleOrderInfo(row: Required<FeedbacksForm>) {
const rows = tableApi.grid.getCheckboxRecords(); orderDetailApi.setData({ id: row.orderId });
const ids = rows.map((row: Required<FeedbacksForm>) => row.id); orderDetailApi.open();
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await feedbacksRemove(ids);
await tableApi.query();
},
});
} }
function handleDownloadExcel() { function handleDownloadExcel() {
commonDownloadExcel(feedbacksExport, '意见反馈数据', tableApi.formApi.form.values, { commonDownloadExcel(feedbacksExport, '意见反馈数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime, fieldMappingTime: formOptions.fieldMappingTime,
@@ -122,48 +117,34 @@ function handleDownloadExcel() {
> >
{{ $t('pages.common.export') }} {{ $t('pages.common.export') }}
</a-button> </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> </Space>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button
v-access:code="['system:feedbacks:info']"
@click.stop="handleInfo(row)"
>
{{ $t('pages.common.info') }}
</ghost-button>
<ghost-button <ghost-button
v-access:code="['system:feedbacks:edit']" v-access:code="['system:feedbacks:edit']"
@click.stop="handleEdit(row)" @click.stop="handleEdit(row)"
> >
{{ $t('pages.common.edit') }} {{ $t('pages.common.edit') }}
</ghost-button> </ghost-button>
<Popconfirm <ghost-button
:get-popup-container="getVxePopupContainer" v-access:code="['system:feedbacks:info']"
placement="left" @click.stop="handleOrderInfo(row)"
title="确认删除?" :disabled="row.isWorkOrder=='1'"
@confirm="handleDelete(row)"
> >
<ghost-button 工单详情
danger </ghost-button>
v-access:code="['system:feedbacks:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space> </Space>
</template> </template>
</BasicTable> </BasicTable>
<FeedbacksModal @reload="tableApi.query()" /> <FeedbacksModal @reload="tableApi.query()" />
<FeedbacksDetail></FeedbacksDetail>
<WorkOrdersDetail></WorkOrdersDetail>
</Page> </Page>
</template> </template>

View File

@@ -0,0 +1,137 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'title',
label: '标题',
},
{
component: 'Select',
componentProps: {
},
fieldName: 'type',
label: '类型',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '标题',
field: 'title',
minWidth: 180
},
{
title: '类型',
field: 'type',
width: 150
},
{
title: '备注',
field: 'remark',
width: 150
},
{
title: '是否全小区公告',
field: 'isAll',
width: 150
},
{
title: '开始时间',
field: 'startTime',
width: 150
},
{
title: '结束时间',
field: 'endTime',
width: 150
},
{
title: '公告内容',
field: 'afficheContent',
width: 150
},
{
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: 'title',
component: 'Textarea',
rules: 'required',
},
{
label: '类型',
fieldName: 'type',
component: 'Select',
componentProps: {
},
rules: 'selectRequired',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
},
{
label: '是否全小区公告',
fieldName: 'isAll',
component: 'Input',
},
{
label: '开始时间',
fieldName: 'startTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '结束时间',
fieldName: 'endTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '公告内容',
fieldName: 'afficheContent',
component: 'RichTextarea',
componentProps: {
// disabled: false, // 是否只读
// height: 400 // 高度 默认400
},
rules: 'required',
},
{
label: '发布人',
fieldName: 'issuers',
component: 'Input',
},
];

View File

@@ -0,0 +1,178 @@
<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 {
noticesExport,
noticesList,
noticesRemove,
} from '#/api/property/customerService/notices';
import type { NoticesForm } from '#/api/property/customerService/notices/model';
import { commonDownloadExcel } from '#/utils/file/download';
import noticesModal from './notices-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 noticesList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-notices-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [NoticesModal, modalApi] = useVbenModal({
connectedComponent: noticesModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<NoticesForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<NoticesForm>) {
await noticesRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<NoticesForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await noticesRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(noticesExport, '客户服务-通知公告数据', 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="['domain:notices:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['domain:notices:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['domain:notices:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['domain:notices: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="['domain:notices:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<NoticesModal @reload="tableApi.query()" />
</Page>
</template>

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 { noticesAdd, noticesInfo, noticesUpdate } from '#/api/property/customerService/notices';
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 noticesInfo(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 ? noticesUpdate(data) : noticesAdd(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

@@ -20,7 +20,7 @@
<a-form-item class="form-button"> <a-form-item class="form-button">
<a-button @click="handleClean">重置</a-button> <a-button @click="handleClean">重置</a-button>
<a-button type="primary" class="primary-button" <a-button type="primary" class="primary-button"
:disabled="!formState.appointmentTime||!formState.openHours||!formState.personNumber" :disabled="!formState.appointmentTime||!(formState.openHours&&formState.openHours.length)||!formState.personNumber"
@click="handleSearch">搜索</a-button> @click="handleSearch">搜索</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>

View File

@@ -37,9 +37,14 @@ export const columns: VxeGridProps['columns'] = [
field: 'name', field: 'name',
minWidth:100, minWidth:100,
}, },
// {
// title: '会议室地址',
// field: 'locationName',
// width:210,
// },
{ {
title: '会议室地址', title: '配套设备',
field: 'locationName', field: 'baseService',
width:210, width:210,
}, },
{ {