|
@@ -1,21 +1,21 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="projectAdd">
|
|
<div class="projectAdd">
|
|
|
- <el-form :model="projectAddFrom" :rules="projectAddRules" ref="projectAddRefs">
|
|
|
|
|
|
|
+ <el-form :model="projectAddFrom" :rules="projectAddRules" ref="ProjectAddRef">
|
|
|
<el-descriptions title="基本信息">
|
|
<el-descriptions title="基本信息">
|
|
|
<el-descriptions-item>
|
|
<el-descriptions-item>
|
|
|
<el-form-item label="保险公司" prop="companyId">
|
|
<el-form-item label="保险公司" prop="companyId">
|
|
|
- <el-select v-model="projectAddFrom.companyId" placeholder="请选择" style="width: 40%">
|
|
|
|
|
- <el-option v-for="item in companyOption" :key="item.id" :value="item.companyCode" :label="item.nameSimple"></el-option>
|
|
|
|
|
|
|
+ <el-select :disabled="isEdit" v-model="projectAddFrom.companyId" placeholder="请选择" style="width: 40%" @change="initProduct">
|
|
|
|
|
+ <el-option v-for="item in companyOption" :key="item.id" :value="item.id" :label="item.nameSimple"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="方案类型" prop="schemeType">
|
|
<el-form-item label="方案类型" prop="schemeType">
|
|
|
- <el-radio-group v-model="projectAddFrom.schemeType">
|
|
|
|
|
|
|
+ <el-radio-group :disabled="isEdit" v-model="projectAddFrom.schemeType" @change="schemeTypeChange">
|
|
|
<el-radio :value="1">基础方案</el-radio>
|
|
<el-radio :value="1">基础方案</el-radio>
|
|
|
<el-radio :value="2">自选方案</el-radio>
|
|
<el-radio :value="2">自选方案</el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="险种类型" prop="productId">
|
|
<el-form-item label="险种类型" prop="productId">
|
|
|
- <el-radio-group v-model="projectAddFrom.productId">
|
|
|
|
|
|
|
+ <el-radio-group :disabled="isEdit" v-model="projectAddFrom.productId" @change="initProduct">
|
|
|
<el-radio-button v-for="item in insuranceType" :key="item.value" :value="item.value">{{ item.label }}</el-radio-button>
|
|
<el-radio-button v-for="item in insuranceType" :key="item.value" :value="item.value">{{ item.label }}</el-radio-button>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -33,14 +33,17 @@
|
|
|
<el-icon><CircleCloseFilled /></el-icon>
|
|
<el-icon><CircleCloseFilled /></el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
</div>-->
|
|
</div>-->
|
|
|
- <rule-condition :ruleConditionVisible="false"></rule-condition>
|
|
|
|
|
|
|
+ <div style="width: 60%">
|
|
|
|
|
+ <rule-condition-container :rulesAttrList="rulesAttrList"></rule-condition-container>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <rule-condition :ruleConditionVisible="rulesShow" :attrIdList="rulesAttrList" @save="saveRule"></rule-condition>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-button style="margin: 10px 10%" plain type="primary" icon="plus">添加条件</el-button>
|
|
|
|
|
|
|
+ <el-button style="margin: 10px 10%" plain type="primary" icon="plus" @click="addRules">添加条件</el-button>
|
|
|
<el-descriptions>
|
|
<el-descriptions>
|
|
|
<template #title>
|
|
<template #title>
|
|
|
<div style="display: flex; align-items: center">
|
|
<div style="display: flex; align-items: center">
|
|
|
<span>方案配置</span>
|
|
<span>方案配置</span>
|
|
|
- <el-button type="primary" icon="plus" style="margin-left: 20px;" @click="addProject">添加新方案</el-button>
|
|
|
|
|
|
|
+ <el-button v-show="!isEdit" type="primary" icon="plus" style="margin-left: 20px;" @click="addProject">添加新方案</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<el-descriptions-item>
|
|
<el-descriptions-item>
|
|
@@ -55,13 +58,6 @@
|
|
|
<div style="display: flex; align-items: center; margin-bottom: 10px">
|
|
<div style="display: flex; align-items: center; margin-bottom: 10px">
|
|
|
<span style="margin-right: 20px">驾意险</span>
|
|
<span style="margin-right: 20px">驾意险</span>
|
|
|
<el-button link icon="plus" type="primary" @click="handleDriving(item, index)">选择驾意险</el-button>
|
|
<el-button link icon="plus" type="primary" @click="handleDriving(item, index)">选择驾意险</el-button>
|
|
|
- <el-dialog
|
|
|
|
|
- v-model="drivingShow"
|
|
|
|
|
- title="选择驾意险"
|
|
|
|
|
- width="700"
|
|
|
|
|
- >
|
|
|
|
|
- <driving ref="DrivingTypeRef" @close="handleDrivingClose(item, $event)"></driving>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<el-table
|
|
<el-table
|
|
|
:data="item.drivingList"
|
|
:data="item.drivingList"
|
|
@@ -71,7 +67,7 @@
|
|
|
<a>{{ scope.row.productName }}</a>
|
|
<a>{{ scope.row.productName }}</a>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="客户端状态" prop="f">
|
|
|
|
|
|
|
+ <el-table-column label="客户端状态" prop="selectedStatus">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-select v-model="scope.row.selectedStatus">
|
|
<el-select v-model="scope.row.selectedStatus">
|
|
|
<el-option label="默认不选中" key="1" value="1"></el-option>
|
|
<el-option label="默认不选中" key="1" value="1"></el-option>
|
|
@@ -102,13 +98,6 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
</el-popover>-->
|
|
</el-popover>-->
|
|
|
- <el-dialog
|
|
|
|
|
- v-model="insuranceShow"
|
|
|
|
|
- title="选择险种"
|
|
|
|
|
- width="500"
|
|
|
|
|
- >
|
|
|
|
|
- <insurance ref="InsuranceTypeRef" @close="handleClose(item, $event, index)" ></insurance>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<el-table
|
|
<el-table
|
|
|
:data="item.tableData"
|
|
:data="item.tableData"
|
|
@@ -118,10 +107,13 @@
|
|
|
<a>{{ scope.row.kindName }}</a>
|
|
<a>{{ scope.row.kindName }}</a>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="保额" prop="quota">
|
|
|
|
|
|
|
+ <el-table-column label="保额" prop="optionId">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-select v-model="scope.row.quota" style="width: 150px">
|
|
|
|
|
- <el-option v-for="m in scope.row.options" :label="m.label" :key="m.value" :value="m.value"></el-option>
|
|
|
|
|
|
|
+ <el-select v-if="projectAddFrom.schemeType === 2" v-model="scope.row.moneyId" style="width: 150px" multiple>
|
|
|
|
|
+ <el-option v-for="m in scope.row.options" :label="m.label" :key="m.id" :value="m.id"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-select v-else v-model="scope.row.moneyId" style="width: 150px" @change="">
|
|
|
|
|
+ <el-option v-for="m in scope.row.options" :label="m.label" :key="m.id" :value="m.id"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -140,24 +132,44 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div class="btns">
|
|
<div class="btns">
|
|
|
<el-button plain @click="quit">取消</el-button>
|
|
<el-button plain @click="quit">取消</el-button>
|
|
|
- <el-button type="primary" @click="save">保存</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="save(ProjectAddRef)">保存</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="drivingShow"
|
|
|
|
|
+ title="选择驾意险"
|
|
|
|
|
+ width="700"
|
|
|
|
|
+ >
|
|
|
|
|
+ <driving ref="DrivingTypeRef" @close="handleDrivingClose"></driving>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="insuranceShow"
|
|
|
|
|
+ title="选择险种"
|
|
|
|
|
+ width="500"
|
|
|
|
|
+ >
|
|
|
|
|
+ <insurance ref="InsuranceTypeRef" @close="handleClose" ></insurance>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
|
|
|
|
import api from "@/api";
|
|
import api from "@/api";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
+import { ElMessage, FormInstance, FormRules } from "element-plus";
|
|
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
|
import insurance from '../../../../layouts/components/InsuranceType/index.vue'
|
|
import insurance from '../../../../layouts/components/InsuranceType/index.vue'
|
|
|
import driving from '../../../../layouts/components/DrivingType/index.vue'
|
|
import driving from '../../../../layouts/components/DrivingType/index.vue'
|
|
|
import rule from '../../../../components/ruleConditionContainer/index.vue'
|
|
import rule from '../../../../components/ruleConditionContainer/index.vue'
|
|
|
|
|
|
|
|
|
|
+const myRouter = useRouter()
|
|
|
|
|
+const myRoute = useRoute()
|
|
|
|
|
+const ProjectAddRef = ref<FormInstance>()
|
|
|
const InsuranceTypeRef = ref(null)
|
|
const InsuranceTypeRef = ref(null)
|
|
|
const DrivingTypeRef = ref(null)
|
|
const DrivingTypeRef = ref(null)
|
|
|
|
|
|
|
|
|
|
+// 是否编辑
|
|
|
|
|
+let isEdit = ref(false)
|
|
|
let projectAddFrom = ref({
|
|
let projectAddFrom = ref({
|
|
|
- rulesList: [],
|
|
|
|
|
|
|
+ ruleAttrs: [],
|
|
|
schemeList: [{
|
|
schemeList: [{
|
|
|
schemeName: '',
|
|
schemeName: '',
|
|
|
description: '',
|
|
description: '',
|
|
@@ -167,19 +179,99 @@ let projectAddFrom = ref({
|
|
|
drivingIntentionList: []
|
|
drivingIntentionList: []
|
|
|
}]
|
|
}]
|
|
|
})
|
|
})
|
|
|
-let projectAddRules = ref({
|
|
|
|
|
|
|
+let projectAddRules = ref<FormRules>({
|
|
|
companyId: [
|
|
companyId: [
|
|
|
{ required: true, trigger: "change", message: "请选择保险公司" }
|
|
{ required: true, trigger: "change", message: "请选择保险公司" }
|
|
|
],
|
|
],
|
|
|
schemeType: [
|
|
schemeType: [
|
|
|
{ required: true, trigger: "change", message: "请选择方案类型" }
|
|
{ required: true, trigger: "change", message: "请选择方案类型" }
|
|
|
|
|
+ ],
|
|
|
|
|
+ productId: [
|
|
|
|
|
+ { required: true, trigger: "change", message: "请选择险种类型" }
|
|
|
]
|
|
]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+// 新增的时候初始化已有的方案
|
|
|
|
|
+const initProduct = () => {
|
|
|
|
|
+ api.projectApi.getSchemeByCompany({
|
|
|
|
|
+ companyId: projectAddFrom.value.companyId,
|
|
|
|
|
+ productId: projectAddFrom.value.productId,
|
|
|
|
|
+ schemeType: projectAddFrom.value.schemeType
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ if(res.data && res.data.schemeList.length > 0) {
|
|
|
|
|
+ res.data.schemeList.forEach(item => {
|
|
|
|
|
+ item.drivingList = item.drivingIntentionList
|
|
|
|
|
+ item.tableData = item.schemeInsuranceList.map(sub => {
|
|
|
|
|
+ let obj = insuranceTypeList.value.find(a => a.id === sub.insuranceId)
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...sub,
|
|
|
|
|
+ optionId: res.data.schemeType===1?`${sub.optionId[0]}`:sub.optionId,
|
|
|
|
|
+ moneyId: res.data.schemeType===1?`${sub.optionId[0]}`:sub.optionId,
|
|
|
|
|
+ options: obj.options
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ projectAddFrom.value = res.data
|
|
|
|
|
+ rulesAttrList.value = res.data.ruleAttrs
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ projectAddFrom.value.ruleAttrs = []
|
|
|
|
|
+ projectAddFrom.value.schemeList = [{
|
|
|
|
|
+ schemeName: '',
|
|
|
|
|
+ description: '',
|
|
|
|
|
+ tableData: [],
|
|
|
|
|
+ drivingList: [],
|
|
|
|
|
+ schemeInsuranceList: [],
|
|
|
|
|
+ drivingIntentionList: []
|
|
|
|
|
+ }]
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 险种
|
|
|
|
|
+let insuranceTypeList = ref([])
|
|
|
|
|
+const initInsurance = () => {
|
|
|
|
|
+ api.projectApi.getBusinessInsurance().then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ // res.data.forEach(item => {
|
|
|
|
|
+ // item.options.forEach(sub => {
|
|
|
|
|
+ // sub.id = sub.value
|
|
|
|
|
+ // })
|
|
|
|
|
+ // })
|
|
|
|
|
+ insuranceTypeList.value = res.data
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 方案类型切换
|
|
|
|
|
+const schemeTypeChange = (e) => {
|
|
|
|
|
+ projectAddFrom.value.ruleAttrs = []
|
|
|
|
|
+ projectAddFrom.value.schemeList = [{
|
|
|
|
|
+ schemeName: '',
|
|
|
|
|
+ description: '',
|
|
|
|
|
+ tableData: [],
|
|
|
|
|
+ drivingList: [],
|
|
|
|
|
+ schemeInsuranceList: [],
|
|
|
|
|
+ drivingIntentionList: []
|
|
|
|
|
+ }]
|
|
|
|
|
+ initProduct()
|
|
|
|
|
+ // rulesAttrList.value = defaultAttrList.value
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 保险公司
|
|
// 保险公司
|
|
|
let companyOption = ref([])
|
|
let companyOption = ref([])
|
|
|
const initCompany = () => {
|
|
const initCompany = () => {
|
|
|
- api.insuranceApi.leftList('').then(res => {
|
|
|
|
|
|
|
+ api.projectApi.getCompanyList().then(res => {
|
|
|
if(res.code == 200) {
|
|
if(res.code == 200) {
|
|
|
companyOption.value = res.data
|
|
companyOption.value = res.data
|
|
|
} else {
|
|
} else {
|
|
@@ -203,13 +295,27 @@ const addProject = () => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 规则
|
|
|
|
|
+let rulesShow = ref(false)
|
|
|
|
|
+const addRules = () => {
|
|
|
|
|
+ rulesShow.value = true
|
|
|
|
|
+}
|
|
|
|
|
+let rulesAttrList = ref([])
|
|
|
|
|
+let defaultAttrList = ref([])
|
|
|
|
|
+const saveRule = (data) => {
|
|
|
|
|
+ if(data && data.length > 0) {
|
|
|
|
|
+ rulesAttrList.value = data
|
|
|
|
|
+ }
|
|
|
|
|
+ rulesShow.value = false
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 险种类型
|
|
// 险种类型
|
|
|
let insuranceType = ref([])
|
|
let insuranceType = ref([])
|
|
|
const initType = () => {
|
|
const initType = () => {
|
|
|
api.commonApi.personInfo('insurance_type').then(res => {
|
|
api.commonApi.personInfo('insurance_type').then(res => {
|
|
|
if(res.code == 200) {
|
|
if(res.code == 200) {
|
|
|
insuranceType.value = res.data
|
|
insuranceType.value = res.data
|
|
|
- projectAddFrom.value.productId = insuranceType.value[0].id
|
|
|
|
|
|
|
+ projectAddFrom.value.productId = insuranceType.value[0].value
|
|
|
} else {
|
|
} else {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -224,13 +330,25 @@ let insuranceShow = ref(false)
|
|
|
// let insuranceList = ref([])
|
|
// let insuranceList = ref([])
|
|
|
// let checkInsuranceList = ref([])
|
|
// let checkInsuranceList = ref([])
|
|
|
// let checkSubInsuranceList = ref([])
|
|
// let checkSubInsuranceList = ref([])
|
|
|
-const handleClose = (item, list, index ) => {
|
|
|
|
|
- if(list && list.length > 0) {
|
|
|
|
|
- list.forEach(a => {
|
|
|
|
|
- let obj = a.options.find(b => b.checked)
|
|
|
|
|
- a.quota = obj.value
|
|
|
|
|
- })
|
|
|
|
|
- item.tableData = list
|
|
|
|
|
|
|
+const handleClose = ( obj ) => {
|
|
|
|
|
+ if(obj.list && obj.list.length > 0) {
|
|
|
|
|
+ if(projectAddFrom.value.schemeType === 2) {
|
|
|
|
|
+ obj.list.forEach(a => {
|
|
|
|
|
+ a.optionId = []
|
|
|
|
|
+ a.options.forEach(b => {
|
|
|
|
|
+ if(b.checked) {
|
|
|
|
|
+ a.optionId.push(b.id)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ a.moneyId = a.optionId
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ obj.list.forEach(a => {
|
|
|
|
|
+ a.optionId = a.options.find(b => b.checked)?.id
|
|
|
|
|
+ a.moneyId = a.optionId
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ projectAddFrom.value.schemeList[obj.index].tableData = obj.list
|
|
|
}
|
|
}
|
|
|
insuranceShow.value = false
|
|
insuranceShow.value = false
|
|
|
}
|
|
}
|
|
@@ -246,18 +364,18 @@ let drivingShow = ref(false)
|
|
|
const handleDriving = (item, index) => {
|
|
const handleDriving = (item, index) => {
|
|
|
drivingShow.value = true
|
|
drivingShow.value = true
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- DrivingTypeRef.value[index].initEditData(item.drivingList)
|
|
|
|
|
|
|
+ DrivingTypeRef.value.initEditData(item.drivingList, index)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-const handleDrivingClose = (item, list ) => {
|
|
|
|
|
- if(list && list.length > 0) {
|
|
|
|
|
- let selectList = list.filter(a => a.checked)
|
|
|
|
|
|
|
+const handleDrivingClose = ( obj ) => {
|
|
|
|
|
+ if(obj.list && obj.list.length > 0) {
|
|
|
|
|
+ let selectList = obj.list.filter(a => a.checked)
|
|
|
selectList.forEach(sub => {
|
|
selectList.forEach(sub => {
|
|
|
- sub.drivingIntentionId = sub.id
|
|
|
|
|
|
|
+ sub.drivingIntentionId = sub.drivingIntentionId
|
|
|
sub.selectedStatus = sub.selectedStatus?sub.selectedStatus:'1'
|
|
sub.selectedStatus = sub.selectedStatus?sub.selectedStatus:'1'
|
|
|
sub.quantity = sub.quantity?sub.quantity:'1'
|
|
sub.quantity = sub.quantity?sub.quantity:'1'
|
|
|
})
|
|
})
|
|
|
- item.drivingList = selectList
|
|
|
|
|
|
|
+ projectAddFrom.value.schemeList[obj.index].drivingList = selectList
|
|
|
}
|
|
}
|
|
|
drivingShow.value = false
|
|
drivingShow.value = false
|
|
|
}
|
|
}
|
|
@@ -269,41 +387,117 @@ const drivingTypeDel = (item, row) => {
|
|
|
const handlePopover = (item, index) => {
|
|
const handlePopover = (item, index) => {
|
|
|
insuranceShow.value = true
|
|
insuranceShow.value = true
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- InsuranceTypeRef.value[index].initEditData(item.tableData)
|
|
|
|
|
|
|
+ InsuranceTypeRef.value.initEditData(item.tableData, index, projectAddFrom.value.schemeType)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 取消
|
|
|
|
|
-const quit = () => {
|
|
|
|
|
-
|
|
|
|
|
|
|
+// 规则
|
|
|
|
|
+const initAttr = () => {
|
|
|
|
|
+ api.agreementApi.ruleAttrGroup({ attrName: '' }).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ let list = res.data?.VehicleInformation?.filter(e => e.attrName === '能源类型' || e.attrName === '使用性质' || e.attrName === '车辆类型')
|
|
|
|
|
+ rulesAttrList.value = [...list]
|
|
|
|
|
+ defaultAttrList.value = [...list]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
-// 保存
|
|
|
|
|
-const save = () => {
|
|
|
|
|
- let formData = {...projectAddFrom.value}
|
|
|
|
|
- formData.schemeList.forEach(item => {
|
|
|
|
|
- item.drivingList.forEach(sub => {
|
|
|
|
|
- let obj = {
|
|
|
|
|
- drivingIntentionId: sub.id,
|
|
|
|
|
- selectedStatus: sub.selectedStatus,
|
|
|
|
|
- quantity: sub.quantity
|
|
|
|
|
- }
|
|
|
|
|
- item.drivingIntentionList.push(obj)
|
|
|
|
|
- })
|
|
|
|
|
- item.tableData.forEach(ins => {
|
|
|
|
|
- let obj = {
|
|
|
|
|
- insuranceId: ins.id,
|
|
|
|
|
- optionId: ins.options.find(a => a.checked)?.value
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 编辑
|
|
|
|
|
+const initEdit = () => {
|
|
|
|
|
+ api.projectApi.getScheme(myRoute.query.id).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ if(res.data && res.data.schemeList.length > 0) {
|
|
|
|
|
+ res.data.schemeList.forEach(item => {
|
|
|
|
|
+ item.drivingList = item.drivingIntentionList
|
|
|
|
|
+ item.tableData = item.schemeInsuranceList.map(sub => {
|
|
|
|
|
+ let obj = insuranceTypeList.value.find(a => a.id === sub.insuranceId)
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...sub,
|
|
|
|
|
+ optionId: res.data.schemeType===1?`${sub.optionId[0]}`:sub.optionId,
|
|
|
|
|
+ moneyId: res.data.schemeType===1?`${sub.optionId[0]}`:sub.optionId,
|
|
|
|
|
+ options: obj.options
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ projectAddFrom.value = res.data
|
|
|
|
|
+ rulesAttrList.value = res.data.ruleAttrs
|
|
|
}
|
|
}
|
|
|
- item.schemeInsuranceList.push(obj)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
- console.log(123, formData)
|
|
|
|
|
- api.projectApi.saveScheme({...formData}).then(res => {
|
|
|
|
|
- if(res.code == 200) {
|
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+// 取消
|
|
|
|
|
+const quit = () => {
|
|
|
|
|
+ myRouter.push({
|
|
|
|
|
+ path: '/quoteConfig/agreement/project'
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+// 保存
|
|
|
|
|
+const save = async (ProjectAddRef: FormInstance | undefined) => {
|
|
|
|
|
+ console.log(123, ProjectAddRef)
|
|
|
|
|
+ if(!ProjectAddRef) {
|
|
|
|
|
+ ProjectAddRef.resetFields()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ await ProjectAddRef.validate((valid) => {
|
|
|
|
|
+ if(valid) {
|
|
|
|
|
+ let formData = {...projectAddFrom.value}
|
|
|
|
|
+ formData.ruleAttrs = [...rulesAttrList.value]
|
|
|
|
|
+ formData.schemeList.forEach(item => {
|
|
|
|
|
+ item.drivingIntentionList = []
|
|
|
|
|
+ item.schemeInsuranceList = []
|
|
|
|
|
+ item.drivingList.forEach(sub => {
|
|
|
|
|
+ let obj = {
|
|
|
|
|
+ id: sub.id,
|
|
|
|
|
+ drivingIntentionId: sub.drivingIntentionId,
|
|
|
|
|
+ selectedStatus: sub.selectedStatus,
|
|
|
|
|
+ quantity: sub.quantity
|
|
|
|
|
+ }
|
|
|
|
|
+ item.drivingIntentionList.push(obj)
|
|
|
|
|
+ })
|
|
|
|
|
+ item.tableData.forEach(ins => {
|
|
|
|
|
+ let obj = {
|
|
|
|
|
+ id: ins.id,
|
|
|
|
|
+ insuranceId: ins.insuranceId,
|
|
|
|
|
+ optionId: projectAddFrom.value.schemeType === 1?[ins.moneyId]:projectAddFrom.value.schemeType === 2?ins.moneyId:[]
|
|
|
|
|
+ }
|
|
|
|
|
+ // ins.options.forEach(sub => {
|
|
|
|
|
+ // if(sub.checked) {
|
|
|
|
|
+ // obj.optionId.push(sub.id)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ item.schemeInsuranceList.push(obj)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ api.projectApi.saveScheme({...formData}).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ })
|
|
|
|
|
+ myRouter.push({
|
|
|
|
|
+ path: '/quoteConfig/agreement/project'
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: res.msg,
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
- message: res.msg,
|
|
|
|
|
|
|
+ message: '请正确填写相关信息!',
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -311,8 +505,17 @@ const save = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ initInsurance()
|
|
|
initType()
|
|
initType()
|
|
|
initCompany()
|
|
initCompany()
|
|
|
|
|
+ // initAttr()
|
|
|
|
|
+ if(myRoute.query.id) {
|
|
|
|
|
+ isEdit.value = true
|
|
|
|
|
+ initEdit()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ isEdit.value = false
|
|
|
|
|
+ initAttr()
|
|
|
|
|
+ }
|
|
|
// initInsurance()
|
|
// initInsurance()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -340,5 +543,10 @@ onMounted(() => {
|
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
|
}
|
|
}
|
|
|
|
|
+ .btns{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|