Sanakey
3 天以前 b5c1614fe473330ceca8b7cff0f1802e19bd5039
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<template>
  <div :class="prefixCls" >
    <div class="mb-20px">
      <div class="mb-10px flex justify-between flex-items-center">
        <div class="relative">
          <a-dropdown :trigger="['click']">
            <a-tooltip placement="top">
              <template #title>
                <span>切换商机</span>
              </template>
              <Icon
                icon="iconamoon:swap"
                class="cursor-pointer"
                @click=""
                :size="16"
              />
            </a-tooltip>
            <template #overlay>
              <a-menu
                v-model:selectedKeys="selectedBusinessTitleKeys"
                style="width: 220px"
                @click="handleBusinessTitleClick"
                :items="businessTitleArray"
              >
              </a-menu>
            </template>
          </a-dropdown>
          <span class="font-bold ml-5px">{{ businessTitle }}</span>
        </div>
        <a-dropdown :trigger="['click']">
          <MoreOutlined class="cursor-pointer mr-10px"/>
          <template #overlay>
            <a-menu>
              <a-menu-item key="0" @click="editBusiness">
                <span >编辑商机信息</span>
              </a-menu-item>
              <a-menu-item key="1" @click="addBusiness">
                <span>新建商机</span>
              </a-menu-item>
              <a-menu-item key="2" @click="removeBusiness">删除商机</a-menu-item>
            </a-menu>
          </template>
        </a-dropdown>
      </div>
      <a-row :gutter="12">
        <a-col :span="10" class="font-size-13px">
          销售金额 <span class="c-gray-4">CNY 0.00</span>
        </a-col>
        <a-col :span="10" class="font-size-13px">
          结束日期 <span class="c-red-5">2024-10-30</span>
        </a-col>
        <a-col :span="4" class="font-size-13px">
          备注 <span class="c-gray-4">--</span>
        </a-col>
      </a-row>
    </div>
    <div class="mb-20px">
      <a-button type="primary" shape="round" block @click="openFollowUpModal">
        <template #icon>
          <PlusCircleOutlined />
        </template>
        添加跟进
      </a-button>
    </div>
    <div class="mb-20px">
      <ScheduleDetailModal @register="registerScheduleModal"></ScheduleDetailModal>
      <div class="mb-10px flex justify-between flex-items-center">
        <span class="font-bold">计划日程</span>
        <a-button shape="round" @click="openScheduleModal">添加日程</a-button>
      </div>
      <div>
        <template v-for="(item,index) in scheduleList" :key="item.id">
          <a-row class="cursor-pointer mb-10px" :gutter="12" @click="handleScheduleRowClick" :data-index="index">
            <a-col span="10" >
              <a-avatar class="mb-3px" :size="10" :style="'background-color:'+ item.color" ></a-avatar>
              <span class="ml-5px c-blue">{{ item.beginTime }}</span>
            </a-col>
            <a-col span="14">
              <span>{{ item.cluesName }}</span>
            </a-col>
          </a-row>
        </template>
      </div>
    </div>
    <div ref="loadingEl">
      <div class="mb-20px flex justify-between flex-items-center">
        <span class="font-bold">历史动态</span>
 
<!--        <a-tree-select-->
<!--          v-model:value="currentDynamicType"-->
<!--          :dropdownStyle="{color: 'red'}"-->
<!--          style="width: 120px"-->
<!--          placeholder="Please select"-->
<!--          :allow-clear="false"-->
<!--          :bordered="false"-->
<!--          tree-default-expand-all-->
<!--          :tree-data="dynamicTypeTree"-->
<!--          @change="handleDynamicTypeChange"-->
<!--        >-->
<!--        </a-tree-select>-->
      </div>
      <div class="mb-20px">
        <a-radio-group size="default" v-model:value="currentDynamicType">
          <a-radio-button value="0">全部({{totalData}})</a-radio-button>
          <a-radio-button value="1">跟进记录({{totalData}})</a-radio-button>
          <a-radio-button value="2">往来邮件({{totalData}})</a-radio-button>
          <a-radio-button value="3">聊天记录({{totalData}})</a-radio-button>
          <a-radio-button value="4">其他({{totalData}})</a-radio-button>
        </a-radio-group>
<!--        <a-button type="primary">全部({{totalData}})</a-button>-->
<!--        <a-button type="primary">跟进记录({{totalData}})</a-button>-->
<!--        <a-button type="primary">往来邮件({{totalData}})</a-button>-->
<!--        <a-button type="primary">聊天记录({{totalData}})</a-button>-->
<!--        <a-button type="primary">其他({{totalData}})</a-button>-->
 
      </div>
      <a-timeline >
        <a-timeline-item v-for="item in dynamicList" :key="item.id">
          <a-row>
            <a-col span="16" class="c-gray-4">
              {{item.cluesName}}
            </a-col>
            <a-col :offset="2" span="6" class="c-gray-4">
              {{item.privateTime}}
            </a-col>
          </a-row>
          <div>
            {{item.failStatusName}}
          </div>
          <div>
            <a-image-preview-group>
              <template v-for="(img,index) in item.imageList" :key="index">
                <a-image :width="100" class="pr-10px" :src="img" />
              </template>
            </a-image-preview-group>
          </div>
        </a-timeline-item>
      </a-timeline>
    </div>
 
<!--    show-size-changer-->
<!--    show-quick-jumper-->
<!--    :show-total="total => `共 ${total} 条数据`"-->
    <a-pagination
      class="text-right"
      v-model:current="currentPage"
      v-model:page-size="pageSize"
      :total="totalData"
      responsive
      show-less-items
      :pageSizeOptions="['10','20', '30', '50']"
      @change="handlePageChange"
    />
  </div>
</template>
<script lang="ts" setup>
import {
  Timeline,
  Row,
  Col,
  ImagePreviewGroup,
  Image,
  Pagination,
  TreeSelect,
} from 'ant-design-vue';
  import Icon from '@/components/Icon/Icon.vue';
  import { applicationList } from './data';
  import {cluesDynamicApi} from "@/api/clues/dynamic";
  import {ref,unref,getCurrentInstance} from "vue";
  import {useLoading} from "@/components/Loading";
  import {PlusCircleOutlined, PlusOutlined, SettingOutlined} from "@ant-design/icons-vue";
  import {treeOptionsListApi} from "@/api/demo/tree";
  import EventBus from "@/utils/eventBus";
  import {MoreOutlined} from "@ant-design/icons-vue";
  import {BasicHelp} from "@/components/Basic";
  import {log} from "vxe-table";
  import {useModal} from "@/components/Modal";
  import ScheduleDetailModal from "@/views/clues/components/drawer/ScheduleDetail.vue";
  import {projectList} from "@/views/clues/components/drawer/data";
  import {cluesListApi} from "@/api/clues/table";
  // const TimelineItem = Timeline.Item;
 
  const prefixCls = 'customer-tab-dynamic';
 
  let scheduleList = ref([] as any[]);
  let dynamicList = ref([] as any[]);
  let totalData = ref(0);
 
  let currentPage = ref(1);
  let pageSize = ref(10);
 
 
 
  const handlePageChange = (current: number, size: number) => {
    currentPage.value = current;
    pageSize.value = size;
    // console.log('PageChange',currentPage, pageSize);
    getCluesDynamicData();
  };
 
  // 打开跟进弹窗
  const openFollowUpModal = () => {
    Logger.log('openFollowUpModal...');
    EventBus.emit('openFollowUpModal', {
      title: '新建任务',
      content: '新建任务内容'
    });
  };
  // let _this = getCurrentInstance();
 
  let businessTitle = ref('新商机');
  let selectedBusinessTitleKeys = ref(['1']);
  let businessTitleArray = ref([
    {
      key: '1',
      label: '新商机',
      title: '新商机',
    },
    {
      key: '2',
      label: '订单确认',
      title: '订单确认',
    },
    {
      key: '3',
      label: '有意向',
      title: '有意向',
    },
    {
      key: '4',
      label: '测试新的机会',
      title: '测试新的机会',
    },
  ]);
  function handleBusinessTitleClick(e){
    Logger.log('handleBusinessTitleClick',e);
    selectedBusinessTitleKeys.value = [e?.key];
    businessTitle.value = e?.item?.title;
  }
 
  // 日程相关
  const [registerScheduleModal, {openModal, setModalProps}] = useModal();
  const openScheduleModal = () => {
    Logger.log('点击openScheduleModal');
    EventBus.emit('openScheduleModal', {
      title: '新建任务',
      content: '新建任务内容'
    });
  };
  function handleScheduleRowClick(e) {
    let index = e?.currentTarget?.dataset?.index;
    Logger.log('handleScheduleRowClick', scheduleList.value[index]);
    openModal(true, {
      // record,
      // isUpdate: true,
    });
  }
  getCustomerScheduleList();
  async function getCustomerScheduleList(){
    let params = {
      page: 1,
      pageSize: 10,
    };
    try {
      let res = await cluesListApi(params)
      Logger.log('cluesListApi...',res);
      // console.log(_this);
      // _this.$set(dynamicList,res.items)
      scheduleList.value = res.items;
 
    } catch (e) {
      Logger.error(e);
    } finally {
    }
  }
 
 
  // 动态类型treeData
  let currentDynamicType = ref('0');
  let dynamicTypeTree = ref([]);
  getTreeData();
  async function getTreeData() {
    try {
      const data = await treeOptionsListApi();
      dynamicTypeTree.value = data?.list || [];
      Logger.log('treeOptionsListApi...dynamicTypeTree', dynamicTypeTree);
    } catch (e) {
      Logger.error(e);
    } finally {
 
    }
  }
  function handleDynamicTypeChange(value: any) {
    Logger.log('handleDynamicTypeChange...', value);
  }
 
  // 动态列表加载
  const loadingEl = ref<ElRef>(null);
  const [openWrapLoading, closeWrapLoading] = useLoading({
    target: loadingEl,
    props: {
      tip: '加载中...',
      absolute: true,
    },
  });
  // 动态列表数据
  setTimeout(()=>{
    getCustomerDynamicList();
  },50)
  async function getCustomerDynamicList(){
    openWrapLoading();
    let params = {
      page: currentPage.value,
      pageSize: pageSize.value,
    };
    try {
      // cluesDynamicApi(params).then(res => {
      //
      // })
      let res = await cluesDynamicApi(params)
      Logger.log('cluesDynamicApi...',res);
      // console.log(_this);
      // _this.$set(dynamicList,res.items)
      dynamicList.value = res.items;
      totalData.value = res.total;
 
    } catch (e) {
      Logger.error(e);
    } finally {
      closeWrapLoading();
    }
  }
 
 
</script>
<style lang="less">
  .customer-tab-dynamic {
    .ant-select-arrow{
      color: #000;
    }
  }
</style>