LAPTOP-FO2T5SIU\35838 hai 7 meses
pai
achega
71a5bde1b0
Modificáronse 1 ficheiros con 65 adicións e 336 borrados
  1. 65 336
      src/views/parkAssets/component/uploadCost.vue

+ 65 - 336
src/views/parkAssets/component/uploadCost.vue

@@ -177,7 +177,10 @@ export default {
                     // this.$emit('cancelUpload', true)
                     this.successCount = res.data.data.successCount
                     this.errorCount = res.data.data.errorCount
-                    this.tableData = res.data.data.errorList || []
+                    res.data.data.errorList.forEach(item => {
+                        const json = this.getItemJson(item)
+                        this.tableData.push(json)
+                    })
                     this.isImport = true
                     console.log('上传成功....')
                 } else {
@@ -243,7 +246,10 @@ export default {
                     // this.$emit('cancelUpload', true)
                     this.successCount = res.data.data.successCount
                     this.errorCount = res.data.data.errorCount
-                    this.tableData = res.data.data.errorList || []
+                    res.data.data.errorList.forEach(item => {
+                        const json = this.getItemJson(item)
+                        this.tableData.push(json)
+                    })
                     this.isImport = true
                     console.log('上传成功....')
                 } else {
@@ -275,7 +281,10 @@ export default {
                     // this.$emit('cancelUpload', true)
                     this.successCount = res.data.data.successCount
                     this.errorCount = res.data.data.errorCount
-                    this.tableData = res.data.data.errorList || []
+                    res.data.data.errorList.forEach(item => {
+                        const json = this.getItemJson(item)
+                        this.tableData.push(json)
+                    })
                     this.isImport = true
                     console.log('上传成功....')
                 } else {
@@ -318,123 +327,28 @@ export default {
             }
         },
         exportErrorGroup() {
+            const _this = this
+            _this.excelFlag = true
             if (!this.tableData.length) {
                 this.$message.error('失败记录为空!')
                 return
             }
-            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('行政区划')
-            title.push('详细地址')
-            title.push('备注')
-            title.push('异常原因')
-            outData.push(title)
-            const errorFiled = []
-            this.tableData.forEach((item, index) => {
-                const jsonArray = []
-                jsonArray.push(item.groupName)
-                jsonArray.push(item.nature)
-                jsonArray.push(item.preSalesLicenseNumber)
-                jsonArray.push(item.companyName)
-                jsonArray.push(item.buildArea)
-                jsonArray.push(item.landArea)
-                jsonArray.push(item.projectApprovalDocument)
-                jsonArray.push(item.engineeringPlanningPermit)
-                jsonArray.push(item.constructionPermit)
-                jsonArray.push(item.landCertificateNumber)
-                jsonArray.push(item.landUsePermitNumber)
-                jsonArray.push(item.volumeRatio)
-                jsonArray.push(item.greenRatio)
-                jsonArray.push(item.price)
-                jsonArray.push(item.exceededPrice)
-                jsonArray.push(item.areaStatus)
-                jsonArray.push(item.saleStatus)
-                jsonArray.push(item.regionalismCode)
-                jsonArray.push(item.address)
-                jsonArray.push(item.introduction)
-                jsonArray.push(item.reason)
-                outData.push(jsonArray)
-            })
-            const outSize = []
-            title.forEach(item => {
-                if (item.length > 4) {
-                    outSize.push({
-                        wch: 30
-                    })
-                } else {
-                    outSize.push({
-                        wch: 15
-                    })
-                }
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'post',
+                url: constant.BASE_URI + '/ParkInfoController/errorListExport',
+                responseType: 'blob',
+                data: this.tableData
+            }).then(res => {
+                this.downloadExcel(res.data, '失败记录.xlsx')
+                _this.excelFlag = false
+            }).catch((err) => {
+                console.log(err)
+                _this.excelFlag = false
             })
-            const fileName = '失败记录导出 ' + new Date().Format('yyyy-MM-dd hh:mm')
-            const ws = XLSX.utils.aoa_to_sheet(outData)
-            ws['!cols'] = outSize
-            ws['!rows'] = []
-            if (errorFiled.length) {
-                errorFiled.forEach(item => {
-                    if (!ws[item]) {
-                        ws[item] = {
-                            v: '',
-                            t: 's',
-                            s: {
-                                fill: {
-                                    bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                                },
-                                font: {
-                                    color: { rgb: 'FFFFFF' }
-                                }
-                            }
-                        }
-                    } else {
-                        ws[item].s = {
-                            fill: {
-                                bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                            },
-                            font: {
-                                color: { rgb: 'FFFFFF' }
-                            }
-                        }
-                    }
-                })
-            }
-            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)
         },
         exportErrorFQ() {
             const _this = this
@@ -461,238 +375,52 @@ export default {
             })
         },
         exportErrorBuild() {
+            const _this = this
+            _this.excelFlag = true
             if (!this.tableData.length) {
                 this.$message.error('失败记录为空!')
                 return
             }
-            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('标准价格参考层及差价系数备注说明')
-            title.push('异常原因')
-            outData.push(title)
-            const errorFiled = []
-            this.tableData.forEach((item, index) => {
-                const jsonArray = []
-                jsonArray.push(item.groupName)
-                jsonArray.push(item.discName)
-                jsonArray.push(item.buildNum)
-                jsonArray.push(item.area)
-                jsonArray.push(item.residentialArea)
-                jsonArray.push(item.unResidentialArea)
-                jsonArray.push(item.coverAnArea)
-                jsonArray.push(item.undergroundArea)
-                jsonArray.push(item.roomNum)
-                jsonArray.push(item.numberInfo)
-                jsonArray.push(item.floors)
-                jsonArray.push(item.overgroundFloors)
-                jsonArray.push(item.undergroundFloors)
-                jsonArray.push(item.structure)
-                jsonArray.push(item.regionalismCode)
-                jsonArray.push(item.landCode)
-                jsonArray.push(item.remark)
-                jsonArray.push(item.priceRemark)
-                jsonArray.push(item.reason)
-                outData.push(jsonArray)
-            })
-            const outSize = []
-            title.forEach(item => {
-                if (item.length > 4) {
-                    outSize.push({
-                        wch: 30
-                    })
-                } else {
-                    outSize.push({
-                        wch: 15
-                    })
-                }
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'post',
+                url: constant.BASE_URI + '/MnpBuildingController/errorListExport',
+                responseType: 'blob',
+                data: this.tableData
+            }).then(res => {
+                this.downloadExcel(res.data, '失败记录.xlsx')
+                _this.excelFlag = false
+            }).catch((err) => {
+                console.log(err)
+                _this.excelFlag = false
             })
-            const fileName = '失败记录导出 ' + new Date().Format('yyyy-MM-dd hh:mm')
-            const ws = XLSX.utils.aoa_to_sheet(outData)
-            ws['!cols'] = outSize
-            ws['!rows'] = []
-            if (errorFiled.length) {
-                errorFiled.forEach(item => {
-                    if (!ws[item]) {
-                        ws[item] = {
-                            v: '',
-                            t: 's',
-                            s: {
-                                fill: {
-                                    bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                                },
-                                font: {
-                                    color: { rgb: 'FFFFFF' }
-                                }
-                            }
-                        }
-                    } else {
-                        ws[item].s = {
-                            fill: {
-                                bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                            },
-                            font: {
-                                color: { rgb: 'FFFFFF' }
-                            }
-                        }
-                    }
-                })
-            }
-            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)
         },
         exportErrorRoom() {
+            const _this = this
+            _this.excelFlag = true
             if (!this.tableData.length) {
                 this.$message.error('失败记录为空!')
                 return
             }
-            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('可售状态')
-            title.push('异常原因')
-            outData.push(title)
-            const errorFiled = []
-            this.tableData.forEach((item, index) => {
-                const jsonArray = []
-                jsonArray.push(item.groupName)
-                jsonArray.push(item.discName)
-                jsonArray.push(item.buildNum)
-                jsonArray.push(item.roomNo)
-                jsonArray.push(item.floor)
-                jsonArray.push(item.predictionInternalArea)
-                jsonArray.push(item.predictionShareArea)
-                jsonArray.push(item.predictionBuildArea)
-                jsonArray.push(item.predictionLandArea)
-                jsonArray.push(item.actualInternalArea)
-                jsonArray.push(item.actualShareArea)
-                jsonArray.push(item.actualBuildArea)
-                jsonArray.push(item.actualLandArea)
-                jsonArray.push(item.roomUse)
-                jsonArray.push(item.roomNumber)
-                jsonArray.push(item.decorationSituation)
-                jsonArray.push(item.twoPointTwo)
-                jsonArray.push(item.houseType)
-                jsonArray.push(item.remark)
-                jsonArray.push(item.saleStatus)
-                jsonArray.push(item.reason)
-                outData.push(jsonArray)
-            })
-            const outSize = []
-            title.forEach(item => {
-                if (item.length > 4) {
-                    outSize.push({
-                        wch: 30
-                    })
-                } else {
-                    outSize.push({
-                        wch: 15
-                    })
-                }
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'post',
+                url: constant.BASE_URI + '/ParkRoomController/errorListExport',
+                responseType: 'blob',
+                data: this.tableData
+            }).then(res => {
+                this.downloadExcel(res.data, '失败记录.xlsx')
+                _this.excelFlag = false
+            }).catch((err) => {
+                console.log(err)
+                _this.excelFlag = false
             })
-            const fileName = '失败记录导出 ' + new Date().Format('yyyy-MM-dd hh:mm')
-            const ws = XLSX.utils.aoa_to_sheet(outData)
-            ws['!cols'] = outSize
-            ws['!rows'] = []
-            if (errorFiled.length) {
-                errorFiled.forEach(item => {
-                    if (!ws[item]) {
-                        ws[item] = {
-                            v: '',
-                            t: 's',
-                            s: {
-                                fill: {
-                                    bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                                },
-                                font: {
-                                    color: { rgb: 'FFFFFF' }
-                                }
-                            }
-                        }
-                    } else {
-                        ws[item].s = {
-                            fill: {
-                                bgColor: { indexed: 64 }, fgColor: { rgb: 'FF0000' }
-                            },
-                            font: {
-                                color: { rgb: 'FFFFFF' }
-                            }
-                        }
-                    }
-                })
-            }
-            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)
         },
         s2ab(s) {
             var cuf
@@ -855,6 +583,7 @@ export default {
             title.push('楼盘/小区名称')
             title.push('分期名称')
             title.push('单元/楼栋号')
+            title.push('施工号')
             title.push('总面积(㎡)')
             title.push('住宅面积(㎡)')
             title.push('非住宅面积(㎡)')
@@ -1002,7 +731,7 @@ export default {
         },
         getItemJson(item) {
             item.groupNameStr = item.groupName.replace('{', '').replace('}', '')
-            item.discNameStr = item.discName.replace('{', '').replace('}', '')
+            item.discNameStr = item.discName ? item.discName.replace('{', '').replace('}', '') : ''
             item.buildNumStr = item.buildNum ? item.buildNum.replace('{', '').replace('}', '') : ''
             item.roomNoStr = item.roomNo ? item.roomNo.replace('{', '').replace('}', '') : ''
             return item