<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" -->
|
<el-dialog
|
v-if="dialogDetail"
|
:visible.sync="dialogDetail"
|
custom-class="comm-dialog"
|
:modal-append-to-body="false"
|
width="850px"
|
>
|
<productQuotaDetail :tempRecord="tempRecord" @close="close" :operation="query.type"></productQuotaDetail>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import CommForm from "@/components/CommForm";
|
import CommTable from "@/components/CommTable";
|
|
import productQuotaDetail from "@/components/dialogAssembly/productQuotaDetail";
|
|
import quotaControlProductList from "@/controller/quotaControlProductList";
|
import qryCustProductQuotaList from "@/controller/qryCustProductQuotaList";
|
import queryProductList from "@/controller/queryProductList";
|
import queryCodeValueList from "@/controller/queryCodeValueList";
|
const recordButtons = [
|
{
|
text: "产品额度详情",
|
prop: "detailsButton"
|
}
|
];
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
productQuotaDetail
|
},
|
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: {},
|
dialogDetail: false
|
};
|
},
|
created() {
|
this.init();
|
},
|
methods: {
|
init() {
|
const { query } = this.$route;
|
const { type } = query;
|
this.query = query;
|
// type 0 管控额度 1 客户额度
|
let model = null;
|
if (type === "0") {
|
model = quotaControlProductList({ operation: "search", type });
|
}
|
if (type === "1") {
|
model = qryCustProductQuotaList({ operation: "search" });
|
}
|
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 === "productArray") {
|
this.queryProductList(name, {});
|
}
|
if (name === "productIdArray") {
|
this.queryProductList(name, {});
|
}
|
if (name === "controlStatus") {
|
this.queryCodeValueList(name, { codeNo: "ControlStatus" });
|
}
|
if (name === "approveStatus") {
|
this.queryCodeValueList(name, { codeNo: "ApproveStatus" });
|
}
|
if (name === "quotaStatus") {
|
this.queryCodeValueList(name, { codeNo: "QuotaStatus" });
|
}
|
});
|
},
|
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;
|
let {
|
serialNo,
|
pageId,
|
type,
|
quotaSerialNo,
|
controlSerialNo,
|
certId = "",
|
certType = "",
|
phaseNo
|
} = query;
|
// type 0-管控额度 1-客户额度
|
serialNo = type === "1" ? "" : serialNo;
|
if (type === "0" && phaseNo === "0020") {
|
serialNo = controlSerialNo;
|
}
|
console.log(serialNo, phaseNo);
|
const res = await model.request({
|
...pageInfo,
|
...formValues,
|
certId,
|
certType,
|
serialNo
|
});
|
// serialNo: pageId === "22" ? quotaSerialNo : serialNo
|
this.loading = false;
|
const { list = [], total } = res;
|
this.records = list;
|
this.total = parseInt(total);
|
},
|
// 表单按钮事件处理
|
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();
|
},
|
doAction(item, record) {
|
const { prop } = item;
|
this.tempRecord = { ...record };
|
if (prop === "detailsButton") {
|
this.dialogDetail = true;
|
}
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getList();
|
},
|
close() {
|
this.dialogDetail = false;
|
},
|
// 更新表单数据
|
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>
|