临时
This commit is contained in:
@@ -15,7 +15,10 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
|
||||
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
||||
|
||||
# 生产环境
|
||||
VITE_APP_BASE_API = 'http://wuyeadmin.bugtc.com/'
|
||||
VITE_APP_BASE_API = 'http://wuyeapi.bugtc.com'
|
||||
# VITE_APP_BASE_API = 'http://192.168.0.222:8080'
|
||||
|
||||
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite serve --mode development",
|
||||
"build:prod": "vite build --mode production",
|
||||
"build:dev": "vite build --mode development",
|
||||
"build:prod": "vite build --mode production",
|
||||
"preview": "vite preview",
|
||||
"preview:dev": "vite preview --mode development",
|
||||
"preview:prod": "vite preview --mode production",
|
||||
"lint:eslint": "eslint",
|
||||
"lint:eslint:fix": "eslint --fix",
|
||||
"prettier": "prettier --write ."
|
||||
|
||||
@@ -16,6 +16,7 @@ export function login(data: LoginData): AxiosPromise<LoginResult> {
|
||||
clientId: data.clientId || clientId,
|
||||
grantType: data.grantType || 'password'
|
||||
};
|
||||
console.log(params);
|
||||
return request({
|
||||
url: '/auth/login',
|
||||
headers: {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { BuildingUnit, BuildingVo } from './type';
|
||||
import { addBuildingType, BuildingUnit, BuildingVo } from './type';
|
||||
|
||||
// 楼栋---------------------------------------------------------------------------------------
|
||||
// 根据 小区id 和 类型 查询楼栋信息
|
||||
// 根据 小区id 和 类型 查询楼栋信息
|
||||
export function getBuildinglistAPI(villageId: number, buildingUse: number): AxiosPromise<BuildingVo[]> {
|
||||
return request({
|
||||
url: '/building/byVillage',
|
||||
@@ -15,10 +15,34 @@ export function getBuildinglistAPI(villageId: number, buildingUse: number): Axio
|
||||
});
|
||||
}
|
||||
|
||||
/** 添加楼栋 */
|
||||
export function addBuildingApi(data: addBuildingType) {
|
||||
return request({
|
||||
url: '/building',
|
||||
method: 'POST',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 房屋----------------------------------------------------------------------------------------------
|
||||
// 根据 楼栋id 查询房屋信息
|
||||
export function getHouselistAPI(buildingId: number): AxiosPromise<BuildingUnit[]> {
|
||||
return request({
|
||||
url: `/house/groupByUnitTree/${buildingId}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
// 添加房屋
|
||||
export function addHouseAPI() {
|
||||
return request({
|
||||
url: `/house`,
|
||||
method: 'POST'
|
||||
});
|
||||
}
|
||||
// 删除房屋
|
||||
export function deleteHouseApi() {
|
||||
return request({
|
||||
url: `/house/{houseIds}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -63,3 +63,13 @@ export interface HouseType {
|
||||
houseId: string;
|
||||
houseNo: string;
|
||||
}
|
||||
|
||||
export interface addBuildingType {
|
||||
buildingName: string;
|
||||
villageId: number;
|
||||
buildStructure?: string;
|
||||
buildTall?: string;
|
||||
buildToward?: string;
|
||||
floorCount?: number;
|
||||
unitCount?: number;
|
||||
}
|
||||
|
||||
BIN
src/assets/images/login-background.png
Normal file
BIN
src/assets/images/login-background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 15 MiB After Width: | Height: | Size: 15 MiB |
@@ -26,8 +26,9 @@ const x = ref(0);
|
||||
const y = ref(0);
|
||||
|
||||
const menuRef = ref();
|
||||
const openHouseId = ref(null);
|
||||
// 打开菜单
|
||||
const open = async (e: MouseEvent, value: any) => {
|
||||
const open = async (e: MouseEvent, value: string) => {
|
||||
e.preventDefault();
|
||||
x.value = e.clientX;
|
||||
y.value = e.clientY;
|
||||
@@ -62,6 +63,7 @@ const open = async (e: MouseEvent, value: any) => {
|
||||
show.value = true;
|
||||
document.addEventListener('click', close);
|
||||
document.addEventListener('contextmenu', close);
|
||||
openHouseId.value = value;
|
||||
}, 10);
|
||||
};
|
||||
|
||||
@@ -74,7 +76,10 @@ const close = () => {
|
||||
|
||||
// 点击选项
|
||||
const handleClick = (item) => {
|
||||
emit('select', item.value);
|
||||
emit('select', {
|
||||
type: item.value,
|
||||
value: openHouseId.value
|
||||
});
|
||||
close();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
<template>
|
||||
<div class="PageHeaderBox">
|
||||
<!-- 面包屑 -->
|
||||
<breadcrumb class="breadcrumb-container" />
|
||||
<!-- 页面标题 -->
|
||||
<div class="pageTitleBox flex items-center">
|
||||
<div class="line"></div>
|
||||
<div class="pagetitle">{{ props.title }}</div>
|
||||
<div class="leftbox">
|
||||
<!-- 面包屑 -->
|
||||
<breadcrumb class="breadcrumb-container" />
|
||||
<!-- 页面标题 -->
|
||||
<div class="pageTitleBox flex items-center">
|
||||
<div class="line"></div>
|
||||
<div class="pagetitle">{{ props.title }}</div>
|
||||
</div>
|
||||
<!-- solt -->
|
||||
<slot name="content" v-if="showSlot"></slot>
|
||||
<div class="h-20px" v-show="!showSlot"></div>
|
||||
</div>
|
||||
<div class="rightbox">
|
||||
<!-- 操作按钮 -->
|
||||
<slot name="operate" v-if="showSlot"></slot>
|
||||
</div>
|
||||
<!-- solt -->
|
||||
<slot name="content" v-if="showSlot"></slot>
|
||||
<div class="h-20px" v-show="!showSlot"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -29,6 +35,7 @@ const props = defineProps({
|
||||
|
||||
defineSlots<{
|
||||
content?: () => void;
|
||||
operate?: () => void;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
@@ -39,6 +46,12 @@ defineSlots<{
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.leftbox {
|
||||
flex: 1;
|
||||
}
|
||||
.pageTitleBox {
|
||||
.line {
|
||||
width: 5px;
|
||||
|
||||
@@ -56,9 +56,9 @@ export enum HttpStatus {
|
||||
*/
|
||||
UNSUPPORTED_TYPE = 415,
|
||||
/**
|
||||
* 图片上传-全部失败
|
||||
* 系统内部错误
|
||||
*/
|
||||
UPLOAD_IMG_ALL_ERROR = 500,
|
||||
SERVER_ERROR = 500,
|
||||
/**
|
||||
* 接口未实现
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ export enum HttpStatus {
|
||||
*/
|
||||
DATABASE_ERROR = 522,
|
||||
/**
|
||||
* 图片上传-部分失败
|
||||
* 系统警告消息
|
||||
*/
|
||||
UPLOAD_IMG_ERROR = 601
|
||||
WARN = 601
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ const getLogoTextColor = computed(() => {
|
||||
& .sidebar-title {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
color: v-bind(getLogoTextColor);
|
||||
// color: v-bind(getLogoTextColor);
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
line-height: 50px;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -73,6 +73,12 @@ export const useHouseStore = defineStore('house', () => {
|
||||
currentFloorInfoList.value = (Array.from(floorslist.value) as string[]).sort(sortNumberStr);
|
||||
};
|
||||
|
||||
// 选中房屋
|
||||
const checkoutHouses = ref<string[]>([]);
|
||||
const checkoutHousesFun = (data: string[]) => {
|
||||
checkoutHouses.value = data;
|
||||
};
|
||||
|
||||
// 切换住宅类型
|
||||
const switchHouseType = (housetype: 0 | 1 | 2 | 3) => {
|
||||
getBuildinglistAPI(currentVilageInfo.value.villageId, housetype)
|
||||
@@ -85,14 +91,26 @@ export const useHouseStore = defineStore('house', () => {
|
||||
getHouselistAPI(buildingId).then(() => ElMessage.success('切换成功'));
|
||||
};
|
||||
|
||||
const deleteHouseFun = (houseId: string | string[]) => {
|
||||
console.log('删除房屋');
|
||||
if (typeof houseId === 'string') {
|
||||
console.log('单条删除');
|
||||
} else if (Array.isArray(houseId)) {
|
||||
console.log('批量删除');
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentVilageInfo,
|
||||
currentBuildingInfoList,
|
||||
currentBuildingInfo,
|
||||
currentHouseInfoList,
|
||||
currentFloorInfoList,
|
||||
checkoutHouses,
|
||||
checkoutHousesFun,
|
||||
initHouse,
|
||||
switchHouseType,
|
||||
switchBuilding
|
||||
switchBuilding,
|
||||
deleteHouseFun
|
||||
};
|
||||
});
|
||||
|
||||
@@ -151,14 +151,14 @@ service.interceptors.response.use(
|
||||
});
|
||||
}
|
||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
||||
// 图片上传全部失败 500
|
||||
} else if (code === HttpStatus.UPLOAD_IMG_ALL_ERROR) {
|
||||
ElMessage({ message: '图片全部上传失败', type: 'error' });
|
||||
// 500
|
||||
} else if (code === HttpStatus.SERVER_ERROR) {
|
||||
ElMessage({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg));
|
||||
// 601
|
||||
} else if (code === HttpStatus.WARN) {
|
||||
ElMessage({ message: msg, type: 'warning' });
|
||||
return Promise.reject(new Error(msg));
|
||||
// 图片上传部分失败 601
|
||||
} else if (code === HttpStatus.UPLOAD_IMG_ERROR) {
|
||||
ElMessage({ message: '部分图片上传失败', type: 'warning' });
|
||||
return Promise.reject(res.data);
|
||||
} else if (code !== HttpStatus.SUCCESS) {
|
||||
ElNotification.error({ title: msg });
|
||||
return Promise.reject('error');
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" :placeholder="proxy.$t('login.username')">
|
||||
<el-input v-model.trim="loginForm.username" type="text" size="large" auto-complete="off" :placeholder="proxy.$t('login.username')">
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
v-model.trim="loginForm.password"
|
||||
type="password"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
@@ -98,6 +98,7 @@ const handleLogin = () => {
|
||||
loginRef.value?.validate(async (valid: boolean, fields: any) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
console.log(loginForm.value);
|
||||
// 勾选了需要记住密码设置在 localStorage 中设置记住用户名和密码
|
||||
if (loginForm.value.rememberMe) {
|
||||
localStorage.setItem('tenantId', String(loginForm.value.tenantId));
|
||||
@@ -114,15 +115,12 @@ const handleLogin = () => {
|
||||
// 调用action的登录方法
|
||||
const [err] = await to(userStore.login(loginForm.value));
|
||||
if (!err) {
|
||||
console.log('登录成功');
|
||||
const redirectUrl = redirect.value || '/';
|
||||
await router.push(redirectUrl);
|
||||
loading.value = false;
|
||||
} else {
|
||||
loading.value = false;
|
||||
// 重新获取验证码
|
||||
if (captchaEnabled.value) {
|
||||
await getCode();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
@@ -200,7 +198,7 @@ onMounted(() => {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url('../assets/images/login-background.jpg');
|
||||
background-image: url('../assets/images/login-background.png');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="楼栋名称" prop="buildingName">
|
||||
<el-input v-model="form.buildingName" placeholder="请输入楼栋名称" />
|
||||
<el-input v-model.trim="form.buildingName" placeholder="请输入楼栋名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋朝向" prop="buildingCode">
|
||||
<el-input v-model="form.buildingCode" placeholder="请输入楼栋朝向" />
|
||||
<el-form-item label="楼栋朝向" prop="buildToward">
|
||||
<el-input v-model.trim="form.buildToward" placeholder="请输入楼栋朝向" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼高(m)" prop="buildingType">
|
||||
<el-input v-model="form.buildingType" placeholder="请输入楼高(m)" />
|
||||
<el-form-item label="楼高(m)" prop="buildTail">
|
||||
<el-input v-model.trim="form.buildTail" placeholder="请输入楼高(m)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋结构" prop="buildingArea">
|
||||
<el-input v-model="form.buildingArea" placeholder="请输入楼栋结构" />
|
||||
<el-form-item label="楼栋结构" prop="buildStructure">
|
||||
<el-input v-model.trim="form.buildStructure" placeholder="请输入楼栋结构" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单元数" prop="buildingAddress">
|
||||
<el-input-number :min="1" v-model="form.buildingAddress" placeholder="单元数" />
|
||||
<el-form-item label="单元数" prop="unitCount">
|
||||
<el-input-number :min="1" v-model.trim="form.unitCount" placeholder="单元数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="楼层" prop="buildingDescription">
|
||||
<el-input-number :min="1" v-model="form.buildingDescription" placeholder="楼层数" />
|
||||
<el-form-item label="楼层" prop="floorCount">
|
||||
<el-input-number :min="1" v-model.trim="form.floorCount" placeholder="楼层数" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
@@ -36,30 +36,52 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { addBuildingApi } from '@/api/system/house';
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
buildingName: '',
|
||||
buildingCode: '',
|
||||
buildingType: '',
|
||||
buildingArea: '',
|
||||
buildingAddress: null,
|
||||
buildingDescription: null
|
||||
buildToward: '',
|
||||
buildTail: '',
|
||||
buildStructure: '',
|
||||
unitCount: null,
|
||||
floorCount: null
|
||||
});
|
||||
const rules = ref({
|
||||
buildingName: [{ required: true, message: '请输入楼栋名称', trigger: 'blur' }],
|
||||
buildingAddress: [{ required: true, message: '请输入单元数', trigger: 'blur' }],
|
||||
buildingDescription: [{ required: true, message: '请输入楼层', trigger: 'blur' }]
|
||||
unitCount: [{ required: true, message: '请输入单元数', trigger: 'blur' }],
|
||||
floorCount: [{ required: true, message: '请输入楼层数', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 获取当前小区信息
|
||||
const currentVilageinfo = ref();
|
||||
function getVilageFun() {
|
||||
getCommunitylistAPI().then((res) => {
|
||||
currentVilageinfo.value = res.rows.find((item) => item.choiceStatus === 0);
|
||||
});
|
||||
}
|
||||
// getVilageFun();
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
console.log(form.value);
|
||||
addBuildingApi({
|
||||
...form.value,
|
||||
villageId: currentVilageinfo.value.id
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('添加成功');
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
ElMessage.error('添加失败');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const cancelForm = () => {
|
||||
console.log('取消');
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
:key="index"
|
||||
@click="switchBuilding(item.id)"
|
||||
>
|
||||
<div class="buildingname">{{ item.villageName ?? '未知' }}</div>
|
||||
<div class="buildingname">{{ item.buildingName ?? '测试数据' }}</div>
|
||||
<div class="buildactions flex align-center justify-around">
|
||||
<el-icon class="pointer hover-color-blue"><Setting /></el-icon>
|
||||
<el-icon class="pointer hover-color-red"><Delete /></el-icon>
|
||||
@@ -26,13 +26,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
const houseStore = useHouseStore();
|
||||
const { switchBuilding } = houseStore; // 方法
|
||||
const { currentBuildingInfoList, currentBuildingInfo } = storeToRefs(houseStore); // 数据
|
||||
const router = useRouter();
|
||||
|
||||
console.log(currentBuildingInfoList);
|
||||
const handleAddBuilding = () => {
|
||||
router.push({
|
||||
path: '/house/addbuilding'
|
||||
|
||||
@@ -25,8 +25,8 @@ const checked = ref<string[]>([]);
|
||||
// 菜单ref
|
||||
const contextMenu = ref();
|
||||
// 点击事件
|
||||
const handleSelect = (val: string) => {
|
||||
emit('contextmenufun', val);
|
||||
const handleSelect = (data: { type: string; value: string }) => {
|
||||
emit('contextmenufun', data);
|
||||
};
|
||||
function handleClick(house: HouseType) {
|
||||
checked.value = checked.value.includes(house.houseId)
|
||||
@@ -37,7 +37,7 @@ function handleClick(house: HouseType) {
|
||||
|
||||
const emit = defineEmits<{
|
||||
change: [value: string[]];
|
||||
contextmenufun: [value: string];
|
||||
contextmenufun: [value: { type: string; value: string }];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
:key="index"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<houseItem :menu-list="menutlist" :unit="units.floors_Json" :f-idx="row"></houseItem>
|
||||
<houseItem
|
||||
@contextmenufun="contextMenuFun"
|
||||
@change="handleChange"
|
||||
:menu-list="menutlist"
|
||||
:unit="units.floors_Json"
|
||||
:f-idx="row"
|
||||
></houseItem>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -33,6 +39,26 @@ const menutlist = [
|
||||
{ label: '详情', value: 'main' },
|
||||
{ label: '删除', value: 'delete' }
|
||||
];
|
||||
function contextMenuFun(val: { type: string; value: string }) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'money':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'main':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'delete':
|
||||
console.log('你选择了:', val);
|
||||
houseStore.deleteHouseFun(val.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
function handleChange(data: string[]) {
|
||||
houseStore.checkoutHousesFun(data);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -31,6 +31,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
cleanOutDir: true
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
|
||||
@@ -13,7 +13,7 @@ import path from 'path';
|
||||
export default (viteEnv: any, isBuild = false): [] => {
|
||||
const vitePlugins: any = [];
|
||||
vitePlugins.push(vue());
|
||||
vitePlugins.push(vueDevTools());
|
||||
// vitePlugins.push(vueDevTools());
|
||||
vitePlugins.push(createUnoCss());
|
||||
vitePlugins.push(createAutoImport(path));
|
||||
vitePlugins.push(createComponents(path));
|
||||
|
||||
Reference in New Issue
Block a user