bibi 3 years ago
parent 84b3ae2034
commit 4d794173d1

@ -163,3 +163,11 @@ export function estateTypeDel(params) {
data: params,
})
}
//
export function estate(params) {
return httpService({
url: `/user/estate/findEstateCascade`,
method: 'get',
params: params,
})
}

@ -15,6 +15,30 @@ export function residentList(params) {
params: params,
})
}
// 新增住户
export function residentInsert(params) {
return httpService({
url: `/user/resident/insert`,
method: 'post',
data: params,
})
}
// 修改住户
export function residentUpdate(params) {
return httpService({
url: `/user/resident/update`,
method: 'post',
data: params,
})
}
export function residentInfo(params) {
return httpService({
url: `/user/resident/findById`,
method: 'get',
params: params,
})
}
// 住户审核
// 审核列表
export function reviewList(params) {
return httpService({

@ -199,9 +199,6 @@ export default {
},
deep: true,
},
"tree.checkedKeys"(val) {
// console.log('onCheck', val);
},
},
mounted() {
this.getData();

@ -137,7 +137,6 @@ export default {
loading: false,
// index
selectedRowKeys: [],
tableChoosed: [],
tableData: [],
ActionsList: [],
activeName:'1',

@ -2,9 +2,9 @@
<div>
<!-- add -->
<a-drawer
title="新增住户"
:title="title"
:width="720"
:visible="drawer.add.show"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
@ -18,58 +18,65 @@
layout="vertical"
>
<a-row>
<a-col :span="8">
<a-col :span="8" v-if="form.id===null">
<a-form-model-item label="关联房屋" prop="manageEstateId">
<a-cascader
:options="options"
placeholder="Please select"
:options="estateData"
v-model="estateArr"
:field-names="{ label: 'name', value: 'id', children: 'childList' }"
placeholder="楼栋/单元/房间号"
@change="onChange"
style="width: 90%"
/>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="房屋类型">
<a-col :span="8" v-if="form.id===null">
<a-form-model-item label="房屋类型" prop="type">
<a-input
v-model="form.type"
placeholder="请先选择关联房屋"
disabled
style="width: 90%"
/>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-col :span="8" v-if="form.id===null">
<a-form-model-item label="住户身份" prop="identity">
<a-select placeholder="请选择住户身份" style="width: 90%" />
<a-select v-model="form.identity" placeholder="请选择住户身份" style="width: 90%">
<a-select-option v-for="item in options.identity" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="姓名" prop="name">
<a-input placeholder="请输入姓名" style="width: 90%" />
<a-input placeholder="请输入姓名" v-model="form.name" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="手机号" prop="tel">
<a-input placeholder="请输入手机号" style="width: 90%" />
<a-input placeholder="请输入手机号" v-model="form.tel" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="性别" prop="sex">
<a-input placeholder="请选择性别" style="width: 90%" />
<a-select placeholder="请选择性别" v-model="form.sex" style="width: 90%" >
<a-select-option v-for="item in options.sex" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="身份证号" prop="idCard">
<a-input placeholder="请输入身份证号" style="width: 90%" />
<a-input placeholder="请输入身份证号" v-model="form.idCard" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="入住时间" prop="checkTime">
<a-date-picker @change="onChange" />
<a-date-picker v-model="form.checkTime" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="户籍所在地" prop="domicile">
<a-input placeholder="户籍所在地" style="width: 90%" />
<a-input placeholder="户籍所在地" v-model="form.domicile" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -115,24 +122,24 @@
<div v-if="form.identity === 2">
<a-col :span="12">
<a-form-model-item label="业主姓名" prop="ownerName">
<a-input placeholder="请输入业主姓名" style="width: 90%" />
<a-input placeholder="请输入业主姓名" v-model="form.ownerName" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="业主电话" prop="ownerTel">
<a-input placeholder="请输入业主电话" style="width: 90%" />
<a-input placeholder="请输入业主电话" v-model="form.ownerTel" style="width: 90%" />
</a-form-model-item>
</a-col>
</div>
<div v-else-if="form.identity === 4">
<a-col :span="12">
<a-form-model-item label="租户姓名" prop="tenantName">
<a-input placeholder="请输入租户姓名" style="width: 90%" />
<a-input placeholder="请输入租户姓名" v-model="form.tenantName" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="租户电话" prop="tenantTel">
<a-input placeholder="请输入租户电话" style="width: 90%" />
<a-input placeholder="请输入租户电话" v-model="form.tenantTel" style="width: 90%" />
</a-form-model-item>
</a-col>
</div>
@ -140,7 +147,7 @@
<a-divider></a-divider>
<a-col :span="12">
<a-form-model-item label="紧急联系人" prop="emergencyContact">
<a-input placeholder="请输入紧急联系人" style="width: 90%" />
<a-input placeholder="请输入紧急联系人" v-model="form.emergencyContact" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
@ -151,6 +158,7 @@
<a-input
placeholder="请输入紧急联系人电话"
style="width: 90%"
v-model="form.emergencyContactNumber"
/>
</a-form-model-item>
</a-col>
@ -158,42 +166,65 @@
<a-divider></a-divider>
<a-col :span="12">
<a-form-model-item label="婚姻状况" prop="maritalStatus">
<a-select placeholder="请选择婚姻状况" style="width: 90%" />
<a-select v-model="form.maritalStatus" placeholder="请选择婚姻状况" style="width: 90%">
<a-select-option v-for="item in options.maritalStatus" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="民族" prop="nation">
<a-input placeholder="请输入民族" style="width: 90%" />
<a-input placeholder="请输入民族" v-model="form.tenantTel" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="政治面貌" prop="politicalOutlook">
<a-select placeholder="请选择婚姻状况" style="width: 90%" />
<a-select placeholder="请选择婚姻状况" v-model="form.politicalOutlook" style="width: 90%" >
<a-select-option v-for="item in options.politicalOutlook" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="户口类型" prop="accountType">
<a-select placeholder="请选择户口类型" style="width: 90%" />
<a-select placeholder="请选择户口类型" v-model="form.accountType" style="width: 90%" >
<a-select-option v-for="item in options.accountType" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="从事职业" prop="occupation">
<a-input placeholder="请输入从事职业" style="width: 90%" />
<a-input placeholder="请输入从事职业" v-model="form.occupation" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="工作单位" prop="employer">
<a-input placeholder="请输入工作单位" style="width: 90%" />
<a-input placeholder="请输入工作单位" v-model="form.employer" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="工作单位地址" prop="employerAddress">
<a-input placeholder="请输入工作单位地址" style="width: 90%" />
<a-input placeholder="请输入工作单位地址" v-model="form.employerAddress" style="width: 90%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
住户照片
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
list-type="picture-card"
:file-list="fileList"
@preview="handlePreview"
@change="handleChange"
>
<div v-if="fileList.length < 4">
<a-icon type="plus" />
<div class="ant-upload-text">
上传照片
</div>
</div>
</a-upload>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="remarks">
<a-textarea placeholder="请输入备注" style="width: 90%" />
<a-textarea placeholder="请输入备注" v-model="form.remarks" style="width: 90%" />
</a-form-model-item>
</a-col>
</a-row>
@ -202,21 +233,163 @@
<div class="drawer-footer">
<a-button
:style="{ marginRight: '8px' }"
@click="drawer.add.show = false"
@click="addClose"
>
关闭
</a-button>
<a-button type="primary" @click="addClose"> </a-button>
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { form, rules, options } from "./form.js"
import { estate } from '@/api/basic/estate'
import { residentInsert, residentUpdate, residentInfo } from '@/api/basic/resident'
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
export default {
props:{
show:{
default:false,
type:Boolean,
},
editId:Number,
},
data() {
return {
form,
rules,
options,
loading: false,
imageUrl: '',
estateArr:[],
estateData:[],
title:'新增住户',
fileList: [],
}
},
mounted() {
this.getEstate()
},
methods: {
async getEstate(){
let res = await estate()
this.estateData = res.data
this.estateDisable(this.estateData)
},
estateDisable(arr){
arr.forEach((item,index)=>{
if(!item.manageEstateTypeName && item.childList.length === 0){
arr[index].disabled = true
}else if(item.manageEstateTypeName || item.childList.length > 0){
arr[index].disabled = false
}else{
this.estateDisable(item.childList)
}
})
},
submit(){
this.$refs.ruleForm.validate(async valid => {
if(valid){
if(this.title === '新增住户'){
let res = await residentInsert(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.success()
this.addClose()
}else{
this.$message.error(res.msg)
}
}else if(this.title === '修改住户信息'){
let res = await residentUpdate(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.success()
this.addClose()
}else{
this.$message.error(res.msg)
}
}
}
})
},
addClose(){
this.$refs.ruleForm.resetFields();
this.$emit('close')
this.estateArr = []
},
success(){
this.$emit('success')
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
handleChange(info){
console.log(info);
},
beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error('Image must smaller than 2MB!');
}
return isJpgOrPng && isLt2M;
},
onChange(value, selectedOptions){
if(value.length > 0){
this.form.manageEstateId = value[value.length - 1];
this.form.type = selectedOptions[selectedOptions.length - 1].manageEstateTypeName;
}else{
this.form.manageEstateId = undefined;
this.form.type = ''
}
},
},
watch: {
editId(val){
if(val){
this.form.id = val
this.title = '修改住户信息'
residentInfo({id:val}).then(res=>{
this.form.name = res.data.name
this.form.tel = res.data.tel
this.form.sex = res.data.sex
this.form.idCard = res.data.idCard
this.form.checkTime = res.data.checkTime
this.form.domicile = res.data.domicile
this.form.emergencyContact = res.data.emergencyContact
this.form.emergencyContactNumber = res.data.emergencyContactNumber
this.form.maritalStatus = res.data.maritalStatus
this.form.nation = res.data.nation
this.form.politicalOutlook = res.data.politicalOutlook
this.form.accountType = res.data.accountType
this.form.occupation = res.data.occupation
this.form.employer = res.data.employer
this.form.employerAddress = res.data.employerAddress
this.form.remarks = res.data.remarks
// idCardFrontImgUrls
// idCardBackImgUrls
// residentImgUrls
})
}else{
this.form.id = null
this.title = '新增住户'
}
}
}
};

@ -6,7 +6,7 @@ export const columns = [
{
title: "住户姓名",
dataIndex: "name",
width: "10%",
width: "8%",
},
{
title: "住户手机号",
@ -16,7 +16,7 @@ export const columns = [
{
title: "住户性别",
dataIndex: "sex",
width: "8%",
width: "7%",
customRender:function(sex){
switch (sex) {
case 1:
@ -33,7 +33,7 @@ export const columns = [
{
title: "住户身份证号",
dataIndex: "idCard",
width: "10%",
width: "14%",
},
{
title: "房屋名称",
@ -64,7 +64,7 @@ export const columns = [
// 搜索项
export const searchForm = {
keyword: "",
sex: null
sex: undefined,
}
// 分页
export const pagination = {

@ -0,0 +1,81 @@
export const form = {
id:undefined,
manageEstateId: undefined,
type:'',
identity:undefined,
name:undefined,
tel:undefined,
sex:undefined,
idCard:undefined,
checkTime:undefined,
domicile:undefined,
emergencyContact:undefined,
emergencyContactNumber:undefined,
maritalStatus:undefined,
nation:undefined,
politicalOutlook:undefined,
accountType:undefined,
occupation:undefined,
employer:undefined,
employerAddress:undefined,
remarks:undefined,
idCardFrontImgUrls:undefined,
idCardBackImgUrls:undefined,
residentImgUrls:undefined,
ownerName:undefined,
ownerTel:undefined,
tenantName:undefined,
tenantTel:undefined,
}
export const rules = {
manageEstateId:[{required:true,message:'请选择房屋',trigger:'change'}],
identity:[{required:true,message:'请选择身份',trigger:'change'}],
name:[{required:true,message:'请输入姓名',trigger:'blur'}],
tel:[{required:true,message:'请输入电话',trigger:'blur'}],
sex:[{required:true,message:'请选择性别',trigger:'change'}],
idCard:[{required:true,message:'请输入身份证号',trigger:'blur'}],
ownerName:[{required:true,message:'请输入业主姓名',trigger:'blur'}],
ownerTel:[{required:true,message:'请输入业主电话',trigger:'blur'}],
tenantName:[{required:true,message:'请输入租户姓名',trigger:'blur'}],
tenantTel:[{required:true,message:'请输入租户电话',trigger:'blur'}],
}
export const options = {
identity:[
{ id:1, name:'业主' },
{ id:2, name:'业主亲属' },
{ id:3, name:'租户' },
{ id:4, name:'租户亲属' },
],
sex:[
{ id:1, name:'男' },
{ id:2, name:'女' },
{ id:3, name:'保密' },
],
maritalStatus:[
{ id:1, name:'未婚' },
{ id:2, name:'已婚' },
],
politicalOutlook:[
{ id:1, name:'群众' },
{ id:2, name:'中共党员' },
{ id:3, name:'共青团' },
{ id:4, name:'民革党员' },
{ id:5, name:'民盟盟员' },
{ id:6, name:'民建会员' },
{ id:7, name:'民进会员' },
{ id:8, name:'农工党党员' },
{ id:9, name:'致公党党员' },
{ id:10, name:'九三学社社员' },
{ id:11, name:'台盟盟员' },
{ id:12, name:'无党派人士' },
],
accountType:[
{ id:1, name:'农村' },
{ id:2, name:'城市' },
]
}
// 请求头
import store from "@/store";
export const uploadHeaders = {
"manage-login-token": store.getters.getToken,
}

@ -5,14 +5,14 @@
<a-row>
<a-col :span="20">
<a-space size="large">
<a-select style="width: 200px" placeholder="请选择性别" >
<a-select v-model='searchForm.sex' style="width: 200px" placeholder="请选择性别" >
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
<a-select-option value="3">保密</a-select-option>
</a-select>
<a-input style="width: 200px" placeholder="请输入关键字(姓名/手机号)" />
<a-input v-model='searchForm.keyword' style="width: 200px" placeholder="请输入关键字(姓名/手机号)" />
<a-button type="primary" @click='getData'> </a-button>
<a-button> </a-button>
<a-button @click='reset'> </a-button>
</a-space>
</a-col>
<a-col :span="4">
@ -77,8 +77,8 @@
</span>
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link"></a>
<a class="ant-dropdown-link" @click="del(row)"></a>
<a class="ant-dropdown-link" @click="edit(row)"></a>
<!-- <a class="ant-dropdown-link" @click="del(row)"></a> -->
</a-space>
</span>
<span slot="tags" slot-scope="tag">
@ -90,16 +90,21 @@
</span>
</a-table>
</div>
<add-form :show="drawer.add.show" :editId="editId" @close='close' @success='success'></add-form>
</div>
</template>
<script>
import { columns,pagination,searchForm } from './depend/config.js'
import { residentList } from '@/api/basic/resident'
import addForm from './depend/addForm.vue'
export default {
components:{
addForm
},
data() {
return {
imageUrl: '',
editId:null,
form: {
identity: 2
},
@ -111,28 +116,28 @@ export default {
},
table_row:{},
changeId:null,
pagination: pagination,
searchForm:searchForm,
activeAction: undefined,
loading: false,
pagination,
searchForm,
activeAction: undefined,
// index
selectedRowKeys: [],
tableChoosed: [],
//
//
columns: columns,
columns,
newData:[],
//
tableData:[],
ActionsList: [
{
label: "批量删除",
value: 1,
},
{
label: "批量导出",
value: 2,
},
// {
// label: "",
// value: 1,
// },
// {
// label: "",
// value: 2,
// },
],
};
},
@ -149,33 +154,34 @@ export default {
})
this.tableData = res.data.rows
},
addClose(){
this.drawer.add.show = false;
reset(){
this.searchForm = {
keyword: "",
sex: undefined,
}
this.getData()
},
handleChange(info){
console.log(info);
edit(data){
this.editId = data.id
this.drawer.add.show = true;
},
beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error('Image must smaller than 2MB!');
}
return isJpgOrPng && isLt2M;
close(){
this.drawer.add.show = false;
this.editId = null
},
success(){
this.getData()
},
//
changeHouse(value){
//
this.tableData.forEach((item,index)=>{
if(item.id === this.table_row.id) {
console.log(item);
item.residentListEstateVoList.forEach((items)=>{
if(items.id === value){
this.$set(this.tableData[index],'identity' ,items.identity )
this.$set(this.tableData[index],'manageEstateTypeName' ,items.manageEstateTypeName )
this.$set(this.tableData[index],'houseId' ,items.id )
}
})
}
@ -191,24 +197,12 @@ export default {
pager.pageSize = pagination.pageSize;
this.pagination = pager;
},
del(data) {
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "delete",
onOk: function () {
console.log(data);
},
});
},
Actions(data) {
console.log(data);
this.activeAction = undefined;
},
selectionChoosed(data) {
console.log(data);
this.tableChoosed = data;
this.selectedRowKeys = data;
},
},
computed: {

Loading…
Cancel
Save