基础功能

dev
bibi 3 years ago
parent 4d794173d1
commit c1b1091239

@ -38,6 +38,30 @@ export function residentInfo(params) {
params: 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) { export function reviewList(params) {

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

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

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

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

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

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

@ -74,4 +74,9 @@ export const pagination = {
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: 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 = { export const form = {
id:undefined, id:null,
manageEstateId: undefined, manageEstateId: undefined,
type:'', type:'',
identity:undefined, identity:undefined,

@ -16,7 +16,7 @@
</a-space> </a-space>
</a-col> </a-col>
<a-col :span="4"> <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-col>
</a-row> </a-row>
</div> </div>
@ -49,6 +49,7 @@
:data-source="tableData" :data-source="tableData"
:pagination="pagination" :pagination="pagination"
:scroll="{ x: 1400 }" :scroll="{ x: 1400 }"
@change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed, onChange: selectionChoosed,
@ -78,7 +79,8 @@
<span slot="action" slot-scope="text, row"> <span slot="action" slot-scope="text, row">
<a-space> <a-space>
<a class="ant-dropdown-link" @click="edit(row)"></a> <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> </a-space>
</span> </span>
<span slot="tags" slot-scope="tag"> <span slot="tags" slot-scope="tag">
@ -90,13 +92,50 @@
</span> </span>
</a-table> </a-table>
</div> </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> </div>
</template> </template>
<script> <script>
import { columns,pagination,searchForm } from './depend/config.js' import { columns,pagination,searchForm, rules } from './depend/config.js'
import { residentList } from '@/api/basic/resident' import { estate } from '@/api/basic/estate'
import { residentList, moveIn, moveOut, findTenantByEstateId } from '@/api/basic/resident'
import addForm from './depend/addForm.vue' import addForm from './depend/addForm.vue'
export default { export default {
components:{ components:{
@ -108,10 +147,18 @@ export default {
form: { form: {
identity: 2 identity: 2
}, },
drawer: { inform:{
add: { estateId:undefined,
show: false residentId:undefined,
}, identity:undefined,
linkUserId:undefined,
},
estateArr:[],
estateData:[],
rules,
show: {
add: false,
in:false,
detail:{} detail:{}
}, },
table_row:{}, table_row:{},
@ -129,6 +176,15 @@ export default {
newData:[], newData:[],
// //
tableData:[], tableData:[],
options:{
identity:[
{ id:1, name:'业主' },
{ id:2, name:'业主亲属' },
{ id:3, name:'租户' },
{ id:4, name:'租户亲属' },
],
tenant:[]
},
ActionsList: [ ActionsList: [
// { // {
// label: "", // label: "",
@ -143,6 +199,7 @@ export default {
}, },
mounted(){ mounted(){
this.getData() this.getData()
this.getEstate()
}, },
methods: { methods: {
async getData() { async getData() {
@ -153,7 +210,26 @@ export default {
keyword:this.searchForm.keyword, keyword:this.searchForm.keyword,
}) })
this.tableData = res.data.rows 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(){ reset(){
this.searchForm = { this.searchForm = {
keyword: "", keyword: "",
@ -161,14 +237,17 @@ export default {
} }
this.getData() this.getData()
}, },
//
edit(data){ edit(data){
this.editId = data.id this.editId = data.id
this.drawer.add.show = true; this.show.add = true;
}, },
// form
close(){ close(){
this.drawer.add.show = false; this.show.add = false;
this.editId = null this.editId = null
}, },
// form
success(){ success(){
this.getData() this.getData()
}, },
@ -191,11 +270,11 @@ export default {
this.table_row = row this.table_row = row
}, },
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination }; const pager = { ...this.pagination };
pager.current = pagination.current; pager.current = pagination.current;
pager.pageSize = pagination.pageSize; pager.pageSize = pagination.pageSize;
this.pagination = pager; this.pagination = pager;
this.getData()
}, },
Actions(data) { Actions(data) {
console.log(data); console.log(data);
@ -204,6 +283,55 @@ export default {
selectionChoosed(data) { selectionChoosed(data) {
this.selectedRowKeys = 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: { computed: {
// selection // selection

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

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

Loading…
Cancel
Save