feat(house): 添加房源类型筛选功能

- 在 houseInfo 组件中新增 type 参数用于筛选房源类型
- 更新 houseInfoEdit 组件以支持传递和显示房源类型
- 修改接口模型增加 type 字段定义
- 调整页面布局及样式以适应新字段展示需求
- 配置开发环境 API 地址并更新相关组件请求路径
- 引入路由监听实现动态类型查询
- 优化表格行键值确保唯一性
- 更新系统设置中微信相关的域名配置为本地地址
- 修改文件上传接口地址为本地服务
- 调整项目库组件中的 ID 键名以匹配后端返回结构
- 移除冗余的表单字段声明提升代码整洁度
- 更新
This commit is contained in:
2025-12-10 16:40:59 +08:00
parent 8c711e066b
commit a540b1fcb0
18 changed files with 377 additions and 322 deletions

View File

@@ -1,5 +1,5 @@
VITE_APP_NAME=后台管理(开发环境)
VITE_API_URL=http://127.0.0.1:9200/api
#VITE_API_URL=http://127.0.0.1:9200/api
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api

BIN
dist.zip

Binary file not shown.

View File

@@ -64,5 +64,10 @@
</div>
</div>
<script type="module" src="/src/main.ts"></script>
<script
async
defer
id="sqlbot-assistant-float-script-7400549959767953408"
src="https://sql-bot.websoft.top/assistant.js?id=7400549959767953408"></script>
</body>
</html>

View File

@@ -8,6 +8,8 @@ export interface HouseInfo {
houseId?: number;
// 房源标题
houseTitle?: string;
// 房源类型
type?: number;
// 房产所在的城市
cityByHouse?: string;
// 户型

View File

@@ -310,6 +310,12 @@
}
}
// 顶栏菜单标题中样式调整
.ele-admin-header-nav{
display: flex;
justify-content: center;
}
// 顶栏菜单标题中样式调整
.ele-admin-header-nav > .ant-menu {
& > .ant-menu-item,

View File

@@ -49,7 +49,7 @@ const DEFAULT_STATE: ThemeState = Object.freeze({
// 侧栏风格: light(亮色), dark(暗色)
sideStyle: 'light',
// 布局风格: side(默认), top(顶栏导航), mix(混合导航)
layoutStyle: 'side',
layoutStyle: 'mix',
// 侧栏菜单风格: default(默认), mix(双排侧栏)
sideMenuStyle: 'default',
// 页签风格: default(默认), dot(圆点), card(卡片)

View File

@@ -322,6 +322,8 @@
visible: boolean;
// 修改回显的数据
data?: HouseInfo | null;
// 类型
type?: null;
}>();
const emit = defineEmits<{

View File

@@ -4,7 +4,7 @@
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="houseInfoId"
row-key="houseId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
@@ -51,7 +51,8 @@
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { createVNode, ref,unref, watch } from 'vue';
import {useRouter} from 'vue-router';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
@@ -65,6 +66,7 @@
import { pageHouseInfo, removeHouseInfo, removeBatchHouseInfo } from '@/api/house/houseInfo';
import type { HouseInfo, HouseInfoParam } from '@/api/house/houseInfo/model';
const {currentRoute} = useRouter();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -78,6 +80,8 @@
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 房产类型
const type = ref(0);
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -380,7 +384,7 @@
/* 删除单个 */
const remove = (row: HouseInfo) => {
const hide = message.loading('请求中..', 0);
removeHouseInfo(row.houseInfoId)
removeHouseInfo(row.houseId)
.then((msg) => {
hide();
message.success(msg);
@@ -405,7 +409,7 @@
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchHouseInfo(selection.value.map((d) => d.houseInfoId))
removeBatchHouseInfo(selection.value.map((d) => d.houseId))
.then((msg) => {
hide();
message.success(msg);
@@ -438,6 +442,22 @@
};
};
query();
watch(
currentRoute,
(route) => {
console.log(route,'12312312route')
const {params} = unref(route);
console.log(params,'ppp')
const {id} = params;
if (id) {
type.value = Number(id);
console.log(type.value,'.......TYPE');
}
reload();
},
{immediate: true}
);
</script>
<script lang="ts">

View File

@@ -376,6 +376,8 @@ import {ref, reactive, watch, computed} from 'vue';
visible: boolean;
// 修改回显的数据
data?: HouseInfo | null;
// 类型
type?: number;
}>();
const emit = defineEmits<{
@@ -691,7 +693,8 @@ import {ref, reactive, watch, computed} from 'vue';
content: content.value,
files: JSON.stringify(files.value),
houseLabel: JSON.stringify(houseLabelData.value),
monthlyRent: monthlyRent.value
monthlyRent: monthlyRent.value,
type: props.type
};
const saveOrUpdate = isUpdate.value ? updateHouseInfo : addHouseInfo;
saveOrUpdate(formData)

View File

@@ -1,5 +1,5 @@
<template>
<div class="ele-body">
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
@@ -30,7 +30,7 @@
style="margin-right: 4px"
>
<template #icon>
<UserOutlined />
<UserOutlined/>
</template>
</a-avatar>
<div class="user-info">
@@ -103,48 +103,56 @@
v-model:visible="showEdit"
:data="current"
:organization-list="data"
:type="type"
@done="reload"
/>
</div>
</a-page-header>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue/es';
import {
import {createVNode, watch, unref, ref} from 'vue';
import {message, Modal} from 'ant-design-vue/es';
import {useRouter} from 'vue-router';
import {
ExclamationCircleOutlined,
UserOutlined
} from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro/es';
import { formatNumber, messageLoading, toDateString } from 'ele-admin-pro/es';
import type {
} from '@ant-design/icons-vue';
import type {EleProTable} from 'ele-admin-pro/es';
import {formatNumber, messageLoading, toDateString} from 'ele-admin-pro/es';
import type {
ColumnItem,
DatasourceFunction
} from 'ele-admin-pro/es/ele-pro-table/types';
import InfoEdit from './components/info-edit.vue';
import {
} from 'ele-admin-pro/es/ele-pro-table/types';
import InfoEdit from './components/info-edit.vue';
import {
pageHouseInfo,
removeBatchHouseInfo,
updateHouseInfo,
updateBatchHouseInfo
} from '@/api/house/houseInfo';
import type { HouseInfo, HouseInfoParam } from '@/api/house/houseInfo/model';
import { Organization } from '@/api/system/organization/model';
import Search from './components/search.vue';
} from '@/api/house/houseInfo';
import type {HouseInfo, HouseInfoParam} from '@/api/house/houseInfo/model';
import {Organization} from '@/api/system/organization/model';
import Search from './components/search.vue';
import {getPageTitle} from "@/utils/common";
// 树形数据
const data = ref<Organization[]>([]);
// 表格选中数据
const selection = ref<HouseInfo[]>([]);
// 当前编辑数据
const current = ref<HouseInfo | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
const {currentRoute} = useRouter();
// 树形数据
const data = ref<Organization[]>([]);
// 表格选中数据
const selection = ref<HouseInfo[]>([]);
// 当前编辑数据
const current = ref<HouseInfo | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 房产类型
const type = ref(0);
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格列配置
const columns = ref<ColumnItem[]>([
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格列配置
const columns = ref<ColumnItem[]>([
// {
// key: 'index',
// width: 48,
@@ -256,12 +264,12 @@
width: 170,
showSorterTooltip: false,
ellipsis: true,
customRender: ({ text }) => toDateString(text)
customRender: ({text}) => toDateString(text)
}
]);
]);
// 表格数据源
const datasource: DatasourceFunction = ({
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
@@ -270,22 +278,23 @@
}) => {
where.showProfile = true;
where.roleId = filters.roles;
return pageHouseInfo({ page, limit, ...where, ...orders });
};
/* 搜索 */
const reload = (where?: HouseInfoParam) => {
where.type = type.value;
return pageHouseInfo({page, limit, ...where, ...orders});
};
/* 搜索 */
const reload = (where?: HouseInfoParam) => {
selection.value = [];
tableRef?.value?.reload({ where });
};
tableRef?.value?.reload({where});
};
/* 打开编辑弹窗 */
const openEdit = (row?: HouseInfo) => {
/* 打开编辑弹窗 */
const openEdit = (row?: HouseInfo) => {
current.value = row ?? null;
showEdit.value = true;
};
};
/* 修改推荐状态 */
const editRecommend = (checked: boolean, row: HouseInfo) => {
/* 修改推荐状态 */
const editRecommend = (checked: boolean, row: HouseInfo) => {
const recommend = checked ? 1 : 0;
updateHouseInfo({
houseId: row.houseId,
@@ -299,10 +308,10 @@
.catch((e) => {
message.error(e.message);
});
};
};
/* 修改上架状态 */
const editStatus = (checked: boolean, row: HouseInfo) => {
/* 修改上架状态 */
const editStatus = (checked: boolean, row: HouseInfo) => {
const status = checked ? 0 : 10;
updateHouseInfo({
houseId: row.houseId,
@@ -316,9 +325,9 @@
.catch((e) => {
message.error(e.message);
});
};
};
const editMustSee = (checked: boolean, row: HouseInfo) => {
const editMustSee = (checked: boolean, row: HouseInfo) => {
const mustSee = checked ? 1 : 0;
updateHouseInfo({
houseId: row.houseId,
@@ -332,9 +341,9 @@
.catch((e) => {
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
@@ -358,10 +367,10 @@
});
}
});
};
};
/* 批量下架 */
const banBatch = () => {
/* 批量下架 */
const banBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
@@ -374,7 +383,7 @@
onOk: () => {
const hide = messageLoading('请求中..', 0);
updateBatchHouseInfo({
ids:selection.value.map((d) => d.houseId),
ids: selection.value.map((d) => d.houseId),
data: {
status: 10
}
@@ -390,10 +399,10 @@
});
}
});
};
};
/* 自定义行属性 */
const customRow = (record: HouseInfo) => {
/* 自定义行属性 */
const customRow = (record: HouseInfo) => {
return {
// 行点击事件
onClick: () => {
@@ -404,23 +413,36 @@
openEdit(record);
}
};
};
};
watch(
currentRoute,
(route) => {
const {query} = unref(route);
if (query.type) {
type.value = Number(query.type);
}
reload();
},
{immediate: true}
);
</script>
<script lang="ts">
export default {
export default {
name: 'HouseInfo'
};
};
</script>
<style lang="less" scoped>
.user-box {
.user-box {
display: flex;
align-items: center;
.user-info {
display: flex;
flex-direction: column;
align-items: start;
}
}
}
</style>

View File

@@ -30,7 +30,7 @@
<a-upload
v-model:file-list="fileList"
name="file"
action="https://server.websoft.top/api/oss/upload"
action="http://192.168.222.129:8000/api/oss/upload"
:headers="headers"
@change="onUpload"
>

View File

@@ -167,7 +167,6 @@
image: undefined,
content: undefined,
files: undefined,
comments: undefined,
recommend: undefined,
status: undefined,
deleted: undefined,
@@ -175,11 +174,7 @@
tenantId: undefined,
createTime: undefined,
updateTime: undefined,
pwlProjectLibraryId: undefined,
pwlProjectLibraryName: '',
status: 0,
comments: '',
sortNumber: 100
comments: ''
});
/* 更新visible */

View File

@@ -4,7 +4,7 @@
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="pwlProjectLibraryId"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
@@ -224,7 +224,7 @@
/* 删除单个 */
const remove = (row: PwlProjectLibrary) => {
const hide = message.loading('请求中..', 0);
removePwlProjectLibrary(row.pwlProjectLibraryId)
removePwlProjectLibrary(row.id)
.then((msg) => {
hide();
message.success(msg);
@@ -249,7 +249,7 @@
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchPwlProjectLibrary(selection.value.map((d) => d.pwlProjectLibraryId))
removeBatchPwlProjectLibrary(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);

View File

@@ -23,7 +23,7 @@
<div class="ele-text-center">
<span>只能上传xlsxlsx文件</span>
<a
href="https://server.websoft.top/api/system/user/import/template"
href="http://192.168.222.129:8000/api/system/user/import/template"
download="用户导入模板.xlsx"
>
下载导入模板

View File

@@ -23,7 +23,7 @@
<div class="ele-text-center">
<span>只能上传xlsxlsx文件</span>
<a
href="https://server.websoft.top/api/system/user/import/template"
href="http://192.168.222.129:8000/api/system/user/import/template"
download="用户导入模板.xlsx"
>
下载导入模板

View File

@@ -27,9 +27,9 @@
</div>
<a-form-item label="request合法域名" name="request">
<a-input-group compact>
<a-input :value="`https://server.websoft.top;https://cms-api.websoft.top;`" placeholder="请输入小程序AppSecret" style="width: calc(100% - 50px)" />
<a-input :value="`http://192.168.222.129:8000;https://cms-api.websoft.top;`" placeholder="请输入小程序AppSecret" style="width: calc(100% - 50px)" />
<a-tooltip title="复制">
<a-button @click="onCopyText(`https://server.websoft.top;https://cms-api.websoft.top;`)">
<a-button @click="onCopyText(`http://192.168.222.129:8000;https://cms-api.websoft.top;`)">
<template #icon><CopyOutlined /></template>
</a-button>
</a-tooltip>

View File

@@ -44,12 +44,12 @@
<a-form-item label="网页授权域名" name="authorize">
<a-input-group compact>
<a-input
:value="`https://server.websoft.top`"
:value="`http://192.168.222.129:8000`"
placeholder="请输入网页授权域名"
style="width: calc(100% - 50px)"
/>
<a-tooltip title="复制">
<a-button @click="onCopyText(`https://server.websoft.top`)">
<a-button @click="onCopyText(`http://192.168.222.129:8000`)">
<template #icon><CopyOutlined /></template>
</a-button>
</a-tooltip>

View File

@@ -68,7 +68,7 @@ export default defineConfig(({ command }) => {
// 代理配置
proxy: {
'/api': {
target: process.env.VITE_API_URL || 'https://server.websoft.top',
target: process.env.VITE_API_URL || 'http://192.168.222.129:8000',
changeOrigin: true,
secure: false,
configure: (proxy, _options) => {