fix: 业主管理添加租户显示

main
wx-jincw 2 weeks ago
parent 0fc483c7ac
commit fca31bb136

@ -4,344 +4,284 @@
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree
:data="deptTreeOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="deptId"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
<el-tree :data="deptTreeOptions" :props="defaultProps" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="tree" node-key="deptId" default-expand-all highlight-current
@node-click="handleNodeClick" />
</div>
</el-col>
<!--业主数据-->
<el-col :span="20" :xs="24">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="业主姓名">
<el-input v-model="dataForm.ownerName" placeholder="请输入业主姓名" clearable></el-input>
</el-form-item>
<el-form-item label="业主类型">
<el-input v-model="dataForm.ownerType" placeholder="请输入业主类型" clearable></el-input>
</el-form-item>
<el-form-item label="业主状态">
<el-input v-model="dataForm.status" placeholder="请输入业主状态" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button @click="resetForm()"></el-button>
<el-button v-hasPermi="['autogencode:pmowner:save']" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="ownerName"
header-align="center"
align="center"
label="业主姓名">
</el-table-column>
<el-table-column
prop="ownerType"
header-align="center"
align="center"
label="业主类型">
</el-table-column>
<el-table-column
prop="ownerIdcard"
header-align="center"
align="center"
label="业主身份证">
</el-table-column>
<el-table-column
prop="phone"
header-align="center"
align="center"
label="联系电话">
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
label="电子邮箱">
</el-table-column>
<el-table-column
prop="emergencyContact"
header-align="center"
align="center"
label="紧急联系人">
</el-table-column>
<el-table-column
prop="emergencyPhone"
header-align="center"
align="center"
label="紧急联系电话">
</el-table-column>
<el-table-column
prop="deptId"
header-align="center"
align="center"
label="所属部门">
<template slot-scope="scope">
{{ getDeptName(scope.row.deptId) }}
</template>
</el-table-column>
<el-table-column
prop="houseId"
header-align="center"
align="center"
label="所属房屋">
<template slot-scope="scope">
{{ getHouseName(scope.row.houseId) }}
</template>
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="业主状态">
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="text" size="small" @click="deleteHandle(scope.row.id)" style="color: #f56c6c;"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 表单弹窗, 新增数据和修改数据 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="业主姓名">
<el-input v-model="dataForm.ownerName" placeholder="请输入业主姓名" clearable></el-input>
</el-form-item>
<el-form-item label="业主类型">
<el-input v-model="dataForm.ownerType" placeholder="请输入业主类型" clearable></el-input>
</el-form-item>
<el-form-item label="业主状态">
<el-input v-model="dataForm.status" placeholder="请输入业主状态" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button @click="resetForm()"></el-button>
<el-button v-hasPermi="['autogencode:pmowner:save']" type="primary"
@click="addOrUpdateHandle()">新增数据</el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column type="expand" header-align="center" align="center">
<template slot-scope="scope">
<TenatList :owner-id="scope.row.id" :show-search="false" />
</template>
</el-table-column>
<el-table-column prop="ownerName" header-align="center" align="center" label="业主姓名">
</el-table-column>
<el-table-column prop="ownerType" header-align="center" align="center" label="业主类型">
</el-table-column>
<el-table-column prop="ownerIdcard" header-align="center" align="center" label="业主身份证">
</el-table-column>
<el-table-column prop="phone" header-align="center" align="center" label="联系电话">
</el-table-column>
<el-table-column prop="email" header-align="center" align="center" label="电子邮箱">
</el-table-column>
<el-table-column prop="emergencyContact" header-align="center" align="center" label="紧急联系人">
</el-table-column>
<el-table-column prop="emergencyPhone" header-align="center" align="center" label="紧急联系电话">
</el-table-column>
<el-table-column prop="deptId" header-align="center" align="center" label="所属部门">
<template slot-scope="scope">
{{ getDeptName(scope.row.deptId) }}
</template>
</el-table-column>
<el-table-column prop="houseId" header-align="center" align="center" label="所属房屋">
<template slot-scope="scope">
{{ getHouseName(scope.row.houseId) }}
</template>
</el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="业主状态">
</el-table-column>
<el-table-column prop="remark" header-align="center" align="center" label="备注">
</el-table-column>
<el-table-column header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="text" size="small"
@click="deleteHandle(scope.row.id)" style="color: #f56c6c;">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 表单弹窗, 新增数据和修改数据 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</el-col>
</el-row>
</div>
</template>
<script>
import AddOrUpdate from './pmowner-add-and-update'
import * as api from '@/api/pmowner.js'
import * as deptApi from '@/api/sysdept.js'
import * as houseApi from '@/api/pmhouse.js'
export default {
data () {
return {
deptTreeOptions: [],
deptMap: {},
houseMap: {},
deptName: undefined,
defaultProps: {
children: "children",
label: "deptName"
},
dataForm: {
ownerName: '',
ownerType: '',
ownerIdcard: '',
phone: '',
email: '',
emergencyContact: '',
emergencyPhone: '',
status: '',
remark: '',
},
//
resetForm() {
this.dataForm = {
ownerName: '',
ownerType: '',
ownerIdcard: '',
phone: '',
email: '',
emergencyContact: '',
emergencyPhone: '',
status: '',
remark: '',
}
import AddOrUpdate from './pmowner-add-and-update'
import * as api from '@/api/pmowner.js'
import * as deptApi from '@/api/sysdept.js'
import * as houseApi from '@/api/pmhouse.js'
import TenatList from '@/views/pm/tenant/index';
export default {
components: {
TenatList,
AddOrUpdate
},
data() {
return {
deptTreeOptions: [],
deptMap: {},
houseMap: {},
deptName: undefined,
defaultProps: {
children: "children",
label: "deptName"
},
dataForm: {
ownerName: '',
ownerType: '',
ownerIdcard: '',
phone: '',
email: '',
emergencyContact: '',
emergencyPhone: '',
status: '',
remark: '',
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
watch: {
deptName(val) {
this.$refs.tree.filter(val);
}
},
// activated () {
// this.getDataList()
// },
mounted() {
//
this.getDataList()
this.handleGetDeptList()
this.handleGetHouseList()
},
methods: {
//
resetForm() {
this.dataForm = {
ownerName: '',
ownerType: '',
ownerIdcard: '',
phone: '',
email: '',
emergencyContact: '',
emergencyPhone: '',
status: '',
remark: '',
}
},
components: {
AddOrUpdate
},
watch: {
deptName(val) {
this.$refs.tree.filter(val);
handleGetDeptList() {
deptApi.deptTreeSelect().then(res => {
this.deptTreeOptions = res
this.buildDeptMap(res)
})
},
handleGetHouseList() {
houseApi.pmhouseListApi({ page: 1, limit: 9999 }).then(res => {
const houseList = res.list || []
houseList.forEach(house => {
this.houseMap[house.id] = `${house.unitNo}单元 ${house.floorNo}${house.houseNo}`
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.deptName.indexOf(value) !== -1;
},
handleNodeClick(data) {
this.dataForm.deptId = data.deptId;
this.getDataList();
},
buildDeptMap(depts) {
depts.forEach(dept => {
this.deptMap[dept.deptId] = dept.deptName
if (dept.children && dept.children.length > 0) {
this.buildDeptMap(dept.children)
}
})
},
getDeptName(deptId) {
return this.deptMap[deptId] || '-'
},
getHouseName(houseId) {
return this.houseMap[houseId] || '-'
},
//
getDataList() {
this.dataListLoading = true
// PmOwnerControllerPageParamRequest
const params = {
page: this.pageIndex,
limit: this.pageSize
}
//
if (this.dataForm.ownerName) params.ownerName = this.dataForm.ownerName;
if (this.dataForm.ownerType) params.ownerType = this.dataForm.ownerType;
if (this.dataForm.ownerIdcard) params.ownerIdcard = this.dataForm.ownerIdcard;
if (this.dataForm.phone) params.phone = this.dataForm.phone;
if (this.dataForm.email) params.email = this.dataForm.email;
if (this.dataForm.emergencyContact) params.emergencyContact = this.dataForm.emergencyContact;
if (this.dataForm.emergencyPhone) params.emergencyPhone = this.dataForm.emergencyPhone;
if (this.dataForm.status) params.status = this.dataForm.status;
if (this.dataForm.deptId) params.deptId = this.dataForm.deptId;
if (this.dataForm.remark) params.remark = this.dataForm.remark;
api.pmownerListApi(params).then(res => {
this.dataListLoading = false
this.dataList = res.list || [];
this.totalPage = res.total;
}).catch(e => {
this.dataListLoading = false
})
},
activated () {
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
mounted() {
//
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
this.handleGetDeptList()
this.handleGetHouseList()
},
methods: {
handleGetDeptList() {
deptApi.deptTreeSelect().then(res => {
this.deptTreeOptions = res
this.buildDeptMap(res)
})
},
handleGetHouseList() {
houseApi.pmhouseListApi({ page: 1, limit: 9999 }).then(res => {
const houseList = res.list || []
houseList.forEach(house => {
this.houseMap[house.id] = `${house.unitNo}单元 ${house.floorNo}${house.houseNo}`
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.deptName.indexOf(value) !== -1;
},
handleNodeClick(data) {
this.dataForm.deptId = data.deptId;
this.getDataList();
},
buildDeptMap(depts) {
depts.forEach(dept => {
this.deptMap[dept.deptId] = dept.deptName
if (dept.children && dept.children.length > 0) {
this.buildDeptMap(dept.children)
}
})
},
getDeptName(deptId) {
return this.deptMap[deptId] || '-'
},
getHouseName(houseId) {
return this.houseMap[houseId] || '-'
},
//
getDataList () {
this.dataListLoading = true
// PmOwnerControllerPageParamRequest
const params = {
page: this.pageIndex,
limit: this.pageSize
}
//
if (this.dataForm.ownerName) params.ownerName = this.dataForm.ownerName;
if (this.dataForm.ownerType) params.ownerType = this.dataForm.ownerType;
if (this.dataForm.ownerIdcard) params.ownerIdcard = this.dataForm.ownerIdcard;
if (this.dataForm.phone) params.phone = this.dataForm.phone;
if (this.dataForm.email) params.email = this.dataForm.email;
if (this.dataForm.emergencyContact) params.emergencyContact = this.dataForm.emergencyContact;
if (this.dataForm.emergencyPhone) params.emergencyPhone = this.dataForm.emergencyPhone;
if (this.dataForm.status) params.status = this.dataForm.status;
if (this.dataForm.deptId) params.deptId = this.dataForm.deptId;
if (this.dataForm.remark) params.remark = this.dataForm.remark;
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(id) {
let ids = []
let idText = ''
api.pmownerListApi(params).then(res => {
this.dataListLoading = false
this.dataList = res.list || [];
this.totalPage = res.total;
}).catch(e => {
this.dataListLoading = false
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle (val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
// id
if (id) {
ids = [id]
idText = id
} else {
//
ids = this.dataListSelections.map(item => {
return item.id
})
},
//
deleteHandle (id) {
let ids = []
let idText = ''
// id
if (id) {
ids = [id]
idText = id
} else {
//
ids = this.dataListSelections.map(item => {
return item.id
})
idText = ids.join(',')
}
idText = ids.join(',')
}
this.$confirm(`确定进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// API
api.pmownerDeleteApi(ids).then(res => {
this.$message.success('删除成功')
this.getDataList()
})
this.$confirm(`确定进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// API
api.pmownerDeleteApi(ids).then(res => {
this.$message.success('删除成功')
this.getDataList()
})
},
}
})
},
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-table__expanded-cell {
padding: 0 !important;
}
</style>

@ -1,6 +1,6 @@
<template>
<div class="divBox">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form v-if="showSearch" :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="租户姓名">
<el-input v-model="dataForm.tenantName" placeholder="请输入租户姓名" clearable></el-input>
</el-form-item>
@ -36,17 +36,12 @@
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
v-if="showSearch"
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="tenantName"
header-align="center"
@ -83,56 +78,49 @@
align="center"
label="状态">
</el-table-column>
<el-table-column
<!-- <el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
</el-table-column> -->
<!-- <el-table-column
prop="delFlag"
header-align="center"
align="center"
label="删除标志0代表存在 2代表删除">
</el-table-column>
<el-table-column
</el-table-column> -->
<!-- <el-table-column
prop="createDept"
header-align="center"
align="center"
label="创建部门">
</el-table-column>
<el-table-column
</el-table-column> -->
<!-- <el-table-column
prop="createBy"
header-align="center"
align="center"
label="创建人">
</el-table-column>
<el-table-column
</el-table-column> -->
<!-- <el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
</el-table-column> -->
<el-table-column
prop="updateBy"
header-align="center"
align="center"
label="修改人">
</el-table-column>
<el-table-column
<!-- <el-table-column
prop="updateTime"
header-align="center"
align="center"
label="修改时间">
</el-table-column>
<el-table-column
prop="tenantId"
header-align="center"
align="center"
label="租户ID">
</el-table-column>
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
@ -144,6 +132,7 @@
</el-table-column>
</el-table>
<el-pagination
hide-on-single-page
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
@ -161,9 +150,22 @@
import AddOrUpdate from './pmtenant-add-and-update'
import * as api from '@/api/pmtenant.js'
export default {
props: {
// ID
ownerId: {
type: String,
default: ''
},
showSearch: {
type: Boolean,
default: true
}
},
data () {
return {
dataForm: {
// ID
ownerId: this.ownerId,
tenantName: '',
tenantType: '',
idCard: '',
@ -185,6 +187,13 @@
components: {
AddOrUpdate
},
watch: {
// ID
ownerId(newVal) {
this.dataForm.ownerId = newVal;
this.getDataList();
}
},
activated () {
this.getDataList()
},
@ -196,6 +205,8 @@
//
resetForm() {
this.dataForm = {
// ID
ownerId: this.ownerId,
tenantName: '',
tenantType: '',
idCard: '',
@ -223,6 +234,7 @@
if (this.dataForm.company) params.company = this.dataForm.company;
if (this.dataForm.status) params.status = this.dataForm.status;
if (this.dataForm.remark) params.remark = this.dataForm.remark;
if (this.dataForm.ownerId) params.ownerId = this.dataForm.ownerId;
api.pmtenantListApi(params).then(res => {
this.dataListLoading = false

Loading…
Cancel
Save