<template>
|
<div class="mod-role">
|
<avue-crud ref="crud" :page.sync="page" :data="dataList" :option="tableOption" @search-change="searchChange"
|
@selection-change="selectionChange" @on-load="getDataList" :cell-class-name="addClasscolor"
|
@refresh-change="refreshChange">
|
|
<!-- <template slot-scope="scope" slot="state">
|
<span>{{ scope.row.state[1] }}</span>
|
</template>
|
|
<template slot-scope="scope" slot="repayment">
|
<span>{{ scope.row.repayment[1] }}</span>
|
</template>
|
|
<template slot-scope="scope" slot="lendingInstitution">
|
<span>{{ scope.row.lendingInstitution[1] }}</span>
|
</template> -->
|
|
<template slot="menuLeft">
|
<el-button type="primary" icon="el-icon-edit" size="small" @click.stop="addOrUpdateHandle()">新增</el-button>
|
</template>
|
|
<template slot-scope="scope" slot="menu">
|
<el-button type="primary" icon="el-icon-edit" size="small" style="margin-right:10px"
|
@click.stop="addOrUpdateHandle(scope.row)">编辑</el-button>
|
|
<el-popconfirm title="确认删除吗?" @confirm="deleteHandle(scope.row)">
|
<el-button slot="reference" type="primary" size="small">删除</el-button>
|
</el-popconfirm>
|
</template>
|
</avue-crud>
|
<!-- 弹窗, 新增 / 修改 -->
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
|
<!-- 确认弹窗-start -->
|
<el-dialog title="驳回原因" :visible.sync="dialogFormVisible" :append-to-body="true">
|
<el-form :model="dataForm2" ref="dataForm2" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
<el-form-item label="驳回原因" :label-width="formLabelWidth" prop="reason">
|
<el-input v-model="dataForm2.reason" placeholder="请输入驳回原因" autocomplete="off"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
<el-button type="primary" @click="dataFormSubmit()">确 定</el-button>
|
</div>
|
</el-dialog>
|
<!-- 确认弹窗-end -->
|
|
</div>
|
</template>
|
|
<script>
|
import { tableOption } from "@/crud/mining/loan-configuration";
|
import AddOrUpdate from "./loanCon-add-or-update";
|
import { Debounce } from '@/utils/debounce'
|
export default {
|
data() {
|
return {
|
dataForm: {},
|
dataList: [],
|
dataListLoading: false,
|
dataListSelections: [],
|
addOrUpdateVisible: false,
|
tableOption: tableOption,
|
page: {
|
total: 0, // 总页数
|
currentPage: 1, // 当前页数
|
pageSize: 10, // 每页显示多少条
|
},
|
dialogFormVisible: false,
|
dataForm2: {},
|
formLabelWidth: "120px",
|
row: {},
|
};
|
},
|
components: {
|
AddOrUpdate,
|
},
|
methods: {
|
addClasscolor({ column, row }) {
|
//表单样式
|
if (
|
(column.property === "direction" && row.direction == "buy") ||
|
(column.property === "profitLoss" && row.profitLoss * 1 > 0) ||
|
(column.property === "rolename" && row.rolename == "MEMBER") ||
|
(column.property === "volume" && row.volume * 1 >= 0) ||
|
(column.property === "deposit" && row.deposit * 1 >= 0) ||
|
(column.property === "state" && row.state == "created")
|
) {
|
return "green";
|
} else if (
|
(column.property === "direction" && row.direction == "sell") ||
|
(column.property === "profitLoss" && row.profitLoss * 1 < 0) ||
|
(column.property === "state" && row.state == "canceled")
|
) {
|
return "red";
|
} else if (
|
(column.property === "rolename" && row.rolename == "GUEST") ||
|
(column.property === "state" && row.state == "submitted")
|
) {
|
return "yellow";
|
}
|
|
},
|
// 获取数据列表
|
getDataList(page, done) {
|
this.dataListLoading = true;
|
this.$http({
|
url: this.$http.adornUrl("/loanParam/getLoanParamList.do"),
|
method: "post",
|
params: this.$http.adornParams({
|
pageNum: this.page.currentPage,
|
pageSize: this.page.pageSize,
|
}),
|
}).then(({ data }) => {
|
console.log("data => " + JSON.stringify(data));
|
this.dataList = data.data.records;
|
this.page.total = data.data.total;
|
this.dataListLoading = false;
|
if (done) {
|
done();
|
}
|
});
|
},
|
// 条件查询
|
searchChange(params, done) {
|
this.page.currentPage = 1; // 重置当前页为第一页
|
this.getDataList(this.page, done);
|
},
|
// 多选变化
|
selectionChange(val) {
|
this.dataListSelections = val;
|
},
|
// 新增 / 修改
|
addOrUpdateHandle(id) {
|
this.addOrUpdateVisible = true;
|
this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(id);
|
});
|
},
|
// 删除
|
deleteHandle: Debounce(function (row) {
|
this.$http({
|
url: this.$http.adornUrl(`/loanParam/delLoanParam.do`),
|
method: 'post',
|
params: { id: row.uuid }
|
})
|
.then(({ data }) => {
|
if (data.code == 0) {
|
this.$message({
|
message: '操作成功',
|
type: 'success',
|
duration: 1000,
|
onClose: () => {
|
this.getDataList()
|
}
|
})
|
} else {
|
this.$message({
|
message: data.msg,
|
type: 'error',
|
duration: 1000,
|
onClose: () => {
|
}
|
})
|
}
|
})
|
}),
|
|
dataFormSubmit() {
|
//驳回原因
|
//
|
this.$http({
|
url: this.$http.adornUrl("/normal/loanadmin!change.action"),
|
method: "get",
|
params: this.$http.adornParams(Object.assign({
|
reason: this.dataForm2.reason,
|
orderId: this.row.uuid,
|
statusStr: 3
|
})),
|
}).then(({ data }) => {
|
console.log("data => " + JSON.stringify(data));
|
this.getDataList();
|
this.dialogFormVisible = false;
|
// if (data.code == 0) {
|
// this.dataForm = data.data;
|
// }
|
});
|
//
|
},
|
// 刷新回调用
|
refreshChange() {
|
console.log("refreshChange")
|
this.page = this.$refs.crud.$refs.tablePage.defaultPage
|
this.getDataList(this.page)
|
this.dataListSelections = []
|
this.$refs.crud.selectClear()
|
},
|
},
|
};
|
</script>
|
<style scoped>
|
.mod-role {}
|
|
.allBox {
|
overflow: hidden;
|
height: 40px;
|
line-height: 40px;
|
margin: 30px 0;
|
}
|
|
.leDiv {
|
float: left;
|
margin-left: 20px;
|
line-height: 40px;
|
}
|
|
.speacRead {
|
font-weight: 500;
|
}
|
|
::v-deep .celectSpeac .el-input__inner {
|
background: #1c4efa !important;
|
}
|
|
::v-deep .celectSpeac .el-input__inner::placeholder {
|
color: #fff;
|
}
|
</style>
|