<!--
|
* @Author: your name
|
* @Date: 2019-10-21 15:40:58
|
* @LastEditTime: 2019-12-10 13:51:49
|
* @LastEditors: PengJianTian
|
* @Description: In User Settings Edit
|
* @FilePath: /e:\Demo\cts-web\src\views\area\enterprise\update\ApplyInfo.vue
|
-->
|
<template>
|
<div class="dataBack" v-loading="loading">
|
<el-form label-position="right" :model="form" v-show="!loading" ref="form">
|
<el-row>
|
<p class="title">申请信息</p>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请编号">
|
<el-input v-model="form.serialNo" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="企业准入类型">
|
<el-input v-model="form.enterpriseAccessType" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="公司类型">
|
<el-input v-model="form.companyType" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请人姓名">
|
<el-input v-model="form.applyName" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请人工号">
|
<el-input v-model="form.applyUserId" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请人直属机构">
|
<el-input v-model="form.applyOrgName" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请人所属一级内部机构">
|
<el-input v-model="form.applyFirstLevelOrgName" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :md="12" :lg="8">
|
<el-form-item label="申请时间">
|
<el-input v-model="form.applyDate" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-row>
|
<p class="title" v-if="!loading">开通产品信息</p>
|
<product-info-table :object-no="enterpriseParams.tempSerialNo" :object-type="enterpriseParams.objectType"></product-info-table>
|
</el-row>
|
<el-form label-position="right" :model="creditForm" v-show="!loading" ref="form">
|
<el-row>
|
<p class="title" v-show="creditFrom">授信信息</p>
|
<div ref="creditFrom">
|
<EnpInputFixed :config.sync="creditForm.creditsum" @valueToFixed="valueToFixed"></EnpInputFixed>
|
<enp-select :config.sync="creditForm.creditterm"></enp-select>
|
<enp-input :config.sync="creditForm.creditopinion"></enp-input>
|
<enp-input :config.sync="creditForm.serialno"></enp-input>
|
</div>
|
</el-row>
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
import { qryEnterpriseApplyInfo, qryEnpCreditInfo, updateEnpCreditInfo } from '@/api/area/enterprise'
|
import EnpSelect from '../components/EnpSelect'
|
import EnpInput from '../components/EnpInput'
|
import EnpInputFixed from '../components/EnpInputFixed'
|
import ProductInfoTable from './components/ProductInfoTable'
|
import { mapState } from 'vuex'
|
|
import { communal } from '@/views/area/mixins'
|
export default {
|
components: { EnpSelect, ProductInfoTable, EnpInput, EnpInputFixed },
|
props: ['nextChange'],
|
mixins: [ communal ],
|
data: function() {
|
return {
|
loading: true,
|
creditFrom: true,
|
form: {
|
serialNo: '',
|
applyName: '',
|
applyUserId: '',
|
applyOrgId: '',
|
applyOrgName: '',
|
enterpriseAccessType: '',
|
applyFirstLevelOrgId: '',
|
applyFirstLevelOrgName: '',
|
applyDate: '',
|
companyType: ''
|
},
|
creditForm: {
|
creditopinion: '',
|
creditsum: '',
|
creditterm: '',
|
serialno: '',
|
},
|
oldForm: {}
|
}
|
},
|
watch: {
|
'creditForm.creditsum': function(val) {
|
// 不可编辑
|
if (!val.writeAble && val.value) {
|
let valCount = val.value * 1
|
this.creditForm.creditsum.value = valCount.toFixed(2).toString()
|
this.oldForm.creditsum.value = valCount.toFixed(2).toString()
|
}
|
}
|
},
|
created() {
|
this.initForm()
|
},
|
computed: {
|
...mapState({
|
enterpriseParams: state => state.risk.enterpriseParams
|
})
|
},
|
methods: {
|
// 初始化
|
async initForm() {
|
let params = {
|
serialno: this.enterpriseParams.tempSerialNo
|
}
|
let res = await qryEnterpriseApplyInfo(params)
|
this._.merge(this.form, res.result)
|
let creditRes = await qryEnpCreditInfo(params)
|
this._.merge(this.creditForm, creditRes.result)
|
// if (this.creditForm.creditsum.value) {
|
// this.creditForm.creditsum.value = this.creditForm.creditsum.value * 1
|
// this.creditForm.creditsum.value = this.creditForm.creditsum.value.toFixed(2)
|
// }
|
// console.log(this.creditForm.creditsum.value.toFixed(2))
|
Object.assign(this.oldForm, creditRes.result)
|
this.$nextTick(() => {
|
this.creditFrom = Boolean(this.$refs['creditFrom'].getElementsByClassName('el-col').length > 0)
|
})
|
|
this.loading = false
|
},
|
// 保存草稿
|
handleSaveDraft() {
|
// let params = {}
|
// Object.keys(this.creditForm).forEach(key => {
|
// params[key] = this.creditForm[key].value
|
// })
|
// params.checkFlag = false
|
// updateEnpCreditInfo(params).then(res => {
|
// if (res.code === '00') {
|
// this.$message.success('保存成功!')
|
// }
|
// })
|
this.$message.success('保存成功!')
|
this.oldForm = Object.assign(this.oldForm, this.form)
|
},
|
// 保存
|
handleSave() {
|
this.$refs['form'].validate(valid => {
|
if (valid) {
|
let params = {}
|
Object.keys(this.creditForm).forEach(key => {
|
params[key] = this.creditForm[key].value
|
})
|
params.checkFlag = true
|
updateEnpCreditInfo(params).then(res => {
|
if (res.code === '00') {
|
this.$message.success('保存成功')
|
// this.$emit('handleNextPage', true)
|
this.oldForm = Object.assign(this.oldForm, this.creditFrom)
|
}
|
})
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
return false
|
}
|
})
|
},
|
// 表单提交
|
handleSubmit() {
|
this.$refs['form'].validate(valid => {
|
if (valid) {
|
let params = {}
|
Object.keys(this.creditForm).forEach(key => {
|
params[key] = this.creditForm[key].value
|
})
|
params.checkFlag = true
|
updateEnpCreditInfo(params).then(res => {
|
if (res.code === '00') {
|
// this.$message.success('提交成功!')
|
this.$emit('handleNextPage', true)
|
}
|
})
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
return false
|
}
|
})
|
},
|
// 可编辑授信额度
|
valueToFixed(value) {
|
const { creditsum } = this.creditForm
|
if (creditsum.writeAble && value !== '') {
|
if (!isNaN(value)) {
|
this.creditForm.creditsum.value = this.formatMoney(value)
|
// console.log(this.formatMoney(value))
|
} else {
|
this.$message.warning('非法输入,请输入正确的金额!')
|
this.creditForm.creditsum.value = ''
|
// this.oldForm.creditsum.value = ''
|
}
|
}
|
}
|
},
|
beforeRouteLeave (to, from, next) {
|
// console.log(this.creditForm)
|
// console.log(this.oldForm)
|
// console.log(this.nextChange)
|
if (this.nextChange) {
|
for (const key in this.oldForm) {
|
if (this.oldForm.hasOwnProperty(key)) {
|
if (this.oldForm[key].value != this.creditForm[key].value) {
|
// console.log(this.oldForm[key].value)
|
// console.log(this.creditForm[key].value)
|
this.$confirm(`当前页面有未保存的数据,是否放弃保存`, '提示', {
|
confirmButtonText: '是',
|
cancelButtonText: '否',
|
customClass: 'enp_messages_box',
|
confirmButtonClass: 'enp_messages_box_confirm',
|
cancelButtonClass: 'enp_messages_box_cancel',
|
center: true
|
})
|
.then(() => {
|
next()
|
})
|
.catch(() => {
|
this.$emit('notNext')
|
})
|
return
|
}
|
}
|
}
|
}
|
next();
|
}
|
}
|
</script>
|
|
<style lang="stylus" scoped>
|
.title
|
margin-top 22px
|
</style>
|