<template>
|
<div class="search-form">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
@buttonAction="buttonAction"
|
ref="form"
|
:formValues="formValues"
|
:formRules="formRules"
|
:buttons="formButtons"
|
:isShowAll="isShowAll"
|
formType="search"
|
></CommForm>
|
|
<CommTable
|
:pageInfo="pageInfo"
|
:total="total"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:loading="loading"
|
:list="records"
|
:header="tableHeader"
|
v-bind="$attrs"
|
></CommTable>
|
|
<el-dialog
|
v-if="dialogTaskAssignOrReturn"
|
:visible.sync="dialogTaskAssignOrReturn"
|
custom-class="comm-dialog"
|
:modal-append-to-body="false"
|
width="850px"
|
>
|
<TaskAssignOrReturn
|
:taskController="taskController"
|
:info="tempRecord"
|
@close="dialogTaskAssignOrReturn = false"
|
:isShow="dialogTaskAssignOrReturn"
|
:queryType="queryType"
|
@callback="toAssignOrReturn"
|
></TaskAssignOrReturn>
|
</el-dialog>
|
|
<Dialog
|
v-model="isShowSucc"
|
icon="succ"
|
iconText="提交成功"
|
:close="false"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="sureSucc"
|
></Dialog>
|
</div>
|
</template>
|
|
<script>
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
import Dialog from '@/components/Dialog'
|
import TaskAssignOrReturn from '@/components/TaskAssignOrReturn'
|
|
import queryModelNodeList from '@/controller/queryModelNodeList'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
|
const recordButtons = [
|
{
|
text: '详情',
|
prop: 'detailButton'
|
},
|
{
|
text: '退回任务池',
|
prop: 'returnTaskPoolButton'
|
},
|
{
|
text: '任务指派',
|
prop: 'turnFlowUserButton'
|
}
|
]
|
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
Dialog,
|
TaskAssignOrReturn
|
},
|
props: {
|
model: {
|
type: Object,
|
required: true
|
},
|
// 初始值
|
initValue: {
|
type: Object,
|
default: () => ({})
|
},
|
// 默认请求参数
|
fetchInfo: {
|
type: Object,
|
default: () => ({})
|
},
|
// queryType 查询类型 01 贷款机构 02 资金单元 03 业务通道 04 兜底机构
|
queryType: {
|
type: String,
|
required: true
|
}
|
},
|
created() {
|
this.init()
|
},
|
data() {
|
return {
|
formList: [],
|
formRules: {},
|
tableHeader: [],
|
tempRecord: {},
|
loading: false,
|
isShowDialog: false,
|
isShowSucc: false,
|
isShowAll: false,
|
dialogTaskAssignOrReturn: false,
|
formButtons: [
|
{ text: '重置', type: 'default' },
|
{ text: '搜索' },
|
{ text: '展开', type: 'fold' }
|
],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10
|
},
|
total: 0,
|
records: [],
|
taskController: '0' // 0 退回任务池 1 任务指派
|
}
|
},
|
methods: {
|
init() {
|
this.$route.meta.keepAlive = true
|
const { model, initValue, queryType } = this
|
model.computedItem = item => {
|
return {
|
...item,
|
action: {
|
buttons: recordButtons.filter(
|
button => Number(item[button.prop]) === 1
|
)
|
}
|
}
|
}
|
this.formList = model.getFormList(initValue)
|
this.formRules = model.getFormRules()
|
this.tableHeader = model.getTableList()
|
|
this.setSelectOptions()
|
this.getList()
|
},
|
|
setSelectOptions() {
|
this.loading = true
|
const { formList, queryType } = this
|
formList.forEach(({ name }) => {
|
if (name === 'phaseNoArray') {
|
this.queryModelNodeList(name)
|
}
|
if (name === 'fundType') {
|
let params = null
|
if (queryType === '01') {
|
params = 'LoanOrgType'
|
} else if (queryType === '03') {
|
params = 'LoanChannelType'
|
} else if (queryType === '04') {
|
params = 'FallBackOrgType'
|
}
|
this.queryCodeValueList(name, { codeNo: params })
|
}
|
})
|
},
|
|
async queryModelNodeList(name, info = {}) {
|
const tempModel = queryModelNodeList()
|
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() {
|
const { formValues, pageInfo, model, queryType } = this
|
const res = await model.request({
|
queryType,
|
...formValues,
|
...pageInfo
|
})
|
this.loading = false
|
const { list = [], total } = res
|
this.records = list
|
this.total = parseInt(total)
|
},
|
|
sureSucc() {
|
this.isShowSucc = false
|
this.resetList()
|
},
|
|
// 更新表单数据
|
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 })
|
}
|
},
|
|
// 表单按钮事件处理
|
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({ prop }, record) {
|
this.tempRecord = { ...record }
|
// 详情
|
if (prop === 'detailButton') {
|
this.toDetail()
|
}
|
|
// 退回任务池
|
if (prop === 'returnTaskPoolButton') {
|
this.TaskReturn()
|
}
|
|
// 任务指派
|
if (prop === 'turnFlowUserButton') {
|
this.TaskAssign()
|
}
|
},
|
|
toDetail() {
|
// 01 贷款机构 02 资金单元 03 业务通道 04 兜底机构
|
let { queryType, tabId = '', path = '' } = this
|
if (queryType === '01') {
|
tabId = '1001'
|
path = 'apply'
|
} else if (queryType === '02') {
|
tabId = '1004'
|
path = 'applyCapitalUnit'
|
} else if (queryType === '03') {
|
tabId = '1003'
|
path = 'applyBusinessChannel'
|
} else if (queryType === '04') {
|
tabId = '1002'
|
path = 'applyBottomPocket'
|
}
|
const info = {
|
isInfo: '1',
|
operation: 'detail',
|
tabId
|
}
|
this.toApply(info, path)
|
},
|
|
toApply(info = {}, path) {
|
const { tempRecord } = this
|
const { objectNo: serialNo, fundCode: orgCode } = tempRecord
|
this.$router.push({
|
path: `/comm/${path}`,
|
query: {
|
serialNo,
|
orgCode,
|
...info
|
}
|
})
|
},
|
|
// 任务指派
|
TaskAssign() {
|
this.taskController = '0'
|
this.dialogTaskAssignOrReturn = true
|
},
|
|
// 退回任务池
|
TaskReturn() {
|
this.taskController = '1'
|
this.dialogTaskAssignOrReturn = true
|
},
|
|
toAssignOrReturn() {
|
const { taskController } = this
|
// this.contentTip = taskController === '1' ? '退回成功' : '指派成功'
|
this.dialogTaskAssignOrReturn = false
|
// this.isShowTip = true
|
this.isShowSucc = true
|
// this.resetList()
|
},
|
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val
|
this.getList()
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val
|
this.getList()
|
}
|
},
|
computed: {
|
formValues() {
|
const { model, formList } = this
|
return model.getFormValues(formList)
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
</style>
|