Parcourir la source

检索条件为空时 不能查询

Qukatie il y a 5 mois
Parent
commit
86f1309f88

+ 113 - 107
src/views/iosBasicData/PaymentApplication/assembly/searchPopup.vue

@@ -3,9 +3,10 @@
     <div>
         <el-dialog title="选择数据" :visible.sync="dialogVisible" append-to-body width="80%" :before-close="handleClose"
             :close-on-click-modal="false">
-            <avue-crud :option="option" :table-loading="loading" :data="data.filter(item=>!item.disabled)" ref="crud" id="out-table"
-                :header-cell-class-name="headerClassName" @search-change="searchChange" @search-reset="searchReset"
-                @selection-change="selectionChange" :search.sync="query" :summary-method="summaryMethod">
+            <avue-crud :option="option" :table-loading="loading" :data="data.filter(item => !item.disabled)" ref="crud"
+                id="out-table" :header-cell-class-name="headerClassName" @search-change="searchChange"
+                @search-reset="searchReset" @selection-change="selectionChange" :search.sync="query"
+                :summary-method="summaryMethod">
                 <template slot="menuLeft">
                     <div style="display:flex;">
                         <el-tabs v-model="activeName" @tab-click="handleClick">
@@ -450,7 +451,7 @@ export default {
             this.queryData = []
             this.pickData = []
             this.dialogVisible = true
-            this.activeName='query'
+            this.activeName = 'query'
             // this.query = this.deepClone(this.form)
             setTimeout(() => {
                 this.query = {
@@ -502,112 +503,117 @@ export default {
             // obj.auditStatus = '0'
             obj.businessDateStart = this.form.businessDateStart // 财务开始日期
             obj.businessDateEnd = this.form.businessDateEnd // 财务结束日期
-            obj = { ...Object.assign(obj, this.query) }
-            // 判断是否有对账单号
-            if (this.form.checkNo) {
-                obj.corpId = this.form.corpId // 结算单位
-                obj.checkNo = this.form.checkNo // CHK NO 对账单号
-                this.loading = true
-                finstlbillsGetByDetail(obj).then(res => {
-                    let arr = res.data.data.finStlBillsItemsList.map((item) => {
-                        if (item.curCode == this.getLocalCurrency()) {
-                            // 发票
-                            this.$set(item, 'currentInvoiceAmountRMB', item.currentInvoiceAmount)
-                            // 应结算金额
-                            this.$set(item, 'amountRMB', item.amount)
-                            // 已结算金额
-                            this.$set(item, 'stlTtlAmountRMB', item.stlTtlAmount)
-                            // 本次金额
-                            this.$set(item, 'currentStlAmountRMB', item.appliedCurrentStlAmount)
-                        } else {
-                            // 发票
-                            this.$set(item, 'currentInvoiceAmountUSD', item.currentInvoiceAmount)
-                            // 应结算金额
-                            this.$set(item, 'amountUSD', item.amount)
-                            // 已结算金额
-                            this.$set(item, 'stlTtlAmountUSD', item.stlTtlAmount)
-                            // 本次金额
-                            this.$set(item, 'currentStlAmountUSD', item.appliedCurrentStlAmount)
-                        }
-                        delete item.id
-                        return item
-                    })
-                    const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
-                    let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
-                    // 有id 的处理
-                    if (itemsWithId.length != 0) {
-                        finstlbillsitemsRemove(arrIds.join(',')).then(res => {
-                            this.$message.success('操作成功')
+            for (let key in this.query) {
+                if (this.query[key]) {
+                    obj = { ...Object.assign(obj, this.query) }
+                    // 判断是否有对账单号
+                    if (this.form.checkNo) {
+                        obj.corpId = this.form.corpId // 结算单位
+                        obj.checkNo = this.form.checkNo // CHK NO 对账单号
+                        this.loading = true
+                        finstlbillsGetByDetail(obj).then(res => {
+                            let arr = res.data.data.finStlBillsItemsList.map((item) => {
+                                if (item.curCode == this.getLocalCurrency()) {
+                                    // 发票
+                                    this.$set(item, 'currentInvoiceAmountRMB', item.currentInvoiceAmount)
+                                    // 应结算金额
+                                    this.$set(item, 'amountRMB', item.amount)
+                                    // 已结算金额
+                                    this.$set(item, 'stlTtlAmountRMB', item.stlTtlAmount)
+                                    // 本次金额
+                                    this.$set(item, 'currentStlAmountRMB', item.appliedCurrentStlAmount)
+                                } else {
+                                    // 发票
+                                    this.$set(item, 'currentInvoiceAmountUSD', item.currentInvoiceAmount)
+                                    // 应结算金额
+                                    this.$set(item, 'amountUSD', item.amount)
+                                    // 已结算金额
+                                    this.$set(item, 'stlTtlAmountUSD', item.stlTtlAmount)
+                                    // 本次金额
+                                    this.$set(item, 'currentStlAmountUSD', item.appliedCurrentStlAmount)
+                                }
+                                delete item.id
+                                return item
+                            })
+                            const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
+                            let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
+                            // 有id 的处理
+                            if (itemsWithId.length != 0) {
+                                finstlbillsitemsRemove(arrIds.join(',')).then(res => {
+                                    this.$message.success('操作成功')
+                                })
+                            }
+                            if (arr.length == 0) {
+                                this.$message.warning('当前检索暂无数据!')
+                            }
+                            this.queryData = arr
+                            this.data = arr
+                        }).finally(() => {
+                            this.loading = false;
                         })
-                    }
-                    if (arr.length == 0) {
-                        this.$message.warning('当前检索暂无数据!')
-                    }
-                    this.queryData = arr
-                    this.data = arr
-                }).finally(() => {
-                    this.loading = false;
-                })
-            } else {
-                obj.corpCnName = this.form.corpId // 结算单位
-                obj.checkBillNo = this.form.checkNo // CHK NO 对账单号
-                this.loading = true
-                finstlbillslistAccBillV1(obj).then(res => {
-                    let arr = res.data.data.map((item, index) => {
-                        item.accBillId = item.id
-                        delete item.id
-                        // 账单编号
-                        item.accBillNo = item.billNo
-                        item.currentStlCurCode = item.curCode // 币别
-                        item.currentStlExrate = item.exrate // 汇率
-                        // quantity
-                        // quantityCntrTypesDescr
-                        item.lineNo = Number(index) + 1
-                        item.pType = item.businessType
-                        item.billNo = item.businessBillDivideNo ? item.businessBillDivideNo : item.businessBillNo
-                        item.accDate = item.billDate
-                        item.dc = item.accountDc // 收付
-                        if (item.curCode == this.getLocalCurrency()) {
-                            // 发票
-                            this.$set(item, 'currentInvoiceAmountRMB', item.currentInvoiceAmount)
-                            // 应结算金额
-                            this.$set(item, 'amountRMB', item.amount)
-                            // 已结算金额
-                            this.$set(item, 'stlTtlAmountRMB', item.stlTtlAmount)
-                            // 本次金额
-                            this.$set(item, 'currentStlAmountRMB', item.appliedCurrentStlAmount)
-                        } else {
-                            // 发票
-                            this.$set(item, 'currentInvoiceAmountUSD', item.currentInvoiceAmount)
-                            // 应结算金额
-                            this.$set(item, 'amountUSD', item.amount)
-                            // 已结算金额
-                            this.$set(item, 'stlTtlAmountUSD', item.stlTtlAmount)
-                            // 本次金额
-                            this.$set(item, 'currentStlAmountUSD', item.appliedCurrentStlAmount)
-                        }
-                        return item
-                    })
-                    const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
-                    let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
-                    // 有id 的处理
-                    if (itemsWithId.length != 0) {
-                        finstlbillsitemsRemove(arrIds.join(',')).then(res => {
-                            this.$message.success('操作成功')
+                    } else {
+                        obj.corpCnName = this.form.corpId // 结算单位
+                        obj.checkBillNo = this.form.checkNo // CHK NO 对账单号
+                        this.loading = true
+                        finstlbillslistAccBillV1(obj).then(res => {
+                            let arr = res.data.data.map((item, index) => {
+                                item.accBillId = item.id
+                                delete item.id
+                                // 账单编号
+                                item.accBillNo = item.billNo
+                                item.currentStlCurCode = item.curCode // 币别
+                                item.currentStlExrate = item.exrate // 汇率
+                                // quantity
+                                // quantityCntrTypesDescr
+                                item.lineNo = Number(index) + 1
+                                item.pType = item.businessType
+                                item.billNo = item.businessBillDivideNo ? item.businessBillDivideNo : item.businessBillNo
+                                item.accDate = item.billDate
+                                item.dc = item.accountDc // 收付
+                                if (item.curCode == this.getLocalCurrency()) {
+                                    // 发票
+                                    this.$set(item, 'currentInvoiceAmountRMB', item.currentInvoiceAmount)
+                                    // 应结算金额
+                                    this.$set(item, 'amountRMB', item.amount)
+                                    // 已结算金额
+                                    this.$set(item, 'stlTtlAmountRMB', item.stlTtlAmount)
+                                    // 本次金额
+                                    this.$set(item, 'currentStlAmountRMB', item.appliedCurrentStlAmount)
+                                } else {
+                                    // 发票
+                                    this.$set(item, 'currentInvoiceAmountUSD', item.currentInvoiceAmount)
+                                    // 应结算金额
+                                    this.$set(item, 'amountUSD', item.amount)
+                                    // 已结算金额
+                                    this.$set(item, 'stlTtlAmountUSD', item.stlTtlAmount)
+                                    // 本次金额
+                                    this.$set(item, 'currentStlAmountUSD', item.appliedCurrentStlAmount)
+                                }
+                                return item
+                            })
+                            const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
+                            let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
+                            // 有id 的处理
+                            if (itemsWithId.length != 0) {
+                                finstlbillsitemsRemove(arrIds.join(',')).then(res => {
+                                    this.$message.success('操作成功')
+                                })
+                            }
+                            if (arr.length == 0) {
+                                this.$message.warning('当前检索暂无数据!')
+                            }
+                            this.queryData = arr
+                            this.data = arr
+
+                        }).finally(() => {
+                            this.$nextTick(() => {
+                                this.$refs.crud.doLayout();
+                            });
+                            this.loading = false;
                         })
                     }
-                    if (arr.length == 0) {
-                        this.$message.warning('当前检索暂无数据!')
-                    }
-                    this.queryData = arr
-                    this.data = arr
-
-                }).finally(() => {
-                    this.$nextTick(() => {
-                        this.$refs.crud.doLayout();
-                    });
-                    this.loading = false;
-                })
+                    return
+                }
             }
         },
         //debounce为了防止重复点

+ 88 - 81
src/views/iosBasicData/fininvoicesOutput/assembly/searchPopup.vue

@@ -2,9 +2,10 @@
     <div>
         <el-dialog title="选择数据" :visible.sync="dialogVisible" append-to-body width="80%" :before-close="handleClose"
             :close-on-click-modal="false">
-            <avue-crud :option="option" :table-loading="loading" :data="data.filter(item=>!item.disabled)" ref="crud" id="out-table"
-                :header-cell-class-name="headerClassName" @search-change="searchChange" @search-reset="searchReset"
-                @selection-change="selectionChange" :search.sync="query" :summary-method="summaryMethod">
+            <avue-crud :option="option" :table-loading="loading" :data="data.filter(item => !item.disabled)" ref="crud"
+                id="out-table" :header-cell-class-name="headerClassName" @search-change="searchChange"
+                @search-reset="searchReset" @selection-change="selectionChange" :search.sync="query"
+                :summary-method="summaryMethod">
                 <template slot="menuLeft">
                     <div style="display:flex;">
                         <el-tabs v-model="activeName" @tab-click="handleClick">
@@ -460,7 +461,7 @@ export default {
             this.queryData = []
             this.pickData = []
             this.dialogVisible = true
-            this.activeName='query'
+            this.activeName = 'query'
             // this.query = this.deepClone(this.form)
 
             setTimeout(() => {
@@ -519,87 +520,93 @@ export default {
             obj.businessType = this.form.businessTypes ? this.form.businessTypes.join(',') : '' // 业务类型
             obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
             obj.dc = this.form.dc
-            obj = { ...Object.assign(obj, this.query) }
-            // 判断是否有对账单号
-            if (this.form.checkNo) {
-                obj.corpId = this.form.corpId // 结算单位
-                obj.checkNo = this.form.checkNo // CHK NO 对账单号
-                // obj.dc='D'
-                finstlbillsGetByDetail(obj).then(res => {
-                    let arr = res.data.data.finStlBillsItemsList.map((item, index) => {
-                        item.lineNo = Number(index) + 1 // 行号
-                        item.currentCurCode = item.curCode
-                        item.currentExrate = item.exrate
-                        if (item.currentCurCode == this.getLocalCurrency()) {
-                            // 本次发票金额
-                            item.currentAmountCNY = item.appliedInvoiceCurrentAmount
-                        } else {
-                            // 本次发票金额
-                            item.currentAmountUSD = item.appliedInvoiceCurrentAmount
-                        }
-                        delete item.id
-                        return item
-                    })
-                    const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
-                    let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
-                    // 有id 的处理
-                    if (itemsWithId.length != 0) {
-                        finstlbillsitemsRemove(arrIds.join(',')).then(res => {
-                            this.$message.success('操作成功')
+            for (let key in this.query) {
+                if (this.query[key]) {
+                    obj = { ...Object.assign(obj, this.query) }
+                    // 判断是否有对账单号
+                    if (this.form.checkNo) {
+                        obj.corpId = this.form.corpId // 结算单位
+                        obj.checkNo = this.form.checkNo // CHK NO 对账单号
+                        // obj.dc='D'
+                        finstlbillsGetByDetail(obj).then(res => {
+                            let arr = res.data.data.finStlBillsItemsList.map((item, index) => {
+                                item.lineNo = Number(index) + 1 // 行号
+                                item.currentCurCode = item.curCode
+                                item.currentExrate = item.exrate
+                                if (item.currentCurCode == this.getLocalCurrency()) {
+                                    // 本次发票金额
+                                    item.currentAmountCNY = item.appliedInvoiceCurrentAmount
+                                } else {
+                                    // 本次发票金额
+                                    item.currentAmountUSD = item.appliedInvoiceCurrentAmount
+                                }
+                                delete item.id
+                                return item
+                            })
+                            const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
+                            let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
+                            // 有id 的处理
+                            if (itemsWithId.length != 0) {
+                                finstlbillsitemsRemove(arrIds.join(',')).then(res => {
+                                    this.$message.success('操作成功')
+                                })
+                            }
+                            if (arr.length == 0) {
+                                this.$message.warning('当前检索暂无数据!')
+                            }
+                            this.queryData = arr
+                            this.data = arr
                         })
-                    }
-                    if (arr.length == 0) {
-                        this.$message.warning('当前检索暂无数据!')
-                    }
-                    this.queryData = arr
-                    this.data = arr
-                })
-            } else {
-                obj.billNo = this.form.businessNo // 业务编号
-                obj.corpCnName = this.form.corpId // 结算单位
-                obj.checkBillNo = this.form.checkNo // 对账单号
-                // obj.dc='D'
-                finstlbillslistAccBillV1(obj).then(res => {
-                    let arr = res.data.data.map((item, index) => {
-                        console.log(item)
-                        item.lineNo = Number(index) + 1 // 行号
-                        item.accBillId = item.id
-                        item.accBillNo = item.billNo
-                        item.billNo = item.businessBillNo
-                        item.accDate = item.createTime
-                        item.currentCurCode = item.curCode
-                        item.currentExrate = item.exrate
-                        item.dc = item.accountDc
-                        if (item.currentCurCode == this.getLocalCurrency()) {
-                            // 本次发票金额
-                            item.currentAmountCNY = item.appliedInvoiceCurrentAmount
-                        } else {
-                            // 本次发票金额
-                            item.currentAmountUSD = item.appliedInvoiceCurrentAmount
-                        }
-                        delete item.id
-                        return item
-                    })
-                    const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
-                    let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
-                    // 有id 的处理
-                    if (itemsWithId.length != 0) {
-                        fininvoicesitemsRemove(arrIds.join(',')).then(res => {
-                            this.$message.success('操作成功')
+                    } else {
+                        obj.billNo = this.form.businessNo // 业务编号
+                        obj.corpCnName = this.form.corpId // 结算单位
+                        obj.checkBillNo = this.form.checkNo // 对账单号
+                        // obj.dc='D'
+                        finstlbillslistAccBillV1(obj).then(res => {
+                            let arr = res.data.data.map((item, index) => {
+                                console.log(item)
+                                item.lineNo = Number(index) + 1 // 行号
+                                item.accBillId = item.id
+                                item.accBillNo = item.billNo
+                                item.billNo = item.businessBillNo
+                                item.accDate = item.createTime
+                                item.currentCurCode = item.curCode
+                                item.currentExrate = item.exrate
+                                item.dc = item.accountDc
+                                if (item.currentCurCode == this.getLocalCurrency()) {
+                                    // 本次发票金额
+                                    item.currentAmountCNY = item.appliedInvoiceCurrentAmount
+                                } else {
+                                    // 本次发票金额
+                                    item.currentAmountUSD = item.appliedInvoiceCurrentAmount
+                                }
+                                delete item.id
+                                return item
+                            })
+                            const itemsWithId = this.data.filter(item => item.hasOwnProperty('id'));
+                            let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
+                            // 有id 的处理
+                            if (itemsWithId.length != 0) {
+                                fininvoicesitemsRemove(arrIds.join(',')).then(res => {
+                                    this.$message.success('操作成功')
+                                })
+                            }
+                            if (arr.length == 0) {
+                                this.$message.warning('当前检索暂无数据!')
+                            }
+                            this.queryData = arr
+                            this.data = arr
+                        }).finally(() => {
+                            this.$nextTick(() => {
+                                this.$refs.crud.doLayout();
+                            });
+                            this.loading = false;
                         })
                     }
-                    if (arr.length == 0) {
-                        this.$message.warning('当前检索暂无数据!')
-                    }
-                    this.queryData = arr
-                    this.data = arr
-                }).finally(() => {
-                    this.$nextTick(() => {
-                        this.$refs.crud.doLayout();
-                    });
-                    this.loading = false;
-                })
+                    return
+                }
             }
+
         },
         //debounce为了防止重复点
         submit: _.debounce(function () {