<template>
|
<div class="search-form">
|
|
<!-- 筛选条件 -->
|
<CommForm ref="form"
|
formType="search"
|
:inline="true"
|
:list="formList"
|
:formValues="formValues"
|
:formRules="formRules"
|
:buttons="formButtons"
|
:isShowAll="isShowAll"
|
@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>
|
</div>
|
|
<!-- 列表 -->
|
<CommTable v-bind="$attrs"
|
:pageInfo="pageInfo"
|
:total="total"
|
:loading="loading"
|
:list="records"
|
:header="tableHeader"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"></CommTable>
|
|
</div>
|
</template>
|
<script>
|
// 提前结清减免配置管理
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
import Dialog from '@/components/Dialog'
|
import EditClaim from '@/components/EditClaim'
|
import ManualReturn from '@/components/ManualReturn'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
import aipOrConfig from '@/controller/acctPrepayConfig/aipOrConfig'
|
// 获取产品api
|
import qryProdList from '@/controller/qryProdList'
|
// 获取还款方式api
|
import queryPaymentMethodAcctPrepayConfig from '@/controller/queryPaymentMethodAcctPrepayConfig'
|
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
Dialog,
|
EditClaim,
|
ManualReturn,
|
},
|
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,
|
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,
|
}
|
},
|
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.setSelectOptions()
|
this.getList()
|
},
|
// 设置表单下拉菜单
|
setSelectOptions() {
|
const { formList, codeNo } = this
|
formList.forEach(({ name }) => {
|
// if (name === 'status') {
|
// this.queryCodeValueList(name, { codeNo: 'ClaimStatus' })
|
// }
|
if (name === 'productid') {
|
this.qryProdList(name)
|
}
|
|
if (name === 'repaymenttype') {
|
this.queryMethodList(name)
|
}
|
})
|
},
|
|
// 获取列表
|
async getList() {
|
this.loading = true
|
let { pageInfo, formValues, model, fetchInfo, transCode = '' } = this
|
// 自动扣款挂起管理新增查询条件字段loanUpStatus
|
if (formValues.loanUpStatusArray) {
|
formValues.loanUpStatus = formValues.loanUpStatusArray
|
}
|
const res = await model.request({
|
...fetchInfo,
|
transCode,
|
...pageInfo,
|
...formValues,
|
})
|
this.loading = false
|
const { list = [], total } = res
|
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: '' })
|
this.updateValue(name, { options: list })
|
},
|
// 还款方式下拉列表
|
async queryMethodList(name) {
|
const tempModel = queryPaymentMethodAcctPrepayConfig()
|
const { list } = await tempModel.request({ paymentMethod: '' })
|
this.updateValue(name, { options: list })
|
const { selectObj } = this
|
},
|
|
async uploadFile(params) {
|
try {
|
let file = params.file
|
const res = await this.fileUploadModel.request({
|
file,
|
})
|
this.$message.success('上传成功')
|
} catch (error) {}
|
},
|
uploadSucc(file) {
|
this.getList()
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val
|
this.getList()
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val
|
this.getList()
|
},
|
|
// // 修改翻页条数
|
// planHandleSizeChange(val) {
|
// this.planPageInfo.pageSize = val
|
// this.getPlanList()
|
// },
|
|
// // 修改翻页数
|
// planHandleCurrentChange(val) {
|
// this.planPageInfo.currentPage = val
|
// this.getPlanList()
|
// },
|
|
// 表单按钮事件处理
|
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()
|
},
|
},
|
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>
|