<template>
|
<div class="apply-info">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
ref="basicForm"
|
title="基本信息"
|
@updateValue="updateValue"
|
:formValues="formValues"
|
:formRules="formRules"
|
formType="info"
|
>
|
</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 queryCustomerInfoChange from '@/controller/queryCustomerInfoChange'
|
import customerInfoChangeModify from '@/controller/customerInfoChangeModify'
|
|
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
|
// const { transCode } = query
|
this.query = query
|
this.model = queryCustomerInfoChange()
|
this.submitModel = customerInfoChangeModify()
|
this.getDetail()
|
},
|
|
async submit() {
|
// console.log(123)
|
const { submitModel, query } = this
|
const { customerId } = query
|
const values = this.$refs.basicForm.validate()
|
if (values) {
|
try {
|
await submitModel.request({
|
customerId,
|
...values
|
})
|
this.isShowDialog = true
|
} catch (error) {
|
console.log(error)
|
}
|
} else {
|
this.$message.warning('当前页面有数据未输入!')
|
}
|
},
|
|
// 提交成功后返回原列表页
|
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)
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
// if (preInfo.name === 'productid') {
|
// this.qryDimensionList()
|
// }
|
}
|
// console.log(index.info)
|
},
|
async getDetail() {
|
const { query, model } = this
|
const { customerId } = query
|
const info = await model.request({
|
customerId
|
})
|
this.formList = model.getFormList(info)
|
},
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormValues(formList)
|
}
|
return {}
|
},
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
}
|
},
|
watch: {
|
$route() {
|
const { transLogSerialno } = this.$route.query
|
if (transLogSerialno) {
|
this.init()
|
}
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
</style>
|