新增流程列表编辑功能

This commit is contained in:
wkc
2026-05-25 16:04:23 +08:00
parent cc6836804e
commit 998f0b3c48
14 changed files with 746 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog title="新增企业利率定价流程" :visible.sync="dialogVisible" width="900px" append-to-body
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="900px" append-to-body
@close="handleClose">
<el-form ref="form" :model="form" :rules="rules" label-width="140px" class="workflow-create-form">
<!-- 基本信息 -->
@@ -59,6 +59,11 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="余值覆盖" prop="resCover">
<el-switch v-model="form.resCover"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@@ -128,7 +133,7 @@
</template>
<script>
import {createCorporateWorkflow, queryHistoryContracts} from "@/api/loanPricing/workflow"
import {createCorporateWorkflow, queryHistoryContracts, updateCorporateWorkflow} from "@/api/loanPricing/workflow"
import HistoryContractSelector from "./HistoryContractSelector"
import {formatRate} from "@/utils/rate"
@@ -145,6 +150,10 @@ export default {
customerMap: {
type: Object,
default: null
},
editData: {
type: Object,
default: null
}
},
data() {
@@ -191,6 +200,7 @@ export default {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '10'
],
submitting: false,
resettingForm: false,
showHistorySelector: false,
historyLoading: false,
historyContracts: [],
@@ -207,6 +217,7 @@ export default {
loanTerm: undefined,
businessType: undefined,
loanRateHistory: undefined,
resCover: false,
isGreenLoan: false,
isTradeBuildEnt: false,
collType: undefined,
@@ -270,6 +281,12 @@ export default {
isCertificatePledge() {
return this.form.guarType === '质押' && this.form.collType === '存单质押'
},
isEdit() {
return !!(this.editData && this.editData.serialNum)
},
dialogTitle() {
return this.isEdit ? '编辑企业利率定价流程' : '新增企业利率定价流程'
},
collateralTypeOptions() {
if (this.form.guarType === '抵押') {
return ['一类', '二类', '三类', '四类', '排污权抵押', '设备等其他不动产抵押']
@@ -287,11 +304,17 @@ export default {
}
},
'form.guarType'(val, oldVal) {
if (this.resettingForm) {
return
}
if (val !== oldVal) {
this.resetCollateralFields()
}
},
'form.collType'() {
if (this.resettingForm) {
return
}
this.resetCouponRateIfNotCertificatePledge()
}
},
@@ -299,7 +322,43 @@ export default {
formatRate,
/** 表单重置 */
reset() {
this.form = {
this.resettingForm = true
this.form = this.buildForm()
this.submitting = false
this.showHistorySelector = false
this.historyLoading = false
this.historyContracts = []
this.selectedHistoryContract = null
this.$nextTick(() => {
this.resettingForm = false
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
buildForm() {
if (this.isEdit) {
return {
orgCode: this.editData.orgCode || '892000',
runType: this.editData.runType || '1',
custIsn: this.editData.custIsn,
custName: this.editData.custName,
idType: this.editData.idType,
idNum: this.editData.idNum,
guarType: this.editData.guarType,
applyAmt: this.editData.applyAmt,
loanTerm: this.editData.loanTerm,
businessType: this.editData.businessType,
loanRateHistory: this.editData.loanRateHistory,
resCover: this.isOne(this.editData.resCover),
isGreenLoan: this.isOne(this.editData.isGreenLoan),
isTradeBuildEnt: this.isOne(this.editData.isTradeBuildEnt),
collType: this.editData.collType,
collThirdParty: this.isOne(this.editData.collThirdParty),
couponRate: this.editData.couponRate
}
}
return {
orgCode: '892000',
runType: '1',
custIsn: this.customerMap ? this.customerMap.cust_isn : undefined,
@@ -311,22 +370,16 @@ export default {
loanTerm: undefined,
businessType: undefined,
loanRateHistory: undefined,
resCover: false,
isGreenLoan: false,
isTradeBuildEnt: false,
collType: undefined,
collThirdParty: false,
couponRate: undefined
}
this.submitting = false
this.showHistorySelector = false
this.historyLoading = false
this.historyContracts = []
this.selectedHistoryContract = null
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
isOne(value) {
return value === true || value === 'true' || value === '1'
},
/** 对话框关闭处理 */
handleClose() {
@@ -415,6 +468,7 @@ export default {
// 转换开关值为字符串
const data = {
...this.form,
resCover: this.form.resCover ? '1' : '0',
isGreenLoan: this.form.isGreenLoan ? '1' : '0',
isTradeBuildEnt: this.form.isTradeBuildEnt ? '1' : '0'
}
@@ -431,8 +485,11 @@ export default {
delete data.couponRate
}
createCorporateWorkflow(data).then(response => {
this.$modal.msgSuccess("新增成功")
const submitRequest = this.isEdit
? updateCorporateWorkflow(this.editData.serialNum, data)
: createCorporateWorkflow(data)
submitRequest.then(response => {
this.$modal.msgSuccess(this.isEdit ? "编辑成功" : "新增成功")
this.dialogVisible = false
this.$emit('success')
}).catch(error => {

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog title="新增个人利率定价流程" :visible.sync="dialogVisible" width="900px" append-to-body
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="900px" append-to-body
@close="handleClose">
<el-form ref="form" :model="form" :rules="rules" label-width="140px" class="workflow-create-form">
<!-- 基本信息 -->
@@ -120,7 +120,7 @@
</template>
<script>
import {createPersonalWorkflow, queryHistoryContracts} from "@/api/loanPricing/workflow"
import {createPersonalWorkflow, queryHistoryContracts, updatePersonalWorkflow} from "@/api/loanPricing/workflow"
import HistoryContractSelector from "./HistoryContractSelector"
import {formatRate} from "@/utils/rate"
@@ -137,6 +137,10 @@ export default {
customerMap: {
type: Object,
default: null
},
editData: {
type: Object,
default: null
}
},
data() {
@@ -169,6 +173,7 @@ export default {
'1', '2', '3', '4', '5', '6'
],
submitting: false,
resettingForm: false,
showHistorySelector: false,
historyLoading: false,
historyContracts: [],
@@ -247,6 +252,12 @@ export default {
isCertificatePledge() {
return this.form.guarType === '质押' && this.form.collType === '存单质押'
},
isEdit() {
return !!(this.editData && this.editData.serialNum)
},
dialogTitle() {
return this.isEdit ? '编辑个人利率定价流程' : '新增个人利率定价流程'
},
collateralTypeOptions() {
if (this.form.guarType === '抵押') {
return ['一线', '一类', '二类', '三类']
@@ -264,11 +275,17 @@ export default {
}
},
'form.guarType'(val, oldVal) {
if (this.resettingForm) {
return
}
if (val !== oldVal) {
this.resetCollateralFields()
}
},
'form.collType'() {
if (this.resettingForm) {
return
}
this.resetCouponRateIfNotCertificatePledge()
}
},
@@ -276,7 +293,41 @@ export default {
formatRate,
/** 表单重置 */
reset() {
this.form = {
this.resettingForm = true
this.form = this.buildForm()
this.submitting = false
this.showHistorySelector = false
this.historyLoading = false
this.historyContracts = []
this.selectedHistoryContract = null
this.$nextTick(() => {
this.resettingForm = false
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
buildForm() {
if (this.isEdit) {
return {
orgCode: this.editData.orgCode || '892000',
runType: this.editData.runType || '1',
custIsn: this.editData.custIsn,
custName: this.editData.custName,
idType: this.editData.idType,
idNum: this.editData.idNum,
guarType: this.editData.guarType,
applyAmt: this.editData.applyAmt,
loanTerm: this.editData.loanTerm,
businessType: this.editData.businessType,
loanRateHistory: this.editData.loanRateHistory,
loanLoop: this.isOne(this.editData.loanLoop),
collType: this.editData.collType,
collThirdParty: this.isOne(this.editData.collThirdParty),
couponRate: this.editData.couponRate
}
}
return {
orgCode: '892000',
runType: '1',
custIsn: this.customerMap ? this.customerMap.cust_isn : undefined,
@@ -293,16 +344,9 @@ export default {
collThirdParty: false,
couponRate: undefined
}
this.submitting = false
this.showHistorySelector = false
this.historyLoading = false
this.historyContracts = []
this.selectedHistoryContract = null
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
isOne(value) {
return value === true || value === 'true' || value === '1'
},
/** 对话框关闭处理 */
handleClose() {
@@ -406,8 +450,11 @@ export default {
delete data.couponRate
}
createPersonalWorkflow(data).then(response => {
this.$modal.msgSuccess("新增成功")
const submitRequest = this.isEdit
? updatePersonalWorkflow(this.editData.serialNum, data)
: createPersonalWorkflow(data)
submitRequest.then(response => {
this.$modal.msgSuccess(this.isEdit ? "编辑成功" : "新增成功")
this.dialogVisible = false
this.$emit('success')
}).catch(error => {

View File

@@ -67,7 +67,7 @@
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createBy" min-width="220" class-name="workflow-important-column" />
<el-table-column label="操作" align="center" fixed="right" min-width="110" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" fixed="right" min-width="150" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@@ -75,6 +75,13 @@
icon="el-icon-view"
@click="handleView(scope.row)"
>查看</el-button>
<el-button
v-if="canEdit(scope.row)"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>编辑</el-button>
</template>
</el-table-column>
</el-table>
@@ -101,6 +108,7 @@
<personal-create-dialog
:visible.sync="showPersonalDialog"
:customer-map="selectedCustomerMap"
:edit-data="editWorkflow"
@success="handleCreateSuccess"
/>
@@ -108,13 +116,15 @@
<corporate-create-dialog
:visible.sync="showCorporateDialog"
:customer-map="selectedCustomerMap"
:edit-data="editWorkflow"
@success="handleCreateSuccess"
/>
</div>
</template>
<script>
import {listWorkflow} from "@/api/loanPricing/workflow"
import {getWorkflowEdit, listWorkflow} from "@/api/loanPricing/workflow"
import {mapGetters} from "vuex"
import CustomerTypeSelector from "./components/CustomerTypeSelector"
import CustomerMapSelector from "./components/CustomerMapSelector"
import PersonalCreateDialog from "./components/PersonalCreateDialog"
@@ -147,6 +157,8 @@ export default {
selectedCustomerType: undefined,
// 当前选择的客户号映射记录
selectedCustomerMap: null,
// 当前编辑的流程记录
editWorkflow: null,
// 是否显示个人客户创建弹出层
showPersonalDialog: false,
// 是否显示企业客户创建弹出层
@@ -164,6 +176,15 @@ export default {
created() {
this.getList()
},
computed: {
...mapGetters([
'name',
'nickName'
]),
currentCreateBy() {
return `${this.nickName}-${this.name}`
}
},
activated() {
this.getList()
},
@@ -207,8 +228,26 @@ export default {
params: { serialNum: row.serialNum }
})
},
/** 是否允许编辑 */
canEdit(row) {
return row && row.createBy === this.currentCreateBy
},
/** 编辑操作 */
handleEdit(row) {
getWorkflowEdit(row.serialNum).then(response => {
this.editWorkflow = response.data
this.selectedCustomerMap = null
this.selectedCustomerType = undefined
if (this.editWorkflow.custType === '个人') {
this.showPersonalDialog = true
} else if (this.editWorkflow.custType === '企业') {
this.showCorporateDialog = true
}
})
},
/** 新增按钮操作 */
handleAdd() {
this.editWorkflow = null
this.showTypeSelector = true
},
/** 选择客户类型回调 */
@@ -219,6 +258,7 @@ export default {
},
/** 选择客户号映射记录回调 */
handleCustomerMapSelect(row) {
this.editWorkflow = null
this.selectedCustomerMap = row
if (this.selectedCustomerType === 'personal') {
this.showPersonalDialog = true
@@ -235,6 +275,7 @@ export default {
clearSelectedCustomer() {
this.selectedCustomerMap = null
this.selectedCustomerType = undefined
this.editWorkflow = null
}
}
}