Browse Source

Merge branch 'wyx' of http://120.46.222.128:10021/elink-star/epmet-apartment-pc into wyx

# Conflicts:
#	src/api/mz/house.js
#	src/views/login.vue
wyx
wangyx 3 months ago
parent
commit
e8a73d60b4
  1. 3
      public/index.html
  2. 2
      src/utils/request.js
  3. 4
      src/views/login.vue
  4. 238
      src/views/mz/realTimeHousingResources/index.vue
  5. 3
      vue.config.js

3
public/index.html

@ -10,8 +10,7 @@
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<script>
window.SITE_CONFIG = {}
window.SITE_CONFIG['apiURL'] = '<%= process.env.VUE_APP_BASE_API %>' // api请求地址
window.SITE_CONFIG['apiURL'] = '/mz-api'; // api请求地址
</script>
<style>
html,

2
src/utils/request.js

@ -15,7 +15,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
baseURL:process.env.NODE_ENV === 'development'? process.env.VUE_APP_BASE_API : window.SITE_CONFIG.apiURL,
// 超时
timeout: 10000
})

4
src/views/login.vue

@ -72,8 +72,8 @@ export default {
return {
codeUrl: "",
loginForm: {
username: "",
password: "",
username: "",//admin
password: "",//admin123
rememberMe: false,
code: "",
uuid: ""

238
src/views/mz/realTimeHousingResources/index.vue

@ -0,0 +1,238 @@
<template>
<div class="app-container">
<el-form :inline="true" :model="queryParams" class="demo-form-inline">
<el-form-item label="小区公寓" prop="deptId">
<treeselect
v-model="queryParams.apartmentId"
:options="deptOptions"
:show-count="true"
:normalizer="normalizer"
placeholder="请选择所在区域"
style="width: 220px"
@select="handleTreeSelect"
:disable-branch-nodes="true"
/>
</el-form-item>
<!-- 楼号 -->
<el-form-item label="楼栋" prop="building">
<el-select
v-model="queryParams.buildingId"
placeholder="请选择楼栋"
@change="handleChangeBuildingId"
>
<el-option
v-for="item in buildingOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<!-- 单元 -->
<el-form-item label="单元" prop="unit">
<el-select
v-model="queryParams.unitId"
placeholder="请选择单元"
@change="handleChangeUnitId"
>
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<!-- 状态 -->
<el-form-item label="入住情况" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态">
<el-option label="未入住" value="0" />
<el-option label="已入住" value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
</el-form-item>
</el-form>
<div class="flex">
<div
:class="{ idle: item.state === 0, flex_item: true }"
v-for="(item, index) in list"
:key="index"
>
<el-tooltip
placement="top"
:content="
item.apartmentName + ' ' + item.buildingName + ' ' + item.unitName
"
>
<template #content>
{{ item.apartmentName }} {{ item.buildingName }} {{ item.unitName }}
</template>
<div class="top">
{{ item.apartmentName }} {{ item.buildingName }} {{ item.unitName }}
</div>
</el-tooltip>
<div class="center">
<span class="num">{{ item.houseName }}</span>
<span>{{ item.typeName }}</span>
</div>
<div>{{ item.stateName }} {{ item.limitName }}</div>
</div>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
:layout="'prev,pager,next'"
/>
</div>
</template>
<script>
import { listHouseLive } from "@/api/mz/house";
import { listDept } from "@/api/system/dept";
import { queryDeptDropdownList } from "@/api/mz/rec";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "realTimeHousingResources",
data() {
return {
list: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 35,
apartmentId: null, //
buildingId: "", //
unitId: "", //
status: "", //
},
buildingOptions: [], //
unitOptions: [], //
deptOptions: [], //
};
},
components: {
Treeselect,
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
getList() {
listHouseLive(this.queryParams).then((res) => {
this.list = res.rows;
this.total = res.total;
});
},
async handleTreeSelect(val) {
this.queryParams.apartmentId = val.deptId;
this.queryParams.buildingId = null;
this.queryParams.unitId = null;
this.houseOptions = [];
this.buildingOptions = await this.getListByParentId("2", val.deptId);
},
async handleChangeBuildingId(val) {
this.queryParams.buildingId = val;
this.queryParams.unitId = null;
this.houseOptions = [];
this.unitOptions = await this.getListByParentId(3, val);
},
async handleChangeUnitId(val) {
this.queryParams.unitId = val;
},
//
getListByParentId(type, id) {
return new Promise((resolve, reject) => {
queryDeptDropdownList({ type, id }).then((res) => {
resolve(res.data);
});
});
},
/** 查询公寓下拉树结构 */
getDeptTree() {
listDept().then((response) => {
this.deptOptions = this.handleTree(
response.data,
"deptId",
"parentId",
"children",
3
);
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 转换公寓数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children,
};
},
},
watch:{
'queryParams.apartmentId': {
handler(newVal, oldVal) {
console.log('newVal',newVal);
if(!newVal)
this.queryParams.buildingId = null;
this.queryParams.unitId = null;
this.apartmentOptions = [];
this.buildingOptions = [];
this.unitOptions = [];
},
deep: true,
immediate: true
}
}
};
</script>
<style lang="scss" scoped>
.flex {
gap: 10px;
flex-wrap: wrap;
.flex_item {
padding: 10px;
background: #ececec;
text-align: center;
.top {
width: 210px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.center {
margin: 10px 0;
font-size: 20px;
display: flex;
justify-content: center;
.num {
font-size: 28px;
font-weight: bold;
margin-right: 5px;
}
}
}
.idle {
background: #1684ff;
color: #fff;
}
}
</style>

3
vue.config.js

@ -18,8 +18,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath:
process.env.NODE_ENV === "production" ? "/epmet-apartment-pc" : "/",
publicPath: "/epmet-apartment-pc",
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: "epmet-apartment-pc",
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)

Loading…
Cancel
Save