<template>
|
<div class="search-form">
|
|
<!-- 筛选条件 -->
|
<CommForm ref="form"
|
formType="search"
|
:inline="true"
|
:list="formList"
|
:formValues="formValues"
|
:formRules="formRules"
|
:buttons="formButtons"
|
:isShowAll="true"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"></CommForm>
|
<div class="middle-button">
|
<!-- <el-upload :show-file-list="false"
|
:http-request="uploadFile"
|
:on-change="uploadSucc"
|
class="file-uploader"
|
type="primary"
|
action="customize"
|
multiple>
|
<el-button size="mini"
|
class="upload-btn">上传</el-button>
|
</el-upload> -->
|
<el-button size="small"
|
type="primary"
|
icon="el-icon-download"
|
:loading="excelLoading"
|
@click="exportBtn">导出</el-button>
|
</div>
|
|
<!-- 列表 -->
|
<CommTable v-bind="$attrs"
|
:pageInfo="pageInfo"
|
:total="total"
|
:loading="loading"
|
:list="records"
|
:header="tableHeader"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"></CommTable>
|
|
</div>
|
</template>
|
<script>
|
// 贷款借据信息详情查询(批量)
|
import XLSX from "xlsx"
|
import dayjs from 'dayjs'
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
import aipOrConfig from '@/controller/paymentLog/aipOrConfig'
|
// 获取产品api
|
import qryProdList from '@/controller/qryProdList'
|
// 导出表头
|
export const AcctPaymentScheduleFields = {
|
'申请编号': 'applySerialNo',
|
'客户名称': 'customerName',
|
'借据状态': 'loanStatus',
|
'产品名称': 'productName',
|
'贷款机构名称': 'fundUnitNo',
|
};
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
},
|
props: {
|
model: {
|
type: Object,
|
required: true,
|
},
|
// 初始值
|
initValue: {
|
type: Object,
|
default: () => ({}),
|
},
|
// 默认请求参数
|
fetchInfo: {
|
type: Object,
|
default: () => ({}),
|
},
|
transCode: {
|
type: String,
|
default: '',
|
},
|
|
codeNo: {
|
type: String,
|
default: '',
|
},
|
|
pageId: {
|
type: String,
|
default: '',
|
},
|
},
|
data() {
|
return {
|
loading: false,
|
isShowAll: false,
|
excelLoading: false,
|
tempRecord: {},
|
buttonProp: '',
|
tempInfo: {},
|
formList: [],
|
formRules: {},
|
tableHeader: [],
|
formButtons: [
|
{ text: '重置', type: 'default' },
|
{ text: '搜索' },
|
// { text: '展开', type: 'fold' },
|
],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
records: [],
|
delRefundModel: null,
|
fileUploadModel: null,
|
fileDownloadModel: null
|
}
|
},
|
created() {
|
this.init()
|
},
|
mounted() {},
|
methods: {
|
init() {
|
this.$route.meta.keepAlive = true
|
const { model, initValue } = this
|
this.formList = model.getFormList(initValue)
|
this.formRules = model.getFormRules()
|
this.tableHeader = model.getTableList()
|
this.fileUploadModel = aipOrConfig('file')
|
this.fileDownloadModel = aipOrConfig('download')
|
|
this.setSelectOptions()
|
this.getList()
|
},
|
// 设置表单下拉菜单
|
setSelectOptions() {
|
const { formList } = this
|
formList.forEach(({ name }) => {
|
if (name === 'productname') {
|
this.qryProdList(name)
|
}
|
|
// 交易日期
|
if (name === 'senddateDate') {
|
this.updateValue(name, { value: [dayjs().subtract(1, 'month').format('YYYY/MM/DD'), dayjs().format('YYYY/MM/DD')] });
|
}
|
})
|
},
|
|
// 获取列表
|
async getList(params={}, fun, loading=true) {
|
loading && (this.loading = true)
|
let { pageInfo, formValues, model, fetchInfo, transCode = '' } = this
|
// 自动扣款挂起管理新增查询条件字段loanUpStatus
|
if (formValues.loanUpStatusArray) {
|
formValues.loanUpStatus = formValues.loanUpStatusArray
|
}
|
const applyserialnoarray = formValues.applyserialnoarray.trim() ? formValues.applyserialnoarray.trim().split('\n'): []
|
const res = await model.request({
|
...fetchInfo,
|
transCode,
|
...pageInfo,
|
...formValues,
|
...params,
|
applyserialnoarray
|
})
|
loading && (this.loading = false)
|
let { list = [], total } = res
|
if(typeof fun === 'function') {
|
fun(list)
|
} else {
|
this.records = list
|
this.total = parseInt(total)
|
}
|
},
|
|
// 更新表单数据
|
updateValue(index, info) {
|
const { formList } = this
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
}
|
},
|
|
// 获取select中options数据
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request(info)
|
this.updateValue(name, { options: list })
|
},
|
|
// 产品名称下拉列表
|
async qryProdList(name) {
|
const tempModel = qryProdList()
|
const { list } = await tempModel.request({ productTypeNo: '' })
|
list.map(item => {
|
item.value = item.label
|
})
|
this.updateValue(name, { options: list })
|
},
|
|
async uploadFile(params) {
|
try {
|
let file = params.file
|
const res = await this.fileUploadModel.request({
|
file,
|
})
|
this.$message.success('上传成功')
|
} catch (error) {}
|
},
|
uploadSucc() {
|
this.getList()
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val
|
this.getList()
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val
|
this.getList()
|
},
|
|
// 表单按钮事件处理
|
buttonAction(id) {
|
if (id === 0) {
|
this.resetForm()
|
}
|
if (id === 1) {
|
this.resetList()
|
}
|
if (id === 2) {
|
const { isShowAll } = this
|
this.isShowAll = !isShowAll
|
}
|
},
|
|
toShowSucc() {
|
this.getList()
|
},
|
|
resetList() {
|
this.pageInfo.currentPage = 1
|
this.getList()
|
},
|
|
resetForm() {
|
const { model } = this
|
this.formList = model.getFormList()
|
this.setSelectOptions()
|
this.getList()
|
},
|
// 导出
|
async exportBtn() {
|
this.excelLoading = true;
|
let { formValues, fetchInfo } = this;
|
// 自动扣款挂起管理新增查询条件字段loanUpStatus
|
if (formValues.loanUpStatusArray) {
|
formValues.loanUpStatus = formValues.loanUpStatusArray
|
}
|
const applyserialnoarray = formValues.applyserialnoarray.trim() ? formValues.applyserialnoarray.trim().split('\n'): []
|
const params = {
|
...fetchInfo,
|
...formValues,
|
applyserialnoarray
|
};
|
await this.fileDownloadModel.request({...params});
|
this.excelLoading = false;
|
},
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model.getFormValues(formList)
|
},
|
},
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.upload-btn {
|
height: 32px;
|
padding: 9px 15px;
|
color: #fff;
|
border-color: #0081f0;
|
background-color: #0081f0;
|
}
|
</style>
|