This commit is contained in:
parent
7d15ff713c
commit
5ff3cd67d0
@ -0,0 +1,61 @@
|
||||
import type { FaqManagementVO, FaqManagementForm, FaqManagementQuery } 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 faqManagementList(params?: FaqManagementQuery) {
|
||||
return requestClient.get<PageResult<FaqManagementVO>>('/property/faqManagement/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出常见问题管理列表
|
||||
* @param params
|
||||
* @returns 常见问题管理列表
|
||||
*/
|
||||
export function faqManagementExport(params?: FaqManagementQuery) {
|
||||
return commonExport('/property/faqManagement/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常见问题管理详情
|
||||
* @param id id
|
||||
* @returns 常见问题管理详情
|
||||
*/
|
||||
export function faqManagementInfo(id: ID) {
|
||||
return requestClient.get<FaqManagementVO>(`/property/faqManagement/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常见问题管理
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function faqManagementAdd(data: FaqManagementForm) {
|
||||
return requestClient.postWithMsg<void>('/property/faqManagement', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新常见问题管理
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function faqManagementUpdate(data: FaqManagementForm) {
|
||||
return requestClient.putWithMsg<void>('/property/faqManagement', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除常见问题管理
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function faqManagementRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/faqManagement/${id}`);
|
||||
}
|
114
apps/web-antd/src/api/property/customerService/faqManagement/model.d.ts
vendored
Normal file
114
apps/web-antd/src/api/property/customerService/faqManagement/model.d.ts
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface FaqManagementVO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
head: string;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
pageView: number;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
contents: string;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
status: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
|
||||
}
|
||||
|
||||
export interface FaqManagementForm extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
head?: string;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
pageView?: number;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
contents?: string;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface FaqManagementQuery extends PageQuery {
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
head?: string;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
pageView?: number;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
contents?: string;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -29,10 +29,11 @@ async function handleOpenChange(open: boolean) {
|
||||
|
||||
<template>
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="工单类型信息" class="w-[70%]">
|
||||
<Descriptions v-if="workOrdersTypeInfoDetail" size="small" :column="2" bordered :labelStyle="{width:'120px'}">
|
||||
<!-- <DescriptionsItem label="工单类型编号">-->
|
||||
<!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<Descriptions v-if="workOrdersTypeInfoDetail" size="small" :column="2" bordered
|
||||
:labelStyle="{width:'120px'}">
|
||||
<!-- <DescriptionsItem label="工单类型编号">-->
|
||||
<!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="类型名称">
|
||||
{{ workOrdersTypeInfoDetail.orderTypeName }}
|
||||
</DescriptionsItem>
|
||||
|
@ -1,11 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
常见问题管理
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -0,0 +1,124 @@
|
||||
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('consultation_type'),
|
||||
},
|
||||
fieldName: 'type',
|
||||
label: '咨询类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('publish_status'),
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '标题',
|
||||
field: 'head',
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
field: 'type',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.type, 'consultation_type');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '浏览量',
|
||||
field: 'pageView',
|
||||
},
|
||||
{
|
||||
title: '发布状态',
|
||||
field: 'status',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.status, 'publish_status');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
field: 'updateTime',
|
||||
},
|
||||
{
|
||||
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: 'head',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '分类',
|
||||
fieldName: 'type',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('consultation_type'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '发布状态',
|
||||
fieldName: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('publish_status'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '内容编辑',
|
||||
fieldName: 'contents',
|
||||
component: 'RichTextarea',
|
||||
componentProps: {
|
||||
// disabled: false, // 是否只读
|
||||
// height: 400 // 高度 默认400
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import type {FaqManagementVO} from '#/api/property/customerService/faqManagement/model';
|
||||
import {shallowRef} from 'vue';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
|
||||
import {faqManagementInfo} from '#/api/property/customerService/faqManagement';
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
onOpenChange: handleOpenChange,
|
||||
onClosed() {
|
||||
faqManagementDetail.value = null;
|
||||
},
|
||||
});
|
||||
|
||||
const faqManagementDetail = shallowRef<null | FaqManagementVO>(null);
|
||||
|
||||
async function handleOpenChange(open: boolean) {
|
||||
if (!open) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const {id} = modalApi.getData() as { id: number | string };
|
||||
const response = await faqManagementInfo(id);
|
||||
faqManagementDetail.value = response;
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="工单类型信息" class="w-[70%]">
|
||||
<Descriptions v-if="faqManagementDetail" size="small" :column="2" bordered :labelStyle="{width:'120px'}">
|
||||
<DescriptionsItem label="标题">
|
||||
{{ faqManagementDetail.head }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="分类">
|
||||
<component
|
||||
:is="renderDict(faqManagementDetail.type,'consultation_type')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="浏览量">
|
||||
{{ faqManagementDetail.pageView }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="发布状态">
|
||||
<component
|
||||
:is="renderDict(faqManagementDetail.status,'publish_status')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="创建时间">
|
||||
{{ faqManagementDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="更新时间">
|
||||
{{ faqManagementDetail.updateTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="内容编辑">
|
||||
<div v-html="faqManagementDetail.contents"></div>
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
</BasicModal>
|
||||
</template>
|
@ -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 { faqManagementAdd, faqManagementInfo, faqManagementUpdate } from '#/api/property/customerService/faqManagement';
|
||||
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 faqManagementInfo(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 ? faqManagementUpdate(data) : faqManagementAdd(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>
|
||||
|
@ -0,0 +1,173 @@
|
||||
<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 {
|
||||
faqManagementExport,
|
||||
faqManagementList,
|
||||
faqManagementRemove,
|
||||
} from '#/api/property/customerService/faqManagement';
|
||||
import type { FaqManagementForm } from '#/api/property/customerService/faqManagement/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import faqManagementModal from './faqManagement-modal.vue';
|
||||
import faqManagementDetail from './faqManagement-detail.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,
|
||||
},
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await faqManagementList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
id: 'property-faqManagement-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [FaqManagementModal, modalApi] = useVbenModal({
|
||||
connectedComponent: faqManagementModal,
|
||||
});
|
||||
|
||||
const [FaqManagementDetail, faqManagementDetailApi] = useVbenModal({
|
||||
connectedComponent: faqManagementDetail,
|
||||
});
|
||||
|
||||
async function handleInfo(row: Required<FaqManagementForm>) {
|
||||
faqManagementDetailApi.setData({ id: row.id });
|
||||
faqManagementDetailApi.open();
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<FaqManagementForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<FaqManagementForm>) {
|
||||
await faqManagementRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<FaqManagementForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await faqManagementRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(faqManagementExport, '常见问题管理数据', 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="['property:faqManagement:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:faqManagement:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:faqManagement:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
@click.stop="handleInfo(row)"
|
||||
>
|
||||
{{ $t('pages.common.info') }}
|
||||
</ghost-button>
|
||||
<ghost-button
|
||||
v-access:code="['property:faqManagement: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="['property:faqManagement:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<FaqManagementModal @reload="tableApi.query()" />
|
||||
<FaqManagementDetail/>
|
||||
</Page>
|
||||
</template>
|
Loading…
Reference in New Issue
Block a user