zjf
2023-02-24 2126cd24b8a0174ac0597340917c0a4595f72254
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
  <div class="f-container">
    <div v-loading="sendLoading">
      <mix-add
        ref="mixadd"
        :crm-type="crmType"
        :id="id"
        @mixadd-info="submitInfo"/>
      <flexbox class="se-section">
        <div class="se-name">记录类型</div>
        <el-dropdown
          style="margin-right: 20px;"
          trigger="click"
          @command="handleTypeDrop">
          <flexbox class="se-select">
            <div class="se-select-name">{{ followType ? followType : '请选择' }}</div>
            <i
              class="el-icon-arrow-down el-icon--right"
              style="color:#ccc;"/>
          </flexbox>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item
              v-for="(item, index) in followTypes"
              :key="index"
              :command="item.type">{{ item.name }}</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <div class="se-name">下次联系时间</div>
        <el-date-picker
          v-model="nextTime"
          :default-value="new Date"
          :editable="false"
          class="se-datepicker"
          type="datetime"
          placeholder="选择日期"
          value-format="yyyy-MM-dd HH:mm:ss"/>
        <el-checkbox
          v-if="showOAPermission"
          v-model="isEvent">添加到日程提醒</el-checkbox>
        <el-button
          class="se-send"
          type="primary"
          @click.native="sendInfo">发布</el-button>
      </flexbox>
    </div>
    <div class="log-cont">
      <flexbox
        v-if="logTypes.length > 0"
        style="border-bottom: 1px solid #E6E6E6;">
        <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>
      <component
        :is="componentsName"
        :id="id"
        :crm-type="crmType"/>
    </div>
  </div>
</template>
 
<script>
import MixAdd from '../../components/MixAdd'
import RecordLog from '../../components/followLog/RecordLog' // 跟进记录
// import { crmLeadsRecordSave } from '@/api/customermanagement/clue'
import followLogType from '@/views/clients/mixins/followLogType'
 
export default {
  /** 线索管理 的 线索详情 的 跟进记录 */
  name: 'ClueFollow',
  components: {
    MixAdd,
    RecordLog
  },
  mixins: [followLogType],
  props: {
    /** 模块ID */
    id: [String, Number],
    /** 没有值就是全部类型 有值就是当个类型 */
    crmType: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      sendLoading: false,
      /** 下次联系时间 */
      nextTime: '',
      /** 是否添加日程提醒 */
      isEvent: false,
      logType: 'record',
      logTypes: []
    }
  },
  computed: {
    componentsName () {
      if (this.logType === 'record') {
        return 'RecordLog'
      }
      return ''
    }
  },
  watch: {},
  mounted () {},
  activated: function () {},
  deactivated: function () {},
  methods: {
    /** 发布 时候的类型选择 */
    handleTypeDrop (command) {
      this.followType = command
    },
    logTabsClick (item, index) {
      this.logType = item.type
    },
    /** 告诉mixad 返回数据 */
    sendInfo () {
      this.$refs.mixadd.$emit('submit-info')
    },
    /** 快捷添加框内 返回的数据用于上传 */
    submitInfo (data) {
      if (this.isEvent && !this.nextTime) {
        this.$message.error('请选择下次联系时间')
        return
      } else if (!data.content) {
        this.$message.error('请输入跟进内容')
        return
      }
 
      var params = {}
      params.typesId = this.id
      params.content = data.content
      params.category = this.followType
      params.batchId = data.batchId
      params.isEvent = this.isEvent ? 1 : 0
      params.nextTime = this.nextTime || ''
 
      this.sendLoading = true
      // crmLeadsRecordSave(params)
      //   .then(res => {
      //     this.sendLoading = false
      //     this.$message.success('发布成功')
      //     // 重置页面
      //     this.$refs.mixadd.resetInfo()
      //     this.isEvent = false
      //     this.nextTime = ''
      //     // 刷新数据
      //     this.$bus.emit('follow-log-refresh', { type: 'record-log' })
      //   })
      //   .catch(() => {
      //     this.sendLoading = false
      //   })
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../../styles/followlog.scss';
</style>