|
@@ -142,6 +142,9 @@ export default {
|
|
|
if (this.importType === 'FQInsert') {
|
|
|
this.importFQ()
|
|
|
}
|
|
|
+ if (this.importType === 'buildInsert') {
|
|
|
+ this.importBuild()
|
|
|
+ }
|
|
|
},
|
|
|
importGroup() {
|
|
|
this.loading = true
|
|
@@ -207,6 +210,70 @@ export default {
|
|
|
console.log('biz user list error', err, x)
|
|
|
})
|
|
|
},
|
|
|
+ importBuild() {
|
|
|
+ this.loading = true
|
|
|
+ this.$axios({
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'multipart/form-data'
|
|
|
+ },
|
|
|
+ method: 'post',
|
|
|
+ url: this.$constant.BASE_URI + '/MnpBuildingController/handleImport',
|
|
|
+ data: this.file
|
|
|
+ }).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '上传成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ // this.$emit('cancelUpload', true)
|
|
|
+ this.successCount = res.data.data.successCount
|
|
|
+ this.errorCount = res.data.data.errorCount
|
|
|
+ this.tableData = res.data.data.errorList || []
|
|
|
+ this.isImport = true
|
|
|
+ console.log('上传成功....')
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.data.msg,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch((err, x) => {
|
|
|
+ console.log('biz user list error', err, x)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ importRoom() {
|
|
|
+ this.loading = true
|
|
|
+ this.$axios({
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'multipart/form-data'
|
|
|
+ },
|
|
|
+ method: 'post',
|
|
|
+ url: this.$constant.BASE_URI + '/ParkRoomController/handleImport',
|
|
|
+ data: this.file
|
|
|
+ }).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '上传成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ // this.$emit('cancelUpload', true)
|
|
|
+ this.successCount = res.data.data.successCount
|
|
|
+ this.errorCount = res.data.data.errorCount
|
|
|
+ this.tableData = res.data.data.errorList || []
|
|
|
+ this.isImport = true
|
|
|
+ console.log('上传成功....')
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.data.msg,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch((err, x) => {
|
|
|
+ console.log('biz user list error', err, x)
|
|
|
+ })
|
|
|
+ },
|
|
|
closeUpload() {
|
|
|
// 关闭弹窗
|
|
|
this.$emit('cancelUpload')
|
|
@@ -345,6 +412,12 @@ export default {
|
|
|
if (this.importType === 'FQInsert') {
|
|
|
this.downloadFQTemplate()
|
|
|
}
|
|
|
+ if (this.importType === 'buildInsert') {
|
|
|
+ this.downloadBuildTemplate()
|
|
|
+ }
|
|
|
+ if (this.importType === 'roomInsert') {
|
|
|
+ this.downloadRoomTemplate()
|
|
|
+ }
|
|
|
},
|
|
|
downloadGroupTemplate() {
|
|
|
const outData = []
|
|
@@ -469,6 +542,139 @@ export default {
|
|
|
URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
document.body.removeChild(elink)
|
|
|
},
|
|
|
+ downloadBuildTemplate() {
|
|
|
+ const outData = []
|
|
|
+ const title = []
|
|
|
+ title.push('楼盘/小区名称')
|
|
|
+ title.push('分期名称')
|
|
|
+ title.push('单元/楼栋号')
|
|
|
+ title.push('总面积(㎡)')
|
|
|
+ title.push('住宅面积(㎡)')
|
|
|
+ title.push('非住宅面积(㎡)')
|
|
|
+ title.push('占地面积(㎡)')
|
|
|
+ title.push('地下面积(㎡)')
|
|
|
+ title.push('房号')
|
|
|
+ title.push('套数')
|
|
|
+ title.push('总层数')
|
|
|
+ title.push('地上层数')
|
|
|
+ title.push('地下层数')
|
|
|
+ title.push('结构')
|
|
|
+ title.push('行政区划')
|
|
|
+ title.push('地号')
|
|
|
+ title.push('备注')
|
|
|
+ title.push('标准价格参考层及差价系数备注说明')
|
|
|
+
|
|
|
+ outData.push(title)
|
|
|
+ const outSize = []
|
|
|
+ title.forEach(item => {
|
|
|
+ if (item.length > 4) {
|
|
|
+ outSize.push({
|
|
|
+ wch: 30
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ outSize.push({
|
|
|
+ wch: 15
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let fileName = '模板'
|
|
|
+ if (this.importTitle === '批量导入') {
|
|
|
+ fileName = '导入模板'
|
|
|
+ }
|
|
|
+ if (this.importTitle === '批量更新') {
|
|
|
+ fileName = '更新模板'
|
|
|
+ }
|
|
|
+ const ws = XLSX.utils.aoa_to_sheet(outData)
|
|
|
+ ws['!cols'] = outSize
|
|
|
+ ws['!rows'] = []
|
|
|
+ const wb = XLSX.utils.book_new()
|
|
|
+ XLSX.utils.book_append_sheet(wb, ws, fileName)
|
|
|
+ const tmpDown = new Blob([
|
|
|
+ this.s2ab(
|
|
|
+ XLSXStyle.write(wb, {
|
|
|
+ bookType: 'xlsx',
|
|
|
+ bookSST: true,
|
|
|
+ type: 'binary',
|
|
|
+ cellStyles: true
|
|
|
+ })
|
|
|
+ )
|
|
|
+ ])
|
|
|
+ const elink = document.createElement('a')
|
|
|
+ elink.download = decodeURIComponent(fileName + '.xlsx')
|
|
|
+ elink.style.display = 'none'
|
|
|
+ elink.href = URL.createObjectURL(tmpDown)
|
|
|
+ document.body.appendChild(elink)
|
|
|
+ elink.click()
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
+ document.body.removeChild(elink)
|
|
|
+ },
|
|
|
+ downloadRoomTemplate() {
|
|
|
+ const outData = []
|
|
|
+ const title = []
|
|
|
+ title.push('楼盘/小区名称')
|
|
|
+ title.push('分期名称')
|
|
|
+ title.push('单元/楼栋号')
|
|
|
+ title.push('户室号')
|
|
|
+ title.push('所在层')
|
|
|
+ title.push('预测套内面积')
|
|
|
+ title.push('预测分摊面积')
|
|
|
+ title.push('预测建筑面积')
|
|
|
+ title.push('预测土地面积')
|
|
|
+ title.push('实测套内面积')
|
|
|
+ title.push('实测分摊面积')
|
|
|
+ title.push('实测建筑面积')
|
|
|
+ title.push('实测土地面积')
|
|
|
+ title.push('用途')
|
|
|
+ title.push('户编号')
|
|
|
+ title.push('装修情况')
|
|
|
+ title.push('2.2M以')
|
|
|
+ title.push('户型')
|
|
|
+ title.push('备注')
|
|
|
+ title.push('可售状态')
|
|
|
+ outData.push(title)
|
|
|
+ const outSize = []
|
|
|
+ title.forEach(item => {
|
|
|
+ if (item.length > 4) {
|
|
|
+ outSize.push({
|
|
|
+ wch: 30
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ outSize.push({
|
|
|
+ wch: 15
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let fileName = '模板'
|
|
|
+ if (this.importTitle === '批量导入') {
|
|
|
+ fileName = '导入模板'
|
|
|
+ }
|
|
|
+ if (this.importTitle === '批量更新') {
|
|
|
+ fileName = '更新模板'
|
|
|
+ }
|
|
|
+ const ws = XLSX.utils.aoa_to_sheet(outData)
|
|
|
+ ws['!cols'] = outSize
|
|
|
+ ws['!rows'] = []
|
|
|
+ const wb = XLSX.utils.book_new()
|
|
|
+ XLSX.utils.book_append_sheet(wb, ws, fileName)
|
|
|
+ const tmpDown = new Blob([
|
|
|
+ this.s2ab(
|
|
|
+ XLSXStyle.write(wb, {
|
|
|
+ bookType: 'xlsx',
|
|
|
+ bookSST: true,
|
|
|
+ type: 'binary',
|
|
|
+ cellStyles: true
|
|
|
+ })
|
|
|
+ )
|
|
|
+ ])
|
|
|
+ const elink = document.createElement('a')
|
|
|
+ elink.download = decodeURIComponent(fileName + '.xlsx')
|
|
|
+ elink.style.display = 'none'
|
|
|
+ elink.href = URL.createObjectURL(tmpDown)
|
|
|
+ document.body.appendChild(elink)
|
|
|
+ elink.click()
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
+ document.body.removeChild(elink)
|
|
|
+ },
|
|
|
handleClose() {
|
|
|
this.dialogVisible = false
|
|
|
}
|