居民管理

This commit is contained in:
liuye
2022-02-07 16:57:08 +08:00
parent c1bca8536d
commit d521226d38
4 changed files with 50 additions and 6 deletions

View File

@@ -144,6 +144,7 @@ export default {
data() {
return {
form: {
id: '',
householdName: '',
householdIdNumber: '',
householdRelation: '',
@@ -164,8 +165,14 @@ export default {
selectList: []
}
},
onLoad() {
document.title = '新增居民'
onLoad(options) {
if(options.id) {
document.title = '编辑居民'
this.form.id = options.id
this.getDetail()
}else {
document.title = '新增居民'
}
this.$dict.load('yesOrNo', 'sex', 'householdRelation', 'nation', 'education', 'maritalStatus', 'politicsStatus', 'militaryStatus', 'faithType')
},
computed: {
@@ -251,6 +258,15 @@ export default {
onHouseAreaChange(e) {
this.form.householdAreaId = e
},
getDetail() {
this.$http.post(`/app/appresident/detail?id=${this.form.id}`).then(res => {
if (res.code === 0) {
this.form = {...res.data.resident}
this.changeIdNumber()
}
})
}
},
}
</script>

View File

@@ -28,7 +28,13 @@
</div>
<div class="right">
<div class="rightTop">{{ item.name }}</div>
<div class="rightTop">
<span class="name">{{ item.name }}</span>
<span class="btn">
<img src="./components/img/edit-icon.png" alt="" @click.stop="edit(item.id)">
<img src="./components/img/del-icon.png" alt="" @click.stop="del(item.id)">
</span>
</div>
<div class="rightBottom">
<span>{{ item.idNumber.replace(/^(\w{6})\w{8}(.*)$/, '$1********$2') }}</span>
@@ -39,7 +45,7 @@
</div>
<AiEmpty class="emptyWrap" v-else :noPermit="true" description="暂无居民<br/>信息点击按钮新增居民信息,也可在管理系统批量导入"></AiEmpty>
<div class="pad-b112"></div>
<div class="add-btn" @click="toAdd">
<div class="add-btn" @click="edit('')">
<div>新增居民</div>
</div>
</div>
@@ -137,8 +143,21 @@ export default {
this.current = 1
this.getList()
},
toAdd() {
uni.navigateTo({url: './Add'})
edit(id) {
uni.navigateTo({url: `./Add?id=${id}`})
},
del(id) {
this.$confirm('确定删除该数据?').then(() => {
uni.showLoading()
this.$http.post(`/app/appresident/delete?ids=${id}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.current = 1
this.getList()
}
uni.hideLoading()
})
}).catch(() => {})
}
},
onReachBottom() {
@@ -222,6 +241,15 @@ uni-page-body {
font-size: 32px;
font-weight: 500;
color: #333333;
display: flex;
justify-content: space-between;
.btn{
img{
width: 48px;
height: 48px;
margin-left: 40px;
}
}
}
.rightBottom {
display: flex;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB