<template>
|
<div class="f-container">
|
<!--<div v-loading="sendLoading">
|
<mix-add
|
ref="mixadd"
|
:crm-type="crmType"
|
:id="id"
|
:detail="detail"
|
:show-relative-business="true"
|
:show-relative-contacts="true"
|
@mixadd-info="submitInfo"/>
|
</div>-->
|
<div class="log-cont">
|
<!--<flexbox>
|
<flexbox
|
v-for="(item, index) in logTypes"
|
:key="index"
|
style="width: auto;"
|
@click.native="logTabsClick(item,index)">
|
<div
|
:style="{ color: logType==item.type ? '#F18C70' : '#777'}"
|
class="log-tabs-item">{{ item.name }}</div>
|
<div
|
v-if="logTypes.length -1 !== index"
|
class="log-tabs-line"/>
|
</flexbox>
|
</flexbox>-->
|
<keep-alive>
|
<component
|
:is="componentsName"
|
:id="id"
|
:crm-type="crmType"/>
|
</keep-alive>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import MixAdd from '../../components/MixAdd'
|
import RecordLog from '../../components/followLog/RecordLog' // 跟进记录
|
import JournalLog from '../../components/followLog/JournalLog' // 日志列表
|
import ExamineLog from '../../components/followLog/ExamineLog' // 审批列表
|
import TaskLog from '../../components/followLog/TaskLog' // 任务日志列表
|
import ScheduleLog from '../../components/followLog/ScheduleLog' // 日程日志列表
|
import FollowRecordTable from '../../components/followLog/components/FollowRecordTable' // 跟进记录
|
import { AddFollowRecord, MakeFollowRecordCompleted } from '@/api/customermanagement/customerManage'
|
// import followLogType from '@/views/clients/mixins/followLogType'
|
|
export default {
|
/** 客户管理 的 商机详情 的 跟进记录 */
|
name: 'BusinessFollow',
|
components: {
|
MixAdd,
|
RecordLog,
|
JournalLog,
|
ExamineLog,
|
TaskLog,
|
ScheduleLog,
|
FollowRecordTable
|
},
|
// mixins: [followLogType],
|
props: {
|
/** 模块ID */
|
id: [String, Number],
|
detail: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
/** 没有值就是全部类型 有值就是当个类型 */
|
crmType: {
|
type: String,
|
default: ''
|
},
|
/** 是公海 默认是客户 */
|
isSeas: {
|
type: Boolean,
|
default: false
|
}
|
},
|
data () {
|
return {
|
sendLoading: false,
|
logType: 'record'
|
}
|
},
|
computed: {
|
logTypes () {
|
// if (this.oa) {
|
return [
|
{ type: 'record', name: '跟进记录' }
|
// { type: 'log', name: '日志' },
|
// { type: 'examine', name: '审批' },
|
// { type: 'task', name: '任务' },
|
// { type: 'schedule', name: '日程' }
|
]
|
// } else {
|
// return [{ type: 'record', name: '跟进记录' }]
|
// }
|
},
|
|
componentsName () {
|
// if (this.logType === 'record') {
|
return 'FollowRecordTable'
|
// } else if (this.logType === 'log') {
|
// return 'JournalLog'
|
// } else if (this.logType === 'examine') {
|
// return 'ExamineLog'
|
// } else if (this.logType === 'task') {
|
// return 'TaskLog'
|
// } else if (this.logType === 'schedule') {
|
// return 'ScheduleLog'
|
// }
|
// return ''
|
}
|
},
|
mounted () {
|
},
|
activated: function () {},
|
deactivated: function () {},
|
methods: {
|
/** 发布 时候的类型选择 */
|
logTabsClick (item, index) {
|
this.logType = item.type
|
},
|
/** 告诉mixad 返回数据 */
|
// sendInfo () {
|
// this.$refs.mixadd.$emit('submit-info')
|
// },
|
/** 快捷添加框内 返回的数据用于上传 */
|
submitInfo (data) {
|
if (data.isEvent && !data.nextTime) {
|
this.$message.error('请选择下次联系时间')
|
return
|
} else if (!data.content) {
|
this.$message.error('请输入跟进内容')
|
return
|
}
|
let params = {
|
'Id': '',
|
'FollowType': 1,
|
'FollowWay': data.wayTypeId,
|
'Content': data.content,
|
'Title': '',
|
'SourceId': this.detail.CustomerId,
|
'FollowTime': data.nextTime || '',
|
'IsCompleted': true,
|
'CustomerContacterId': data.contacts,
|
'SalesChanceId': this.id
|
}
|
if (data.files || data.images) {
|
// 1代表附件 2代表图片
|
console.log(data)
|
params['Files'] = []
|
if (data.files && data.files.length > 0) {
|
for (let i in data.files) {
|
let list1 = {
|
'Id': '',
|
'DocumentName': data.files[i].name,
|
'DocumentFileName': data.files[i].path,
|
'FileType': 1
|
}
|
params['Files'].push(list1)
|
}
|
}
|
if (data.images && data.images.length > 0) {
|
let list2 = {
|
'Id': '',
|
'DocumentName': data.images[0].name,
|
'DocumentFileName': data.images[0].path,
|
'FileType': 2
|
}
|
params['Files'].push(list2)
|
}
|
}
|
console.log(params)
|
this.sendLoading = true
|
if (data.isEvent) {
|
MakeFollowRecordCompleted({'Id': this.id}).then(res => {
|
this.$message.success('完成跟进')
|
})
|
}
|
AddFollowRecord(params)
|
.then(res => {
|
if (res.data.ErrorCode === 200) {
|
this.sendLoading = false
|
this.$message.success('发布成功')
|
// 重置页面
|
this.$refs.mixadd.resetInfo()
|
// 刷新数据
|
this.$bus.emit('follow-log-refresh', { type: 'follow-record-table' })
|
} else {
|
this.sendLoading = false
|
this.$message.error(res.data.Message)
|
}
|
})
|
.catch(() => {
|
this.sendLoading = false
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import '../../styles/followlog.scss';
|
</style>
|