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

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

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

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

Loading…
Cancel
Save