|
|
@@ -8,67 +8,78 @@
|
|
|
<el-row :gutter="20" align="middle" style="display: flex; align-items: center; width: 100%; overflow: hidden; margin: 0">
|
|
|
<el-col :span="18" style="padding-left: 20px">报价限制</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-button type="primary" @click="handleSync" :disabled="!quoteForm.isEnabled">同步配置到其他保司</el-button>
|
|
|
- <el-button type="primary" @click="handleEdit" :disabled="!quoteForm.isEnabled" v-if="!quoteForm.isEnabled">编辑</el-button>
|
|
|
+ <el-button type="primary" @click="handleSync" :disabled="!isEdit">同步配置到其他保司</el-button>
|
|
|
+ <el-button type="primary" @click="handleEdit" v-if="!isEdit">编辑</el-button>
|
|
|
<el-button type="primary" @click="handleSave" v-else>保存</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-divider></el-divider>
|
|
|
<el-form :model="quoteForm" ref="QuoteFormRef" :rules="quoteRules" style="padding-left: 30px;" label-width="120px">
|
|
|
- <el-form-item prop="count" label="报价次数限制">
|
|
|
- <el-switch v-model="quoteForm.isEnabled"></el-switch>
|
|
|
+ <el-form-item prop="isEnabled" label="报价次数限制">
|
|
|
+ <el-switch v-model="quoteForm.isEnabled" :disabled="!isEdit"></el-switch>
|
|
|
<p class="tips">开启后,代理人的报价次数将受到限制,超出设置的报价次数后将停止代理人的报价功能</p>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="agentLimit" label="代理人限制">
|
|
|
+ <el-form-item prop="authorize" label="代理人限制">
|
|
|
<div>
|
|
|
- <el-radio-group v-model="quoteForm.authorize" :disabled="!quoteForm.isEnabled">
|
|
|
+ <el-radio-group v-model="quoteForm.authorize" :disabled="!isEdit">
|
|
|
<el-radio :label="0">限制全部代理人</el-radio>
|
|
|
<el-radio :label="1">限制部分代理人</el-radio>
|
|
|
</el-radio-group>
|
|
|
- <kt-button v-if="quoteForm.authorize" type="text" label="选择代理人" icon="el-icon-plus" style="color: #2D4D89; margin-left: 30px" @click="selectAgent" />
|
|
|
+ <kt-button v-if="quoteForm.authorize" type="text" label="选择代理人" :disabled="!isEdit" icon="el-icon-plus" style="color: #2D4D89; margin-left: 30px" @click="selectAgent" />
|
|
|
</div>
|
|
|
<el-table
|
|
|
- :data="selectedList"
|
|
|
+ :data="selectList"
|
|
|
>
|
|
|
<el-table-column prop="deptId" label="部门编码"></el-table-column>
|
|
|
- <el-table-column prop="organization" label="机构名称"></el-table-column>
|
|
|
+<!-- <el-table-column prop="organization" label="机构名称"></el-table-column>-->
|
|
|
<el-table-column prop="deptName" label="部门名称"></el-table-column>
|
|
|
<el-table-column prop="id" label="工号"></el-table-column>
|
|
|
<el-table-column prop="name" label="姓名"></el-table-column>
|
|
|
<el-table-column prop="mobile" label="联系电话"></el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <kt-button :disabled="!quoteForm.isEnabled" type="text" label="删除" style="color: #2D4D89;" />
|
|
|
+ <el-popconfirm
|
|
|
+ confirm-button-text='确定'
|
|
|
+ cancel-button-text='取消'
|
|
|
+ icon="el-icon-info"
|
|
|
+ icon-color="red"
|
|
|
+ :ref="`popconfirm-${scope.row.id}`"
|
|
|
+ title="确定删除吗?"
|
|
|
+ @confirm="handleDelete(scope.row)"
|
|
|
+ >
|
|
|
+ <kt-button slot="reference" :disabled="!isEdit" type="text" label="删除" style="color: #2D4D89;" />
|
|
|
+ </el-popconfirm>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="quoteLimit" label="报价限制">
|
|
|
- <el-checkbox-group v-model="quoteForm.quoteLimit" :disabled="!quoteForm.isEnabled">
|
|
|
+ <el-checkbox-group v-model="quoteForm.quoteLimit" @change="checkChange">
|
|
|
<div>
|
|
|
- <el-checkbox :label="1">
|
|
|
+ <el-checkbox label="1" :disabled="!isEdit">
|
|
|
<div style="display: flex; align-items: center">
|
|
|
- 单日报价,出单比不满<el-input size="small" v-model="quoteForm.orderRatio" :disabled="!quoteForm.isEnabled" style="width: 100px; margin: 0 20px;">
|
|
|
+ 单日报价,出单比不满<el-input size="small" maxlength="2" v-model="quoteForm.orderRatio" :disabled="!isEdit" style="width: 150px; margin: 0 20px;">
|
|
|
<template slot="append">%</template>
|
|
|
</el-input>后,锁定代理人报价次数
|
|
|
</div>
|
|
|
</el-checkbox>
|
|
|
</div>
|
|
|
+ <p style="font-size: 12px; color: #999; margin: 0">报价出单比=承保单数/报价单数*100% (四舍五入到小数点后两位)</p>
|
|
|
<div>
|
|
|
- <el-checkbox :label="2">
|
|
|
+ <el-checkbox label="2" :disabled="!isEdit">
|
|
|
<div>单日最大报价次数</div>
|
|
|
<div style="display: flex; align-items: center">
|
|
|
- 单日代理人报价满<el-input size="small" v-model="quoteForm.dayMaxQuoteNum" :disabled="!quoteForm.isEnabled" style="width: 100px; margin: 0 20px;">
|
|
|
+ 单日代理人报价满<el-input size="small" maxlength="4" v-model="quoteForm.dayMaxQuoteNum" :disabled="!isEdit" style="width: 150px; margin: 0 20px;">
|
|
|
<template slot="append">次</template>
|
|
|
</el-input>后,锁定代理人报价次数
|
|
|
</div>
|
|
|
</el-checkbox>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <el-checkbox :label="3">
|
|
|
+ <el-checkbox label="3" :disabled="!isEdit">
|
|
|
<div>单日单车限制</div>
|
|
|
<div style="display: flex; align-items: center">
|
|
|
- 单日代理人单车最多报价<el-input size="small" :disabled="!quoteForm.isEnabled" v-model="quoteForm.carMaxQuoteNum" style="width: 100px; margin: 0 20px;">
|
|
|
+ 单日代理人单车最多报价<el-input size="small" maxlength="4" :disabled="!isEdit" v-model="quoteForm.carMaxQuoteNum" style="width: 150px; margin: 0 20px;">
|
|
|
<template slot="append">次</template>
|
|
|
</el-input>后,锁定代理人报价次数
|
|
|
</div>
|
|
|
@@ -129,11 +140,12 @@
|
|
|
row-key="id"
|
|
|
:reserve-selection="true"
|
|
|
style="width: 100%"
|
|
|
- @selection-change="handleSelectChange"
|
|
|
+ @select-all="handleSelectAll"
|
|
|
+ @select="handleSelectChange"
|
|
|
>
|
|
|
<el-table-column type="selection"></el-table-column>
|
|
|
<el-table-column prop="deptId" label="部门编码"></el-table-column>
|
|
|
- <el-table-column prop="organization" label="机构名称"></el-table-column>
|
|
|
+<!-- <el-table-column prop="organization" label="机构名称"></el-table-column>-->
|
|
|
<el-table-column prop="deptName" label="部门名称"></el-table-column>
|
|
|
<el-table-column prop="id" label="工号"></el-table-column>
|
|
|
<el-table-column prop="name" label="姓名"></el-table-column>
|
|
|
@@ -150,8 +162,8 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
<template slot="footer">
|
|
|
- <kt-button label="取消" size="small" type="text" @click="agentTableShow = false" />
|
|
|
- <kt-button label="确认" size="small" type="primary" @click="agentTableShow = false" />
|
|
|
+ <kt-button label="取消" size="small" type="text" @click="handleCancel" />
|
|
|
+ <kt-button label="确认" size="small" type="primary" @click="handleOk" />
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -159,7 +171,7 @@
|
|
|
|
|
|
<script>
|
|
|
import KtButton from "../../Core/KtButton.vue";
|
|
|
-import {getAgentUser, setQuoteInfo} from "../../../http/moudules/quote";
|
|
|
+import {getAgentUser, getQuoteConfigInfo, setQuoteInfo, syncQuoteInfo} from "../../../http/moudules/quote";
|
|
|
import {findTree} from "../../../http/moudules/insCompany";
|
|
|
|
|
|
export default {
|
|
|
@@ -172,6 +184,7 @@ export default {
|
|
|
menuIndex: 0, // 保险公司item下标
|
|
|
syncShow: false, // 同步设置弹框
|
|
|
quoteForm: {
|
|
|
+ id: '',
|
|
|
isEnabled: false,
|
|
|
authorize: '',
|
|
|
quoteLimit: []
|
|
|
@@ -189,15 +202,16 @@ export default {
|
|
|
],
|
|
|
quoteLimit: [
|
|
|
{
|
|
|
- type: 'array',required: true, message: '请选择报价限制', triangle: 'change'
|
|
|
+ type: 'array',required: true, message: '请选择报价限制', trigger: 'change'
|
|
|
}
|
|
|
]
|
|
|
}, // 报价form规则
|
|
|
- isCheckedAll: false,
|
|
|
- checkType: '',
|
|
|
- agentTableShow: false,
|
|
|
+ isEdit: false, // 是否可编辑
|
|
|
+ checkType: '', // 全选类型
|
|
|
+ agentTableShow: false, // 控制选择代理人弹框
|
|
|
agentDataList: [],
|
|
|
- selectList: [], // 勾选的数据(格式为每页勾选的为一个数组并作为数组元素保存)
|
|
|
+ myList: [], // 记录每个保险公司接口返回的已经选好的代理人
|
|
|
+ selectList: [], // 勾选的数据
|
|
|
selectedList: [], // 勾选的数据(格式为平铺后)
|
|
|
pageList: [1], // 记录点击了的页码
|
|
|
selectedLength: 0, // 选择(包括全选后)的数据数量
|
|
|
@@ -208,11 +222,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ checkChange() {
|
|
|
+ if(!this.quoteForm.quoteLimit.includes('1')) {
|
|
|
+ this.$set(this.quoteForm, 'orderRatio', '')
|
|
|
+ }
|
|
|
+ if(!this.quoteForm.quoteLimit.includes('2')) {
|
|
|
+ this.$set(this.quoteForm, 'dayMaxQuoteNum', '')
|
|
|
+ }
|
|
|
+ if(!this.quoteForm.quoteLimit.includes('3')) {
|
|
|
+ this.$set(this.quoteForm, 'carMaxQuoteNum', '')
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取保险公司
|
|
|
initCompany() {
|
|
|
this.$api.quote.getCompany().then(res => {
|
|
|
if(res.code == 200) {
|
|
|
this.leftTree = res.data
|
|
|
+ this.initQuoteDetails(res.data[0].id)
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
@@ -235,7 +261,7 @@ export default {
|
|
|
value: that.countDetailForm.orderNumber?that.countDetailForm.orderNumber: ''
|
|
|
},
|
|
|
deptId: {
|
|
|
- value: that.countDetailForm.organization?that.countDetailForm.organization: ''
|
|
|
+ value: that.countDetailForm.organization?that.countDetailForm.organization[that.countDetailForm.organization.length-1]: ''
|
|
|
}
|
|
|
}
|
|
|
}).then(res => {
|
|
|
@@ -247,7 +273,7 @@ export default {
|
|
|
that.selectedLength = res.data.totalSize
|
|
|
if(that.agentDataList.length>0) {
|
|
|
that.agentDataList.forEach(item => {
|
|
|
- that.$refs.multipleTable.toggleRowSelection(item)
|
|
|
+ that.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
|
@@ -256,7 +282,7 @@ export default {
|
|
|
list.forEach(item => {
|
|
|
let arrayItem = that.agentDataList.find(sub => sub.id === item.id)
|
|
|
if(arrayItem) {
|
|
|
- that.$refs.multipleTable.toggleRowSelection(arrayItem)
|
|
|
+ that.$refs.multipleTable.toggleRowSelection(arrayItem, true)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -269,34 +295,72 @@ export default {
|
|
|
reset() {
|
|
|
this.countDetailForm = {}
|
|
|
this.pageNum = 1
|
|
|
+ this.initAgentUser()
|
|
|
},
|
|
|
// 代理人分页页数变化函数
|
|
|
handlePageNumChange(page) {
|
|
|
this.pageNum = page
|
|
|
+ if(this.checkType === 'cur') {
|
|
|
+ this.checkType = ''
|
|
|
+ }
|
|
|
this.initAgentUser()
|
|
|
},
|
|
|
+ // 选择代理人确认
|
|
|
+ handleOk() {
|
|
|
+ if(this.checkType === 'all') {
|
|
|
+ this.quoteForm.authorize = 0
|
|
|
+ this.selectList = []
|
|
|
+ } else {
|
|
|
+ this.selectList = [...this.selectedList]
|
|
|
+ }
|
|
|
+ this.agentTableShow = false
|
|
|
+ },
|
|
|
+ // 选择代理人取消
|
|
|
+ handleCancel() {
|
|
|
+ // this.selectList = [...this.myList]
|
|
|
+ this.selectedList = [...this.selectList]
|
|
|
+ this.selectedLength = this.selectedList.length
|
|
|
+ this.agentTableShow = false
|
|
|
+ },
|
|
|
// 代理选择
|
|
|
handleSelectChange(rows) {
|
|
|
if(this.checkType === 'all') {
|
|
|
this.selectedLength = this.total
|
|
|
return;
|
|
|
}
|
|
|
- if(rows.length>0) {
|
|
|
- let list = [...this.selectedList]
|
|
|
- if(this.selectedList.length>0){
|
|
|
- list.forEach((item, index) => {
|
|
|
- this.agentDataList.forEach(sub => {
|
|
|
- if(sub.id === item.id) {
|
|
|
- list.splice(index,1)
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- this.selectedList = this.uniqueItems([...list, ...rows])
|
|
|
- this.selectedLength = this.selectedList.length
|
|
|
+ let list = [...this.selectedList]
|
|
|
+ if(list.length>0){
|
|
|
+ if(rows.length>0) {
|
|
|
+ let arr = list.filter(item1 => !this.agentDataList.some(item2 => item1.id === item2.id))
|
|
|
+ this.selectedList = this.uniqueItems([...arr, ...rows])
|
|
|
} else {
|
|
|
+ this.selectedList = this.uniqueItems([...list])
|
|
|
+ }
|
|
|
+ this.selectedLength = this.selectedList.length
|
|
|
+ } else {
|
|
|
+ if(rows.length>0) {
|
|
|
this.selectedList = [...rows]
|
|
|
+ } else {
|
|
|
+ this.selectedList = []
|
|
|
+ }
|
|
|
+ this.selectedLength = this.selectedList.length
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 手动点击全选
|
|
|
+ handleSelectAll(rows) {
|
|
|
+ let list = [...this.selectedList]
|
|
|
+ if(rows.length===0) {
|
|
|
+ if(list.length>0){
|
|
|
+ let arr = list.filter(item1 => !this.agentDataList.some(item2 => item1.id === item2.id))
|
|
|
+ this.selectedList = this.uniqueItems([...arr])
|
|
|
this.selectedLength = this.selectedList.length
|
|
|
+ } else {
|
|
|
+ this.selectedList = [...rows]
|
|
|
}
|
|
|
+ } else {
|
|
|
+ let arr = [...rows], brr = [...list], crr = brr.concat(arr)
|
|
|
+ this.selectedList = this.uniqueItems([...crr])
|
|
|
+ this.selectedLength = this.selectedList.length
|
|
|
}
|
|
|
},
|
|
|
// 数组去重
|
|
|
@@ -313,7 +377,43 @@ export default {
|
|
|
// 保险公司切换
|
|
|
handleSelect(item, index) {
|
|
|
this.menuIndex = index
|
|
|
- this.quoteForm = {}
|
|
|
+ this.quoteForm = {
|
|
|
+ id: '',
|
|
|
+ isEnabled: false,
|
|
|
+ authorize: '',
|
|
|
+ quoteLimit: []
|
|
|
+ }
|
|
|
+ this.isEdit = false
|
|
|
+ this.initQuoteDetails(item.id)
|
|
|
+ },
|
|
|
+ // 获取详情
|
|
|
+ initQuoteDetails(id) {
|
|
|
+ this.selectList = []
|
|
|
+ this.selectedList = []
|
|
|
+ this.myList = []
|
|
|
+ this.$api.quote.getQuoteConfigInfo(id).then(res => {
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.quoteForm = {...res.data}
|
|
|
+ this.quoteForm.isEnabled = res.data.isEnabled?true:false
|
|
|
+ let list = []
|
|
|
+ if(res.data.orderRatio){
|
|
|
+ list.push('1')
|
|
|
+ }
|
|
|
+ if(res.data.dayMaxQuoteNum){
|
|
|
+ list.push('2')
|
|
|
+ }
|
|
|
+ if(res.data.carMaxQuoteNum){
|
|
|
+ list.push('3')
|
|
|
+ }
|
|
|
+ this.$set(this.quoteForm, 'quoteLimit', list)
|
|
|
+ this.selectedList = [...res.data.proxyList]
|
|
|
+ this.selectedLength = res.data.proxyList.length
|
|
|
+ this.selectList = [...res.data.proxyList]
|
|
|
+ this.myList = [...res.data.proxyList]
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 同步到其他
|
|
|
handleSync() {
|
|
|
@@ -321,7 +421,7 @@ export default {
|
|
|
},
|
|
|
// 编辑
|
|
|
handleEdit() {
|
|
|
-
|
|
|
+ this.isEdit = true
|
|
|
},
|
|
|
// 保存
|
|
|
handleSave() {
|
|
|
@@ -330,16 +430,16 @@ export default {
|
|
|
this.$api.quote.setQuoteInfo({
|
|
|
companyId: this.leftTree[this.menuIndex].id,
|
|
|
isEnabled: this.quoteForm.isEnabled?1:0,
|
|
|
- id: null,
|
|
|
+ id: this.quoteForm.id,
|
|
|
authorize: this.quoteForm.authorize,
|
|
|
proxyList: this.selectedList,
|
|
|
orderRatio: this.quoteForm.orderRatio,
|
|
|
dayMaxQuoteNum: this.quoteForm.dayMaxQuoteNum,
|
|
|
carMaxQuoteNum: this.quoteForm.carMaxQuoteNum
|
|
|
}).then(res => {
|
|
|
- console.log('保存', res)
|
|
|
if(res.code == 200) {
|
|
|
this.$message.success(res.msg)
|
|
|
+ this.initQuoteDetails(this.leftTree[this.menuIndex].id)
|
|
|
this.quoteForm = {}
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
@@ -348,16 +448,36 @@ export default {
|
|
|
} else {
|
|
|
this.$message.error('请填写或选择必要数据!')
|
|
|
}
|
|
|
+ this.isEdit = false
|
|
|
})
|
|
|
},
|
|
|
// 同步到其他确定
|
|
|
handleSubmit() {
|
|
|
-
|
|
|
+ this.$api.quote.syncQuoteInfo({
|
|
|
+ companyId: this.leftTree[this.menuIndex].id,
|
|
|
+ isEnabled: this.quoteForm.isEnabled?1:0,
|
|
|
+ id: this.quoteForm.id,
|
|
|
+ authorize: this.quoteForm.authorize,
|
|
|
+ proxyList: this.selectedList,
|
|
|
+ orderRatio: this.quoteForm.orderRatio,
|
|
|
+ dayMaxQuoteNum: this.quoteForm.dayMaxQuoteNum,
|
|
|
+ carMaxQuoteNum: this.quoteForm.carMaxQuoteNum
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ this.syncShow = false
|
|
|
+ })
|
|
|
},
|
|
|
// 选择代理人
|
|
|
selectAgent() {
|
|
|
this.agentTableShow = true
|
|
|
this.countDetailForm = {}
|
|
|
+ this.pageNum = 1
|
|
|
+ this.checkType = ''
|
|
|
+ this.selectedLength = 0
|
|
|
this.initAgentUser()
|
|
|
this.initOrganization()
|
|
|
},
|
|
|
@@ -365,31 +485,44 @@ export default {
|
|
|
selectTypeChange() {
|
|
|
if(this.agentDataList.length>0) {
|
|
|
this.agentDataList.forEach(item => {
|
|
|
- this.$refs.multipleTable.toggleRowSelection(item)
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
})
|
|
|
}
|
|
|
if(this.checkType === 'all') {
|
|
|
this.selectedLength = this.total
|
|
|
+ this.selectedList = []
|
|
|
}
|
|
|
if(this.checkType === 'cur') {
|
|
|
- this.selectedLength = 0
|
|
|
- let list = [...this.selectedList, ...this.agentDataList]
|
|
|
- this.selectedList = this.uniqueItems(list)
|
|
|
+ let list = [...this.selectedList], arr = [...this.agentDataList]
|
|
|
+ this.selectedList = this.uniqueItems(list.concat(arr))
|
|
|
this.selectedLength = this.selectedList.length
|
|
|
}
|
|
|
},
|
|
|
// 监听浏览器刷新
|
|
|
handleBeforeUnload(event) {
|
|
|
- event.preventDefault();
|
|
|
- event.returnValue = '';
|
|
|
+ if(this.isEdit) {
|
|
|
+ event.preventDefault();
|
|
|
+ event.returnValue = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除选择的代理人
|
|
|
+ handleDelete(row) {
|
|
|
+ let list = []
|
|
|
+ list = this.selectList.filter((item) => {
|
|
|
+ return item.id != row.id
|
|
|
+ })
|
|
|
+ this.selectList = [...list]
|
|
|
+ this.selectedList = [...list]
|
|
|
+ this.selectedLength = this.selectedList.length
|
|
|
+ this.myList = [...list]
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initCompany();
|
|
|
- // window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
|
+ window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- // window.removeEventListener('beforeunload', this.handleBeforeUnload)
|
|
|
+ window.removeEventListener('beforeunload', this.handleBeforeUnload)
|
|
|
}
|
|
|
}
|
|
|
</script>
|