飘泊客 10 months ago
commit 499d2ed222

@ -0,0 +1,10 @@
import httpClient from '@/utils/axios'
import type { ApiResult } from '@/api/types'
import type { directPageParam, distributeData } from './types'
/**
*
*/
export function confirmToRead(announcementId: number | undefined) {
return httpClient.get<ApiResult>(`/notify/user-announcement/read/${announcementId}`)
}

@ -0,0 +1,32 @@
import type { PageParam } from '@/api/types'
import type { Dayjs } from 'dayjs'
export type directParam = {
customName?: string
originType?: number | null
attribute?: string
distributeDate?: [Dayjs, Dayjs]
}
interface otherObj {
[name: string]: any
}
export type directDTO = {
directClueId?: number
batchNo?: string
nid?: string | undefined
customName?: string
originType: number
effectiveStatus: number
otherClueObj: otherObj
clueLabelName?: string
distributeType: number
distributeDate?: Dayjs | null
distributeUserId?: number | null
userId?: number[]
}
export type directPageParam = directParam & PageParam
export type distributeData = {
clueId: number
userId: number
userName: string
}

@ -9,26 +9,34 @@
<div v-for="(item, index) in newclueList" :key="index" class="listItem"> <div v-for="(item, index) in newclueList" :key="index" class="listItem">
<div class="listItemTop"> <div class="listItemTop">
<div class="type"> <div class="type">
{{ item.type === 1 ? '系统公告' : '导出通知' }}{{ item.title }} {{ item.messageType === 1 ? '系统公告' : '导出通知' }}{{ item.title }}
</div> </div>
<div class="time">{{ item.createTime }}</div> <div class="time">{{ item.createTime }}</div>
</div> </div>
<div class="listItemCenter"> <div class="listItemCenter">
<span ref="contentRef" class="content" :class="{ expanded: item.show }">{{ <div :style="item.show ? 'max-height:44px;overflow:hidden' : ''">
item.content <!-- :class="{ expanded: item.show }" -->
}}</span> <span
<div class="iconContainer" @click="toggleShowAll(item)"> ref="contentRef"
class="content"
:class="{ expanded: item.show }"
@click="toggleShowAll(item)"
>{{ item.content }}</span
>
</div>
<!-- v-if="item.content.length > 48" -->
<!-- <div v-if="item.showBtn" class="iconContainer" @click="toggleShowAll(item)">
<div v-if="item.show" class="openOrClose"> <div v-if="item.show" class="openOrClose">
<span><down-outlined /></span> <span><down-outlined /></span>
</div> </div>
<div v-else class="openOrClose"> <div v-else class="openOrClose">
<up-outlined /> <up-outlined />
</div> </div>
</div> </div> -->
</div> </div>
<div class="listItemBottom"> <div class="listItemBottom">
<a key="list-loadmore-edit" style="margin-right: 8px">{{ <a key="list-loadmore-edit" style="margin-right: 8px" @click="readConfirmation(item)">{{
item.state === 1 ? '已读' : '确认' item.state === 1 ? '已读' : '确认'
}}</a> }}</a>
<a <a
@ -106,15 +114,17 @@ import type { ProTableInstanceExpose, TableRequest, ProColumns } from '#/table'
import { mergePageParam } from '@/utils/page-utils' import { mergePageParam } from '@/utils/page-utils'
import { messageAccessLogs } from '@/api/customermanagement/customerList' import { messageAccessLogs } from '@/api/customermanagement/customerList'
import type { CustomerListQO } from '@/api/customermanagement/customerList/types' import type { CustomerListQO } from '@/api/customermanagement/customerList/types'
import { confirmToRead } from '@/api/message/index'
import MessageSearch from '@/components/Message/messageSearch.vue' import MessageSearch from '@/components/Message/messageSearch.vue'
import type { DistributeTaskManagementPageParam } from '@/api/controlcenterstation/distributionTaskManagement/types' import type { DistributeTaskManagementPageParam } from '@/api/controlcenterstation/distributionTaskManagement/types'
import router from '@/router' import router from '@/router'
import { doRequest } from '@/utils/axios/request'
defineOptions({ name: 'MessagePage' }) defineOptions({ name: 'MessagePage' })
interface DataItem { interface DataItem {
id: number | undefined id: number | undefined
type: number messageType: number
createTime: string createTime: string
content: string content: string
messageKey: string messageKey: string
@ -192,9 +202,9 @@ const columns: ProColumns[] = [
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
customRender: function ({ record }: any) { customRender: function ({ record }: any) {
if (record.type === 1) { if (record.messageType === 1) {
return '系统公告' return '系统公告'
} else if (record.type === 2) { } else if (record.messageType === 2) {
return '导出通知' return '导出通知'
} }
} }
@ -244,14 +254,29 @@ const handleOk = (e: MouseEvent) => {
// //
const positioning = (messageKey: string) => { const positioning = (messageKey: string) => {
localStorage.setItem('clueId', messageKey)
emits('click-success', false) emits('click-success', false)
router.push({ path: '/task/customerlist', query: { clueId: messageKey } }) // /task/customerlist const randomClueId = Math.random().toString(36).substring(2, 15) // ID
router.push({ path: '/task/customerlist', query: { clueId: randomClueId } }) // /task/customerlist
} }
// //
const toggleShowAll = (itemShow: DataItem) => { const toggleShowAll = (itemShow: DataItem) => {
itemShow.show = !itemShow.show itemShow.show = !itemShow.show
} }
const contentRef = ref<HTMLElement | null>(null)
//
const readConfirmation = (item: any) => {
if (item.state === 1) {
//
return
}
//
item.state = 1
//
doRequest(confirmToRead(toRaw(item.id)), {
onSuccess: (res: any) => {}
})
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.ms-container { .ms-container {
@ -345,10 +370,10 @@ const contentRef = ref<HTMLElement | null>(null)
margin: 5px 0; margin: 5px 0;
font-size: 13px; font-size: 13px;
} }
.iconContainer { // .iconContainer {
display: inline-block; /* 让容器内的内容水平排列 */ // display: inline-block; /* */
vertical-align: middle; /* 垂直居中对齐 */ // vertical-align: middle; /* */
} // }
.content { .content {
white-space: normal; /* 不换行 */ white-space: normal; /* 不换行 */
@ -364,11 +389,11 @@ const contentRef = ref<HTMLElement | null>(null)
-webkit-box-orient: vertical; /* 设置伸缩盒子的子元素垂直排列 */ -webkit-box-orient: vertical; /* 设置伸缩盒子的子元素垂直排列 */
-webkit-line-clamp: 2; /* 设置显示的行数 */ -webkit-line-clamp: 2; /* 设置显示的行数 */
} }
.openOrClose { // .openOrClose {
display: inline; // display: inline;
margin-left: 4px; // margin-left: 4px;
float: right; // float: right;
} // }
.listItemBottom { .listItemBottom {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

@ -1,11 +1,12 @@
import { useWebSocket, type UseWebSocketReturn } from '@vueuse/core' import { useWebSocket, type UseWebSocketReturn } from '@vueuse/core'
import { useUserStore } from '@/stores/user-store' import { useUserStore } from '@/stores/user-store'
import { emitter } from '@/hooks/mitt' // import { emitter } from '@/hooks/mitt'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
let useWebSocketReturn: UseWebSocketReturn<any> | undefined = undefined let useWebSocketReturn: UseWebSocketReturn<any> | undefined = undefined
//它是一个自定义的Vue hook用于管理WebSocket连接 //它是一个自定义的Vue hook用于管理WebSocket连接
const useAdminWebSocket = () => { const useAdminWebSocket = () => {
return new Promise((resolve, _) => {
//检查是否已经存在WebSocket连接以及连接状态。如果WebSocket连接存在且状态不是已关闭则直接返回现有的WebSocket连接。 //检查是否已经存在WebSocket连接以及连接状态。如果WebSocket连接存在且状态不是已关闭则直接返回现有的WebSocket连接。
if (useWebSocketReturn && useWebSocketReturn.status.value != 'CLOSED') { if (useWebSocketReturn && useWebSocketReturn.status.value != 'CLOSED') {
return useWebSocketReturn return useWebSocketReturn
@ -35,7 +36,6 @@ const useAdminWebSocket = () => {
interval: 30000 interval: 30000
} }
}) })
//监听WebSocket的数据变化根据接收到的消息类型进行相应的处理并通过emitter发布事件或数据。 //监听WebSocket的数据变化根据接收到的消息类型进行相应的处理并通过emitter发布事件或数据。
watch( watch(
() => useWebSocketReturn!.data.value, () => useWebSocketReturn!.data.value,
@ -56,16 +56,15 @@ const useAdminWebSocket = () => {
dataMsg = value dataMsg = value
} }
// emitter.emit(event, dataMsg) // emitter.emit(event, dataMsg)
// console.log(dataMsg, 'dataMsg') // +''+ JSON.stringify(dataMsg.content).slice(1, -1)
// Show alert with the received message message.info(dataMsg.title + ',手动刷新后获取最新线索数据')
// alert(JSON.stringify(dataMsg.title) + JSON.stringify(dataMsg.content)) // message.info(JSON.stringify(dataMsg.title).slice(1, -1) + ',手动刷新后获取最新线索数据')
message.info( resolve(value)
JSON.stringify(dataMsg.title).slice(1, -1) +''+ JSON.stringify(dataMsg.content).slice(1, -1)
)
} }
) )
return useWebSocketReturn // return useWebSocketReturn
})
} }
//将创建的WebSocket连接对象返回给调用者 //将创建的WebSocket连接对象返回给调用者

@ -89,13 +89,21 @@ import { useUserStore } from '@/stores/user-store'
const { userInfo } = useUserStore() const { userInfo } = useUserStore()
const userInfoCurrent = ref<string | undefined>('') const userInfoCurrent = ref<string | undefined>('')
onMounted(() => { onMounted(() => {
userInfoCurrent.value = userInfo?.roleCodes?.toLocaleString() userInfoCurrent.value = userInfo?.roleCodes?.toLocaleString()
if ( if (
userInfoCurrent.value === 'ROLE_SALESMAN' || userInfoCurrent.value === 'ROLE_SALESMAN' ||
userInfoCurrent.value === 'ROLE_STORE_SALESMAN' userInfoCurrent.value === 'ROLE_STORE_SALESMAN'
) { ) {
useAdminWebSocket() useAdminWebSocket().then((res: any) => {
const newRes = JSON.parse(res)
newRes.show = true
//
newclueList.value.unshift(newRes)
//,10
newclueList.value.pop()
})
} }
}) })
@ -104,7 +112,7 @@ const container = ref(null)
// 线 // 线
interface DataItem { interface DataItem {
id: number | undefined id: number | undefined
type: number messageType: number
createTime: string createTime: string
content: string content: string
messageKey: string messageKey: string
@ -113,14 +121,7 @@ interface DataItem {
show: boolean show: boolean
} }
const newclueList = ref<DataItem[]>([ const newclueList = ref<DataItem[]>([])
// {
// id: undefined,
// type: '',
// createTime: '',
// content: ''
// }
])
const multiTabStore = useMultiTabStore() const multiTabStore = useMultiTabStore()
@ -190,7 +191,6 @@ const getMessageList = () => {
{ {
onSuccess: (res: any) => { onSuccess: (res: any) => {
newclueList.value = res.data.records newclueList.value = res.data.records
console.log(newclueList.value, 'newclueList.value')
newclueList.value.forEach(item => { newclueList.value.forEach(item => {
item.show = true item.show = true
}) })

@ -67,7 +67,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted, defineOptions } from 'vue'
// //
// import { UserOutlined, DownOutlined } from '@ant-design/icons-vue' // import { UserOutlined, DownOutlined } from '@ant-design/icons-vue'
// import type { MenuProps } from 'ant-design-vue' // import type { MenuProps } from 'ant-design-vue'
@ -86,19 +86,22 @@ import { pageAccessLogs } from '@/api/customermanagement/customerList'
import CustomerListSearch from '@/views/customermanagement/customerList/customerListSearch.vue' import CustomerListSearch from '@/views/customermanagement/customerList/customerListSearch.vue'
import CustomerListViewModal from '@/views/customermanagement/customerList/customerListModal.vue' import CustomerListViewModal from '@/views/customermanagement/customerList/customerListModal.vue'
import CustomerListEditModal from '@/views/customermanagement/customerList/customerListEditModal.vue' import CustomerListEditModal from '@/views/customermanagement/customerList/customerListEditModal.vue'
import { useRoute } from 'vue-router' // import { useRoute } from 'vue-router'
// import useAdminWebSocket from '@/hooks/websocket'
// //
// import { doRequest } from '@/utils/axios/request' // import { doRequest } from '@/utils/axios/request'
const route = useRoute() // const route = useRoute()
onMounted(() => { onMounted(() => {
const customerId = route.query.clueId as string // 使 const savedUserData = localStorage.getItem('clueId')
if (customerId) { if (savedUserData) {
searchTable({ clueId: customerId }) searchTable({ clueId: savedUserData })
localStorage.setItem('clueId', '')
} }
// useAdminWebSocket() // const customerId = route.query.clueId as string // 使
// if (customerId) {
// searchTable({ clueId: customerId })
// }
}) })
defineOptions({ name: 'CustomerList' }) defineOptions({ name: 'CustomerList' })

@ -26,9 +26,9 @@ import { antdvStyleDeps } from './src/utils/resolvers'
//jt //jt
// export const serverAddress = 'http://172.18.1.8:8000' // export const serverAddress = 'http://172.18.1.8:8000'
//ts //ts
export const serverAddress = 'http://172.18.0.228:8000' // export const serverAddress = 'http://172.18.0.228:8000'
//测试 //测试
// export const serverAddress = 'http://39.100.77.21:8000' export const serverAddress = 'http://39.100.77.21:8000'
//线上ip //线上ip
// export const serverAddress = 'http://175.27.212.74:80' // export const serverAddress = 'http://175.27.212.74:80'

Loading…
Cancel
Save