소스 검색

修改客户跟进页面的操作日志弹窗展示、页面展示和详情跳转

lm 1 개월 전
부모
커밋
b69b8b43ad

+ 13 - 0
src/components/CustomerOperationDialog/formSearchGroup.ts

@@ -0,0 +1,13 @@
+import { ref } from "vue";
+
+
+export const operationRecordBlurSearch = ref([
+    {
+        key:'queryStr',
+        type:'input',
+        placeholder:'请输入关键字搜索',
+        hidden:false,
+        defaultValue:'',
+        disabled:false
+    }
+])

+ 106 - 33
src/components/CustomerOperationDialog/index.vue

@@ -10,18 +10,22 @@
         @close="CloseOperationRecordDialog">
         <SearchBlock :searchList="operationRecordSearchList" 
             @searchChange="HandleOperationLogSearchChange">
+            <template #rowItem-time>
+                <el-date-picker
+                    v-if="searchParams.time=='custom'"
+                    style="flex-grow: 0;height: 28px;width: 220px;"
+                    v-model="searchParams.startAndEndTime"
+                    @change="(val)=>HandleOperationLogSearchChange({startAndEndTime:val},'startAndEndTime')"
+                    start-placeholder="开始时间"
+                    end-placeholder="结束时间"
+                    type="datetimerange"
+                    range-separator="至"
+                    size="default"
+                    />
+            </template>
         </SearchBlock>
-        <!-- 带完善 -->
-        <FormSearchGroup :searchList="[
-            {
-                key:'queryStr',
-                type:'input',
-                placeholder:'请输入关键字搜索',
-                hidden:false,
-                defaultValue:'',
-                disabled:false
-            }
-        ]" @searchChange="HandleOperationLogSearchChange"/>
+        <FormSearchGroup style="margin:16px 0" v-if="props.interfaceSource == 'customerFollow'" 
+            :searchList="operationRecordBlurSearch" @searchChange="HandleOperationLogSearchChange"/>
 
         <FollowCard :cardList="finalOperationLogRenderData">
             <template #operation><i></i></template>
@@ -54,7 +58,7 @@ import Pagination from '@/baseComponents/Pagination.vue';
 import {operationRecordSearchList} from './searchBlock'
 
 import FormSearchGroup from '@/baseComponents/FormSearchGroup.vue';
-
+import {operationRecordBlurSearch} from './formSearchGroup'
 
 import {
     getOperationLogApi,
@@ -63,10 +67,22 @@ import {
 import {getPrivateOperationLogApi} from '@/api/myCustomer'
 import { getCustomerOperationLogApi} from '@/api/customerFollowUp';
 
+
+import {
+    getTodayRange,
+    getYesterdayRange,
+    getRecentDaysRange,
+    getRecentWeeksRange,
+    getRecentMonthsRange,
+    formatTime
+} from '@/utils/timeRangeGet'
+
+
+
 const props = defineProps({
     interfaceSource:{
         type:String as ()=>'highSeasCustomer'|'myCustomer'|'customerFollow',
-        default:'highSeasCustomer',  //
+        requreid:true, 
     }, //查询操作日志 接口来源 
 })
 
@@ -83,14 +99,20 @@ const currentPage = ref(1)
 const pageSize = ref(20)
 const totalNum = ref(0)
 const searchParams = ref({
-    personnel:'all'
+    personnel:'all',
+    time:'all',
+    group:'all',
+    startAndEndTime:[],
 })
 
 // 关闭
 const CloseOperationRecordDialog=()=>{
     operationRecordDialogVisible.value = false
     searchParams.value = {
-        personnel:'all'
+        personnel:'all',
+        time:'all',
+        group:'all',
+        startAndEndTime:[],
     }
 }
 
@@ -117,6 +139,35 @@ const HandleLogPaginationChange = async (params)=>{
 
 //获取日志列表
 const GetOperationList = async ()=>{
+    let rangeTime = {
+        startTime:'',
+        endTime:'',
+    }
+    if(['myCustomer','customerFollow'].includes(props.interfaceSource)){
+        switch(searchParams.value.time){
+            case 'today':
+                rangeTime = getTodayRange()
+                break
+            case 'yesterday':
+                rangeTime = getYesterdayRange()
+                break
+            case 'last3Days':
+                rangeTime = getRecentDaysRange(3)
+                break
+            case 'last1Week':
+                rangeTime = getRecentWeeksRange(1)
+                break
+            case 'last1Month':
+                rangeTime = getRecentMonthsRange(1)
+                break
+            case 'custom':
+                rangeTime = {
+                    startTime:formatTime(searchParams.value.startAndEndTime?.[0]) ,
+                    endTime: formatTime(searchParams.value.startAndEndTime?.[1]),
+                }
+                break
+        }
+    }
 
     let res = undefined
     if(props.interfaceSource == 'highSeasCustomer'){
@@ -127,31 +178,32 @@ const GetOperationList = async ()=>{
             pageSize: pageSize.value
         }
         res = await getOperationLogApi(params)
+
     }else if(props.interfaceSource == 'myCustomer'){ 
         let params = {
             customerId: route.query.id,
             operUserId: searchParams.value.personnel == 'all' ? '' : searchParams.value.personnel,
-            "startDate": "",   //带完善
-            "endDate": "",
+            startDate: rangeTime.startTime,  
+            endDate: rangeTime.endTime,
             pageNum: currentPage.value,
             pageSize: pageSize.value
         }
         res = await getPrivateOperationLogApi(params)
     }else if(props.interfaceSource == 'customerFollow'){
         let params = {
-            customerId: '', //待完善
-            operUserId: '',
-            groupId: '',
-            startDate: "",
-            endDate: "",
+            operUserId:  searchParams.value.personnel == 'all' ? '' : searchParams.value.personnel,
+            groupId: searchParams.value.group == 'all' ? '' : searchParams.value.group,
+            startDate: rangeTime.startTime,
+            endDate: rangeTime.endTime,
             pageNum: currentPage.value,
             pageSize: pageSize.value,
+            queryStr:searchParams.value.queryStr  
         }
         res = await getCustomerOperationLogApi(params)
     }
    
     if(res?.code == 200){
-       const {data:operationData, dateData, groupData, memberData} =  res?.data
+       const {data:operationData, groupData, memberData} =  res?.data
        totalNum.value = operationData.total
         let memberOption = memberData?.map(item=>{
             return {
@@ -159,14 +211,33 @@ const GetOperationList = async ()=>{
                 value:item.id
             }
         }) || []
+
+        let groupOption = groupData?.map(item=>{
+            return {
+                label:item.name,
+                value:item.id
+            }
+        }) || []
         operationRecordSearchList.value = operationRecordSearchList.value.map(item=>{
-            if(item.key=='personnel'){
-                item.options = [
-                    { label: '全部', value: 'all' },
-                    ...memberOption
-                ]
-                item.defaultValue = searchParams.value.personnel
+            switch(item.key){
+                case 'personnel':
+                    item.options = [
+                        { label: '全部', value: 'all' },
+                        ...memberOption
+                    ]
+                    break
+                case 'group':
+                    item.options = [
+                        { label: '全部', value: 'all' },
+                        ...groupOption
+                    ]
+                    item.hidden = props.interfaceSource == 'customerFollow' ?  false : true
+                    break
+                case 'time':
+                    item.hidden = ['customerFollow','myCustomer']?.includes(props.interfaceSource) ?  false : true
+                    break
             }
+            item.defaultValue = searchParams.value[item.key]
             return item
         })
 
@@ -191,9 +262,6 @@ const GetOperationList = async ()=>{
                 }else{
                     operationAim = ''
                 }
-                // 这个 记录的结果待完善
-                // case 1:
-                //     return '跟进'
             }
 
             // 具体操作信息
@@ -212,7 +280,12 @@ const GetOperationList = async ()=>{
                 operationDetail = content[0]
             }
             return {
-                headerTitleList:[
+                headerTitleList:props.interfaceSource == 'customerFollow' ? [
+                    item.operDatetime,
+                    item.operName,
+                    item.customerName,  // 学校信息 只在 客户跟进显示
+                    operationName+operationAim,
+                ] : [
                     item.operDatetime,
                     item.operName,
                     operationName+operationAim,

+ 10 - 1
src/components/CustomerOperationDialog/searchBlock.ts

@@ -6,7 +6,16 @@ export const operationRecordSearchList = ref([
         label: '时间',
         key: 'time',
         type: 'single',
-        options: [],
+        options: [
+            { label: '全部', value: 'all' },
+            { label: '今天', value: 'today' },
+            { label: '昨天', value: 'yesterday' },
+            { label: '近3天', value: 'last3Days' },
+            { label: '近1周', value: 'last1Week' },
+            { label: '近1月', value: 'last1Month' },
+            { label: '自定义', value: 'custom' }
+
+        ],
         defaultValue: 'all'
     },
     {

+ 22 - 7
src/views/customerFollowUp/index.vue

@@ -26,7 +26,7 @@
                             赢单申请
                             <span class="bubble">{{ winnerOrderNum }}</span>
                         </el-button>
-                        <el-button class="button_border" @click="OpenOperationLogDialog">操作日志</el-button>
+                        <el-button v-if="userInfo?.roles?.includes('Admin')" class="button_border" @click="OpenOperationLogDialog">操作日志</el-button>
                     </div>
                 </div>
             </div>
@@ -41,22 +41,22 @@
                 }
             ]" @searchChange="HandleBlockSearchChange"/>
             <Table :currentPage="currentPage" :pageSize="pageSize" :totalNum="totalNum" 
-                :tableColumns="tableColumns" :tableData="tableData" 
+                :tableColumns="tableColumns" :tableData="tableData" :showPageSize="true"
                 @paginationChange="HandlePaginationChange">
                 <template #num="{currentIndex}">
                     {{ (currentPage - 1) * pageSize + currentIndex }}
                 </template>
-                
-
                 <template #followContent="{row}">
                     <span class="two_line_ellipsis">{{ row.followContent }}</span>
                 </template>
-
                 <template #operation="{row}">
                     <div class="table_row_option">
-                        <span class="option_button_editor">详情</span>
+                        <span class="option_button_editor" @click="GoToDetail(row)">详情</span>
                     </div>
                 </template>
+                <template #paginationDesc>
+                    <span>共{{ totalNum }}条数据</span>
+                </template>
             </Table>
 
         </div>
@@ -89,7 +89,8 @@
         <!-- 操作日志弹窗 -->
         <CustomerOperationDialog
             v-if="operationLogDialogVisible" 
-            v-model:dialogVisible="operationLogDialogVisible">
+            v-model:dialogVisible="operationLogDialogVisible"
+            interfaceSource="customerFollow">
         </CustomerOperationDialog>
     </div>
 </template>
@@ -97,6 +98,7 @@
 
 <script setup lang="ts">
 import { computed, onMounted, ref } from 'vue';
+import { useRouter } from 'vue-router';
 import {ElMessage} from 'element-plus'
 import SearchBlock from '@/baseComponents/SearchBlock.vue';
 import {headerSearchList} from './searchBlock'
@@ -123,7 +125,11 @@ import {
         getRecentMonthsRange
     } from '@/utils/timeRangeGet'
 
+const router = useRouter()
 
+const userInfo = computed(()=>{
+  return  JSON.parse(localStorage.getItem('userInfo') || '{}')
+})
 /**
  * 1. 头部筛选项有关数据
  */
@@ -301,6 +307,15 @@ const HandlePaginationChange = async (params)=>{
     await GetFollowInfo()
 }
 
+// 跳转详情 
+const GoToDetail = (row)=>{
+    sessionStorage.setItem('customerMsg',JSON.stringify({
+        ...row,
+        name:row.customerName,
+        lastFollowDatetime:row.lastClaimDatetime
+    }))
+    router.push(`myCustomerDetail?id=${row.id}`)
+}
 
 /**
  * 3.默认列表 筛选项有关数据 及操作

+ 2 - 1
src/views/highSeasCustomer/highSeasCustomerDetail/index.vue

@@ -38,7 +38,8 @@
         <!-- 操作记录 弹窗 -->
         <CustomerOperationDialog 
             v-if="operationRecordDialogVisible"
-            v-model:dialogVisible="operationRecordDialogVisible">
+            v-model:dialogVisible="operationRecordDialogVisible"
+            interfaceSource="highSeasCustomer">
         </CustomerOperationDialog>
 
         <!-- 编辑学校弹窗 -->

+ 2 - 1
src/views/myCustomer/myCustomerDetail/index.vue

@@ -55,7 +55,8 @@
         <!-- 操作记录 弹窗 -->
          <CustomerOperationDialog 
             v-if="operationRecordDialogVisible"
-            v-model:dialogVisible="operationRecordDialogVisible">
+            v-model:dialogVisible="operationRecordDialogVisible"
+            interfaceSource="myCustomer">
          </CustomerOperationDialog>
 
        

+ 0 - 35
src/views/myCustomer/myCustomerDetail/searchBlock.ts

@@ -1,35 +0,0 @@
-import { ref } from "vue";
-
-
-export const operationRecordSearchList = ref([
-    {
-        label: '时间',
-        key: 'time',
-        type: 'single',
-        options:[
-            { label: '全部', value: 'all' },
-            { label: '今天', value: 'today' },
-            { label: '昨天', value: 'yesterday' },
-            { label: '近3天', value: 'last3Days' },
-            { label: '近1周', value: 'last1Week' },
-            { label: '近1月', value: 'last1Month' },
-            { label: '自定义', value: 'custom' }
-        ],
-        defaultValue: 'all'
-    },
-    {
-        label: '人员',
-        key: 'personnel',
-        type: 'single',
-        options: [
-            { label: '全部', value: 'all' },
-            { label: '马丁', value: 'martin' },
-            { label: '王诗雅', value: 'wangshiya' },
-            { label: '王梓木', value: 'wangzimu' },
-            { label: '殷思源', value: 'yinsiyuan' },
-            { label: '付文杰', value: 'fuwenjie' },
-            { label: '李润曦', value: 'lirunxi' },
-        ],
-        defaultValue: 'all'
-    },
-])