<template>
|
<div class="search-form">
|
|
<!-- 筛选条件 -->
|
<CommForm ref="form"
|
formType="search"
|
:inline="true"
|
:list="formList"
|
:formValues="formValues"
|
:formRules="formRules"
|
:buttons="formButtons"
|
:isShowAll="isShowAll"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"></CommForm>
|
<div class="middle-button">
|
<el-button type="primary"
|
icon="el-icon-circle-plus-outline"
|
size="small"
|
@click="addConfig">新增</el-button>
|
</div>
|
|
<!-- 列表 -->
|
<CommTable v-bind="$attrs"
|
:pageInfo="pageInfo"
|
:total="total"
|
:loading="loading"
|
:list="records"
|
:header="tableHeader"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"></CommTable>
|
|
<!-- 编辑 -->
|
<el-dialog :visible.sync="dialogEditMark"
|
:modal-append-to-body="false"
|
custom-class="comm-dialog"
|
width="850px">
|
<SpecialDerateUpdate :info="tempRecord"
|
:detail="tempInfo"
|
:buttonProp="buttonProp"
|
:isShow="dialogEditMark"
|
:addOrEdit="addOrEdit"
|
@callback="toShowSucc"
|
@close="dialogEditMark = false"></SpecialDerateUpdate>
|
</el-dialog>
|
|
<!-- 删除 -->
|
<Dialog v-model="isDelDialog"
|
title="删除确认"
|
:contentText="`请确认是否删除${tempRecord.customername} ?`"
|
:buttons="[{text: '取消'},{text: '确定', type: 'primary'}]"
|
@handleClick="clickDelCancel"></Dialog>
|
</div>
|
</template>
|
<script>
|
// 提前结清减免配置管理
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
import Dialog from '@/components/Dialog'
|
import SpecialDerateUpdate from '@/components/SpecialDerateUpdate'
|
import EditClaim from '@/components/EditClaim'
|
import ManualReturn from '@/components/ManualReturn'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
import aipOrConfig from '@/controller/acctPrepaySpecial/aipOrConfig'
|
|
const recordButtons = [
|
{
|
text: '修改',
|
prop: 'editRemarkButton',
|
},
|
{
|
text: '删除',
|
prop: 'delButton',
|
},
|
]
|
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
SpecialDerateUpdate,
|
Dialog,
|
EditClaim,
|
ManualReturn,
|
},
|
props: {
|
model: {
|
type: Object,
|
required: true,
|
},
|
// 初始值
|
initValue: {
|
type: Object,
|
default: () => ({}),
|
},
|
// 默认请求参数
|
fetchInfo: {
|
type: Object,
|
default: () => ({}),
|
},
|
transCode: {
|
type: String,
|
default: '',
|
},
|
|
codeNo: {
|
type: String,
|
default: '',
|
},
|
|
pageId: {
|
type: String,
|
default: '',
|
},
|
},
|
data() {
|
return {
|
loading: false,
|
isShowAll: false,
|
tempRecord: {},
|
buttonProp: '',
|
tempInfo: {},
|
dialogEditMark: false,
|
isShowSucc: false,
|
isDelDialog: false,
|
formList: [],
|
formRules: {},
|
tableHeader: [],
|
formButtons: [{ text: '重置', type: 'default' }, { text: '搜索' }],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
records: [],
|
delRefundModel: null,
|
powerControl: {
|
delButton: true,
|
editRemarkButton: true,
|
},
|
addOrEdit: 'add',
|
}
|
},
|
created() {
|
this.init()
|
},
|
mounted() {
|
},
|
methods: {
|
init() {
|
this.$route.meta.keepAlive = true
|
const { model, initValue } = this
|
model.computedItem = (item) => {
|
return {
|
...item,
|
action: {
|
buttons: recordButtons
|
},
|
}
|
}
|
this.formList = model.getFormList(initValue)
|
this.formRules = model.getFormRules()
|
this.tableHeader = model.getTableList()
|
this.delRefundModel = aipOrConfig('del')
|
this.getList()
|
},
|
|
// 设置表单下拉菜单
|
setSelectOptions() {
|
const { formList, codeNo } = this
|
formList.forEach(({ name }) => {
|
if (name === 'status') {
|
this.queryCodeValueList(name, { codeNo: 'ClaimStatus' })
|
}
|
})
|
},
|
|
// 获取列表
|
async getList() {
|
this.loading = true
|
let { pageInfo, formValues, model, fetchInfo, transCode = '' } = this
|
// 自动扣款挂起管理新增查询条件字段loanUpStatus
|
if (formValues.loanUpStatusArray) {
|
formValues.loanUpStatus = formValues.loanUpStatusArray
|
}
|
const res = await model.request({
|
...fetchInfo,
|
transCode,
|
...pageInfo,
|
...formValues,
|
})
|
this.loading = false
|
const { list = [], total } = res
|
this.records = list
|
this.total = parseInt(total)
|
},
|
|
// 更新表单数据
|
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 })
|
}
|
},
|
|
// 获取select中options数据
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request(info)
|
this.updateValue(name, { options: list })
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val
|
this.getList()
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val
|
this.getList()
|
},
|
|
// // 修改翻页条数
|
// planHandleSizeChange(val) {
|
// this.planPageInfo.pageSize = val
|
// this.getPlanList()
|
// },
|
|
// // 修改翻页数
|
// planHandleCurrentChange(val) {
|
// this.planPageInfo.currentPage = val
|
// this.getPlanList()
|
// },
|
|
// 表单按钮事件处理
|
buttonAction(id) {
|
if (id === 0) {
|
this.resetForm()
|
}
|
if (id === 1) {
|
this.resetList()
|
}
|
if (id === 2) {
|
const { isShowAll } = this
|
this.isShowAll = !isShowAll
|
}
|
},
|
|
// 新增
|
async addConfig() {
|
this.addOrEdit = 'add'
|
this.tempInfo = { rpyNam: '', acctNo: '', certtype: '', coreBalance: '' }
|
this.dialogEditMark = true
|
},
|
// 表格按钮事件处理
|
doAction(item, record) {
|
const { prop } = item
|
this.tempRecord = { ...record }
|
this.buttonProp = prop
|
|
// 编辑
|
if (prop === 'editRemarkButton') {
|
record.certtype = '01'
|
this.addOrEdit = 'edit'
|
this.tempInfo = record
|
this.dialogEditMark = true
|
}
|
|
// 删除
|
if (prop === 'delButton') {
|
this.isDelDialog = true
|
}
|
},
|
// 删除
|
clickDelCancel(index) {
|
if (index === 0) {
|
this.isDelDialog = false
|
} else {
|
this.delSpecial()
|
}
|
},
|
// 删除
|
async delSpecial() {
|
const { tempRecord, delRefundModel } = this
|
const { serialno } = tempRecord
|
await delRefundModel.request({
|
ids: serialno
|
})
|
this.toShowSucc()
|
},
|
|
toShowSucc() {
|
this.dialogEditMark = false
|
this.isDelDialog = false
|
this.isShowSucc = true
|
this.getList()
|
},
|
|
resetList() {
|
this.pageInfo.currentPage = 1
|
this.getList()
|
},
|
|
resetForm() {
|
const { model } = this
|
this.formList = model.getFormList()
|
this.setSelectOptions()
|
},
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model.getFormValues(formList)
|
},
|
},
|
}
|
</script>
|
<style lang="postcss" scoped>
|
</style>
|