<template>
|
<div>
|
<div class="form-content">
|
<FormList
|
:info="formInfo"
|
:isShowDetail="isShowDetail"
|
@handleClick="isShowDetail = !isShowDetail"
|
@updateValue="updateValue"
|
@onSubmit="onSubmit"
|
@setValueInfo="setValueInfo"
|
:isChangeArray="false"
|
@resetValue="resetValue"
|
></FormList>
|
</div>
|
<div class="list-content">
|
<TableList
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:isAutoIndex="true"
|
:isPaddingRight="false"
|
:activeIndex="activeIndex"
|
ref="tableRef"
|
:list="records"
|
:header="tableHeader"
|
:height="tableHeight"
|
:loading="loading"
|
></TableList>
|
</div>
|
</div>
|
</template>
|
<script>
|
import FormList from "../../../comprehensiveTransaction/components/FormList.vue";
|
import TableList from "../../../comprehensiveTransaction/components/TableList.vue";
|
import { qryProjectCompanyListHeader } from "@comprehensive/utils/tableHeaders";
|
import { qryProjectCompanyListSearch } from "@comprehensive/utils/formItems";
|
import { qryCompany, qryProjectCompanyList } from "@comprehensive/serve/public";
|
import { customerQryFlowPhaseList } from "@/api/product";
|
export default {
|
name: "workerLoanList",
|
components: {
|
FormList,
|
TableList,
|
},
|
computed: {
|
activeIndex() {
|
const arr = [];
|
this.records.forEach((item, i) => {
|
// this.checkInfoList.forEach((val) => {
|
// if (item.applySerialNo == val.applySerialNo) {
|
// arr.push(i);
|
// }
|
// });
|
});
|
return arr;
|
},
|
},
|
data() {
|
return {
|
formInfo: [...qryProjectCompanyListSearch],
|
formInfoFilter: [],
|
// 是否显示所有表单项
|
isShowDetail: false,
|
// 表单结果数据
|
valueInfo: {},
|
//下载loading
|
downLoading: false,
|
//表单数据
|
records: [],
|
//页码
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
tableHeader: [...qryProjectCompanyListHeader],
|
tableHeight: "560px",
|
//数据列表loading
|
loading: false,
|
checkInfoList: [],
|
excelLoading: false,
|
};
|
},
|
activated() {
|
this.init();
|
},
|
created() {
|
// this.init();
|
},
|
methods: {
|
// 获取下拉值
|
customerQryFlowPhaseList() {
|
customerQryFlowPhaseList({}).then((res) => {
|
const { result } = res;
|
this.setOrGetFormInfo("phasenoArray", { options: result });
|
});
|
},
|
init() {
|
this.formInfo = qryProjectCompanyListSearch.filter(
|
({ name }) => !this.formInfoFilter.includes(name)
|
);
|
for (let key in this.valueInfo) {
|
if (this.valueInfo.hasOwnProperty(key)) {
|
if (this.valueInfo[key]) {
|
this.setOrGetFormInfo(key, { value: this.valueInfo[key] });
|
}
|
}
|
}
|
this.customerQryFlowPhaseList();
|
this.requestQryProjectCompanyList();
|
},
|
// 获取当前数据列表
|
async requestQryProjectCompanyList() {
|
let { valueInfo, pageInfo } = this;
|
this.loading = true;
|
console.log("当前url", this.$route.path);
|
const res = await qryProjectCompanyList({
|
...valueInfo,
|
...pageInfo,
|
});
|
this.loading = false;
|
if (res.result) {
|
this.records = res.result.records.reduce((pre, curr) => {
|
console.log("curr", curr.phasename);
|
let sortButtons = [
|
{
|
label: "保证金退还",
|
disabled: curr.phasename === "审核通过" ? false : true,
|
},
|
];
|
pre.push({
|
...curr,
|
buttons: [...sortButtons],
|
});
|
return pre;
|
}, []);
|
this.pageInfo = {
|
...pageInfo,
|
total: res.result.total,
|
};
|
}
|
},
|
// 设置表单结果数据
|
setValueInfo(info = {}) {
|
this.valueInfo = info;
|
},
|
resetValue() {
|
this.valueInfo = {};
|
},
|
// 更新表单数据或查找某项数据
|
setOrGetFormInfo(nameKey, newInfo) {
|
let { formInfo } = this;
|
let index = formInfo.findIndex(({ name }) => name === nameKey);
|
let result = {};
|
if (!isNaN(index)) {
|
this.$set(this.formInfo, index, { ...formInfo[index], ...newInfo });
|
result = this.formInfo[index];
|
}
|
if (typeof newInfo === "undefined") {
|
return result;
|
}
|
},
|
// 更新数据
|
updateValue(value, item) {
|
let { name } = item;
|
this.setOrGetFormInfo(name, { value });
|
},
|
|
// 表单事件回调
|
async doAction(name, item, { label }) {
|
console.log("doAction name, item", name, item, label);
|
console.log("当前url,区分跳转", this.$route.path);
|
const { serialno } = item;
|
if (name === "serialno") {
|
this.$router.push({
|
path: `/workerLoanDetail/${serialno}`,
|
query: { ...item },
|
});
|
}
|
if (label === "立即处理") {
|
this.$store.commit("SET_projectCompany", item);
|
this.$router.push({ path: "/workerLoanInitialReview" });
|
}
|
if (label === "保证金退还") {
|
this.$router.push({
|
path: `/workerLoanDetail/${serialno}`,
|
query: { ...item, enterType: "depositRefund" },
|
});
|
}
|
},
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.requestQryProjectCompanyList();
|
},
|
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.requestQryProjectCompanyList();
|
},
|
|
// 查询操作
|
onSubmit(val) {
|
console.log("onSubmit");
|
this.pageInfo.currentPage = 1;
|
if (val == "reset") {
|
this.formInfo = qryProjectCompanyListSearch.filter(
|
({ name }) => !this.formInfoFilter.includes(name)
|
);
|
this.valueInfo = {};
|
}
|
this.customerQryFlowPhaseList();
|
this.requestQryProjectCompanyList();
|
},
|
},
|
watch: {},
|
};
|
</script>
|
<style lang="postcss" scoped>
|
.list-content {
|
font-size: 14px;
|
}
|
.export-excle {
|
margin: 0 0 20px 0;
|
}
|
.message {
|
font-size: 12px;
|
color: #666666;
|
padding: 10px 20px;
|
background-color: #fafafa;
|
}
|
>>> .el-table__header {
|
width: 100% !important;
|
}
|
>>> .el-table__body {
|
width: 100% !important;
|
}
|
>>> .el-table__empty-block {
|
width: 100% !important;
|
}
|
</style>
|