<template> <div class="eibs-tab currentPage"> <el-form :model="feeConVo" ref="feeConVoForm" label-width="100px" label-position="right" size="small"> <c-col :span="24"> <c-col :span="12"> <el-form-item label="业务编号" prop="ownref"> <c-input v-model="feeConVo.ownref" placeholder="请输入业务编号" style="width:100%" clearable /> </el-form-item> </c-col> <c-col :span="12"> <el-form-item label="客户号/名称" prop="ptyextkey"> <c-input v-model="feeConVo.ptyextkey" placeholder="请输入客户号/客户名称" style="width:100%" clearable /> </el-form-item> </c-col> </c-col> <c-col :span="24"> <c-col :span="12"> <el-form-item label="费用名称" prop="feecods"> <c-select v-model="feeConVo.feecods" clearable placeholder="请选择" dbCode="FEETXT" :isShowKeyAndLabel="true" filterable multiple> </c-select> </el-form-item> </c-col> <c-col :span="12"> <el-form-item label="费用收取日期" style="width: 100%"> <c-col :span="11"> <c-date-picker type="date" v-model="feeConVo.dondat1" style="width: 100%" placeholder="请选择费用收取开始日期" value-format="yyyy-MM-dd"></c-date-picker> </c-col> <c-col :span="2" style="text-align: center"> <label style="display: inline-block; width: 100%">-</label> </c-col> <c-col :span="11"> <c-date-picker type="date" v-model="feeConVo.dondat2" style="width: 100%" placeholder="请选择费用收取结束日期" value-format="yyyy-MM-dd"></c-date-picker> </c-col> </el-form-item> </c-col> </c-col> <c-col :span="24"> <c-col :span="12"> <el-form-item label="业务类型" prop="feecods"> <c-select v-model="feeConVo.bustyps" clearable placeholder="请选择" :code="bustyp" filterable multiple> </c-select> </el-form-item> </c-col> </c-col> <!-- <c-col :span="24"> <c-col :span="12"> <el-form-item label=""> <c-checkbox v-model="feeConVo.qryflg" :true-label="'Y'" :false-label="'N'">是否查询未收</c-checkbox> </el-form-item> </c-col> </c-col> --> <c-col :span="24"> <span style="float: left"> <el-button type="primary" size="small" @click="exportExcel()" :disabled="isDisabled">导出Excel</el-button> </span> <span style="float: right"> <el-button size="small" @click="resetFormFields('feeConVoForm')">重置</el-button> <el-button type="primary" icon="el-icon-search" size="small" :loading="searchLoading" @click="searchTable()"> 查询</el-button> </span> </c-col> <c-col :span="24"> <c-paging-table :data="tableData" ref="feeConVoTableRef" :pageSize="feeConVo.pageSize" :pageNumber="feeConVo.pageNumber" :total="feeConVo.total" @queryFunc="queryFunc" :border="true"> <el-table-column label="业务编号" prop="ownref" min-width="180px"> <template slot-scope="scope">{{scope.row.ownref}}</template> </el-table-column> <el-table-column label="客户号" prop="ptyextkey" min-width="100px"> <template slot-scope="scope">{{scope.row.ptyextkey}}</template> </el-table-column> <el-table-column label="客户名称" prop="ptynam" min-width="200px"> <template slot-scope="scope">{{scope.row.ptynam}}</template> </el-table-column> <el-table-column label="业务类型" prop="objtyp" min-width="180px"> <template slot-scope="scope"> <el-form-item label-width="0"> <c-select-value-to-label v-model="scope.row.objtyp" :code="bustyp"> </c-select-value-to-label> </el-form-item> </template> </el-table-column> <el-table-column label="费用名称" prop="nam" min-width="200px"> <template slot-scope="scope">{{ scope.row.nam }}</template> </el-table-column> <el-table-column label="费用收取日期" prop="dondat" min-width="100px"> <template slot-scope="scope">{{ scope.row.dondat }}</template> </el-table-column> <el-table-column label="计费开始日期" prop="dat1" min-width="100px"> <template slot-scope="scope">{{ scope.row.dat1 }}</template> </el-table-column> <el-table-column label="计费结束日期" prop="dat2" min-width="100px"> <template slot-scope="scope">{{ scope.row.dat2 }}</template> </el-table-column> <el-table-column label="币种" prop="cur" min-width="100px"> <template slot-scope="scope">{{ scope.row.cur }}</template> </el-table-column> <el-table-column label="应收金额" prop="ogiamt" min-width="100px"> <template slot-scope="scope"><span> {{moneyFormat(scope.row.ogiamt, scope.row.cur) }}</span></template> </el-table-column> <el-table-column label="实收金额" prop="amt" min-width="100px"> <template slot-scope="scope"><span> {{moneyFormat(scope.row.amt, scope.row.cur) }}</span></template> </el-table-column> <el-table-column label="优惠金额" prop="dctamt" min-width="100px"> <template slot-scope="scope"><span> {{moneyFormat(scope.row.dctamt, scope.row.cur) }}</span></template> </el-table-column> </c-paging-table> </c-col> </el-form> </div> </template> <script> import FeeConModel, { Pattern } from "../model/model.js"; import { queryByPage } from "../event/index.js"; import Utils from "~/utils"; import commonFunctions from "~/mixin/commonFunctions.js"; import Api from '~/service/Api'; export default { mixins: [commonFunctions], data() { return { feeConVo: new FeeConModel().data.FeeConVo, rules: Pattern, tableData: [], searchLoading: false, isDisabled: true, bustyp:[ {label: "进口信用证", value: "LID"}, {label: "进口信用证单据", value: "BRD"}, {label: "出口信用证", value: "LED"}, {label: "出口信用证单据", value: "BED"}, {label: "转让信用证", value: "LTD"}, {label: "转让信用证单据", value: "BTD"}, {label: "国内证买方", value: "DID"}, {label: "国内证买方单据", value: "BDD"}, {label: "国内证卖方", value: "DED"}, {label: "国内证卖方单据", value: "BFD"}, {label: "汇款", value: "CPD"}, {label: "保证金业务", value: "FCD"}, {label: "出口融资", value: "BPD"}, {label: "进口融资", value: "TRD"}, {label: "委托方代付", value: "DFD"}, {label: "进口代收", value: "BCD"}, {label: "出口托收", value: "BOD"}, {label: "光票托收", value: "CCD"}, {label: "国际保函", value: "GID"}, {label: "国内保函", value: "NID"}, {label: "国际保函索赔", value: "GCD"}, {label: "国内保函索赔", value: "NCD"}, {label: "结售汇", value: "JSD"}, {label: "万能交易", value: "MCD"}, ] } }, mounted() { this.searchTable(); }, methods: { // 重置表单数据 resetFormFields(formName) { this.feeConVo.dondat1 = new Date((new Date).getTime() - (7 * 24 * 60 * 60 * 1000)); this.feeConVo.dondat2 = new Date(); this.feeConVo.qryflg = 'N'; this.$refs[formName].resetFields(); }, // 获取分页组件数据,为请求数据赋值 queryFunc(pageNumber, pageSize) { this.feeConVo.pageNumber = pageNumber; this.feeConVo.pageSize = pageSize; this.searchTable(); }, // 列表查询 searchTable() { if (this.feeConVo.dondat1 == null || this.feeConVo.dondat1 == '') { this.$notify.error({ title: '错误', message: '费用结算开始日期必输!' }); return; } if (this.feeConVo.dondat2 == null || this.feeConVo.dondat2 == '') { this.$notify.error({ title: '错误', message: '费用结算结束日期必输!' }); return; } if (this.feeConVo.dondat1 != null && this.feeConVo.dondat2 != null) { if (new Date(this.feeConVo.dondat1).getTime() > new Date(this.feeConVo.dondat2).getTime()) { this.$notify.error({ title: '错误', message: '费用结算开始日期应小于费用结算结束日期!' }); return } if (new Date(this.feeConVo.dondat2).getTime() - new Date(this.feeConVo.dondat2).getTime() > 365 * 24 * 60 * 60 * 1000 * 5) { this.$notify.error({ title: '错误', message: '费用结算时间跨度不应超过5年!' }); return } } const loading = this.loading(); this.searchLoading = true; queryByPage(this.feeConVo) .then((res) => { this.tableData = res.data.list; this.feeConVo.total = res.data.total; this.feeConVo.pageNumber = res.data.pageNumber; this.feeConVo.pageSize = res.data.pageSize; this.setBtnDisabled(); this.searchLoading = false; loading.close(); }) .catch((err) => { this.searchLoading = false; loading.close(); this.$notify.error("查询失败!"); }); }, // 设置导出按钮状态 setBtnDisabled() { if (this.tableData == null || this.tableData.length <= 0) { this.isDisabled = true; } else { this.isDisabled = false; } }, // 导出Excel文件 async exportExcel() { const loading = this.loading(); let res = await Api.post("/business/fepsel/exportExcel",{ ...this.feeConVo,}); if (res.respCode == SUCCESS) { let objdata = res.data var columns = this.$refs.feeConVoTableRef.$refs.table.columns; let obj = [] let arr = [] for (let i = 0; i < columns.length; i++) { arr.push(columns[i].label) } obj.push(arr); for (let m = 0; m < objdata.length; m++) { let array = [] for (let n = 0; n < columns.length; n++) { if (columns[n].property === 'objtyp') { let valueObjs = this.bustyp.filter(bustyp => bustyp.value === objdata[m][columns[n].property]); if (valueObjs && valueObjs.length > 0) { array.push(valueObjs[0].label); } else { array.push(objdata[m][columns[n].property]) } } else { array.push(objdata[m][columns[n].property]) } } obj.push(array) } Utils.exportToExcel(obj, "收费优惠明细文件.xlsx", "收费优惠明细"); } loading.close(); } } } </script> <style lang="less" scoped> .currentPage { .el-table--enable-row-hover { .el-table__body { tr:hover>td { background-color: #c694dc !important; } } } ::v-deep .el-checkbox { float: none; } } </style>