对接收入管理、提现管理
This commit is contained in:
@@ -1,27 +1,40 @@
|
||||
<template>
|
||||
<div class="p-2 app-container help-user-index-page">
|
||||
<div class="p-2 page-shell helpManage-helpArticle-page">
|
||||
<el-card shadow="hover" class="tabs-panel">
|
||||
<div class="segmented" role="tablist" aria-label="帮助类型">
|
||||
<button
|
||||
v-for="tab in helpTabs"
|
||||
:key="tab.value"
|
||||
type="button"
|
||||
role="tab"
|
||||
class="segmented-item"
|
||||
:class="{ 'is-active': activeTab === tab.value }"
|
||||
:aria-selected="activeTab === tab.value"
|
||||
@click="handleTabChange(tab.value)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</button>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="search-wrap">
|
||||
<el-card shadow="hover" class="search-panel" :class="{ 'is-collapsed': !showSearch }">
|
||||
<template #header>
|
||||
<div class="panel-heading search-panel-toggle" @click.stop="showSearch = !showSearch">
|
||||
<div>
|
||||
<span class="panel-kicker">Search Filters</span>
|
||||
<h3>筛选条件</h3>
|
||||
</div>
|
||||
<div><h3>筛选条件</h3></div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="query-form">
|
||||
<el-form-item label="帮助标题" prop="title">
|
||||
<el-input v-model="queryParams.title" placeholder="请输入帮助标题" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="category">
|
||||
<el-select v-model="queryParams.category" placeholder="请选择分类" clearable>
|
||||
<el-option v-for="item in categoryOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-form-item label="文章标题" prop="title">
|
||||
<el-input v-model="queryParams.title" placeholder="请输入文章标题" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable >
|
||||
<el-option
|
||||
v-for="dict in ur_help_article_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -36,154 +49,309 @@
|
||||
<template #header>
|
||||
<div class="toolbar-shell">
|
||||
<div class="table-heading">
|
||||
<span class="panel-kicker">Help Dataset</span>
|
||||
<h3>用户帮助</h3>
|
||||
<p>共 {{ total }} 条记录,支持按分类和状态筛选。</p>
|
||||
<h3>帮助文章列表</h3>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<!-- 帮助模块的接口与菜单尚未建立,权限标识待后端约定后再补 v-hasPermi -->
|
||||
<el-button type="primary" plain icon="Plus" @click="notImplemented">新增</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="notImplemented">修改</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="notImplemented">删除</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['helpManage:helpArticle:add']">新增</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['helpManage:helpArticle:edit']">修改</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['helpManage:helpArticle:remove']">删除</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['helpManage:helpArticle:export']">导出</el-button>
|
||||
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="getList"></right-toolbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="helpList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="帮助标题" prop="title" align="center" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column label="分类" prop="category" align="center" width="120">
|
||||
<el-table v-loading="loading" border class="data-table" :data="helpArticleList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="文章标题" align="center" prop="title" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="categoryOptions" :value="scope.row.category" />
|
||||
<span>{{ parseTime(scope.row.updateTime) || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="sortNo" align="center" width="90" />
|
||||
<el-table-column label="状态" prop="status" align="center" width="100">
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="statusOptions" :value="scope.row.status" />
|
||||
<dict-tag :options="ur_help_article_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime" align="center" width="170" />
|
||||
<el-table-column label="备注" prop="remark" align="center" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" width="150" fixed="right">
|
||||
<template #default>
|
||||
<el-tooltip content="详情" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="notImplemented"></el-button>
|
||||
</el-tooltip>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="notImplemented"></el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['helpManage:helpArticle:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="notImplemented"></el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['helpManage:helpArticle:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改帮助文章对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
|
||||
<el-form ref="helpArticleFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="文章标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入文章标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文章内容" prop="content">
|
||||
<editor v-model="form.content" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="立即上架">
|
||||
<el-switch v-model="publishNow" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="HelpUser" lang="ts">
|
||||
<script setup name="HelpArticle" lang="ts">
|
||||
import {
|
||||
addHelpArticle,
|
||||
delHelpArticle,
|
||||
getHelpArticle,
|
||||
listHelpArticle,
|
||||
updateHelpArticle
|
||||
} from '@/api/helpArticle/index';
|
||||
import { HelpArticleForm, HelpArticleQuery, HelpArticleVO } from '@/api/helpArticle/types';
|
||||
import { useLoading } from '@/hooks/async/useLoading';
|
||||
import { useFormDialog } from '@/hooks/dialog/useFormDialog';
|
||||
import { useSearchReset } from '@/hooks/form/useSearchReset';
|
||||
import { useSearchToggle } from '@/hooks/form/useSearchToggle';
|
||||
import { useTableSelection } from '@/hooks/table/useTableSelection';
|
||||
import { parseTime } from '@/utils/ruoyi';
|
||||
import { useDict } from '@/utils/dict';
|
||||
import modal from '@/plugins/modal';
|
||||
import { download as requestDownload } from '@/utils/request';
|
||||
|
||||
/** 用户帮助(面向住户端的说明文档) */
|
||||
interface HelpVO {
|
||||
/** 帮助ID */
|
||||
helpId?: string;
|
||||
/** 帮助标题 */
|
||||
title?: string;
|
||||
/** 分类(1充值说明 2故障报修 3水费电价 4其他) */
|
||||
category?: string;
|
||||
/** 排序 */
|
||||
sortNo?: number;
|
||||
/** 状态(0发布 1停用) */
|
||||
status?: string;
|
||||
/** 更新时间 */
|
||||
updateTime?: string;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
interface HelpQuery extends PageQuery {
|
||||
title?: string;
|
||||
category?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
// 帮助字典后端尚未建立,先用本地兜底选项
|
||||
const categoryOptions: DictDataOption[] = [
|
||||
{ label: '充值说明', value: '1', elTagType: 'primary' },
|
||||
{ label: '故障报修', value: '2', elTagType: 'warning' },
|
||||
{ label: '水费电价', value: '3', elTagType: 'success' },
|
||||
{ label: '其他', value: '4', elTagType: 'info' }
|
||||
/** 状态字典 */
|
||||
const { ur_help_article_status } = toRefs<any>(useDict('ur_help_article_status'));
|
||||
|
||||
/** 适用端:0 租客(用户帮助) 1 房东(房东帮助) */
|
||||
const helpTabs = [
|
||||
{ label: '用户帮助', value: '0' },
|
||||
{ label: '房东帮助', value: '1' }
|
||||
];
|
||||
const statusOptions: DictDataOption[] = [
|
||||
{ label: '发布', value: '0', elTagType: 'success' },
|
||||
{ label: '停用', value: '1', elTagType: 'danger' }
|
||||
];
|
||||
|
||||
const helpList = ref<HelpVO[]>([]);
|
||||
const total = ref(0);
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const { showSearch } = useSearchToggle();
|
||||
const activeTab = ref('0');
|
||||
const helpArticleList = ref<HelpArticleVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const { loading, withLoading } = useLoading(true);
|
||||
const { single, multiple, handleSelectionChange } = useTableSelection<HelpVO>(item => item.helpId);
|
||||
const { showSearch } = useSearchToggle();
|
||||
const total = ref(0);
|
||||
|
||||
const queryParams = ref<HelpQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: '',
|
||||
category: '',
|
||||
status: ''
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const helpArticleFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: HelpArticleForm = {
|
||||
articleId: undefined,
|
||||
categoryId: undefined,
|
||||
audience: undefined,
|
||||
title: undefined,
|
||||
content: undefined,
|
||||
status: undefined,
|
||||
publishedAt: undefined,
|
||||
createDept: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
}
|
||||
const data = reactive<PageData<HelpArticleForm, HelpArticleQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// 适用端必传:0 租客 / 1 房东,与页签保持一致
|
||||
audience: '0',
|
||||
title: undefined,
|
||||
status: undefined
|
||||
},
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true, message: "文章标题不能为空", trigger: "blur" }
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: "文章内容不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
/** 查询用户帮助列表 */
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 弹窗「立即上架」开关:开 → 状态置为已上架并记录上架时间;关 → 草稿(已下架保持原状态) */
|
||||
const publishNow = ref(false);
|
||||
const applyPublishState = () => {
|
||||
if (publishNow.value) {
|
||||
// 从未上架转为上架时,记录本次上架时间
|
||||
if (form.value.status !== '1') {
|
||||
form.value.publishedAt = parseTime(new Date()) ?? undefined;
|
||||
}
|
||||
form.value.status = '1';
|
||||
} else if (form.value.status !== '2') {
|
||||
form.value.status = '0';
|
||||
}
|
||||
};
|
||||
const { ids, single, multiple, handleSelectionChange } = useTableSelection<HelpArticleVO>(item => item.articleId);
|
||||
const { dialog, resetForm: reset, openDialog, showDialog, closeDialog } = useFormDialog({
|
||||
form,
|
||||
formRef: helpArticleFormRef,
|
||||
initialFormData: initFormData
|
||||
});
|
||||
|
||||
/** 查询帮助文章列表 */
|
||||
const getList = async () => {
|
||||
// TODO: 帮助接口就绪后替换为真实请求,例如 listHelp(queryParams.value) 取 res.data.rows / res.data.total
|
||||
await withLoading(async () => {
|
||||
helpList.value = [];
|
||||
total.value = 0;
|
||||
const res = await listHelpArticle(queryParams.value);
|
||||
helpArticleList.value = res.data?.rows;
|
||||
total.value = res.data?.total;
|
||||
});
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
closeDialog();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 用户帮助 / 房东帮助切换 */
|
||||
const handleTabChange = (audience: string) => {
|
||||
if (activeTab.value === audience) return;
|
||||
activeTab.value = audience;
|
||||
queryParams.value.audience = audience;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
const { resetQuery } = useSearchReset({
|
||||
queryFormRef,
|
||||
queryParams,
|
||||
pageNumKey: 'pageNum',
|
||||
pageSizeKey: 'pageSize',
|
||||
initialPageSize: 10,
|
||||
afterReset: () => {
|
||||
handleQuery();
|
||||
}
|
||||
});
|
||||
|
||||
/** 尚未接入的写操作统一提示,避免静默失败 */
|
||||
const notImplemented = () => modal.msgWarning('帮助接口待接入,暂不支持该操作');
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
publishNow.value = false;
|
||||
openDialog('添加帮助文章');
|
||||
// 适用端不在弹窗里编辑,默认归属当前页签
|
||||
form.value.audience = activeTab.value;
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: Partial<HelpArticleVO>) => {
|
||||
reset();
|
||||
const _articleId = row?.articleId || ids.value[0];
|
||||
const res = await getHelpArticle(_articleId);
|
||||
Object.assign(form.value, res.data);
|
||||
publishNow.value = form.value.status === '1';
|
||||
showDialog('修改帮助文章');
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
helpArticleFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
applyPublishState();
|
||||
buttonLoading.value = true;
|
||||
if (form.value.articleId) {
|
||||
await updateHelpArticle(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addHelpArticle(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
modal.msgSuccess('操作成功');
|
||||
closeDialog();
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: Partial<HelpArticleVO>) => {
|
||||
const _articleIds = row?.articleId || ids.value;
|
||||
await modal.confirm('是否确认删除帮助文章编号为"' + _articleIds + '"的数据项?');
|
||||
await delHelpArticle(_articleIds);
|
||||
modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
requestDownload(
|
||||
'helpManage/helpArticle/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`helpArticle_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '@/assets/styles/components/page-shell' as pageShell;
|
||||
<style scoped lang="scss">
|
||||
.tabs-panel {
|
||||
:deep(.el-card__body) {
|
||||
padding: 10px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@include pageShell.table-crud-page;
|
||||
/* 分段式切换:整条灰底,选中项为白色圆角浮起 */
|
||||
.segmented {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
border-radius: 10px;
|
||||
background: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
.segmented-item {
|
||||
flex: 1;
|
||||
padding: 8px 0;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
color 0.2s;
|
||||
|
||||
&:hover {
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: var(--el-color-primary);
|
||||
color: #fff;
|
||||
// background: var(--app-surface-bg);
|
||||
// color: var(--el-text-color-primary);
|
||||
|
||||
font-weight: 600;
|
||||
box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user