<template>
|
<div class="apply-info">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
ref="claimApply"
|
@updateValue="updateValue"
|
:formValues="formValues"
|
:formRules="formRules"
|
formType="info"
|
title="认领撤销申请信息"
|
></CommForm>
|
<Dialog
|
v-model="isShowDialog"
|
icon="succ"
|
iconText="提交成功"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="commitSuccess"
|
></Dialog>
|
</div>
|
</template>
|
<script>
|
// 转账认领撤销申请信息
|
import CommForm from '@/components/CommForm'
|
import Dialog from '@/components/Dialog'
|
import queryClaimApplyInfo from '@/controller/queryClaimApplyInfo'
|
import claimApplySubmit from '@/controller/claimApplySubmit'
|
|
export default {
|
components: {
|
CommForm,
|
Dialog
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
info: {},
|
query: {},
|
formList: [],
|
model: null,
|
submitModel: null,
|
isShowDialog: false
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
const { query } = this.$route
|
this.query = query
|
this.getDetail()
|
},
|
async getDetail() {
|
const { query, conf } = this
|
// const { edit } = conf
|
const { objectNo, transCodeOne } = query
|
const model = queryClaimApplyInfo()
|
const info = await model.request({
|
transSerialNo: objectNo,
|
transCode: transCodeOne
|
})
|
|
// this.formList = model.getFormList(info)
|
// this.model = model
|
// this.submitModel = claimApplySubmit()
|
const formList = model.getFormList(info)
|
this.formList = formList
|
// if (edit === 'Y') {
|
// this.formList = formList
|
// } else {
|
// this.formList = formList.map(item => {
|
// return {
|
// ...item,
|
// attrs: ['readonly'],
|
// rules: []
|
// }
|
// })
|
// }
|
this.model = model
|
this.submitModel = claimApplySubmit()
|
},
|
|
// 更新表单数据
|
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 })
|
// if (preInfo.name === 'productid') {
|
// this.qryDimensionList()
|
// }
|
}
|
},
|
// 表单按钮事件处理
|
async submit() {
|
const { submitModel, query, conf } = this
|
const { transSerialNo, transCodeOne, objectNo, objectType } = query
|
const { edit } = conf
|
const values = this.$refs.claimApply.validate()
|
if (values) {
|
try {
|
if (edit === 'Y') {
|
await submitModel.request({
|
...values,
|
imagObjectNo: objectNo,
|
imagObjectType: objectType,
|
// claimAmt: values.virtualAmount,
|
// applyReason,
|
transSerialNo,
|
transCode: transCodeOne
|
// hisRemark: values.trxTxt
|
})
|
this.isShowDialog = true
|
// console.log(1)
|
}
|
} catch (error) {
|
console.log(error)
|
}
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
}
|
},
|
// 提交成功后返回原列表页
|
commitSuccess() {
|
this.isShowDialog = false
|
this.$router.go(-1)
|
}
|
},
|
computed: {
|
// 表单值信息 控制表单的values值
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
// 控制rules属性
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
}
|
},
|
watch: {
|
$route() {
|
const { transSerialNo } = this.$route.query
|
if (transSerialNo) {
|
this.init()
|
}
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
</style>
|