|
@@ -14,7 +14,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { insureDetail, insureSave } from '@/api/InsuranceManagement.js'
|
|
|
+import { insureDetail, insureAdd, insureUpdate } from '@/api/InsuranceManagement.js'
|
|
|
import { dateFormat } from '@/utils/util'
|
|
|
export default {
|
|
|
props: {
|
|
@@ -32,40 +32,37 @@ export default {
|
|
|
disabled: this.type === 2,
|
|
|
// 表单数据
|
|
|
formData: {
|
|
|
- content: '',
|
|
|
- typeName: '',
|
|
|
- name: '',
|
|
|
- number: '',
|
|
|
- amount: '',
|
|
|
+ policyName: '',
|
|
|
+ policyNumber: '',
|
|
|
+ policyPrice: '',
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
- insureCompany: '',
|
|
|
- isSync: '',
|
|
|
- isEmail: '',
|
|
|
- insureTax1: '',
|
|
|
- insureTax2: '',
|
|
|
- insureTax3: '',
|
|
|
- insureTax4: '',
|
|
|
- insureTax5: '',
|
|
|
- insureTax6: '',
|
|
|
- insureTax7: '',
|
|
|
- insureTax8: '',
|
|
|
- insureTax9: '',
|
|
|
- insureTax10: '',
|
|
|
- insureTax11: '',
|
|
|
- insureTax12: '',
|
|
|
- insureRangeList: [{ name: '', content: '' }]
|
|
|
+ isBuy: '',
|
|
|
+ company: '',
|
|
|
+ text: '',
|
|
|
+ month1: '',
|
|
|
+ month2: '',
|
|
|
+ month3: '',
|
|
|
+ month4: '',
|
|
|
+ month5: '',
|
|
|
+ month6: '',
|
|
|
+ month7: '',
|
|
|
+ month8: '',
|
|
|
+ month9: '',
|
|
|
+ month10: '',
|
|
|
+ month11: '',
|
|
|
+ month12: '',
|
|
|
+ policyRanges: [{ rangeName: '', rangeText: '' }]
|
|
|
},
|
|
|
formRules: {
|
|
|
- content: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- typeName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- number: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- amount: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ text: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ policyName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ policyNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ policyPrice: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
startTime: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
endTime: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- insureCompany: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- insureTax1: [
|
|
|
+ company: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ month1: [
|
|
|
{ required: true, message: '全部必填', trigger: 'blur' },
|
|
|
{
|
|
|
required: true,
|
|
@@ -82,19 +79,19 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- insureTaxKeys: [
|
|
|
- 'insureTax1',
|
|
|
- 'insureTax2',
|
|
|
- 'insureTax3',
|
|
|
- 'insureTax4',
|
|
|
- 'insureTax5',
|
|
|
- 'insureTax6',
|
|
|
- 'insureTax7',
|
|
|
- 'insureTax8',
|
|
|
- 'insureTax9',
|
|
|
- 'insureTax10',
|
|
|
- 'insureTax11',
|
|
|
- 'insureTax12'
|
|
|
+ monthKeys: [
|
|
|
+ 'month1',
|
|
|
+ 'month2',
|
|
|
+ 'month3',
|
|
|
+ 'month4',
|
|
|
+ 'month5',
|
|
|
+ 'month6',
|
|
|
+ 'month7',
|
|
|
+ 'month8',
|
|
|
+ 'month9',
|
|
|
+ 'month10',
|
|
|
+ 'month11',
|
|
|
+ 'month12'
|
|
|
]
|
|
|
}
|
|
|
},
|
|
@@ -104,22 +101,17 @@ export default {
|
|
|
{
|
|
|
name: 'el-input',
|
|
|
attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保险类型', prop: 'typeName' }
|
|
|
+ formItemAttributes: { label: '保单名称', prop: 'policyName' }
|
|
|
},
|
|
|
{
|
|
|
name: 'el-input',
|
|
|
attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保单名称', prop: 'name' }
|
|
|
+ formItemAttributes: { label: '保单编号', prop: 'policyNumber' }
|
|
|
},
|
|
|
{
|
|
|
name: 'el-input',
|
|
|
attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保单编号', prop: 'number' }
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'el-input',
|
|
|
- attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保单金额', prop: 'amount' }
|
|
|
+ formItemAttributes: { label: '保单金额', prop: 'policyPrice' }
|
|
|
},
|
|
|
{
|
|
|
name: 'el-date-picker',
|
|
@@ -147,29 +139,8 @@ export default {
|
|
|
disabled: this.disabled
|
|
|
},
|
|
|
formItemAttributes: {
|
|
|
- label: '是否发送邮件',
|
|
|
- prop: 'isEmail',
|
|
|
- rules: [{ required: true, message: '请选择', trigger: 'blur' }]
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'el-radio',
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '是',
|
|
|
- value: 'YES'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '否',
|
|
|
- value: 'NO'
|
|
|
- }
|
|
|
- ],
|
|
|
- attributes: {
|
|
|
- disabled: this.disabled
|
|
|
- },
|
|
|
- formItemAttributes: {
|
|
|
- label: '是否上传格力',
|
|
|
- prop: 'isSync',
|
|
|
+ label: '是否允许购买',
|
|
|
+ prop: 'isBuy',
|
|
|
rules: [{ required: true, message: '请选择', trigger: 'blur' }]
|
|
|
}
|
|
|
},
|
|
@@ -177,7 +148,7 @@ export default {
|
|
|
name: 'slot-component',
|
|
|
md: 24,
|
|
|
attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保费率', prop: 'insureTax1' },
|
|
|
+ formItemAttributes: { label: '保费率', prop: 'month1' },
|
|
|
render: (h, { props }) => {
|
|
|
var { formData } = props
|
|
|
return (
|
|
@@ -204,7 +175,7 @@ export default {
|
|
|
return (
|
|
|
<el-form-item
|
|
|
prop={keys[i]}
|
|
|
- rules={this.formRules.insureTax1}
|
|
|
+ rules={this.formRules.month1}
|
|
|
label-width="0px"
|
|
|
style="margin:0"
|
|
|
>
|
|
@@ -226,7 +197,7 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
return list
|
|
|
- })(this.insureTaxKeys)
|
|
|
+ })(this.monthKeys)
|
|
|
]}
|
|
|
tableData={[{}]}
|
|
|
></zj-table>
|
|
@@ -240,14 +211,14 @@ export default {
|
|
|
attributes: { disabled: this.disabled },
|
|
|
formItemAttributes: {
|
|
|
label: '保障范围',
|
|
|
- prop: 'insureRangeList',
|
|
|
+ prop: 'policyRanges',
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
|
validator: (rule, value, callback) => {
|
|
|
let bool = false
|
|
|
for (let item of value) {
|
|
|
- if (!item.name || !item.content) {
|
|
|
+ if (!item.rangeName || !item.rangeText) {
|
|
|
bool = true
|
|
|
}
|
|
|
}
|
|
@@ -281,16 +252,16 @@ export default {
|
|
|
<el-button
|
|
|
type="text"
|
|
|
onClick={() => {
|
|
|
- formData.insureRangeList.push({ name: '', content: '' })
|
|
|
+ formData.policyRanges.push({ rangeName: '', rangeText: '' })
|
|
|
}}
|
|
|
>
|
|
|
添加
|
|
|
</el-button>
|
|
|
- {formData.insureRangeList.length > 1 ? (
|
|
|
+ {formData.policyRanges.length > 1 ? (
|
|
|
<el-button
|
|
|
type="text"
|
|
|
onClick={() => {
|
|
|
- formData.insureRangeList.splice(index, 1)
|
|
|
+ formData.policyRanges.splice(index, 1)
|
|
|
}}
|
|
|
>
|
|
|
删除
|
|
@@ -313,12 +284,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})([
|
|
|
- { name: '名称', prop: 'name' },
|
|
|
- { name: '内容', prop: 'content' },
|
|
|
+ { name: '名称', prop: 'rangeName' },
|
|
|
+ { name: '内容', prop: 'rangeText' },
|
|
|
{ name: '操作', prop: 'options' }
|
|
|
])
|
|
|
]}
|
|
|
- tableData={formData.insureRangeList}
|
|
|
+ tableData={formData.policyRanges}
|
|
|
></zj-table>
|
|
|
)
|
|
|
}
|
|
@@ -328,28 +299,28 @@ export default {
|
|
|
formItems2() {
|
|
|
return [
|
|
|
{
|
|
|
+ name: 'el-input',
|
|
|
+ md: 24,
|
|
|
+ attributes: { disabled: this.disabled },
|
|
|
+ formItemAttributes: { label: '承保公司', prop: 'company' }
|
|
|
+ },
|
|
|
+ {
|
|
|
name: 'slot-component',
|
|
|
md: 24,
|
|
|
attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '保单内容', prop: 'content' },
|
|
|
+ formItemAttributes: { label: '保单内容', prop: 'text' },
|
|
|
render: (h, { props }) => {
|
|
|
var { formData } = props
|
|
|
return (
|
|
|
<v-quill-editor
|
|
|
disabled={this.disabled}
|
|
|
- value={formData.content}
|
|
|
+ value={formData.text}
|
|
|
onInput={val => {
|
|
|
- formData.content = val
|
|
|
+ formData.text = val
|
|
|
}}
|
|
|
></v-quill-editor>
|
|
|
)
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'el-input',
|
|
|
- md: 24,
|
|
|
- attributes: { disabled: this.disabled },
|
|
|
- formItemAttributes: { label: '承保公司', prop: 'insureCompany' }
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -361,10 +332,10 @@ export default {
|
|
|
id: this.item.id
|
|
|
}).then(res => {
|
|
|
for (var key in res.data) {
|
|
|
- if (~this.insureTaxKeys.indexOf(key)) {
|
|
|
+ if (~this.monthKeys.indexOf(key)) {
|
|
|
this.formData[key] = res.data[key] * 100
|
|
|
- } else if (key == 'insureRangeList') {
|
|
|
- this.formData[key] = res?.data[key]?.length ? res.data[key] : [{ name: '', content: '' }]
|
|
|
+ } else if (key == 'policyRanges') {
|
|
|
+ this.formData[key] = res?.data[key]?.length ? res.data[key] : [{ rangeName: '', rangeText: '' }]
|
|
|
} else {
|
|
|
this.formData[key] = res.data[key]
|
|
|
}
|
|
@@ -376,13 +347,13 @@ export default {
|
|
|
submit() {
|
|
|
this.$refs['formRef'].validate(valid => {
|
|
|
if (valid) {
|
|
|
- insureSave({
|
|
|
+ ;(this.form.id ? insureUpdate : insureAdd)({
|
|
|
...this.formData,
|
|
|
startTime: dateFormat('YYYY-mm-dd HH:MM:SS', new Date(this.formData.startTime)),
|
|
|
endTime: dateFormat('YYYY-mm-dd HH:MM:SS', new Date(this.formData.endTime)),
|
|
|
...(() => {
|
|
|
var obj = {}
|
|
|
- for (var key of this.insureTaxKeys) {
|
|
|
+ for (var key of this.monthKeys) {
|
|
|
obj[key] = this.formData[key] / 100
|
|
|
}
|
|
|
return obj
|