|
@@ -1,9 +1,11 @@
|
|
|
<template>
|
|
|
<div class="crm-action">
|
|
|
<!-- 收录 -->
|
|
|
- <div class="action-content" v-for="(item, i) in list" :key="i">
|
|
|
+ <div class="action-content" v-for="(item, i) in getList" :key="i">
|
|
|
<div @click="setActionEvent(item)" class="action-list" :class="'action-' + item.class">
|
|
|
- <i class="iconfont" :class="[ 'icon-' + item['icon-' + item.active] , {'checked': !!item.active }]"></i>
|
|
|
+ <i class="iconfont" :class="[ 'icon-' + item['icon-' + item.active] , {'checked': !!item.active }]">
|
|
|
+ <div class="msg" v-if="item.msg">{{ item.msg }}</div>
|
|
|
+ </i>
|
|
|
<span> {{ item.active ? '已' : '' }}{{ item.title }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -12,29 +14,95 @@
|
|
|
|
|
|
<script>
|
|
|
import '@/assets/style/iconfont.css'
|
|
|
+import { ajaxIgnoreOperate, ajaxEmployOperate, ajaxEmployInfo } from '@/api/modules/'
|
|
|
export default {
|
|
|
name: 'crm-action',
|
|
|
+ props: {
|
|
|
+ params: {
|
|
|
+ type: Object,
|
|
|
+ default () {
|
|
|
+ return {
|
|
|
+ employType: 3,
|
|
|
+ idArr: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
list: [
|
|
|
{ title: '收录', 'icon-0': 'a-Property1shoulu', 'icon-1': 'a-Property1yishoulu', class: 'employ', active: 0 },
|
|
|
{ title: '忽略', 'icon-0': 'a-Property1hulve', 'icon-1': 'a-Property1yihulve', class: 'ignore', active: 0 },
|
|
|
- { title: '创建客户', 'icon-0': 'chuangjiankehu', 'icon-1': 'chuangjiankehu', class: 'add-custom', active: 0 }
|
|
|
- ]
|
|
|
+ { title: '创建客户', 'icon-0': 'chuangjiankehu', 'icon-1': 'chuangjiankehu', class: 'custom', active: 0, msg: 0 }
|
|
|
+ ],
|
|
|
+ employInfo: {}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ getList () {
|
|
|
+ if (this.list[0].active === 0) {
|
|
|
+ return this.list.slice(0, 1)
|
|
|
+ } else {
|
|
|
+ return this.list
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getEmployEvent()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 收录情况
|
|
|
+ async getEmployEvent () {
|
|
|
+ const { data, error_code: code } = await ajaxEmployInfo(this.params)
|
|
|
+ if (code === 0 && Array.from(data) && data.length > 0) {
|
|
|
+ this.employInfo = data
|
|
|
+ // 收录情况
|
|
|
+ this.list[0].active = data[0].isEmploy ? 1 : 0
|
|
|
+ // 忽略情况
|
|
|
+ this.list[1].active = data[0].isIgnore ? 1 : 0
|
|
|
+ }
|
|
|
+ },
|
|
|
setActionEvent (data) {
|
|
|
switch (data.class) {
|
|
|
case 'employ':
|
|
|
- data.active = data.active === 0 ? 1 : 0
|
|
|
+ this.setEmployEvent(data)
|
|
|
break
|
|
|
case 'ignore':
|
|
|
- data.active = data.active === 0 ? 1 : 0
|
|
|
+ this.setIgnoreEvent(data)
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
+ },
|
|
|
+ // 收录操作
|
|
|
+ async setEmployEvent (item) {
|
|
|
+ const info = this.employInfo[0]
|
|
|
+ const params = {
|
|
|
+ idArr: this.params.idArr,
|
|
|
+ isEmploy: !info.isEmploy,
|
|
|
+ employType: this.params.employType
|
|
|
+ }
|
|
|
+ const { data, error_code: code } = await ajaxEmployOperate(params)
|
|
|
+ if (code === 0) {
|
|
|
+ if (data.status) {
|
|
|
+ item.active = item.active === 0 ? 1 : 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 忽略操作
|
|
|
+ async setIgnoreEvent (item) {
|
|
|
+ const info = this.employInfo[0]
|
|
|
+ const params = {
|
|
|
+ idArr: this.params.idArr,
|
|
|
+ isIgnore: !info.isIgnore,
|
|
|
+ employType: this.params.employType
|
|
|
+ }
|
|
|
+ const { data, error_code: code } = await ajaxIgnoreOperate(params)
|
|
|
+ if (code === 0) {
|
|
|
+ if (data.status) {
|
|
|
+ item.active = item.active === 0 ? 1 : 0
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -49,6 +117,7 @@ export default {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
.iconfont{
|
|
|
+ position: relative;
|
|
|
margin-right: 4px;
|
|
|
font-size: 20px;
|
|
|
color: #AAA;
|
|
@@ -61,6 +130,20 @@ export default {
|
|
|
&.icon-a-Property1yihulve {
|
|
|
color: #FF9F40;
|
|
|
}
|
|
|
+ .msg {
|
|
|
+ position: absolute;
|
|
|
+ top: -8px;
|
|
|
+ right: -6px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ background: #FF3A20;
|
|
|
+ border-radius: 50%;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|