Browse Source

bug修改

asd26269546 1 year ago
parent
commit
436dfbdb2b

+ 4 - 2
src/components/headerBar/header-bar.vue

@@ -133,12 +133,12 @@
       </ul>
       </ul>
       <div class="fr">
       <div class="fr">
         <!-- :value="12" -->
         <!-- :value="12" -->
-        <el-badge style="cursor: pointer;" class="badge" @click="noticeTableModal = true">
+        <el-badge :value="badgeNum" style="cursor: pointer;" class="badge" @click="noticeTableModal = true">
           <el-icon :size="20">
           <el-icon :size="20">
             <BellFilled />
             <BellFilled />
           </el-icon>
           </el-icon>
         </el-badge>
         </el-badge>
-        <notice v-model='noticeTableModal'></notice>
+        <notice v-model='noticeTableModal' @changeNum="(e)=> badgeNum = e"></notice>
         <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
         <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
           <div class="dropdown-box">
           <div class="dropdown-box">
             {{ userData }}
             {{ userData }}
@@ -187,6 +187,8 @@ const openLeftBaner = (i, index) => {
   menuName.value = i.menuName;
   menuName.value = i.menuName;
   routerInit(i);
   routerInit(i);
 };
 };
+
+const badgeNum = ref(0);
 let menuName = ref("");
 let menuName = ref("");
 const logoUrl = ref();
 const logoUrl = ref();
 const getLogo = () => {
 const getLogo = () => {

+ 92 - 23
src/components/notice/index.vue

@@ -15,11 +15,12 @@
 				v-if="data.length > 0"
 				v-if="data.length > 0"
 				style="margin-top: 10px"
 				style="margin-top: 10px"
 			>
 			>
-				{{ data[index].content }}
+				<h3>{{ data[index].title }}</h3>
+				{{ data[index].businessData }}
 			</div>
 			</div>
 			<template #footer>
 			<template #footer>
 				<span class="dialog-footer">
 				<span class="dialog-footer">
-					<!-- <el-button
+					<el-button
 						size="small"
 						size="small"
 						@click="index--"
 						@click="index--"
 						:disabled="data.length < 2 || index == 0"
 						:disabled="data.length < 2 || index == 0"
@@ -30,14 +31,14 @@
 						@click="index++"
 						@click="index++"
 						:disabled="data.length == index + 1"
 						:disabled="data.length == index + 1"
 						>下一条</el-button
 						>下一条</el-button
-					> -->
-					<!-- <el-button
+					>
+					<el-button
 						type="primary"
 						type="primary"
 						size="small"
 						size="small"
-						:disabled="data.length == 0"
+						:disabled="data.length == 0 || data[index].isRead"
 						@click="confirm"
 						@click="confirm"
 						>确认已读</el-button
 						>确认已读</el-button
-					> -->
+					>
 					<!-- <span class="more" @click="moreFn">查看更多 &gt;</span> -->
 					<!-- <span class="more" @click="moreFn">查看更多 &gt;</span> -->
 				</span>
 				</span>
 			</template>
 			</template>
@@ -47,30 +48,41 @@
 			:class="modelValue ? 'notice-table-warp-open' : ''"
 			:class="modelValue ? 'notice-table-warp-open' : ''"
 			@click.stop="closeNoticeTableModal"
 			@click.stop="closeNoticeTableModal"
 		>
 		>
-			<div class="notice-table" @click.stop>
+			<div class="notice-table" @click.stop  v-loading="loading" >
 				<div class="tabs">
 				<div class="tabs">
 					<ul>
 					<ul>
-						<li style="padding-left: 0; border: none" @click="tableTagType = 1" :class="tableTagType == 1 ? 'active' : ''">
-							全部(0
+						<li style="padding-left: 0; border: none" @click="pushInfoReq.type = '';getPushInfo()" :class="pushInfoReq.type == '' ? 'active' : ''">
+							全部({{pushInfoReq.total}}
 						</li>
 						</li>
-						<li  @click="tableTagType = 2" :class="tableTagType == 2 ? 'active' : ''">待办(0)</li>
-						<li  @click="tableTagType = 3" :class="tableTagType == 3 ? 'active' : ''">通知(0)</li>
+						<li  @click="pushInfoReq.type = 1;getPushInfo()" :class="pushInfoReq.type == 1 ? 'active' : ''">流程(0)</li>
+						<li  @click="pushInfoReq.type = 2;getPushInfo()" :class="pushInfoReq.type == 2 ? 'active' : ''">业务(0)</li>
 					</ul>
 					</ul>
-					<div class="more">查看更多&gt;</div>
+					<!-- <div class="more">查看更多&gt;</div> -->
 				</div>
 				</div>
 				<el-table :data="noticeData" style="width: 100%">
 				<el-table :data="noticeData" style="width: 100%">
-					<el-table-column prop="date" label="标题内容" width="250">
+					<el-table-column prop="title" label="标题内容" width="250">
+						<template #default="scope">
+							<el-tooltip
+								class="box-item"
+								effect="dark"
+								:content="scope.row.title"
+								placement="top"
+							>
+								<span>{{ scope.row.title.slice(0,12) }}</span><span v-if="scope.row.title.length > 12">..</span>
+							</el-tooltip>
+							
+						</template>
 					</el-table-column>
 					</el-table-column>
-					<el-table-column prop="name" label="类型" width="120">
+					<el-table-column prop="businessType" label="类型" width="120">
 					</el-table-column>
 					</el-table-column>
 					<el-table-column prop="address" label="操作">
 					<el-table-column prop="address" label="操作">
 						<template #default="scope">
 						<template #default="scope">
-							<span style="cursor: pointer">未读</span>
+							<span style="cursor: pointer" @click="readFn(scope)">未读</span>
 						</template>
 						</template>
 					</el-table-column>
 					</el-table-column>
 				</el-table>
 				</el-table>
 				<div class="notice-btn-box" style="margin-top: 20px">
 				<div class="notice-btn-box" style="margin-top: 20px">
-					<el-button plain disabled>点击清空</el-button>
+					<!-- <el-button plain disabled>点击清空</el-button> -->
 					<el-button type="primary" disabled>全部已读</el-button>
 					<el-button type="primary" disabled>全部已读</el-button>
 				</div>
 				</div>
 			</div>
 			</div>
@@ -78,7 +90,7 @@
 	</div>
 	</div>
 </template>
 </template>
 <script setup>
 <script setup>
-import { ElMessageBox, ElNotification } from 'element-plus'
+import { ElMessageBox, ElNotification,ElMessage } from 'element-plus'
 import {
 import {
   getToken
   getToken
 } from '@/utils/auth'
 } from '@/utils/auth'
@@ -89,11 +101,10 @@ defineProps({
     default: false,
     default: false,
   },
   },
 });
 });
-const emit = defineEmits(["update:modelValue"]);
+const emit = defineEmits(["update:modelValue"],'changeNum');
 const closeNoticeTableModal = () => {
 const closeNoticeTableModal = () => {
 	emit("update:modelValue", false);
 	emit("update:modelValue", false);
 };
 };
-const tableTagType = ref(1)
 let noticeData = ref([
 let noticeData = ref([
 	// {
 	// {
 	// 	date: '2016-05-02',
 	// 	date: '2016-05-02',
@@ -123,8 +134,27 @@ const moreFn = () => {
 	noticeTableModal.value = true
 	noticeTableModal.value = true
 }
 }
 
 
+const readFn = (item) => {
+	commonRead([item.row.id])
+}
+const commonRead = (ids,type) => {
+	proxy.post('/pushInfo/read',{idList:ids}).then(res=>{
+		console.log(res)
+		ElMessage({
+			message: '已读成功',
+			type: 'success',
+		})
+		if(type == 'confirm'){
+			data.value[index].isRead = true
+		}else{
+			getPushInfo()
+		}
+	})
+}
 const confirm = () => {
 const confirm = () => {
 	value.value = false
 	value.value = false
+	commonRead([data.value[index.value].id],'confirm')
+	
 }
 }
 // proxy.post('sendMeg/page',{
 // proxy.post('sendMeg/page',{
 // 	pageNum:1,
 // 	pageNum:1,
@@ -147,11 +177,27 @@ const socketInit = () => {
 	window.ws.onmessage = function (e) {
 	window.ws.onmessage = function (e) {
 		//当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
 		//当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
 		//在data.value前面插入
 		//在data.value前面插入
-		console.log(JSON.parse(e.data).data)
-		data.value.unshift({title:"最新公告",content:JSON.parse(e.data).data})
-		index.value = 0
-		value.value = true
+		const res = JSON.parse(e.data)
+		console.log(res)
+		
 		
 		
+		if(res.type == 1) {
+			index.value = 0
+			data.value = res.list
+			if(res.list.length > 0) value.value = true
+		}
+		if(res.type == 2) {
+			emit('changeNum',res.count * 1)
+			getPushInfo()
+		}
+		if(res.type == 3) {
+			ElNotification({
+				title: '提示',
+				message: res.title,
+				position: 'bottom-right',
+				duration:0,
+			})
+		}
 		
 		
 	}
 	}
 	window.ws.onclose = function (e) {
 	window.ws.onclose = function (e) {
@@ -163,6 +209,29 @@ const socketInit = () => {
 		console.log(error)
 		console.log(error)
 	}
 	}
 }
 }
+let pushInfoReq = ref({
+	pageNum: 1,
+	pageSize: 5,
+	pushRead: 0,
+	type: '',
+	total:0,
+})
+const loading = ref(false)
+const getPushInfo = () => {
+	loading.value = true
+	proxy.post('/pushInfo/page',{
+		pageNum:1,
+		pageSize:5,
+		pushRead:0,
+		type:2,
+	}).then(res=>{
+		noticeData.value = res.rows
+		pushInfoReq.value.total = res.total
+		setTimeout(() => {
+			loading.value = false
+		}, 500);
+	})
+}
 socketInit()
 socketInit()
 const handleClose = () => {
 const handleClose = () => {
 	value.value = false
 	value.value = false

+ 1 - 1
src/views/index.vue

@@ -167,7 +167,7 @@ const getData = (() => {
 	}).then(res=>{
 	}).then(res=>{
 		haveInitiatedData.value = res
 		haveInitiatedData.value = res
 	})
 	})
-	proxy.post('sendMeg/page',{
+	proxy.post('pushAnnouncement/page',{
 		pageNum:1,
 		pageNum:1,
 		pageSize:3,
 		pageSize:3,
 	}).then(res=>{
 	}).then(res=>{

+ 0 - 1
src/views/system/langConfig/index.vue

@@ -39,7 +39,6 @@
 				:formConfig="formConfig"
 				:formConfig="formConfig"
 				:formOption="formOption"
 				:formOption="formOption"
 				v-model="formData.data"
 				v-model="formData.data"
-				
 				ref="byform"
 				ref="byform"
 			>
 			>
 			</byForm>
 			</byForm>

+ 16 - 25
src/views/system/msg/index.vue

@@ -229,7 +229,7 @@ const getDict = () => {
 const getList = async (req) => {
 const getList = async (req) => {
 	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
 	sourceList.value.pagination = { ...sourceList.value.pagination, ...req }
 	loading.value = true
 	loading.value = true
-	proxy.post('/sendMeg/page', sourceList.value.pagination).then((res) => {
+	proxy.post('/pushAnnouncement/page', sourceList.value.pagination).then((res) => {
 		sourceList.value.data = res.rows
 		sourceList.value.data = res.rows
 		sourceList.value.pagination.total = res.total
 		sourceList.value.pagination.total = res.total
 		setTimeout(() => {
 		setTimeout(() => {
@@ -256,20 +256,20 @@ const formOption = reactive({
 })
 })
 const formConfig = computed(() => {
 const formConfig = computed(() => {
 	return [
 	return [
-		{
-			label: '基础信息',
-		},
-		{
-			type: 'select',
-			prop: 'type',
-			label: '消息类型',
-            data: [
-				{
-					label: '系统公告',
-					value: '1',
-				},
-			],
-		},
+		// {
+		// 	label: '基础信息',
+		// },
+		// {
+		// 	type: 'select',
+		// 	prop: 'type',
+		// 	label: '消息类型',
+        //     data: [
+		// 		{
+		// 			label: '系统公告',
+		// 			value: '1',
+		// 		},
+		// 	],
+		// },
 		{
 		{
 			type: 'input',
 			type: 'input',
 			prop: 'title',
 			prop: 'title',
@@ -325,7 +325,7 @@ const openModal = () => {
 const submitForm = () => {
 const submitForm = () => {
 	submit.value.handleSubmit(() => {
 	submit.value.handleSubmit(() => {
 		loadingOperation.value = true
 		loadingOperation.value = true
-		proxy.post('/sendMeg/' + modalType.value, formData.data).then(
+		proxy.post('/pushAnnouncement/' + modalType.value, formData.data).then(
 			() => {
 			() => {
 				ElMessage({
 				ElMessage({
 					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
 					message: modalType.value == 'add' ? '添加成功' : '编辑成功',
@@ -341,15 +341,6 @@ const submitForm = () => {
 		)
 		)
 	})
 	})
 }
 }
-const update = (row) => {
-	modalType.value = 'edit'
-	loadingOperation.value = true
-	proxy.post('/contractTemplate/detail', { id: row.id }).then((res) => {
-		formData.data = res
-		loadingOperation.value = false
-		dialogVisible.value = true
-	})
-}
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>