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

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

@ -89,13 +89,21 @@ import { useUserStore } from '@/stores/user-store'
const { userInfo } = useUserStore()
const userInfoCurrent = ref<string | undefined>('')
onMounted(() => {
userInfoCurrent.value = userInfo?.roleCodes?.toLocaleString()
if (
userInfoCurrent.value === 'ROLE_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 {
id: number | undefined
type: number
messageType: number
createTime: string
content: string
messageKey: string
@ -113,14 +121,7 @@ interface DataItem {
show: boolean
}
const newclueList = ref<DataItem[]>([
// {
// id: undefined,
// type: '',
// createTime: '',
// content: ''
// }
])
const newclueList = ref<DataItem[]>([])
const multiTabStore = useMultiTabStore()
@ -190,7 +191,6 @@ const getMessageList = () => {
{
onSuccess: (res: any) => {
newclueList.value = res.data.records
console.log(newclueList.value, 'newclueList.value')
newclueList.value.forEach(item => {
item.show = true
})

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

@ -26,9 +26,9 @@ import { antdvStyleDeps } from './src/utils/resolvers'
//jt
// export const serverAddress = 'http://172.18.1.8:8000'
//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
// export const serverAddress = 'http://175.27.212.74:80'

Loading…
Cancel
Save