Sanakey
6 天以前 cb165187ddcf5d9cfd8aad97a2868d0343b14bd9
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
<template>
  <div :class="prefixCls" >
    <div class="mb-20px">
      <a-button type="primary" shape="round" block @click="openFollowUpModal">
        <template #icon>
          <PlusCircleOutlined />
        </template>
        添加跟进
      </a-button>
    </div>
    <div ref="loadingEl">
      <div class="mb-20px flex justify-between flex-items-center">
        <span class="font-bold">共 {{totalData}} 条</span>
        <TreeSelect
          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"
        >
        </TreeSelect>
      </div>
      <Timeline >
        <TimelineItem v-for="item in dynamicList" :key="item.id">
          <Row>
            <Col span="16" class="c-gray-4">
              {{item.cluesName}}
            </Col>
            <Col :offset="2" span="6" class="c-gray-4">
              {{item.privateTime}}
            </Col>
          </Row>
          <div>
            {{item.failStatusName}}
          </div>
          <div>
            <ImagePreviewGroup>
              <template v-for="(img,index) in item.imageList" :key="index">
                <Image :width="100" class="pr-10px" :src="img" />
              </template>
            </ImagePreviewGroup>
          </div>
        </TimelineItem>
      </Timeline>
    </div>
 
<!--    show-size-changer-->
<!--    show-quick-jumper-->
<!--    :show-total="total => `共 ${total} 条数据`"-->
    <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} from "@ant-design/icons-vue";
  import {treeOptionsListApi} from "@/api/demo/tree";
  import EventBus from "@/utils/eventBus";
  const TimelineItem = Timeline.Item;
 
  const prefixCls = 'clues-tab-dynamic';
 
  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();
 
  // 动态类型treeData
  let currentDynamicType = ref('0-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(()=>{
    getCluesDynamicData();
  },50)
  async function getCluesDynamicData(){
    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">
  .clues-tab-dynamic {
    .ant-select-arrow{
      color: #000;
    }
  }
</style>