@@ -197,7 +215,7 @@ export default {
if (fromTree) {
this.agencyObj = treeObj
}
-
+ console.log(this.agencyObj)
const url = "/gov/org/building/buildinglist"
let params = {
pageSize: this.pageSize,
@@ -246,6 +264,7 @@ export default {
this.$refs.ref_form.initForm('edit', row, this.agencyObj)
})
},
+
handleToNextLevel (row) {
this.$emit('toNextLevel', row, 'building')
},
@@ -355,11 +374,20 @@ export default {
},
- handleExportModule () {
+ handleExportModule (type) {
+
let title = ''
- title = '楼栋模板'
+ let url = ""
+ if (type === 'building') {
+ title = '楼宇导入模板'
+ url = '/gov/org/building/exporttemplate'
+
+ } else if (type === 'room') {
+ title = '房屋导入模板'
+ url = '/gov/org/house/exporttemplate'
+ }
+
- const url = "/gov/org/building/exporttemplate"
let params = {}
app.ajax.exportFilePost(
@@ -375,8 +403,9 @@ export default {
);
},
+
// 上传文件之前的钩子
- beforeUpload (file) {
+ beforeUpload (file, type) {
this.files = file;
const isText = file.type === 'application/vnd.ms-excel'
@@ -384,6 +413,8 @@ export default {
if (!isText && !isTextComputer) {
this.$message.error('请选择正确格式的文件')
+ this.files = null
+ this.fileName = ''
return false
} else {
this.fileName = file.name;
@@ -396,34 +427,58 @@ export default {
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
},
- async uploadFile () {
- this.loading = true
-
+ async uploadFile (type) {
if (this.fileName == "") {
- this.$message.warning('请选择要上传的文件!')
+
return false
}
+ this.loading = true
- //清空上传列表
- this.$refs['upload'].clearFiles()
- var url = '/gov/org/building/import'
+ //清空上传列表
+ let url = ''
+ let params = {}
let fileFormData = new FormData();
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
- const { data, code, msg } = await requestPost(url, fileFormData)
- if (code === 0) {
+ // params.file = fileFormData
+ // params.orgId = this.agencyObj.id
+ // params.orgType = this.agencyObj.level
+
+ if (type === 'building') {
+ this.$refs['upload_building'].clearFiles()
+ // url = 'http://192.168.51.26:8080/api/gov/org/building/buildingimport'
+ url = '/gov/org/building/buildingimport'
- this.$message({
- type: "success",
- message: "导入成功"
- });
- this.$emit('refreshTree')
- this.loadTable()
- } else {
- this.$message.error(msg)
- }
+ } else if (type === 'room') {
+ this.$refs['upload_room'].clearFiles()
+ // url = 'http://192.168.51.26:8080/api/gov/org/house/houseimport'
+ url = '/gov/org/house/houseimport'
+
+ }
+ this.startLoading()
+ window.app.ajax.post2(url, fileFormData,
+ (data, rspMsg) => {
+ this.endLoading()
+ if (data.code === 0 || data.code > 8000) {
+ // this.$message({
+ // type: "success",
+ // message: "导入成功"
+ // });
+ this.$message.success(rspMsg)
+ this.$emit('refreshTree')
+ this.loadTable()
+ } else {
+ this.$message.error(rspMsg)
+ }
+ },
+ (rspMsg, data) => {
+ this.endLoading()
+ this.$message.error(rspMsg)
+ }, { headers: { 'Content-Type': 'multipart/form-data' } })
},
@@ -510,6 +565,7 @@ export default {
}
.div_btn {
+ display: flex;
margin-top: 20px;
}
diff --git a/src/views/modules/base/community/community.vue b/src/views/modules/base/community/community.vue
index 41005ba13..14254aa9d 100644
--- a/src/views/modules/base/community/community.vue
+++ b/src/views/modules/base/community/community.vue
@@ -27,7 +27,7 @@
-
@@ -151,7 +151,7 @@ export default {
if (obj.level === 'building') {//点击楼栋
this.$refs['ref_buildingTable'].loadTable(true, this.selTreeObj)
- } else if (obj.level === 'neighbourHood') {//点击小区
+ } else if (obj.level === 'neighborHood') {//点击小区
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj)
} else {
@@ -200,7 +200,7 @@ export default {
obj.communityId = communityNode.data.id
obj.communityName = communityNode.data.label
- } else if (obj.level === 'neighbourHood') {//点击小区
+ } else if (obj.level === 'neighborHood') {//点击小区
let gridNode = this.$refs.ref_tree.getNode(obj.pid)
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid)
diff --git a/src/views/modules/base/community/communityTable.vue b/src/views/modules/base/community/communityTable.vue
index 211b44eac..e475a5c0a 100644
--- a/src/views/modules/base/community/communityTable.vue
+++ b/src/views/modules/base/community/communityTable.vue
@@ -39,62 +39,61 @@
type="green"
size="small"
@click="handleAdd">新增小区
- 下载小区模板
-
-
-
+ 导入小区数据
-
-
- 下载楼宇模板
-
-
- 下载小区模板
+
+
+ 导入小区数据
+
+
+ 导入楼宇数据
-
- 下载房屋模板
-
-
- 下载楼宇模板
+
+
+ 导入楼宇数据
+
+ 导入房屋数据
-
+ @click="handleExportModule('room')">下载房屋模板
+
+
+ 导入房屋数据
+
+
@@ -241,9 +240,9 @@ export default {
if (fromTree) {
this.agencyObj = treeObj
}
-
+ console.log(this.agencyObj)
const url = "/gov/org/neighborhood/neighborhoodlist"
- // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodlist"
+
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
@@ -401,11 +400,22 @@ export default {
},
- handleExportModule () {
+ handleExportModule (type) {
let title = ''
- title = '小区模板'
+ let url = ""
+ if (type === 'community') {
+ title = '小区导入模板'
+ url = '/gov/org/neighborhood/exporttemplate'
+
+ } else if (type === 'building') {
+ title = '楼宇导入模板'
+ url = '/gov/org/building/exporttemplate'
+
+ } else if (type === 'room') {
+ title = '房间导入模板'
+ url = '/gov/org/house/exporttemplate'
+ }
- const url = "/gov/org/neighborhood/exporttemplate"
let params = {}
app.ajax.exportFilePost(
@@ -441,11 +451,10 @@ export default {
},
// 上传文件个数超过定义的数量
handleExceed (files, fileList) {
-
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
},
- async uploadFile () {
+ async uploadFile (type) {
if (this.fileName == "") {
@@ -454,25 +463,53 @@ export default {
this.loading = true
//清空上传列表
- this.$refs['upload'].clearFiles()
+ let url = ''
- var url = '/gov/org/neighborhood/import'
let fileFormData = new FormData();
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgType', this.agencyObj.level === 'grid' ? 'grid' : 'agency');//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
- const { data, code, msg } = await requestPost(url, fileFormData)
- if (code === 0) {
- this.$message({
- type: "success",
- message: "导入成功"
- });
- this.$emit('refreshTree')
- this.loadTable()
- } else {
- // debugger
- // this.$message.error(msg)
+
+
+ if (type === 'community') {
+ this.$refs['upload_community'].clearFiles()
+ url = '/gov/org/icneighborhood/neighborhoodimport'
+
+
+ } else if (type === 'building') {
+ this.$refs['upload_building'].clearFiles()
+ url = '/gov/org/building/buildingimport'
+
+
+ } else if (type === 'room') {
+ this.$refs['upload_room'].clearFiles()
+ url = '/gov/org/house/houseimport'
+
}
+ this.startLoading()
+ window.app.ajax.post2(url, fileFormData,
+ (data, rspMsg) => {
+ this.endLoading()
+ if (data.code === 0 || data.code > 8000) {
+ // this.$message({
+ // type: "success",
+ // message: "导入成功"
+ // });
+ this.$message.success(rspMsg)
+ this.$emit('refreshTree')
+ this.loadTable()
+ } else {
+ this.$message.error(rspMsg)
+ }
+ },
+ (rspMsg, data) => {
+ this.endLoading()
+ this.$message.error(rspMsg)
+ }, { headers: { 'Content-Type': 'multipart/form-data' } })
+
+
},
@@ -560,6 +597,11 @@ export default {
.div_btn {
display: flex;
margin-top: 20px;
+
+ .btn_upload {
+ margin-left: 10px;
+ display: flex;
+ }
}
.el-row {
diff --git a/src/views/modules/base/community/roomTable.vue b/src/views/modules/base/community/roomTable.vue
index 7aacb8352..7addb7cf9 100644
--- a/src/views/modules/base/community/roomTable.vue
+++ b/src/views/modules/base/community/roomTable.vue
@@ -210,6 +210,7 @@ export default {
if (fromTree) {
this.agencyObj = treeObj
}
+
const url = "/gov/org/house/houselist"
let params = {
@@ -416,21 +417,33 @@ export default {
//清空上传列表
this.$refs['upload'].clearFiles()
- var url = '/gov/org/house/import'
+ var url = '/gov/org/house/houseimport'
+
let fileFormData = new FormData();
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
+ fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
- const { data, code, msg } = await requestPost(url, fileFormData)
- if (code === 0) {
- this.$message({
- type: "success",
- message: "导入成功"
- });
- this.$emit('refreshTree')
- this.loadTable()
- } else {
- this.$message.error(msg)
- }
+ this.startLoading()
+ window.app.ajax.post2(url, fileFormData,
+ (data, rspMsg) => {
+ this.endLoading()
+ if (data.code === 0 || data.code > 8000) {
+ // this.$message({
+ // type: "success",
+ // message: "导入成功"
+ // });
+ this.$message.success(rspMsg)
+ this.$emit('refreshTree')
+ this.loadTable()
+ } else {
+ this.$message.error(rspMsg)
+ }
+ },
+ (rspMsg, data) => {
+ this.endLoading()
+ this.$message.error(rspMsg)
+ }, { headers: { 'Content-Type': 'multipart/form-data' } })
},
diff --git a/src/views/modules/communityParty/elegant/index.vue b/src/views/modules/communityParty/elegant/index.vue
index 422df400c..e7d9257b8 100644
--- a/src/views/modules/communityParty/elegant/index.vue
+++ b/src/views/modules/communityParty/elegant/index.vue
@@ -13,15 +13,26 @@
+