<template>
|
<div class="apply-info">
|
<CommTable title="流程流转记录" :isAutoIndex="true" :list="list" :header="tableHeader"></CommTable>
|
<div v-if="hideForm">
|
<CommForm
|
:inline="true"
|
:column="1"
|
:list="formList"
|
@updateValue="updateValue"
|
ref="opiniopForm"
|
:formValues="formValues"
|
:formRules="formRules"
|
title="审批意见"
|
formType="info"
|
></CommForm>
|
</div>
|
|
<Dialog
|
v-model="isShowDialog"
|
icon="succ"
|
iconText="提交成功"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="commitSuccess"
|
></Dialog>
|
</div>
|
</template>
|
|
<script>
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
import Dialog from '@/components/Dialog'
|
|
import queryFlowTaskInfoCommom from '@/controller/queryFlowTaskInfoCommom'
|
import loanOrgApproveCommit from '@/controller/loanOrgApproveCommit'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
|
export default {
|
components: {
|
CommForm,
|
CommTable,
|
Dialog
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
info: {},
|
query: {},
|
formList: [],
|
list: [],
|
tableHeader: [],
|
model: null,
|
selectModel: null,
|
tableModel: null,
|
isShowDialog: false
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
const { query } = this.$route
|
this.query = query
|
|
const model = loanOrgApproveCommit()
|
const tableModel = queryFlowTaskInfoCommom()
|
|
this.tableModel = tableModel
|
this.model = model
|
|
this.tableHeader = tableModel.getTableList()
|
this.formList = model.getFormList()
|
|
this.getList()
|
this.selectOptions()
|
},
|
|
async getList() {
|
const { query, tableModel } = this
|
const { objectType, serialNo } = query
|
const res = await tableModel.request({
|
objectNo: serialNo,
|
objectType
|
})
|
const { list } = res
|
this.list = [...list]
|
},
|
|
selectOptions() {
|
const { formList } = this
|
formList.forEach(({ name }) => {
|
if (name === 'approveCode') {
|
this.queryCodeValueList(name, { codeNo: 'FundConfigFlowStatus' })
|
}
|
})
|
},
|
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request({ ...info })
|
this.updateValue(name, { options: list })
|
},
|
|
async submit() {
|
const { model, formValues, query } = this
|
const { serialNo } = query
|
try {
|
await model.request({
|
...formValues,
|
serialNo
|
})
|
this.isShowDialog = true
|
} catch (error) {
|
console.log(error)
|
}
|
},
|
|
commitSuccess() {
|
this.isShowDialog = false
|
this.$router.go(-1)
|
},
|
// 更新表单数据
|
updateValue(index, info) {
|
const { formList } = this
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
}
|
const approveOpinionIndex = formList.findIndex(
|
({ name }) => name === 'approveOpinion'
|
)
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
|
if (preInfo.name === 'approveCode' && approveOpinionIndex > -1) {
|
const tempItem = formList[approveOpinionIndex] || {}
|
let { rules = [] } = tempItem
|
|
rules = rules.filter(
|
item =>
|
(typeof item === 'string' && item !== 'required') ||
|
(typeof item === 'object' &&
|
!Object.keys(item).includes('required'))
|
)
|
|
if (info.value === '01') {
|
rules = [...rules]
|
} else {
|
rules = [...rules, 'required']
|
}
|
this.$set(formList, approveOpinionIndex, { ...tempItem, rules })
|
}
|
}
|
}
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
formRules() {
|
const { model, formList } = this
|
return model.getFormRules(formList)
|
},
|
hideForm() {
|
const { query } = this
|
const { operation } = query
|
return operation === 'detail' ? false : true
|
}
|
}
|
}
|
</script>
|
|
<style lang="postcss" scoped>
|
</style>
|