Quellcode durchsuchen

Merge branch 'dev1.0' of http://192.168.0.200:3000/suf/factoring-trade-front-end-v2 into chang

changjiaming vor 7 Monaten
Ursprung
Commit
4d6c52ad0e

+ 11 - 0
src/utils/index.js

@@ -410,3 +410,14 @@ export function formatMoney(amount, decimalPlaces = 2) {
   }
   return amountNum.toLocaleString(undefined, options)
 }
+
+// 处理后端字段为null的情况
+export function replaceNull(obj) {
+  for (const key in obj) {
+    if (obj[key] === null) {
+      obj[key] = ''
+    } else if (typeof obj[key] === 'object') {
+      replaceNull(obj[key]) // 递归调用
+    }
+  }
+}

+ 8 - 5
src/views/financialManagement/index.vue

@@ -26,7 +26,7 @@
             <el-input v-model="search.fastSearch" style="width: 300px" placeholder="请输入项目名称/主企业名称/核心企业名称" clearable></el-input>
           </div>
           <div class="leftBtn">
-            <el-button type="primary" @click="fetchData">查询</el-button>
+            <el-button type="primary" @click="fetchData('search')">查询</el-button>
           </div>
         </div>
       </div>
@@ -72,13 +72,16 @@ export default {
   },
   methods: {
     fetchData(type) {
-      this.page = 1
-      this.size = 10
+      if (type === 'search') {
+        this.page = 1
+        this.size = 10
+      }
+
       this.loading = true
       const params = {
         ...this.search,
-        page: this.page,
-        rows: this.size
+        page: this.page || 1,
+        rows: this.size || 10
       }
       getList(params).then(response => {
         this.tableData = response.rows

+ 1 - 1
src/views/financingManage/index.vue

@@ -43,7 +43,7 @@
           :columns="columns"
           :data="tableData"
           :count="total"
-          parentComponent="FinancingManage"
+          parent-component="FinancingManage"
         />
       </el-tabs>
     </template>

+ 6 - 2
src/views/financingManage/limitExpenditure/components/RevenueExpenditurePlan.vue

@@ -19,6 +19,7 @@
 
 <script>
 import { mapGetters } from 'vuex'
+import { replaceNull } from '@/utils'
 export default {
   props: {
     disabled: {
@@ -48,7 +49,7 @@ export default {
                 disabled={this.disabled}
                 type='date'
                 placeholder='选择日期'
-                value-format="yyyy-MM-dd"
+                value-format='yyyy-MM-dd'
                 onChange={() => this.$emit('getTrrData')}
               >
               </el-date-picker>
@@ -148,7 +149,9 @@ export default {
     detailsInfo: {
       handler(newV) {
         if (newV && Object.keys(newV).length) {
-          this.$set(this, 'tableData', JSON.parse(JSON.stringify(newV.incomeExpenditurePlanList)))
+          const list = JSON.parse(JSON.stringify(newV.incomeExpenditurePlanList))
+          replaceNull(list)
+          this.tableData = list
           this.ruleForm.planIrrStr = newV.planIrrStr
         }
       },
@@ -161,6 +164,7 @@ export default {
   },
   methods: {
     handlerOperate(type, row, index) {
+      console.log(type, index)
       if (type === 'add') {
         this.tableData.push({
           incomeExpenditureDate: '',

+ 27 - 27
src/views/financingManage/limitExpenditure/mainContent.vue

@@ -36,8 +36,8 @@
             :disabled="disabled"
             type="date"
             placeholder="请选择应收账款起始日"
-            @change="getEndDate"
             value-format="yyyy-MM-dd"
+            @change="getEndDate"
           >
           </el-date-picker>
         </el-form-item>
@@ -84,7 +84,7 @@
           incomeExpenditurePlanList: ruleForm.incomeExpenditurePlanList || [],
           planIrrStr: ruleForm.planIrrStr
         }"
-        :disabled="disabled"  
+        :disabled="disabled"
         @getTrrData="getTrrData"
       >
       </revenue-expenditure-plan>
@@ -103,7 +103,7 @@
 
 <script>
 import { getLimitExpenditureDatails, getExpenditurePlan, getTrr, reviewQuotaDisburseSubmit } from '@/api/financingManage'
-import { parseTime } from "@/utils";
+import { parseTime } from '@/utils'
 export default {
   components: {
     FinancingInfo: () => import('./components/FinancingInfo'),
@@ -199,7 +199,7 @@ export default {
       const { startDate, term } = this.ruleForm
       if (startDate && term) {
         const endDateGetTime = new Date(`${startDate} 00:00:00`).getTime() + (3600 * 1000 * 24 * term)
-        this.ruleForm.endDate = parseTime(endDateGetTime) 
+        this.ruleForm.endDate = parseTime(endDateGetTime)
       }
     },
     async automaticGeneration() {
@@ -223,18 +223,18 @@ export default {
       // const { id } = this.$route.params
       const { taskId } = this.$route.query
       var params = {
-        Loading: true,
+        Loading: true
       }
       if (this.ruleForm.approvalConclusion === 'pass') {
-        if(type === 'submit') {
+        if (type === 'submit') {
           const { startDate, endDate } = this.ruleForm
-          if(!startDate) {
+          if (!startDate) {
             this.$message.warning('请选择应收账款起始日')
-            return 
+            return
           }
-          if(!endDate) {
+          if (!endDate) {
             this.$message.warning('请选择应收账款结束日')
-            return 
+            return
           }
         }
         const financingInfo = await this.$refs.financingInfo.getParams(type)
@@ -254,11 +254,11 @@ export default {
           ...assignment,
           taskId
         }
-        if(!assignment.reviewTransferReceivable.confirm) {
+        if (!assignment.reviewTransferReceivable.confirm) {
           params.reviewBasicContractList = []
         }
-      }else {
-        const { approvalConclusion, approvalComments,financingBasicInfoId, id } = this.ruleForm
+      } else {
+        const { approvalConclusion, approvalComments, financingBasicInfoId, id } = this.ruleForm
         params = {
           ...params,
           approvalConclusion,
@@ -271,30 +271,30 @@ export default {
       return params
     },
     async submit(type) {
-      
-      if(type === 'temp') {
-        let data = await this.getParams(type)
+      if (type === 'temp') {
+        const data = await this.getParams(type)
         data.visible = type !== 'temp'
         reviewQuotaDisburseSubmit(data).then(() => {
           this.$message.warning('暂存成功')
           this.$router.go(-1)
         })
-      }else {
-        this.$refs.ruleForm.validate(async (valid) => {  
-          if(valid) {
-            let data = await this.getParams(type)
+      } else {
+        await this.automaticGeneration()
+        this.$refs.ruleForm.validate(async(valid) => {
+          if (valid) {
+            const data = await this.getParams(type)
             data.visible = type !== 'temp'
-            reviewQuotaDisburseSubmit(data).then(() => {
-              this.$message.warning('提交成功')
-              this.$router.go(-1)
-            })
-          }else {
+            setTimeout(() => {
+              reviewQuotaDisburseSubmit(data).then(() => {
+                this.$message.warning('提交成功')
+                this.$router.go(-1)
+              })
+            }, 500)
+          } else {
             return false
           }
-       
         })
       }
-  
     }
   }
 }