diff --git a/src/sass/AppResidentDocument/Add.vue b/src/sass/AppResidentDocument/Add.vue index b544291c..3b45f8c6 100644 --- a/src/sass/AppResidentDocument/Add.vue +++ b/src/sass/AppResidentDocument/Add.vue @@ -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() + } + }) + } }, } diff --git a/src/sass/AppResidentDocument/AppResidentDocument.vue b/src/sass/AppResidentDocument/AppResidentDocument.vue index 9c0265bf..4040f797 100644 --- a/src/sass/AppResidentDocument/AppResidentDocument.vue +++ b/src/sass/AppResidentDocument/AppResidentDocument.vue @@ -28,7 +28,13 @@
-
{{ item.name }}
+
+ {{ item.name }} + + + + +
{{ item.idNumber.replace(/^(\w{6})\w{8}(.*)$/, '$1********$2') }} @@ -39,7 +45,7 @@
-
+
新增居民
@@ -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; diff --git a/src/sass/AppResidentDocument/components/img/del-icon.png b/src/sass/AppResidentDocument/components/img/del-icon.png new file mode 100644 index 00000000..b3424dac Binary files /dev/null and b/src/sass/AppResidentDocument/components/img/del-icon.png differ diff --git a/src/sass/AppResidentDocument/components/img/edit-icon.png b/src/sass/AppResidentDocument/components/img/edit-icon.png new file mode 100644 index 00000000..30a07533 Binary files /dev/null and b/src/sass/AppResidentDocument/components/img/edit-icon.png differ