基础功能

dev
bibi 3 years ago
parent 4d794173d1
commit c1b1091239

@ -38,6 +38,30 @@ export function residentInfo(params) {
params: params,
})
}
// 迁出
export function moveOut(params) {
return httpService({
url: `/user/resident/moveOut`,
method: 'post',
data: params,
})
}
// 迁入
export function moveIn(params) {
return httpService({
url: `/user/resident/moveIn`,
method: 'post',
data: params,
})
}
// 根据房屋查租户
export function findTenantByEstateId(params) {
return httpService({
url: `/user/resident/findTenantByEstateId`,
method: 'get',
params: params,
})
}
// 住户审核
// 审核列表
export function reviewList(params) {

@ -29,6 +29,7 @@
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,

@ -80,7 +80,6 @@
</template>
<script>
import { columns, pagination, searchForm } from "./config.js";
import { getrolelist, FindAllMenus, roleDel } from "@/api/basic/role";
import addForm from "./form.vue";
export default {
@ -94,13 +93,7 @@ export default {
title: "新增角色",
editId:null
},
tableChoosed: [],
roleList: [],
//
pagination: pagination,
//
columns: columns,
searchForm: searchForm,
expandedKeys: [],
replaceFields: {
children: "childrenList",
@ -110,8 +103,6 @@ export default {
autoExpandParent: true,
checkedKeys: [],
selectedKeys: [],
//
tableData: [],
ActionsList: [],
menus: [],
};
@ -180,33 +171,6 @@ export default {
// console.log('onSelect', info);
this.selectedKeys = selectedKeys;
},
reset() {
this.searchForm.keyword = "";
},
handleTableChange(pagination) {
const pager = { ...this.pagination };
pager.current = pagination.current;
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);
},
selectionChoosed(data) {
console.log(data);
this.tableChoosed = data;
},
},
watch: {
checkedKeys(val) {

@ -274,7 +274,6 @@ export default {
this.getPeople();
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;

@ -92,7 +92,6 @@ export default {
this.getData()
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;

@ -58,6 +58,7 @@
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,

@ -80,38 +80,42 @@
</a-form-model-item>
</a-col>
<a-col :span="12">
身份证徽面照
身份证头像照
<!-- head -->
<a-upload
name="avatar"
list-type="picture-card"
class="avatar-uploader"
:show-upload-list="false"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:before-upload="beforeUpload"
@change="handleChange"
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG,.jpeg,.JPEG'
@preview="handlePreview"
@change="headChange"
:file-list="headList"
>
<img v-if="imageUrl" :src="imageUrl" alt="avatar" />
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text"></div>
<div v-if="headList.length < 1">
<a-icon type="plus" />
<div class="ant-upload-text">
上传照片
</div>
</div>
</a-upload>
</a-col>
<a-col :span="12">
身份证头像照
身份证徽面照
<!-- back -->
<a-upload
name="avatar"
list-type="picture-card"
class="avatar-uploader"
:show-upload-list="false"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:before-upload="beforeUpload"
@change="handleChange"
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG,.jpeg,.JPEG'
@preview="handlePreview"
@change="backChange"
:file-list="backList"
>
<img v-if="imageUrl" :src="imageUrl" alt="avatar" />
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text"></div>
<div v-if="backList.length < 1">
<a-icon type="plus" />
<div class="ant-upload-text">
上传照片
</div>
</div>
</a-upload>
</a-col>
@ -207,14 +211,17 @@
</a-col>
<a-col :span="24">
住户照片
<!-- pic -->
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
list-type="picture-card"
:file-list="fileList"
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG,.jpeg,.JPEG'
@preview="handlePreview"
@change="handleChange"
@change="picChange"
:file-list="picList"
>
<div v-if="fileList.length < 4">
<div v-if="picList.length < 4">
<a-icon type="plus" />
<div class="ant-upload-text">
上传照片
@ -240,11 +247,14 @@
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</div>
</template>
<script>
import { form, rules, options } from "./form.js"
import { form, rules, options, uploadHeaders } from "./form.js"
import { estate } from '@/api/basic/estate'
import { residentInsert, residentUpdate, residentInfo } from '@/api/basic/resident'
function getBase64(file) {
@ -269,11 +279,15 @@ export default {
rules,
options,
loading: false,
imageUrl: '',
estateArr:[],
estateData:[],
title:'新增住户',
fileList: [],
previewVisible:false,
uploadHeaders,
previewImage:'',
headList: [],
backList: [],
picList: [],
}
},
mounted() {
@ -297,6 +311,43 @@ export default {
})
},
submit(){
//
//
let head = []
for(let item of this.headList){
//
if(item.response){
head.push(item.response.data)
}else{
//
head.push(item.url.split('/')[item.url.split('/').length-1])
}
}
this.form.idCardFrontImgUrls = head
//
let back = []
for(let item of this.backList){
//
if(item.response){
back.push(item.response.data)
}else{
//
back.push(item.url.split('/')[item.url.split('/').length-1])
}
}
this.form.idCardBackImgUrls = back
//
let pic = []
for(let item of this.picList){
//
if(item.response){
pic.push(item.response.data)
}else{
//
pic.push(item.url.split('/')[item.url.split('/').length-1])
}
}
this.form.residentImgUrls = pic
this.$refs.ruleForm.validate(async valid => {
if(valid){
if(this.title === '新增住户'){
@ -325,6 +376,9 @@ export default {
this.$refs.ruleForm.resetFields();
this.$emit('close')
this.estateArr = []
this.headList = []
this.backList = []
this.picList = []
},
success(){
this.$emit('success')
@ -336,8 +390,17 @@ export default {
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
handleChange(info){
console.log(info);
headChange(info){
this.headList = info.fileList
},
backChange(info){
this.backList = info.fileList
},
picChange(info){
this.picList = info.fileList
},
handleCancel() {
this.previewVisible = false;
},
beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
@ -385,6 +448,42 @@ export default {
// idCardFrontImgUrls
// idCardBackImgUrls
// residentImgUrls
const head = []
for(let item of res.data.idCardFrontImgUrls){
let obj = {
name:item.url.split('_')[0] +'.'+ item.url.split('.')[1],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
thumbUrl: this.$ImgUrl(item.url),
}
head.push(obj)
}
this.headList = head
const back = []
for(let item of res.data.idCardBackImgUrls){
let obj = {
name:item.url.split('_')[0] +'.'+ item.url.split('.')[1],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
thumbUrl: this.$ImgUrl(item.url),
}
back.push(obj)
}
this.backList = back
const pic = []
for(let item of res.data.residentImgUrls){
let obj = {
name:item.url.split('_')[0] +'.'+ item.url.split('.')[1],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
thumbUrl: this.$ImgUrl(item.url),
}
pic.push(obj)
}
this.picList = pic
})
}else{
this.form.id = null
@ -394,6 +493,6 @@ export default {
}
};
</script>
<style lang="less" scoped>
<style>
</style>

@ -75,3 +75,8 @@ export const pagination = {
showSizeChanger: true,
showQuickJumper: true,
}
export const rules = {
estateId:[{required:true,message:'请选择房屋',trigger:'change'}],
identity:[{required:true,message:'请选择身份',trigger:'change'}],
linkUserId :[{required:true,message:'请输入姓名',trigger:'change'}],
}

@ -1,5 +1,5 @@
export const form = {
id:undefined,
id:null,
manageEstateId: undefined,
type:'',
identity:undefined,

@ -16,7 +16,7 @@
</a-space>
</a-col>
<a-col :span="4">
<a-button class="add-btn" @click="drawer.add.show = true">添加住户</a-button>
<a-button class="add-btn" @click="show.add = true">添加住户</a-button>
</a-col>
</a-row>
</div>
@ -49,6 +49,7 @@
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
@ -78,7 +79,8 @@
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link" @click="edit(row)"></a>
<!-- <a class="ant-dropdown-link" @click="del(row)"></a> -->
<a class="ant-dropdown-link" @click="show.in=true,inform.residentId = row.id">迁入</a>
<a class="ant-dropdown-link" @click="out(row)"></a>
</a-space>
</span>
<span slot="tags" slot-scope="tag">
@ -90,13 +92,50 @@
</span>
</a-table>
</div>
<add-form :show="drawer.add.show" :editId="editId" @close='close' @success='success'></add-form>
<add-form :show="show.add" :editId="editId" @close='close' @success='success'></add-form>
<a-modal
title="迁入"
:visible="show.in"
@ok="insubmit"
@cancel="inclose"
>
<div>
<a-form-model
ref="ruleForm"
:model="inform"
:rules="rules"
layout="vertical"
>
<a-form-model-item label="关联房屋" prop="estateId">
<a-cascader
:options="estateData"
v-model="estateArr"
:field-names="{ label: 'name', value: 'id', children: 'childList' }"
placeholder="楼栋/单元/房间号"
@change="onChange"
style="width: 90%"
/>
</a-form-model-item>
<a-form-model-item label="住户身份" prop="identity">
<a-select v-model="inform.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-form-model-item label="房屋租户" prop="linkUserId" v-if="inform.identity===4">
<a-select v-model="inform.linkUserId" placeholder="请选择住户身份" style="width: 90%">
<a-select-option v-for="item in options.tenant" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</a-modal>
</div>
</template>
<script>
import { columns,pagination,searchForm } from './depend/config.js'
import { residentList } from '@/api/basic/resident'
import { columns,pagination,searchForm, rules } from './depend/config.js'
import { estate } from '@/api/basic/estate'
import { residentList, moveIn, moveOut, findTenantByEstateId } from '@/api/basic/resident'
import addForm from './depend/addForm.vue'
export default {
components:{
@ -108,10 +147,18 @@ export default {
form: {
identity: 2
},
drawer: {
add: {
show: false
},
inform:{
estateId:undefined,
residentId:undefined,
identity:undefined,
linkUserId:undefined,
},
estateArr:[],
estateData:[],
rules,
show: {
add: false,
in:false,
detail:{}
},
table_row:{},
@ -129,6 +176,15 @@ export default {
newData:[],
//
tableData:[],
options:{
identity:[
{ id:1, name:'业主' },
{ id:2, name:'业主亲属' },
{ id:3, name:'租户' },
{ id:4, name:'租户亲属' },
],
tenant:[]
},
ActionsList: [
// {
// label: "",
@ -143,6 +199,7 @@ export default {
},
mounted(){
this.getData()
this.getEstate()
},
methods: {
async getData() {
@ -153,7 +210,26 @@ export default {
keyword:this.searchForm.keyword,
})
this.tableData = res.data.rows
this.pagination.total = res.data.total
},
//
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)
}
})
},
//
reset(){
this.searchForm = {
keyword: "",
@ -161,14 +237,17 @@ export default {
}
this.getData()
},
//
edit(data){
this.editId = data.id
this.drawer.add.show = true;
this.show.add = true;
},
// form
close(){
this.drawer.add.show = false;
this.show.add = false;
this.editId = null
},
// form
success(){
this.getData()
},
@ -191,11 +270,11 @@ export default {
this.table_row = row
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData()
},
Actions(data) {
console.log(data);
@ -204,6 +283,55 @@ export default {
selectionChoosed(data) {
this.selectedRowKeys = data;
},
async insubmit(){//
console.log(this.inform);
this.$refs.ruleForm.validate(async valid => {
if(valid){let res = await moveIn(this.inform)
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
this.inclose()
}else{
this.$message.error(res.msg)
}}
})
},
inclose(){
this.$refs.ruleForm.resetFields();
this.estateArr = []
this.show.in = false
},
out(data) {//
if(!data.houseId) {
this.$message.error('请先选择房屋')
return
}
this.$confirm({
title: "是否迁出",
// okText:'',
// cancelText:'',
icon: "logout",
onOk:async ()=> {
let res = await moveOut({estateId:data.houseId,residentId:data.id})
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
}else{
this.$message.error(res.msg)
}
},
});
},
onChange(value, selectedOptions){
if(value.length > 0){
this.inform.estateId = value[value.length - 1];
findTenantByEstateId({estateId:this.inform.estateId}).then(res =>{
this.options.tenant = res.data
})
}else{
this.inform.estateId = undefined;
}
},
},
computed: {
// selection

@ -53,6 +53,7 @@
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,

@ -74,6 +74,7 @@
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,

Loading…
Cancel
Save