<template>
|
<div>
|
<div class="search-form">
|
<EditForm ref="form"
|
formType="search"
|
:inline="true"
|
:list="formList"
|
:buttons="buttons"
|
:isShowAll="isShowAll"
|
:formValues="formValues"
|
:formRules="formRules"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"></EditForm>
|
</div>
|
|
<p class="export-excle">
|
<el-button size="small"
|
type="primary"
|
@click="editDialog(1)">新增</el-button>
|
</p>
|
|
<div class="list-content">
|
<TableList :isAutoIndex="true"
|
:isPaddingRight="false"
|
:loading="loading"
|
:list="records"
|
:header="tableList"
|
:total="total"
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"></TableList>
|
</div>
|
|
<!-- 新增 -->
|
<HouseholdBagAgencyFlowEdit :dialogVisible="dialogVisible"
|
:info="form"
|
:applyListAll="applyListAll"
|
@doAction="formDoAction" />
|
|
</div>
|
</template>
|
<script>
|
/**
|
* 返现佣金-经纪公司转账管理
|
*/
|
|
import EditForm from './components/EditForm';
|
import TableList from './components/TableList';
|
import HouseholdBagAgencyFlowEdit from '@comprehensive/components/HouseholdBagAgencyFlowEdit';
|
|
import qryHouseholdBagAgencyFlowList from '@comprehensive/model/qryHouseholdBagAgencyFlowList';
|
import getApplyListAll from '@comprehensive/model/getApplyListAll';
|
|
export default {
|
name: 'HouseholdBagAgencyFlow',
|
components: {
|
TableList,
|
EditForm,
|
HouseholdBagAgencyFlowEdit,
|
},
|
data() {
|
return {
|
title: '新增',
|
form: {},
|
dialogVisible: false,
|
// 是否显示详情页
|
formList: [],
|
tableList: [],
|
formRules: {},
|
listModel: null,
|
query: {},
|
records: [],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
loading: false,
|
uploading: false,
|
// 是否显示所有表单项
|
isShowAll: false,
|
buttons: [
|
{ text: '重置', type: '' },
|
{ text: '搜索' },
|
// { type: 'fold', text: '展开' },
|
],
|
applyListAll: [],
|
};
|
},
|
created() {
|
this.init();
|
},
|
methods: {
|
// 页面初始化处理
|
init() {
|
const { query } = this.$route;
|
this.query = query;
|
const listModel = qryHouseholdBagAgencyFlowList();
|
const formList = listModel.getFormList(query);
|
this.tableList = listModel.getTableList();
|
this.formRules = listModel.getFormRules();
|
this.formList = formList;
|
this.listModel = listModel;
|
|
this.fetch();
|
// this.queryapplyListAll();
|
this.getApplyListAll();
|
},
|
|
// 表单事件回调
|
doAction(name, item, { id, label }) {
|
if (name === 'lastAction') {
|
if (id == 1) {
|
// 编辑
|
this.editDialog(0, item);
|
}
|
}
|
},
|
// 项目管理列表
|
async getApplyListAll() {
|
const res = await getApplyListAll().request({});
|
const { list } = res;
|
this.applyListAll = list;
|
this.updateValue('projectSerialno', { options: list });
|
},
|
// 表单按钮操作
|
buttonAction(index, button) {
|
let { listModel, isShowAll } = this;
|
if (index === 0) {
|
// 重置
|
// this.formList = listModel.getFormList()
|
this.init();
|
}
|
if (index === 1) {
|
// 搜索
|
this.pageInfo.currentPage = 1;
|
this.fetch();
|
}
|
if (index === 2) {
|
// 展开/收起
|
this.isShowAll = !isShowAll;
|
}
|
},
|
editDialog(type, record) {
|
if (type === 1) {
|
// 新增
|
this.form = {};
|
this.title = '新增';
|
this.dialogVisible = true;
|
}
|
},
|
formDoAction(type, data = {}) {
|
if (type === 'close') {
|
this.dialogVisible = false;
|
}
|
if (type === 'succ') {
|
this.dialogVisible = false;
|
this.fetch();
|
}
|
},
|
// 获取当前列表数据
|
async fetch() {
|
try {
|
this.loading = true;
|
let { pageInfo, listModel, formValues, query } = this;
|
const { customerPhone, from } = query;
|
const res = await listModel.request({ ...pageInfo, ...formValues });
|
this.loading = false;
|
const { list, total } = res;
|
this.records = list.reduce((pre, curr) => {
|
let arr = [];
|
arr.push({ id: 1, label: '编辑', disabled: false });
|
|
pre.push({
|
...curr,
|
buttons: [...arr],
|
});
|
|
return pre;
|
}, []);
|
this.total = total;
|
} catch (error) {
|
this.loading = false;
|
}
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.fetch();
|
},
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.fetch();
|
},
|
|
// 更新表单数据
|
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 });
|
}
|
},
|
|
updateOptions(name, list, labelKey, valueKey, isResetValue = true) {
|
const valueObj = isResetValue ? { value: '' } : {};
|
this.updateValue(name, {
|
options: list.map((item) => ({
|
label: item[labelKey],
|
value: item[valueKey],
|
})),
|
...valueObj,
|
});
|
},
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { listModel, formList } = this;
|
return listModel.getFormValues(formList);
|
},
|
},
|
// watch: {
|
// $route() {
|
// this.init()
|
// }
|
// }
|
};
|
</script>
|
<style lang="postcss" scoped>
|
.search-form {
|
padding-top: 16px;
|
}
|
.list-content {
|
font-size: 14px;
|
}
|
.export-excle {
|
margin: 0 0 20px 0;
|
}
|
.message {
|
font-size: 12px;
|
color: #666666;
|
padding: 10px 20px;
|
background-color: #fafafa;
|
}
|
.upload-demo {
|
display: inline-block;
|
margin-left: 10px;
|
}
|
</style>
|