<template>
|
<div class="search-form">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"
|
ref="form"
|
title="额度项下业务"
|
:formValues="formValues"
|
:formRules="formRules"
|
:buttons="formButtons"
|
:isShowAll="isShowAll"
|
></CommForm>
|
<CommTable
|
:pageInfo="pageInfo"
|
:total="total"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:loading="loading"
|
:list="records"
|
:header="tableHeader"
|
v-bind="$attrs"
|
:isShowMore="false"
|
></CommTable>
|
<!-- @handleSelectionChange="handleSelectionChange" -->
|
</div>
|
</template>
|
|
<script>
|
import CommForm from "@/components/CommForm";
|
import CommTable from "@/components/CommTable";
|
|
import quotaUnderBusinessList from "@/controller/quotaUnderBusinessList";
|
import queryProductList from "@/controller/queryProductList";
|
import queryCodeValueList from "@/controller/queryCodeValueList";
|
const recordButtons = [
|
{
|
text: "贷款详情",
|
prop: "detailsButton"
|
}
|
];
|
export default {
|
components: {
|
CommForm,
|
CommTable
|
},
|
data() {
|
return {
|
loading: false,
|
isShowAll: false,
|
dialogEditClaim: false,
|
dialogRefundTransInfo: false,
|
query: {},
|
trxnBr: "",
|
buttonProp: "",
|
tempInfo: {},
|
model: null,
|
formList: [],
|
tableHeader: [],
|
formButtons: [
|
{ text: "重置", type: "default" },
|
{ text: "搜索" },
|
{ text: "展开", type: "fold" }
|
],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10
|
},
|
total: 0,
|
records: [],
|
tempRecord: {}
|
};
|
},
|
created() {
|
this.init();
|
},
|
methods: {
|
init() {
|
const { query } = this.$route;
|
this.query = query;
|
let model = quotaUnderBusinessList();
|
this.formList = model.getFormList();
|
this.formRules = model.getFormRules();
|
this.tableHeader = model.getTableList();
|
model.computedItem = item => {
|
return {
|
...item,
|
action: {
|
buttons: [...recordButtons]
|
}
|
};
|
};
|
this.model = model;
|
this.setSelectOptions();
|
this.getList();
|
},
|
|
setSelectOptions() {
|
const { formList } = this;
|
formList.forEach(({ name }) => {
|
if (name === "productIdArray") {
|
this.queryProductList(name, {});
|
}
|
if (name === "controlStatus") {
|
this.queryCodeValueList(name, { codeNo: "ControlStatus" });
|
}
|
if (name === "approveStatus") {
|
this.queryCodeValueList(name, { codeNo: "ApproveStatus" });
|
}
|
});
|
},
|
|
async queryProductList(name, info = {}) {
|
const tempModel = queryProductList();
|
const { list } = await tempModel.request();
|
this.updateValue(name, { options: list });
|
},
|
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList();
|
const { list } = await tempModel.request(info);
|
this.updateValue(name, { options: list });
|
},
|
|
async getList() {
|
this.loading = true;
|
const { query, pageInfo, model, formValues = {} } = this;
|
const { serialNo, customerId } = query;
|
const res = await model.request({
|
...pageInfo,
|
...formValues,
|
controlSerialNo: serialNo,
|
customerId
|
});
|
this.loading = false;
|
const { list = [], total } = res;
|
this.records = list;
|
this.total = parseInt(total);
|
},
|
|
doAction(item, record) {
|
const { prop } = item;
|
this.tempRecord = { ...record };
|
if (prop === "detailsButton") {
|
this.toDetail();
|
}
|
},
|
|
toDetail() {
|
const { tempRecord } = this;
|
const {
|
detailFlowNo,
|
detailObjectType,
|
detailOccurtype,
|
customerId,
|
applySerialNo
|
} = tempRecord;
|
const info = {
|
occurType: detailOccurtype,
|
flowno: detailFlowNo,
|
objectType: detailObjectType,
|
customerID: customerId,
|
applySerialNo,
|
};
|
this.toEdit(info)
|
},
|
|
toEdit(info = {}) {
|
const { applySerialNo } = info
|
const params = Object.keys(info)
|
.map(key => `${key}=${info[key]}`)
|
.join("&");
|
// console.log(location.origin)
|
// location.href = `${location.origin}/rlc-mal-web/#/comm/apply?from=cts&${params}`
|
this.openWindow(
|
`${location.origin}/cts-web/#/comprehensiveTransaction/loanDetail/${applySerialNo}?from=newCts&isHideBack=1&${params}`
|
);
|
},
|
|
openWindow(url) {
|
window.open(
|
url,
|
"newDetailWindow",
|
"height=600px, width=1200px, top=100px,left=300px"
|
);
|
},
|
// 表单按钮事件处理
|
buttonAction(id) {
|
if (id === 0) {
|
this.resetForm();
|
}
|
if (id === 1) {
|
this.resetList();
|
}
|
if (id === 2) {
|
const { isShowAll } = this;
|
this.isShowAll = !isShowAll;
|
}
|
},
|
resetForm() {
|
const { model } = this;
|
this.formList = model.getFormList();
|
this.setSelectOptions();
|
},
|
resetList() {
|
this.pageInfo.currentPage = 1;
|
this.getList();
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getList();
|
},
|
// 更新表单数据
|
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 });
|
}
|
}
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this;
|
return model.getFormValues(formList);
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
</style>
|