diff --git a/src/views/modules/user/housinginformation.vue b/src/views/modules/user/housinginformation.vue
index 1801da5..c5fcfbb 100644
--- a/src/views/modules/user/housinginformation.vue
+++ b/src/views/modules/user/housinginformation.vue
@@ -45,6 +45,21 @@
导出模板
+
+
+ 点击上传
+
+
+
+ {{ $t('export') }}
+
{{scope.$index+1}}
@@ -83,6 +98,30 @@
+
+
+
+
+
+
+
+
+ 确定
+
+
@@ -91,6 +130,8 @@
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './housinginformation-add-or-update'
import HousinginformationDetail from './housinginformation-detail'
+import Cookies from 'js-cookie'
+
export default {
mixins: [mixinViewModule],
data () {
@@ -104,7 +145,8 @@ export default {
exportMoudle: '/app-user/housinginformation/exportModule'
},
dataForm: {
- id: ''
+ id: '',
+ gridId: ''
},
deptIdList: [],
options: [],
@@ -122,7 +164,10 @@ export default {
label: '经营'
}
],
- detailVisible: false
+ detailVisible: false,
+ uploadUrl: '',
+ faultDataVisible: false,
+ errorDataList: []
}
},
components: {
@@ -150,6 +195,7 @@ export default {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = this.deptIdList[1]
this.dataForm.gridId = this.deptIdList[2]
+ this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/app-user/housinginformation/importExcel?gridId=${this.deptIdList[2]}&token=${Cookies.get('token')}`
}
}
},
@@ -164,6 +210,7 @@ export default {
})
.catch(() => { })
this.getDataList()
+ this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/app-user/housinginformation/importExcel?gridId=${this.dataForm.gridId}&token=${Cookies.get('token')}`
},
methods: {
houseUseFormatter: function (row, column) {
@@ -186,6 +233,37 @@ export default {
lookResidentInfo (id) {
this.$parent.selectComponent = 'Househeadedit'
this.$router.push({ path: '/user-houseinfomationroute', query: { id: id } })
+ },
+ errorExceed (file, fileList) {
+ this.$message.error('上传失败请重试')
+ },
+ uploadError (error, file, fileList) {
+ this.$message.error(error)
+ },
+ handlePreview (file) {
+ if (this.dataForm.gridId === undefined || this.dataForm.gridId === '') {
+ this.$message.error('请选择网格后导入')
+ return false
+ }
+ },
+ uploadSuccess (response, file, fileList) {
+ this.$refs.upload.clearFiles()
+ if (response.code !== 0) {
+ return this.$message.error(response.msg)
+ }
+ if (response.data !== null && response.data.length > 0) {
+ this.faultDataVisible = true
+ this.errorDataList = response.data
+ return
+ }
+ this.$message({
+ message: this.$t('prompt.success'),
+ type: 'success',
+ duration: 500,
+ onClose: () => {
+ this.getDataList()
+ }
+ })
}
}
}