diff --git a/.env.development b/.env.development index 051bbe9..bfebc85 100644 --- a/.env.development +++ b/.env.development @@ -13,10 +13,10 @@ VITE_APP_BASE_API = '/dev-api' VITE_APP_CONTEXT_PATH = '/' # 监控地址 -VITE_APP_MONITOR_ADMIN = 'http://192.168.0.222/admin/applications' +VITE_APP_MONITOR_ADMIN = 'http://192.168.1.222/admin/applications' # SnailJob 控制台地址 -VITE_APP_SNAILJOB_ADMIN = 'http://192.168.0.222/snail-job' +VITE_APP_SNAILJOB_ADMIN = 'http://192.168.1.222/snail-job' VITE_APP_PORT = 5173 diff --git a/src/api/login.ts b/src/api/login.ts index 47f5b99..35e6a4e 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -16,7 +16,6 @@ export function login(data: LoginData): AxiosPromise { clientId: data.clientId || clientId, grantType: data.grantType || 'password' }; - console.log(params); return request({ url: '/auth/login', headers: { diff --git a/src/api/system/Decoration/type.ts b/src/api/system/Decoration/type.ts index 82f2a48..68c4d85 100644 --- a/src/api/system/Decoration/type.ts +++ b/src/api/system/Decoration/type.ts @@ -7,7 +7,7 @@ export interface DecorationVO { /** * 所属小区id */ - villageId: string | number; + villageId: number; /** * 所属房屋id @@ -59,7 +59,7 @@ export interface DecorationForm extends BaseEntity { /** * 所属小区id */ - villageId?: string | number; + villageId?: number; /** * 所属房屋id @@ -106,7 +106,7 @@ export interface DecorationQuery extends PageQuery { /** * 所属小区id */ - villageId?: string | number; + villageId?: number; /** * 所属房屋id diff --git a/src/api/system/HouseFacilities/index.ts b/src/api/system/HouseFacilities/index.ts new file mode 100644 index 0000000..6ef149a --- /dev/null +++ b/src/api/system/HouseFacilities/index.ts @@ -0,0 +1,63 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { HouseFacilitiesVO, HouseFacilitiesForm, HouseFacilitiesQuery } from '@/api/system/HouseFacilities/type'; + +/** + * 查询房屋设施管理列表 + * @param query + * @returns {*} + */ + +export const listHouseFacilities = (query?: HouseFacilitiesQuery): AxiosPromise => { + return request({ + url: '/houseFacilities/list', + method: 'get', + params: query + }); +}; + +/** + * 查询房屋设施管理详细 + * @param id + */ +export const getHouseFacilities = (id: string | number): AxiosPromise => { + return request({ + url: '/houseFacilities/' + id, + method: 'get' + }); +}; + +/** + * 新增房屋设施管理 + * @param data + */ +export const addHouseFacilities = (data: HouseFacilitiesForm) => { + return request({ + url: '/houseFacilities', + method: 'post', + data: data + }); +}; + +/** + * 修改房屋设施管理 + * @param data + */ +export const updateHouseFacilities = (data: HouseFacilitiesForm) => { + return request({ + url: '/houseFacilities', + method: 'put', + data: data + }); +}; + +/** + * 删除房屋设施管理 + * @param id + */ +export const delHouseFacilities = (id: string | number | Array) => { + return request({ + url: '/houseFacilities/' + id, + method: 'delete' + }); +}; diff --git a/src/api/system/HouseFacilities/type.ts b/src/api/system/HouseFacilities/type.ts new file mode 100644 index 0000000..a033fb3 --- /dev/null +++ b/src/api/system/HouseFacilities/type.ts @@ -0,0 +1,65 @@ +export interface HouseFacilitiesVO { + /** + * 房屋设施管理表id + */ + id: string | number; + + /** + * 设施名称 + */ + name: string; + + /** + * 状态 0启用 1停用 + */ + status: string; + + /** + * 创建者姓名 + */ + createName: string; +} + +export interface HouseFacilitiesForm extends BaseEntity { + /** + * 房屋设施管理表id + */ + id?: string | number; + + /** + * 设施名称 + */ + name?: string; + + /** + * 状态 0启用 1停用 + */ + status?: string; + + /** + * 创建者姓名 + */ + createName?: string; +} + +export interface HouseFacilitiesQuery extends PageQuery { + /** + * 设施名称 + */ + name?: string; + + /** + * 状态 0启用 1停用 + */ + status?: string; + + /** + * 创建者姓名 + */ + createName?: string; + + /** + * 日期范围参数 + */ + params?: any; +} diff --git a/src/api/system/community/index.ts b/src/api/system/community/index.ts index 0950a35..fc80f78 100644 --- a/src/api/system/community/index.ts +++ b/src/api/system/community/index.ts @@ -10,7 +10,7 @@ export function getCommunitylistAPI(): AxiosPromise { }); } /** 通过小区id获取小区信息 */ -export function getVillageByIdAPI(id: string): AxiosPromise { +export function getVillageByIdAPI(id: number): AxiosPromise { return request({ url: `/village/${id}`, method: 'get' diff --git a/src/api/system/community/type.ts b/src/api/system/community/type.ts index 4dd09fe..212c583 100644 --- a/src/api/system/community/type.ts +++ b/src/api/system/community/type.ts @@ -1,5 +1,5 @@ export interface communitylist_rows_type { - villageId?: number; + villageId: number; villageName: string; villageCode: string; address: string; diff --git a/src/assets/icons/svg/banshiguanli.svg b/src/assets/icons/svg/banshiguanli.svg new file mode 100644 index 0000000..5d0208a --- /dev/null +++ b/src/assets/icons/svg/banshiguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/baoxiuguanli.svg b/src/assets/icons/svg/baoxiuguanli.svg new file mode 100644 index 0000000..022f3bc --- /dev/null +++ b/src/assets/icons/svg/baoxiuguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/cangkuxinxi.svg b/src/assets/icons/svg/cangkuxinxi.svg new file mode 100644 index 0000000..ed43013 --- /dev/null +++ b/src/assets/icons/svg/cangkuxinxi.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/chehangguanli.svg b/src/assets/icons/svg/chehangguanli.svg new file mode 100644 index 0000000..fa9b5b1 --- /dev/null +++ b/src/assets/icons/svg/chehangguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/cheliangguanli.svg b/src/assets/icons/svg/cheliangguanli.svg new file mode 100644 index 0000000..f82641c --- /dev/null +++ b/src/assets/icons/svg/cheliangguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/cheweiguanli.svg b/src/assets/icons/svg/cheweiguanli.svg new file mode 100644 index 0000000..22680b4 --- /dev/null +++ b/src/assets/icons/svg/cheweiguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fangkeguanli.svg b/src/assets/icons/svg/fangkeguanli.svg new file mode 100644 index 0000000..fc24908 --- /dev/null +++ b/src/assets/icons/svg/fangkeguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fangwuguanli.svg b/src/assets/icons/svg/fangwuguanli.svg new file mode 100644 index 0000000..2049daa --- /dev/null +++ b/src/assets/icons/svg/fangwuguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/gonggaoguanli.svg b/src/assets/icons/svg/gonggaoguanli.svg new file mode 100644 index 0000000..b8fd6af --- /dev/null +++ b/src/assets/icons/svg/gonggaoguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/huodongguanli.svg b/src/assets/icons/svg/huodongguanli.svg new file mode 100644 index 0000000..caaa7ea --- /dev/null +++ b/src/assets/icons/svg/huodongguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/pay.svg b/src/assets/icons/svg/pay.svg new file mode 100644 index 0000000..8932295 --- /dev/null +++ b/src/assets/icons/svg/pay.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/peizhitubiaosvg-.svg b/src/assets/icons/svg/peizhitubiaosvg-.svg new file mode 100644 index 0000000..8e7bbef --- /dev/null +++ b/src/assets/icons/svg/peizhitubiaosvg-.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/quyuguanli.svg b/src/assets/icons/svg/quyuguanli.svg new file mode 100644 index 0000000..8ce2eee --- /dev/null +++ b/src/assets/icons/svg/quyuguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tousuguanli.svg b/src/assets/icons/svg/tousuguanli.svg new file mode 100644 index 0000000..3a10672 --- /dev/null +++ b/src/assets/icons/svg/tousuguanli.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/wenjuantiaocha.svg b/src/assets/icons/svg/wenjuantiaocha.svg new file mode 100644 index 0000000..251507d --- /dev/null +++ b/src/assets/icons/svg/wenjuantiaocha.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/zhuangxiu.svg b/src/assets/icons/svg/zhuangxiu.svg new file mode 100644 index 0000000..20fe029 --- /dev/null +++ b/src/assets/icons/svg/zhuangxiu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/index/summer.png b/src/assets/images/index/summer.png new file mode 100644 index 0000000..57fdb59 Binary files /dev/null and b/src/assets/images/index/summer.png differ diff --git a/src/assets/styles/element-ui.scss b/src/assets/styles/element-ui.scss index e70e8ed..836a830 100644 --- a/src/assets/styles/element-ui.scss +++ b/src/assets/styles/element-ui.scss @@ -195,8 +195,6 @@ // Buttons .el-button { - width: 80px; - height: 35px; border-radius: var(--app-radius-md); transition: transform 0.15s ease, diff --git a/src/components/Holder/index.vue b/src/components/Holder/index.vue index 9f568f8..692d5cf 100644 --- a/src/components/Holder/index.vue +++ b/src/components/Holder/index.vue @@ -106,7 +106,7 @@ const props = defineProps<{ // ✅ 手动设置默认值(替代 withDefaults) const isMultiple = computed(() => props.isMultiple ?? false); -const returnvalue = computed(() => props.returnvalue ?? 'userId'); // 👈 默认 userId +const returnvalue = computed(() => props.returnvalue ?? 'id'); // 👈 默认 userId const { userid } = toRefs(props); @@ -267,6 +267,7 @@ function confirm() { // ✅ 返回整个对象 emit('change', multipleSelection.value[0]); } else { + console.log(multipleSelection.value[0], returnvalue.value); // 返回指定字段 emit('change', multipleSelection.value[0][returnvalue.value as keyof tableType]); } diff --git a/src/components/Holder/repairUser.vue b/src/components/Holder/repairUser.vue index d20f321..8d63900 100644 --- a/src/components/Holder/repairUser.vue +++ b/src/components/Holder/repairUser.vue @@ -120,7 +120,6 @@ const handleRowClick = (row: tableType) => { // 统一回显 userid 选中(安全版) const handleUserSelection = () => { if (!userid.value || !tableData.value.length) return; - console.log('user', userid, tableData.value); const target = tableData.value.find((item) => item.userId == userid.value); if (target) { diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index b17ffdd..b4a71c2 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -145,9 +145,12 @@ watch( height: 50px; overflow: hidden; position: relative; - background: #1a75ff; + // background: #1a75ff; + background: #dfedff; + // border-bottom: 1px solid #1a75ff; + border-bottom: 1px solid #dfedff; + color: #fff; - border-bottom: 1px solid #1a75ff; box-shadow: none; display: flex; align-items: center; diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 8c9ab8b..50692ef 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -71,7 +71,9 @@ const getLogoTextColor = computed(() => { position: relative; height: 50px; line-height: 50px; - background-color: #1a75ff; + // background-color: #1a75ff; + background: #dfedff; + text-align: center; overflow: hidden; box-shadow: none; @@ -91,8 +93,7 @@ const getLogoTextColor = computed(() => { & .sidebar-title { display: inline-block; margin: 0; - // color: v-bind(getLogoTextColor); - color: white; + font-weight: 600; line-height: 50px; font-size: 14px; @@ -103,6 +104,11 @@ const getLogoTextColor = computed(() => { Helvetica, sans-serif; vertical-align: middle; + + // color: v-bind(getLogoTextColor); + // color: white; + color: #000000; + font-size: 16px; } } diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index db8fb86..5b5f314 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -50,6 +50,7 @@ const activeMenu = computed(() => { } return path; }); -const bgColor = computed(() => (sideTheme.value === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground)); +const bgColor = '#eaf2ff'; +// const bgColor = computed(() => (sideTheme.value === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground)); const textColor = computed(() => (sideTheme.value === 'theme-dark' ? variables.menuColor : variables.menuLightColor)); diff --git a/src/permission.ts b/src/permission.ts index 88291e2..7b52211 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -31,8 +31,7 @@ router.beforeEach(async (to, from, next) => { if (useUserStore().roles.length === 0) { isRelogin.show = true; // 判断当前用户是否已拉取完user_info信息 - const [data, err] = await tos(useUserStore().getInfo()); - console.log(data); + const [err, res] = await tos(useUserStore().getInfo()); if (err) { await useUserStore().logout(); ElMessage.error(err); @@ -46,8 +45,13 @@ router.beforeEach(async (to, from, next) => { router.addRoute(route); // 动态添加可访问路由表 } }); - // @ts-expect-error hack方法 确保addRoutes已完成 - next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成 + if (res.user.userId === 1 && from.path === '/login') { + // 管理员 → 强制跳转到社区列表 + next('/community/communitylist'); + } else { + // 普通用户 → 正常跳转目标页 + next(to.fullPath); + } } } else { next(); @@ -59,8 +63,7 @@ router.beforeEach(async (to, from, next) => { // 在免登录白名单,直接进入 next(); } else { - const redirect = encodeURIComponent(to.fullPath || '/'); - next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页 + next(`/login`); // 否则全部重定向到登录页 NProgress.done(); } } diff --git a/src/router/index.ts b/src/router/index.ts index 5da7919..0f20a81 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -93,9 +93,9 @@ export const constantRoutes: RouteRecordRaw[] = [ children: [ { path: '/index', - component: () => import('@/views/workbench/index.vue'), + component: () => import('@/views/workbench/index2.vue'), name: 'Index', - meta: { title: '首页', icon: 'dashboard', affix: true } + meta: { title: '工作台', icon: 'dashboard', affix: true } } ] }, diff --git a/src/store/modules/house.ts b/src/store/modules/house.ts index 8bec6dd..772feb8 100644 --- a/src/store/modules/house.ts +++ b/src/store/modules/house.ts @@ -1,4 +1,4 @@ -import { getCommunitylistAPI } from '@/api/system/community'; +import { getCommunitylistAPI, getVillageByIdAPI } from '@/api/system/community'; import { communitylist_rows_type } from '@/api/system/community/type'; import { deleteHouseApi, getBuildinglistAPI, getHouselistAPI, getVillageTree } from '@/api/system/house'; import type { addBuildingType, BuildingUnit, BuildingVo } from '@/api/system/house/type'; @@ -51,38 +51,55 @@ export const useHouseStore = defineStore( // 当前楼栋 所有楼层数据 const currentFloorInfoList = computed(() => { - return (Array.from(floorslist.value) as string[]).sort(sortNumberStr); + return [...floorslist.value].sort(sortNumberStr); }); // 楼层列表 set const floorslist = ref>(new Set()); + // + // 查找当前小区 + const getviliageinfo = async (id) => { + const res = await getVillageByIdAPI(id); + currentVilageInfo.value = res.data; + }; + + // 更新小区信息 + const updateVilageinfo = (data) => { + currentVilageInfo.value = data; + }; + // 初始化 - const initHouse = async (buildingtype: number) => { - // 查找当前小区 - const res = await getCommunitylistAPI(); - const currentVilage = res.rows.find((item) => item.choiceStatus === 0); - currentVilageInfo.value = currentVilage; + const initHouse = async (currentbuildingtype: number) => { + currentBuildingInfoList.value = []; // 获取当前小区 所有楼栋信息 - const res2 = await getBuildinglistAPI(currentVilage.villageId, buildingtype); + const res2 = await getBuildinglistAPI(currentVilageInfo.value.villageId, currentbuildingtype); currentBuildingInfoList.value = res2.data; + // 获取当前小区 第一个楼栋信息 - if (currentBuildingInfo.value.id === null) { + // ! 不同住宅类型 + if ((currentBuildingInfo.value && currentBuildingInfo.value.id === null) || buildingtype.value !== currentbuildingtype) { currentBuildingInfo.value = res2.data[0]; - } else { + // ! 相同住宅类型 + } else if (buildingtype.value === currentbuildingtype) { // 更新当前楼栋的 信息 currentBuildingInfo.value = res2.data.find((item) => item.id === currentBuildingInfo.value.id); } - // 获取当前 第一个楼栋的所有信息 - const res3 = await getHouselistAPI(currentBuildingInfo.value.id); - currentHouseInfoList.value = res3.data; - floorslist.value = new Set(); - // 得到所有的有房屋的 楼层 数组 - currentHouseInfoList.value.units.forEach((item) => { - item.floors.forEach((floor) => { - floorslist.value.add(floor.floorNo); + if (currentBuildingInfo.value && currentBuildingInfo.value.id) { + // 获取当前 第一个楼栋的所有信息 + const res3 = await getHouselistAPI(currentBuildingInfo.value.id); + currentHouseInfoList.value = res3.data; + floorslist.value = new Set(); + // 得到所有的有房屋的 楼层 数组 + currentHouseInfoList.value.units.forEach((item) => { + item.floors.forEach((floor) => { + floorslist.value.add(floor.floorNo); + }); }); - }); + if (buildingtype.value !== currentbuildingtype) { + buildingtype.value = currentbuildingtype; + } + } }; // 选中的房屋 @@ -93,18 +110,59 @@ export const useHouseStore = defineStore( }; // 切换住宅类型 - const switchHouseType = (housetype: number) => { - getBuildinglistAPI(currentVilageInfo.value.villageId, housetype) - .then(() => { - buildingtype.value = housetype; - initHouse(housetype); - ElMessage.success('切换成功'); - }) - .catch(() => ElMessage.error('切换失败')); + const switchHouseType = async (housetype: number) => { + // 清空 + currentBuildingInfoList.value = []; + // 获取当前小区 所有楼栋信息 + const res2 = await getBuildinglistAPI(currentVilageInfo.value.villageId, housetype); + currentBuildingInfoList.value = res2.data; + // 获取当前小区 第一个楼栋信息 + if ((currentBuildingInfo.value && currentBuildingInfo.value.id === null) || buildingtype.value !== housetype) { + if (res2.data.length > 0) { + currentBuildingInfo.value = res2.data[0]; + } else { + currentBuildingInfo.value = { + 'id': null, + 'villageId': null, + 'villageName': '', + 'buildingName': '', + 'buildingUse': null, + 'buildToward': '', + 'buildTall': '', + 'buildStructure': '', + 'unitCount': null, + 'floorCount': null, + 'remark': '' + }; + } + } + if (currentBuildingInfo.value.id !== null) { + switchBuilding(currentBuildingInfo.value.id); + } else { + floorslist.value = new Set(); + } + buildingtype.value = housetype; + console.log(housetype); + ElMessage.success('切换成功'); }; + // 更新当前楼栋信息 + const updateCureentBuilding = async () => { + currentHouseInfoList.value = null; + // 获取当前 楼栋的所有信息 + const res3 = await getHouselistAPI(currentBuildingInfo.value.id); + currentHouseInfoList.value = res3.data; + floorslist.value = new Set(); + // 得到所有的有房屋的 楼层 数组 + currentHouseInfoList.value.units.forEach((item) => { + item.floors.forEach((floor) => { + floorslist.value.add(floor.floorNo); + }); + }); + }; // 切换楼栋 const switchBuilding = (buildingId: string) => { + if (!buildingId) return; // 切换之前 清空当前楼栋信息 currentBuildingInfo.value = { 'id': null, @@ -122,12 +180,11 @@ export const useHouseStore = defineStore( currentHouseInfoList.value = null; getHouselistAPI(buildingId).then((res) => { currentHouseInfoList.value = res.data; - console.log(currentHouseInfoList.value); // 获取当前楼栋信息并 赋值 currentBuildingInfo.value = currentBuildingInfoList.value.find((item) => item.id === buildingId); // 清空 楼层信息 - floorslist.value = new Set(); + floorslist.value.clear(); // 重新获取楼层信息 currentHouseInfoList.value.units.forEach((item) => { item.floors.forEach((floor) => { @@ -144,7 +201,6 @@ export const useHouseStore = defineStore( }; // 删除指定楼栋 const deleteBuildingFun = (buildingId: string) => { - console.log('删除楼栋'); // 手动 从 楼栋列表中删除 指定楼栋 currentBuildingInfoList.value = currentBuildingInfoList.value.filter((item) => item.id !== buildingId); // 判断指定楼栋是 当前楼栋 @@ -159,12 +215,20 @@ export const useHouseStore = defineStore( // 房屋 树状结构类型 const getCurrentVilageTreeHouse = async () => { - const res = await getCommunitylistAPI(); - const currentVilage = res.rows.find((item) => item.choiceStatus === 0); - currentVilageInfo.value = currentVilage; - getVillageTree(currentVilageInfo.value.villageId).then((res) => { - treedata.value = convertBuildingToTree(res.data.buildings); - }); + if (!currentVilageInfo.value?.villageId) { + treedata.value = []; + return treedata.value; + } + try { + treedata.value = []; + const res = await getVillageTree(currentVilageInfo.value.villageId); + treedata.value = convertBuildingToTree(res.data.buildings || []); + return treedata.value; + } catch (err) { + console.error('获取楼栋树失败:', err); + treedata.value = []; + return treedata.value; + } }; return { currentVilageInfo, @@ -176,6 +240,9 @@ export const useHouseStore = defineStore( buildingtype, buildingtypelist, treedata, + updateVilageinfo, + updateCureentBuilding, + getviliageinfo, checkoutHousesFun, initHouse, switchHouseType, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index a188082..c53fd3d 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import defAva from '@/assets/images/profile.jpg'; import { defineStore } from 'pinia'; import { ref } from 'vue'; import { useHouseStore } from './house'; +import { UserInfo } from '@/api/system/user/types'; export const useUserStore = defineStore('user', () => { const token = ref(getToken()); @@ -34,15 +35,15 @@ export const useUserStore = defineStore('user', () => { }; // 获取用户信息 - const getInfo = async (): Promise => { + const getInfo = async (): Promise => { const [err, res] = await to(getUserInfo()); if (res) { const data = res.data; const user = data.user; const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; - // useHouseStore().getCurrentVilageTreeHouse(); - console.log(data); - sessionStorage.setItem('villageid', data.user.villageId); + if (data.user.userId !== 1) { + localStorage.setItem('villageid', data.user.villageId); + } if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 roles.value = data.roles; diff --git a/src/views/community/index.vue b/src/views/community/index.vue index 162169d..9b5ef67 100644 --- a/src/views/community/index.vue +++ b/src/views/community/index.vue @@ -13,14 +13,7 @@
-
+
- +
访问房屋:
-
北境碧桂园小区A栋2单元402
+
{{ form.houseName }}
访客姓名:
-
李淑一
+
{{ form.visitorName }}
访客性别:
-
+
+ +
手机号码:
-
15020360831
+
{{ form.visitorPhone }}
访问日期:
-
2024/05/08
+
{{ form.startTime }} - {{ form.endTime }}
访问时长:
-
3h
+
{{ formatTimeDiff(form.startTime, form.endTime) }}
访问业主:
@@ -44,14 +46,18 @@
提交时间:
-
2024/09/15 22:48
+
{{ form.startTime }}
- -
+ +
通行证
+
+ + +
@@ -78,30 +84,55 @@ diff --git a/src/views/system/house/components/components/table.vue b/src/views/system/house/components/components/table.vue index 6a0aebc..30aae6b 100644 --- a/src/views/system/house/components/components/table.vue +++ b/src/views/system/house/components/components/table.vue @@ -44,7 +44,6 @@ function handleChangeCheckhouses(val: string[]) { function contextMenuFun(val: { type: string; value: string }) { switch (val.type) { case 'edit': - console.log('你选择了:', val); router.push({ path: '/house/addHouse', query: { @@ -56,7 +55,6 @@ function contextMenuFun(val: { type: string; value: string }) { console.log('你选择了:', val); break; case 'main': - console.log('你选择了:', val); router.push({ path: '/house/HouseDetails', query: { @@ -65,7 +63,6 @@ function contextMenuFun(val: { type: string; value: string }) { }); break; case 'delete': - console.log('你选择了:', val); deleteHouseApi(val.value).then(() => { ElMessage.success('删除成功'); houseStore.switchBuilding(houseStore.currentBuildingInfo.id); diff --git a/src/views/system/house/components/unit.vue b/src/views/system/house/components/unit.vue index 2a357e2..cb1b7f7 100644 --- a/src/views/system/house/components/unit.vue +++ b/src/views/system/house/components/unit.vue @@ -3,15 +3,15 @@
- {{ houseStore.currentBuildingInfo.buildingName }} + {{ houseStore.currentBuildingInfo?.buildingName }} - 楼栋朝向:{{ houseStore.currentBuildingInfo.buildToward }} - 楼高:{{ houseStore.currentBuildingInfo.buildTall }}(m) - 楼栋结构:{{ houseStore.currentBuildingInfo.buildStructure }} + 楼栋朝向:{{ houseStore.currentBuildingInfo?.buildToward }} + 楼高:{{ houseStore.currentBuildingInfo?.buildTall ? `${houseStore.currentBuildingInfo?.buildTall}(m)` : '' }} + 楼栋结构:{{ houseStore.currentBuildingInfo?.buildStructure }}
+增加房屋 - 收费标准设置 + 删除
@@ -35,7 +35,6 @@ function handleAddHouse() { function deleteAllhouse() { const checkhouse = houseStore.checkoutHouses; - console.log(checkhouse); if (checkhouse.length > 0) { let deletecount = 0; checkhouse.forEach((item) => { diff --git a/src/views/system/house/index.vue b/src/views/system/house/index.vue index a051f29..7fb1d74 100644 --- a/src/views/system/house/index.vue +++ b/src/views/system/house/index.vue @@ -10,13 +10,13 @@
- {{ house }} + {{ house.label }}
@@ -32,9 +32,13 @@ import building from './components/building.vue'; import unit from './components/unit.vue'; import PageHeader from '@/components/Pageheader/index.vue'; import { useHouseStore } from '@/store/modules/house'; + const houseStore = useHouseStore(); -const { currentVilageInfo } = storeToRefs(houseStore); -const housetypelist = ['住宅', '办公', '商用', '公寓']; +const { buildingtype, currentVilageInfo } = storeToRefs(houseStore); + +const { proxy } = getCurrentInstance() as ComponentInternalInstance; +const { com_build_use } = toRefs(proxy?.useDict('com_build_use')); + houseStore.initHouse(houseStore.buildingtype); // 初始化数据 diff --git a/src/views/system/houseRental/addhouseResident.vue b/src/views/system/houseRental/addhouseResident.vue index 9b6cea5..018729b 100644 --- a/src/views/system/houseRental/addhouseResident.vue +++ b/src/views/system/houseRental/addhouseResident.vue @@ -31,7 +31,7 @@ - + @@ -48,7 +48,7 @@ - {{ item.label }} + {{ item.label }} @@ -96,16 +96,16 @@
- {{ item.label }} + {{ item.name }}
@@ -184,13 +184,16 @@ import { getHousePathById, hasFormData, splitStringUrl } from '@/utils/house'; import { addHouseRental, getHouseRental, updateHouseRental, uploadHouseImage } from '@/api/system/houseRental'; import { validator } from '@/utils/Reg'; import { useHouseStore } from '@/store/modules/house'; +import { listHouseFacilities } from '@/api/system/HouseFacilities'; const houseStore = useHouseStore(); -const { treedata } = storeToRefs(houseStore); + const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/houseRental/uploadImages'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { com_rental_method } = toRefs(proxy?.useDict('com_rental_method')); + const { com_house_rental_facilities } = toRefs(proxy?.useDict('com_house_rental_facilities') || {}); + const { com_rental_status } = toRefs(proxy?.useDict('com_rental_status')); const { com_house_use } = toRefs(proxy?.useDict('com_house_use')); @@ -205,7 +208,7 @@ const form = ref({ rentalName: '', // 租户姓名 rent: null, // 租金 houseFace: '', // 房屋朝向 - rentalType: 0, // 整租合租 + rentalType: '0', // 整租合租 phone: null, //手机号 houseArea: null, // 房屋面积 floorNo: null, //楼层号 @@ -214,7 +217,7 @@ const form = ref({ houseImageUrl: '', //房屋图片 supInfo: '', //补充租房信息 vx: '', //微信 - houseUse: 0, //房屋用途 + houseUse: '0', //房屋用途 rentalStatus: 0, //租赁状态 email: '' //邮箱 }); @@ -233,12 +236,17 @@ const rules = ref({ }); // ! 编辑租赁-================================================================================= const userid = ref(null); +const treedata = ref(null); +const housefacilities = ref([]); // !== 楼栋房屋 ============================================================================= -function gettreedata() { +async function gettreedata() { + const reslist = await listHouseFacilities(); + housefacilities.value = reslist.rows; + + treedata.value = await houseStore.getCurrentVilageTreeHouse(); if (route.query.id) { userid.value = route.query.id; getHouseRental(userid.value).then((res) => { - console.log(res); form.value = { ...form.value, ...res.data @@ -273,7 +281,6 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => { dialogVisible.value = true; }; const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { - console.log(uploadFile, uploadFiles); fileList.value = uploadFiles; }; @@ -281,13 +288,6 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { // 家电 const housedeviceslist = ref([]); -watch( - () => com_house_rental_facilities.value, - (newVal) => { - housedeviceslist.value = (newVal || []).map((item) => item.value); - }, - { deep: true, immediate: true } -); function handleClick(index: number) { if (housedeviceslist.value.includes(index)) { housedeviceslist.value = housedeviceslist.value.filter((item) => item !== index); @@ -302,6 +302,7 @@ function handleClick(index: number) { const submitForm = () => { formRef.value?.validate(async (valid: boolean) => { if (valid) { + // 处理家电 form.value.facilities = housedeviceslist.value.join(','); let str = ''; // 判断有无图片 @@ -315,7 +316,6 @@ const submitForm = () => { str += item.url + ','; } }); - console.log(formdata); if (!hasFormData(formdata)) return sendForm(str); uploadHouseImage(formdata) .then((res) => { @@ -354,15 +354,18 @@ const submitForm = () => { }; const sendForm = (val: string) => { form.value.houseImageUrl = val; + form.value.villageId = Number(localStorage.getItem('villageid')); // edit or add if (userid.value) { - console.log('edit'); updateHouseRental(form.value).then(() => { ElMessage.success('编辑成功'); cancelForm(); }); } else { - addHouseRental(form.value).then((res) => { + addHouseRental({ + ...form.value, + villageid: Number(localStorage.getItem('villageid')) + }).then(() => { ElMessage.success('添加成功'); cancelForm(); }); diff --git a/src/views/system/houseRental/houseMain.vue b/src/views/system/houseRental/houseMain.vue index 04cac2a..8eb354f 100644 --- a/src/views/system/houseRental/houseMain.vue +++ b/src/views/system/houseRental/houseMain.vue @@ -125,7 +125,6 @@ function init() { houseRentalid.value = route.query.id; } getHouseRental(houseRentalid.value).then((res) => { - console.log(res); HouseInfo.value = res.data; HouseInfo.value.houseImageUrls = HouseInfo.value.houseImageUrl.split(',').filter((item) => item); const arr = getHousePathById(treedata.value, HouseInfo.value.houseId, 'label'); diff --git a/src/views/system/houseRental/index.vue b/src/views/system/houseRental/index.vue index 84c02dd..3ea0742 100644 --- a/src/views/system/houseRental/index.vue +++ b/src/views/system/houseRental/index.vue @@ -62,8 +62,7 @@ @@ -130,8 +129,8 @@ const data = reactive>({ queryParams: { pageNum: 1, pageSize: 10, - - houseUse: undefined, + villageId: Number(localStorage.getItem('villageid')), + houseUse: '', rentalName: undefined, rent: undefined, rentalType: undefined, diff --git a/src/views/system/parking/addParking.vue b/src/views/system/parking/addParking.vue index 58b0eb5..818e5e9 100644 --- a/src/views/system/parking/addParking.vue +++ b/src/views/system/parking/addParking.vue @@ -100,6 +100,7 @@ const form = ref({ residentId: null, // 住户id parkingStatus: '', // 车位状态 remark: '', // 备注 + villageId: Number(localStorage.getItem('villageid')), parkingCode: '' // 车位编码 }); const rules = ref({ @@ -132,8 +133,6 @@ getAreaList(); const holderInfo = ref(null); function handleChange(pop) { - console.log('获得数据'); - console.log(pop); holderInfo.value = pop; } @@ -143,6 +142,7 @@ const submitForm = () => { formRef.value?.validate(async (valid: boolean) => { if (valid) { form.value.residentId = holderInfo.value; + form.value.villageId = Number(localStorage.getItem('villageid')); if (userid.value) { updateParking(form.value).then((res) => { ElMessage.success('编辑成功'); diff --git a/src/views/system/parking/index.vue b/src/views/system/parking/index.vue index 04992af..965b82f 100644 --- a/src/views/system/parking/index.vue +++ b/src/views/system/parking/index.vue @@ -7,10 +7,9 @@ - + - @@ -50,9 +49,7 @@ - - - + @@ -91,7 +88,6 @@