Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

zt vor 7 Monaten
Ursprung
Commit
8da82d2c46

+ 59 - 100
src/views/parkAssets/component/uploadCost.vue

@@ -15,9 +15,9 @@
     >
       <!--        :title="isImport?'导入结果':'批量导入'"-->
       <div v-if="!isImport">
-<!--        <p v-for="(item, index) in uploadTitle" :key="index" class="uploadtitle">-->
-<!--          {{ item }}-->
-<!--        </p>-->
+        <!--        <p v-for="(item, index) in uploadTitle" :key="index" class="uploadtitle">-->
+        <!--          {{ item }}-->
+        <!--        </p>-->
         <el-card style="padding-top: 10px;padding-bottom: 10px">
 
           <div style="width: 50%;float:left;">
@@ -61,22 +61,22 @@
         >
           <el-table-column align="center" label="楼盘/小区名称" prop="groupName">
             <template v-slot="scope">
-              <span>{{ scope.row.groupName }}</span>
+              <span>{{ scope.row.groupNameStr }}</span>
             </template>
           </el-table-column>
           <el-table-column align="center" label="分期名称" prop="discName">
             <template v-slot="scope">
-              <span>{{ scope.row.discName }}</span>
+              <span>{{ scope.row.discNameStr }}</span>
             </template>
           </el-table-column>
           <el-table-column align="center" label="单元/楼栋号" prop="buildNum">
             <template v-slot="scope">
-              <span>{{ scope.row.buildNum }}</span>
+              <span>{{ scope.row.buildNumStr }}</span>
             </template>
           </el-table-column>
           <el-table-column align="center" label="户室号" prop="roomNo">
             <template v-slot="scope">
-              <span>{{ scope.row.roomNo }}</span>
+              <span>{{ scope.row.roomNoStr }}</span>
             </template>
           </el-table-column>
           <el-table-column align="center" label="异常原因" prop="reason">
@@ -92,12 +92,13 @@
           v-if="!isImport"
           :disabled="fileUrlList.length===0"
           type="primary"
-          @click="importFile()"
           class="ch-button-else"
+          @click="importFile()"
         >导入</el-button>
         <el-button
           v-if="isImport"
           type="primary"
+          :loading="excelFlag"
           @click="exportError()"
         >
           下载失败记录
@@ -110,8 +111,12 @@
 <script>
 // import XLSX from 'xlsx'
 // import XLSXStyle from 'xlsx-style-fixedver'
+import constant from '@/static/utils/constant'
+
 const XLSX = require('xlsx')
 const XLSXStyle = require('xlsx-style-fixedver')
+import axios from 'axios'
+import qs from 'qs'
 
 const defaultTitle = '批量导入'
 export default {
@@ -134,7 +139,8 @@ export default {
             isImport: false,
             file: null,
             successCount: 0,
-            errorCount: ''
+            errorCount: '',
+            excelFlag: false
         }
     },
     methods: {
@@ -185,6 +191,7 @@ export default {
             })
         },
         importFQ() {
+            this.tableData = []
             this.loading = true
             this.$axios({
                 headers: {
@@ -200,12 +207,13 @@ export default {
                         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 || []
+                    res.data.data.errorList.forEach(item => {
+                        const json = this.getItemJson(item)
+                        this.tableData.push(json)
+                    })
                     this.isImport = true
-                    console.log('上传成功....')
                 } else {
                     this.$message({
                         message: res.data.msg,
@@ -429,99 +437,28 @@ export default {
             document.body.removeChild(elink)
         },
         exportErrorFQ() {
+            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('异常原因')
-            outData.push(title)
-            const errorFiled = []
-            this.tableData.forEach((item, index) => {
-                const jsonArray = []
-                jsonArray.push(item.groupName)
-                jsonArray.push(item.name)
-                jsonArray.push(item.unitPrice)
-                jsonArray.push(item.propertyUnitPrice)
-                jsonArray.push(item.maintenanceFunds)
-                jsonArray.push(item.subscriptionFunds)
-                jsonArray.push(item.proportion)
-                jsonArray.push(item.paymentMethods)
-                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 + '/ParkFloorDiscController/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)
         },
         exportErrorBuild() {
             if (!this.tableData.length) {
@@ -1047,6 +984,28 @@ export default {
         },
         handleClose() {
             this.dialogVisible = false
+        },
+        downloadExcel(blobPart, filename) {
+            const blob = new Blob([blobPart], {
+                type: 'application/vnd.ms-excel'
+            })
+            // console.log('downloadExcel', blob.size)
+            // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
+            const elink = document.createElement('a')
+            elink.download = decodeURIComponent(filename)
+            elink.style.display = 'none'
+            elink.href = URL.createObjectURL(blob)
+            document.body.appendChild(elink)
+            elink.click()
+            URL.revokeObjectURL(elink.href) // 释放URL 对象
+            document.body.removeChild(elink)
+        },
+        getItemJson(item) {
+            item.groupNameStr = item.groupName.replace('{', '').replace('}', '')
+            item.discNameStr = item.discName.replace('{', '').replace('}', '')
+            item.buildNumStr = item.buildNum ? item.buildNum.replace('{', '').replace('}', '') : ''
+            item.roomNoStr = item.roomNo ? item.roomNo.replace('{', '').replace('}', '') : ''
+            return item
         }
     }
 }

+ 13 - 7
src/views/signingManagement/contractManagement/contractAdd.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div class="contractAdd">
     <el-form ref="form" :model="form" style="width: 100%;padding: 5px" :rules="rules">
       <el-row>
         <el-col style="padding-bottom: 10px">
@@ -299,7 +299,7 @@
                     <el-button v-if="!isView" size="small" type="primary">点击上传</el-button>
                     <div slot="file" slot-scope="{file}">
                       <a :href="file.url">{{ file.name }}</a>
-                      <span class="el-upload-list__item-actions">
+                      <span class="el-upload-list__item-actions" v-show="!isView">
                         <i class="el-icon-delete" @click="handlePictureRemove(file,contractOriginalList)" />
                       </span>
                     </div>
@@ -320,7 +320,7 @@
                     <el-button v-if="!isView" size="small" type="primary">点击上传</el-button>
                     <div slot="file" slot-scope="{file}">
                       <a :href="file.url">{{ file.name }}</a>
-                      <span class="el-upload-list__item-actions">
+                      <span class="el-upload-list__item-actions" v-show="!isView">
                         <i class="el-icon-delete" @click="handlePictureRemove(file,contractOtherList)" />
                       </span>
                     </div>
@@ -548,10 +548,16 @@ export default {
 }
 </script>
 
-<style scoped>
-  .ch-input .el-input__inner {
-      border-color: #32323A;
-  }
+<style lang="scss">
+.contractAdd{
+    .ch-input .el-input__inner {
+        border-color: #32323A;
+    }
+    .el-textarea__inner{
+        padding-right: 75px !important;
+    }
+}
+
 
 
 </style>