Commit bb98a375 by yuzhenWang

Merge branch 'feature-20250827wyz-写业务' into 'test'

Feature 20250827wyz 写业务

See merge request !82
parents 5acadb8b efbc9102
...@@ -92,7 +92,7 @@ const customer = [ ...@@ -92,7 +92,7 @@ const customer = [
unitColor: 'rgba(0, 82, 217, 1)', unitColor: 'rgba(0, 82, 217, 1)',
inputType: 'text', inputType: 'text',
required: true, required: true,
maxLength: 15, maxLength: 30,
disabled: false, disabled: false,
placeholder: '请输入2~6位汉字', placeholder: '请输入2~6位汉字',
show: true, show: true,
...@@ -108,7 +108,7 @@ const customer = [ ...@@ -108,7 +108,7 @@ const customer = [
domType: 'Input', domType: 'Input',
inputType: 'text', inputType: 'text',
required: true, required: true,
maxLength: 30, maxLength: 100,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
show: true, show: true,
...@@ -118,36 +118,6 @@ const customer = [ ...@@ -118,36 +118,6 @@ const customer = [
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
// {
// label: '证件类型',
// key: 'documentType',
// domType: 'Select',
// required: true,
// disabled: false,
// placeholder: '请选择',
// dictType: 'csf_id_type',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '证件号码',
// key: 'idNumber',
// domType: 'Input',
// inputType: 'text',
// required: true,
// maxLength: 20,
// disabled: false,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
{ {
label: '性别', label: '性别',
key: 'gender', key: 'gender',
...@@ -179,7 +149,9 @@ const customer = [ ...@@ -179,7 +149,9 @@ const customer = [
label: '年龄', label: '年龄',
key: 'age', key: 'age',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
valueType: '',
maxLength: 30, maxLength: 30,
required: true, required: true,
disabled: true, disabled: true,
...@@ -294,7 +266,8 @@ const customer = [ ...@@ -294,7 +266,8 @@ const customer = [
label: '退休年龄', label: '退休年龄',
key: 'retirementAge', key: 'retirementAge',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
maxLength: 30, maxLength: 30,
required: false, required: false,
disabled: false, disabled: false,
...@@ -324,7 +297,8 @@ const customer = [ ...@@ -324,7 +297,8 @@ const customer = [
label: '体重(KG)', label: '体重(KG)',
key: 'weight', key: 'weight',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -339,7 +313,8 @@ const customer = [ ...@@ -339,7 +313,8 @@ const customer = [
label: '身高(CM)', label: '身高(CM)',
key: 'height', key: 'height',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -369,7 +344,8 @@ const customer = [ ...@@ -369,7 +344,8 @@ const customer = [
label: '受供养人数目', label: '受供养人数目',
key: 'dependentsNum', key: 'dependentsNum',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'integer', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -468,7 +444,7 @@ const customer = [ ...@@ -468,7 +444,7 @@ const customer = [
label: '固定电话', label: '固定电话',
key: 'landline', key: 'landline',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
required: false, required: false,
disabled: false, disabled: false,
placeholder: '请填写', placeholder: '请填写',
...@@ -616,7 +592,8 @@ const customer = [ ...@@ -616,7 +592,8 @@ const customer = [
key: 'currentMonthlyIncome', key: 'currentMonthlyIncome',
domType: 'Input', domType: 'Input',
unit: 'HKD', unit: 'HKD',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -631,7 +608,8 @@ const customer = [ ...@@ -631,7 +608,8 @@ const customer = [
label: '总工作年期', label: '总工作年期',
key: 'totalWorkingYears', key: 'totalWorkingYears',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -646,7 +624,8 @@ const customer = [ ...@@ -646,7 +624,8 @@ const customer = [
label: '受雇于现职年期', label: '受雇于现职年期',
key: 'currentTenure', key: 'currentTenure',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -714,7 +693,7 @@ const customer = [ ...@@ -714,7 +693,7 @@ const customer = [
domType: 'Input', domType: 'Input',
inputType: 'text', inputType: 'text',
required: false, required: false,
maxLength: 20, maxLength: 50,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
show: true, show: true,
...@@ -739,7 +718,8 @@ const customer = [ ...@@ -739,7 +718,8 @@ const customer = [
key: 'monthIncome', key: 'monthIncome',
domType: 'Input', domType: 'Input',
unit: 'HKD', unit: 'HKD',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -755,7 +735,8 @@ const customer = [ ...@@ -755,7 +735,8 @@ const customer = [
key: 'monthExpenditure', key: 'monthExpenditure',
domType: 'Input', domType: 'Input',
unit: 'HKD', unit: 'HKD',
inputType: 'number', inputType: 'text',
valueType: 'decimal', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -771,7 +752,8 @@ const customer = [ ...@@ -771,7 +752,8 @@ const customer = [
key: 'totalCurrentAssets', key: 'totalCurrentAssets',
domType: 'Input', domType: 'Input',
unit: 'HKD', unit: 'HKD',
inputType: 'number', inputType: 'text',
valueType: 'decimalNumber', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
...@@ -787,7 +769,8 @@ const customer = [ ...@@ -787,7 +769,8 @@ const customer = [
key: 'totalDebt', key: 'totalDebt',
domType: 'Input', domType: 'Input',
unit: 'HKD', unit: 'HKD',
inputType: 'number', inputType: 'text',
valueType: 'decimalNumber', //输入值的格式
required: false, required: false,
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
......
// 格式化金额为货币格式 // 格式化金额为货币格式
export function formatCurrency(value,currency='') { export function formatCurrency(value, currency = '') {
if (value === undefined || value === null) return currency + '0.00' if (value === undefined || value === null) return currency + '0.00'
return currency + value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,') return currency + value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
} }
export function numberFormat(value, item) {
const { valueType = 'text', decimalDigits = 2 } = item
// if (!value) return
let result = String(value ?? '').trim()
if (valueType === 'integer') {
// 只保留数字和负号
result = result.replace(/[^-\d]/g, '')
// 如果有多个负号或者负号不在开头,则移除多余的负号
if ((result.match(/-/g) || []).length > 1) {
result = result.replace(/-/g, '').replace(/^/, '-') // 仅保留一个负号在最前面
}
} else if (valueType === 'decimalNumber') {
// 可以输入正数,负数,小数
// 1. 只保留数字、小数点和负号
result = result.replace(/[^-\d.]/g, '')
// 2. 处理负号:确保最多只有一个负号且必须在开头
if ((result.match(/-/g) || []).length > 1) {
result = result.replace(/-/g, '') // 移除所有负号
if (result.startsWith('-')) {
result = '-' + result.slice(1) // 确保负号在最前面
} else {
result = '-' + result // 如果原本没有负号但需要保留数值,可以省略此步骤
}
}
// 3. 去掉开头的小数点(不允许 ".5" → 改为 "0.5" 更好)
if (result.startsWith('.')) {
result = '0' + result
} else if (result.startsWith('-.')) {
result = '-0' + result.slice(2)
}
// 4. 保证最多一个小数点
const parts = result.split('.')
if (parts.length > 2) {
result = parts[0] + '.' + parts.slice(1).join('')
}
// 5. 限制小数位数(但保留结尾的小数点!)
if (result.includes('.')) {
const [intPart, decPart] = result.split('.')
// 如果小数部分超过限制,截断
if (decPart.length > decimalDigits) {
result = intPart + '.' + decPart.slice(0, decimalDigits)
}
// ✅ 不再删除结尾的 '.'
}
} else if (valueType === 'decimal') {
// 可以输入正整数和小数
// 1. 只保留数字和小数点
result = result.replace(/[^\d.]/g, '')
// 2. 去掉开头的小数点(不允许 ".5" → 改为 "0.5" 更好,但这里先简单处理)
if (result.startsWith('.')) {
result = '0.' + result.slice(1)
}
// 3. 保证最多一个小数点
const parts = result.split('.')
if (parts.length > 2) {
result = parts[0] + '.' + parts.slice(1).join('')
}
// 4. 限制小数位数(但保留结尾的小数点!)
if (result.includes('.')) {
const [intPart, decPart] = result.split('.')
// 如果小数部分超过限制,截断
if (decPart.length > decimalDigits) {
result = intPart + '.' + decPart.slice(0, decimalDigits)
}
}
}
return result
}
export default { export default {
formatCurrency formatCurrency,
numberFormat
} }
...@@ -68,12 +68,13 @@ ...@@ -68,12 +68,13 @@
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</template> </template>
<!-- -->
<el-input <el-input
v-if="child.domType === 'Input'" v-if="child.domType === 'Input'"
:type="child.inputType"
v-model="form[child.key]" v-model="form[child.key]"
:type="child.inputType"
:placeholder="child.placeholder" :placeholder="child.placeholder"
maxlength="30" :maxlength="child.maxlength"
:disabled=" :disabled="
child.key == 'age' || child.key == 'age' ||
child.key == 'bmi' || child.key == 'bmi' ||
...@@ -82,6 +83,7 @@ ...@@ -82,6 +83,7 @@
: editStatus : editStatus
" "
@blur="handleInputBlur(child)" @blur="handleInputBlur(child)"
@input="val => handleInputChange(val, child)"
> >
<template #append v-if="child.unit"> <template #append v-if="child.unit">
<span <span
...@@ -442,6 +444,7 @@ import CommonForm from '@/views/components/commonForm' ...@@ -442,6 +444,7 @@ import CommonForm from '@/views/components/commonForm'
import CommonDialog from '@/components/commonDialog' import CommonDialog from '@/components/commonDialog'
import CommonPage from '@/components/commonPage' import CommonPage from '@/components/commonPage'
import CardOne from '@/components/formCard/cardOne' import CardOne from '@/components/formCard/cardOne'
import { numberFormat } from '@/utils/number'
import { watch } from 'vue' import { watch } from 'vue'
import { import {
addCustomer, addCustomer,
...@@ -640,6 +643,11 @@ const handleAppendInput = child => { ...@@ -640,6 +643,11 @@ const handleAppendInput = child => {
customerList() customerList()
} }
} }
//处理数据
const handleInputChange = (val, child) => {
let newVal = numberFormat(val, child)
form.value[child.key] = newVal
}
const handleInputBlur = child => { const handleInputBlur = child => {
if ( if (
(child.key == 'weight' || child.key == 'height') && (child.key == 'weight' || child.key == 'height') &&
......
...@@ -960,6 +960,13 @@ const handleSubmit = async type => { ...@@ -960,6 +960,13 @@ const handleSubmit = async type => {
return return
} }
} }
console.log('====================================')
console.log(
'submitAppointmentObj.value.apiProductPlanInfoDto',
submitAppointmentObj.value.apiProductPlanInfoDto
)
console.log('====================================')
// return
// 获取投保人form // 获取投保人form
if (policyHolderInfoRef.value) { if (policyHolderInfoRef.value) {
submitAppointmentObj.value.apiPolicyholderInfoDto = submitAppointmentObj.value.apiPolicyholderInfoDto =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment