Parcourir la source

feat(message): 消息列表下拉刷新

wangpx il y a 1 an
Parent
commit
17bd782e58

+ 4 - 4
api/message.js

@@ -2,7 +2,7 @@ import request from '@/utils/request.js'
 const preUrl = '/clientServices.do?iscrypt=1'
 
 //获取用户消息列表
-export function GetMessageList(params) {
+export function getMessageList(params) {
 	return request({
 		url: preUrl,
 		method: 'post',
@@ -20,7 +20,7 @@ export function GetMessageList(params) {
 }
 
 //获取用户公告列表
-export function GetNoticeList(params) {
+export function getNoticeList(params) {
 	return request({
 		url: preUrl,
 		method: 'post',
@@ -38,7 +38,7 @@ export function GetNoticeList(params) {
 }
 
 //获取公告详情
-export function GetNoticeInfo(params) {
+export function getNoticeInfo(params) {
 	return request({
 		url: preUrl,
 		method: 'post',
@@ -53,7 +53,7 @@ export function GetNoticeInfo(params) {
 }
 
 //获取消息详情
-export function GetMessageInfo(params) {
+export function getMessageInfo(params) {
 	return request({
 		url: preUrl,
 		method: 'post',

+ 40 - 24
api/process.js

@@ -1,13 +1,13 @@
 import request from '@/utils/request.js'
 const preUrl = '/clientServices.do?iscrypt=1'
 //获取用户所有流程
-export function getUserAllProcess({staffId,page,pageNum}) {
+export function getUserAllProcess({staffId, page, pageNum}) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'bpm_2013V0100PHONE009',
-			'params': {
+			serviceId: 'bpm_2013V0100PHONE009',
+			params: {
 				staffId,
 				page,
 				pageNum
@@ -22,30 +22,31 @@ export function getUserProcessed(params) {
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'bpm_2013V0100PHONE003',
-			'params': {
-				"staffId": params.staffId,
-				"page": params.page,
-				"pageNum": params.pageNum,
-				"modelId": params.modelId, //流程类型
-				"control": params.control //流程控制方式 0 手写 1 引擎
+			serviceId: 'bpm_2013V0100PHONE003',
+			params: {
+				staffId: params.staffId,
+				page: params.page,
+				pageNum: params.pageNum,
+				modelId: params.modelId, //流程类型
+				control: params.control //流程控制方式 0 手写 1 引擎
 			}
 		}
 	})
 }
+
 //获取用户待办流程
 export function getUserProcess(params) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'bpm_2013V0010PHONE001',
-			'params': {
-				"staffId": params.staffId,
-				"page": params.page,
-				"pageNum": params.pageNum,
-				"modelId": params.modelId, //流程类型
-				"control": params.control //流程控制方式 0 手写 1 引擎
+			serviceId: 'bpm_2013V0010PHONE001',
+			params: {
+				staffId: params.staffId,
+				page: params.page,
+				pageNum: params.pageNum,
+				modelId: params.modelId, //流程类型
+				control: params.control //流程控制方式 0 手写 1 引擎
 			}
 		}
 	})
@@ -57,13 +58,28 @@ export function getUserProcessing(params) {
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'bpm_2013V0100PHONE002',
-			'params': {
-				"staffId": params.staffId,
-				"page": params.page,
-				"pageNum": params.pageNum,
-				"modelId": params.modelId, //流程类型
-				"control": params.control //流程控制方式 0 手写 1 引擎
+			serviceId: 'bpm_2013V0100PHONE002',
+			params: {
+				staffId: params.staffId,
+				page: params.page,
+				pageNum: params.pageNum,
+				modelId: params.modelId, //流程类型
+				control: params.control //流程控制方式 0 手写 1 引擎
+			}
+		}
+	})
+}
+
+//获取流程详情
+export function getProcessInfo(userId, insId) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2020V0100PHONE006',
+			params: {
+				userId: userId, // useId
+				insId: insId // process.insId
 			}
 		}
 	})

+ 106 - 0
components/ygoa/messageList.vue

@@ -0,0 +1,106 @@
+<template>
+	<view class="msg_list_content">
+		<uni-collapse>
+			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="true">
+				<template v-slot:title>
+					<uni-section :title="title" type="line" titleFontSize="1.5rem"></uni-section>
+				</template>
+				<View style="height: 85vh">
+					<z-paging :fixed="false" :auto="false" @query="queryPage" :value="messages" :default-page-size="pSize" ref="paging">
+						<template #top>
+							<view class="segmented_control_container">
+								<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem"
+									styleType="text" activeColor="#409eff"></uni-segmented-control>
+							</view>
+						</template>
+						<view @click="handleToDetail(message)" v-for="(message, index) in messages" :key="index"
+							:class="message.isread == 'Y' ? ' ' : 'message_container_unread'" class="message_container">
+							<uni-card :is-full="true">
+								<template v-slot:title>
+									<uni-row>
+										<view class="message_top_container">
+											<uni-col :span="24">
+												<text class="message_user">
+													{{ message.name }}
+												</text>
+											</uni-col>
+										</view>
+									</uni-row>
+									<uni-row>
+										<view class="message_mid_container">
+											<uni-col :span="19">
+												<text class="message_title hidden_over">
+													<text :class="message.icon" class="ygoa-icon"></text>
+													<text class="message_title_text">{{ message.title }}</text>
+												</text>
+											</uni-col>
+											<uni-col :span="5">
+												<!-- <text class="message_time">
+													{{ message.sendtime }}
+												</text> -->
+												<view class="message_time" v-for="(item, index) in message.sendtime.split(' ')" :key="index">
+													{{ item }}
+												</view>
+											</uni-col>
+										</view>
+									</uni-row>
+								</template>
+								<view class="message_bottom_container">
+									<text class="message_content hidden_over">
+										{{ message.content }}
+									</text>
+								</view>
+							</uni-card>
+						</view>
+					</z-paging>
+				</View>
+			</uni-collapse-item>
+		</uni-collapse>
+	</view>
+</template>
+
+<script setup lang="ts">
+/* 
+	message: {
+		messageid,
+		universalid
+	}
+*/
+import { ref } from 'vue';
+const current = ref(0)
+const props = defineProps({
+	type: Number,
+	title: String,
+	items: Array,
+	messages: Array,
+	pSize: Number,
+})
+const emit = defineEmits(['clickSegment', 'clickItem', 'scrollToBottom'])
+const paging = ref(null)
+// 加载完成 更新数据
+const complete = (list) => {
+	paging.value.complete(list)
+}
+// 下拉加载
+function queryPage(page) {
+	let isRead = ''
+	if(current.value === 1) {
+		isRead = '1'
+	} else if(current.value === 2) {
+		isRead = '0'
+	}
+	const type = ''
+	emit('scrollToBottom', isRead, props.pSize, type, page, complete)
+}
+
+function onClickItem({ currentIndex }) {
+	current.value = currentIndex
+	emit('clickSegment', { currentIndex })
+}
+function handleToDetail(message) {
+	emit('clickItem', { message, type: props.type })
+}
+</script>
+
+<style lang="scss">
+</style>

+ 26 - 59
components/ygoa/processList.vue

@@ -3,44 +3,6 @@
 		<view @click="handleToDetail(process)" v-for="(process,index) in processes" :key="index">
 			<uni-card :isFull="true" padding="10px 0">
 				<uni-row>
-					<!-- <uni-col :xs="4" :sm="2">
-						<view class="icon_container">
-							<text class="ygoa-icon" :class="process.type"></text>
-						</view>
-					</uni-col>
-					<uni-col :xs="20" :sm="22">
-
-						<uni-card padding="0 10px 10px" :isFull="true" :border="false" :is-shadow="true">
-							<template v-slot:title>
-								<uni-row>
-									<uni-col :xs="18" :sm="22">
-										<view class="process_title">
-											<text>{{ process.title }}</text>
-										</view>
-									</uni-col>
-									<uni-col :xs="6" :sm="2">
-										<uni-tag :text="process.step == 0?'审批中':''" :type="process.step == 0?'primary':''"></uni-tag>
-									</uni-col>
-								</uni-row>
-							</template>
-							<view class="process_contant">
-								<uni-row>
-									<uni-col :xs="8" :sm="7">{{ 'icon-apply-overtime'==process.type?'加班时间':'请假天数' }}:</uni-col>
-									<uni-col :xs="15" :sm="16">{{ process.totalTime }}</uni-col>
-								</uni-row>
-								<uni-row>
-									<uni-col :xs="8" :sm="7">开始时间:</uni-col>
-									<uni-col :xs="15" :sm="16">{{ process.startTime }}</uni-col>
-								</uni-row>
-								<uni-row>
-									<uni-col :xs="8" :sm="7">结束时间:</uni-col>
-									<uni-col :xs="15" :sm="16">{{ process.endTime }}</uni-col>
-								</uni-row>
-								
-							</view>
-						</uni-card>
-					</uni-col> -->
-
 					<uni-col :xs="4" :sm="2">
 						<view class="icon_container">
 							<text class="ygoa-icon icon-apply-leave"></text>
@@ -48,7 +10,7 @@
 					</uni-col>
 					<uni-col :xs="20" :sm="22">
 
-						<uni-card padding="0 10px 10px" :isFull="true" :border="false" :is-shadow="true">
+						<uni-card padding="0" :isFull="true" :border="false" :is-shadow="false">
 							<template v-slot:title>
 								<uni-row>
 									<uni-col :xs="18" :sm="22">
@@ -57,15 +19,16 @@
 										</view>
 									</uni-col>
 									<uni-col :xs="6" :sm="2">
-										<uni-tag :text="process.control == 0?'审批中':'已办结'"
-											:type="process.control == 0?'primary':''"></uni-tag>
+										<uni-tag v-if="current == 1" text="审批中" type="success"></uni-tag>
+										<uni-tag v-else-if="current == 2" text="审批中" type="success"></uni-tag>
+										<uni-tag v-else-if="current == 3" text="已办结" type="primary"></uni-tag>
 									</uni-col>
 								</uni-row>
 							</template>
 							<view class="process_contant">
 								<uni-row>
 									<uni-col :xs="8" :sm="7">流程类型:</uni-col>
-									<uni-col :xs="15" :sm="16">{{ process.typeName }}</uni-col>
+									<uni-col :xs="15" :sm="16" style="color: blue;">{{ process.typeName }}</uni-col>
 								</uni-row>
 								<uni-row>
 									<uni-col :xs="8" :sm="7">创建时间:</uni-col>
@@ -84,34 +47,29 @@
 	import $tab from '@/plugins/tab.js'
 	import { onMounted, ref } from 'vue';
 	
-
 	onMounted(() => {
 		startProcessCheck();
 	})
 	const intervalId = ref(null); // 定时器ID
 	
-	// TODO: 根据接口返回的数据动态生成process表单
 	// const props = defineProps(['processes'])
 	const props = defineProps({
-		processes:{
-			type: Array,
-			required: true,
-			default: []
-		}
+		processes: Array,
+		current: Number
 	})
 	function startProcessCheck() {
 		// intervalId.value = setInterval(() => {
-			console.log(111);
-			if (props.processes && props.processes.length > 0) {
-				console.log('props',props.processes);
+			// console.log(111);
+			// if (props.processes && props.processes.length > 0) {
+			// 	console.log('props',props.processes);
 				// clearInterval(intervalId.value); // 清除定时器    
-			}
+			// }
 		// }, 100); // 每0.1秒检查一次
 	}
 	
 	
-	function handleToDetail({ id, title }) { // 跳转流程详情页
-		$tab.navigateTo('/pages/process/detail/index?id=' + id + '&title=' + title)
+	function handleToDetail({ insId, insName }) { // 跳转流程详情页
+		$tab.navigateTo('/pages/process/detail/index?insId=' + insId + '&insName=' + insName)
 	}
 </script>
 
@@ -127,10 +85,19 @@
 			margin: 50% 0;
 		}
 
-		.process_title {
-			font-weight: bold;
-			font-size: 1.2rem;
-			margin-top: 10px;
+		.process_title { // TODO 长度限制15字
+			line-height: 1.5rem;
+		  white-space: nowrap;
+		  overflow: hidden;
+		  text-overflow: ellipsis;
+			font-weight: 500;
+			font-size: 1.5rem;
+			margin: 10px 0;
+			color: #333;
+		}
+		
+		.process_contant {
+			
 		}
 	}
 </style>

+ 3 - 3
pages/message/detail/index.vue

@@ -59,7 +59,7 @@
 	import { onMounted, reactive, ref } from 'vue';
 	import $tab from '@/plugins/tab';
 	import uParse from '@/components/gaoyia-parse/parse.vue'
-	import { GetNoticeInfo, GetMessageInfo } from '@/api/message';
+	import { getNoticeInfo, getMessageInfo } from '@/api/message';
 	import { useUserStore } from '@/store/user';
 import attachmentList from '@/components/ygoa/attachmentList.vue'
 	const userStore = useUserStore();
@@ -97,7 +97,7 @@ import attachmentList from '@/components/ygoa/attachmentList.vue'
 			userId: userStore.user.useId, //当前用户id
 			noticeId: id
 		}
-		GetNoticeInfo(params).then(({ returnParams }) => {
+		getNoticeInfo(params).then(({ returnParams }) => {
 			// console.log('returnParams', returnParams);
 			msgInfo.value = {
 				title: returnParams.title,
@@ -118,7 +118,7 @@ import attachmentList from '@/components/ygoa/attachmentList.vue'
 			universalId: universalId,
 			messageId: messageId
 		}
-		GetMessageInfo(params).then(({ returnParams }) => {
+		getMessageInfo(params).then(({ returnParams }) => {
 			msgInfo.value = {
 				title: returnParams.title,
 				sendTime: returnParams.sendtime,

+ 218 - 218
pages/message/index.vue

@@ -2,30 +2,10 @@
 	<view class="index_container">
 		<uni-nav-bar dark :border="false" :fixed="true" title="宇光同行">
 		</uni-nav-bar>
-		<!-- <uni-nav-bar :border="false" :fixed="true">
-			<template v-slot:left>研发部</template>
-			<template v-slot:right>用户1</template>
-		</uni-nav-bar> -->
-		<!-- <view class="grid-body">
-			<uni-grid :column="2" :square="false" :showBorder="false" @change="changeIndexGrid">
-				<uni-grid-item :index="1">
-					<view class="grid-item-box">
-						<text class="ygoa-icon icon-checkIn"></text>
-						<text class="text">考勤打卡</text>
-					</view>
-				</uni-grid-item>
-				<uni-grid-item :index="2">
-					<view class="grid-item-box">
-						<text class="ygoa-icon icon-init-process"></text>
-						<text class="text">流程申请</text>
-					</view>
-				</uni-grid-item>
-			</uni-grid>
-		</view> -->
 		<uni-collapse>
 			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="false">
 				<template v-slot:title>
-					<uni-section title="待办消息" type="line" titleFontSize="20px"></uni-section>
+					<uni-section title="待办" type="line" titleFontSize="1.5rem"></uni-section>
 				</template>
 				<view class="process_container">
 					<view class="process_list">
@@ -34,11 +14,10 @@
 				</view>
 			</uni-collapse-item>
 		</uni-collapse>
-
 		<uni-collapse>
 			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="false">
 				<template v-slot:title>
-					<uni-section title="公告" type="line" titleFontSize="20px"></uni-section>
+					<uni-section title="公告" type="line" titleFontSize="1.5rem"></uni-section>
 				</template>
 
 				<view class="segmented_control_container">
@@ -46,9 +25,8 @@
 						styleType="text" activeColor="#409eff"></uni-segmented-control>
 				</view>
 				<view class="content">
-					<view @click="handleToDetail({ message: message, type: 0 })" v-for="(message, index) in notices"
-						:key="index" :class="message.if_read ? ' ' : 'message_container_unread'"
-						class="message_container">
+					<view @click="handleToDetail({ message, type: 0 })" v-for="(message, index) in notices" :key="index"
+						:class="message.if_read ? ' ' : 'message_container_unread'" class="message_container">
 						<uni-card :is-full="true">
 							<template v-slot:title>
 								<uni-row>
@@ -76,22 +54,16 @@
 									</view>
 								</uni-row>
 							</template>
-							<!-- <view class="message_bottom_container">
-								<text class="message_content hidden_over">
-									{{ message.content }}
-								</text>
-							</view> -->
 						</uni-card>
 					</view>
 				</view>
 			</uni-collapse-item>
 		</uni-collapse>
 
-
-		<uni-collapse>
+		<!-- <uni-collapse>
 			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="true">
 				<template v-slot:title>
-					<uni-section title="消息" type="line" titleFontSize="20px"></uni-section>
+					<uni-section title="消息" type="line" titleFontSize="1.5rem"></uni-section>
 				</template>
 
 				<view class="segmented_control_container">
@@ -99,8 +71,8 @@
 						activeColor="#409eff"></uni-segmented-control>
 				</view>
 				<view class="content">
-					<view @click="handleToDetail({ message: message, type: 1 })" v-for="(message, index) in messages"
-						:key="index" :class="message.isread=='Y' ? ' ' : 'message_container_unread'"
+					<view @click="handleToDetail({ message, type: 1 })" v-for="(message, index) in messages"
+						:key="index" :class="message.isread == 'Y' ? ' ' : 'message_container_unread'"
 						class="message_container">
 						<uni-card :is-full="true">
 							<template v-slot:title>
@@ -138,9 +110,13 @@
 					</view>
 				</view>
 			</uni-collapse-item>
-		</uni-collapse>
+		</uni-collapse> -->
+
+		<message-list :messages="messages" @clickSegment="onClickItem" @clickItem="handleToDetail" :type="1" :pSize="10"
+			:items="['全部', '已读', '未读']" title="消息" @scrollToBottom="getMessagePage"></message-list>
+
 		<view class="fab_button">
-			<uni-fab :pattern="{icon:'headphones'}" :popMenu="false" horizontal="right"
+			<uni-fab :pattern="{ icon: 'headphones' }" :popMenu="false" horizontal="right"
 				@fabClick="clickFabButton"></uni-fab>
 		</view>
 
@@ -148,219 +124,243 @@
 </template>
 
 <script setup lang="ts">
-	import { onMounted, reactive, ref } from 'vue';
-	import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
-	import $tab from '@/plugins/tab.js';
-	import $modal from '@/plugins/modal.js';
-	import processList from '@/components/ygoa/processList.vue'
-	import { useUserStore } from '@/store/user.js'
-	import { GetMessageList, GetNoticeList } from '@/api/message.js';
-	onLoad((options) => {
-		if (options.to == 'clockIn') toClockIn()
+import { onMounted, reactive, ref, toRaw } from 'vue';
+import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
+import $tab from '@/plugins/tab.js';
+import $modal from '@/plugins/modal.js';
+import processList from '@/components/ygoa/processList.vue'
+import messageList from '@/components/ygoa/messageList.vue'
+import { useUserStore } from '@/store/user.js'
+import { getMessageList, getNoticeList } from '@/api/message.js';
+onLoad((options) => {
+	if (options.to == 'clockIn') toClockIn()
+})
+function toClockIn() {
+	$modal.confirm('当前未打卡,是否前往打卡').then(() => {
+		$tab.navigateTo('/pages/mine/clockIn/clockIn')
 	})
-	function toClockIn() {
-		$modal.confirm('当前未打卡,是否前往打卡').then(() => {
-			$tab.navigateTo('/pages/mine/clockIn/clockIn')
-		})
+}
+onPullDownRefresh(() => {
+	onClickItem({ currentIndex: 0 })
+	onClickItem2({ currentIndex: 0 })
+	uni.stopPullDownRefresh();
+})
+onMounted(() => { // TODO 初始化数据
+	onClickItem({ currentIndex: 0 })
+	onClickItem2({ currentIndex: 0 })
+})
+const userStore = useUserStore()
+
+// 分段器选项列表
+const items = reactive(['全部', '已读', '未读'])
+// 分段器选项
+const current = ref(-1)
+const current2 = ref(0)
+// 消息列表
+let messages = ref([])
+//公告列表
+let notices = ref([]);
+// 待办列表
+let processes = reactive([])
+
+function getMessageData({ isRead, pSize, type, p }) {
+	const params = {
+		currentUser: userStore.user.useId,
+		isRead: isRead,
+		pSize: pSize,
+		type: type,
+		p: p,
 	}
-	onPullDownRefresh(() => {
-		console.log('onPullDownRefresh');
-		onClickItem({ currentIndex: 0 })
-		onClickItem2({ currentIndex: 0 })
-    uni.stopPullDownRefresh();
-	})
-	onMounted(() => {
-		onClickItem({ currentIndex: 0 })
-		onClickItem2({ currentIndex: 0 })
+	getMessageList(params).then(({ returnParams }) => {
+		return returnParams.list;
 	})
-	const userStore = useUserStore()
-
-	// 分段器选项列表
-	const items = reactive(['全部', '已读', '未读'])
-	// 分段器选项
-	const current = ref(-1)
-	const current2 = ref(0)
-	// 消息列表
-	let messages = ref([])
-	//公告列表
-	let notices = ref([]);
-	// 待办列表
-	let processes = reactive([])
+}
 
+function getMessagePage(isRead, pSize, type, page, callback) {
+	const params = {
+		currentUser: userStore.user.useId,
+		isRead: isRead,
+		pSize: pSize,
+		type: type,
+		p: page,
+	}
+	getMessageList(params).then(({ returnParams }) => {
+		messages.value.push(...returnParams.list)
+		callback(returnParams.list)
+	})
+}
 
-	// 点击消息分段器
-	function onClickItem({ currentIndex }) {
-		current.value = currentIndex
-		let params = {};
-		switch (currentIndex) {
-			case 0:
-				params = {
-					 currentUser : userStore.user.useId,
-					 isRead : "",
-					 pSize : "5",
-					 type : "",
-					 p : "1",
-				}
-				GetMessageList(params).then(res => {
-					messages.value = res.returnParams.list;
-				})
+// 点击消息分段器
+function onClickItem({ currentIndex }) {
+	current.value = currentIndex
+	let params = {};
+	switch (currentIndex) {
+		case 0:
+			params = {
+				currentUser: userStore.user.useId,
+				isRead: "",
+				pSize: 10,
+				type: "",
+				p: 1,
+			}
+			getMessageList(params).then(res => {
+				messages.value = res.returnParams.list;
+			})
 
-				break;
-			case 1:
-				params = {
-					 currentUser : userStore.user.useId,
-					 isRead : "1",
-					 pSize : "5",
-					 type : "",
-					 p : "1",
-				}
-				GetMessageList(params).then(res => {
-					messages.value = res.returnParams.list;
-				})
-				break;
-			case 2:
-				params = {
-					 currentUser : userStore.user.useId,
-					 isRead : "0",
-					 pSize : "5",
-					 type : "",
-					 p : "1",
-				}
-				GetMessageList(params).then(res => {
-					messages.value = res.returnParams.list;
-				})
-				break;
-		}
+			break;
+		case 1:
+			params = {
+				currentUser: userStore.user.useId,
+				isRead: "1",
+				pSize: "5",
+				type: "",
+				p: "1",
+			}
+			getMessageList(params).then(res => {
+				messages.value = res.returnParams.list;
+			})
+			break;
+		case 2:
+			params = {
+				currentUser: userStore.user.useId,
+				isRead: "0",
+				pSize: "5",
+				type: "",
+				p: "1",
+			}
+			getMessageList(params).then(res => {
+				messages.value = res.returnParams.list;
+			})
+			break;
 	}
+}
 
-	// 点击公告分段器
-	function onClickItem2({ currentIndex }) {
-		current2.value = currentIndex;
-		switch (currentIndex) {
-			case 0:
-				const params1 = {
-					  notice_title  : "",
-					 p : "1",
-					 pSize : "5",
-					 userId : userStore.user.useId,
-					 unitId : userStore.user.unitId,
-				}
-				GetNoticeList(params1).then(res => {
-					// console.log(res);
-					notices.value = res.returnParams.noticelist.list;
-				})
-				break;
-			case 1:
-				notices.value = [];
-				break;
-			case 2:
-				notices.value = [];
-				break;
-		}
-	}
-	// 点击消息
-	function handleToDetail({ message, type }) {
-		switch (type) {
-			case 0:
-				$tab.navigateTo('/pages/message/detail/index?type=' + type + '&noticeId=' + message.id)
-				break
-			case 1:
-				$tab.navigateTo('/pages/message/detail/index?type=' + type + '&messageId=' + message.messageid+ '&universalId=' + message.universalid)
-				break
-		}
-		console.log('handleToDetail', type);
+// 点击公告分段器
+function onClickItem2({ currentIndex }) {
+	current2.value = currentIndex;
+	switch (currentIndex) {
+		case 0:
+			const params1 = {
+				notice_title: "",
+				p: "1",
+				pSize: "5",
+				userId: userStore.user.useId,
+				unitId: userStore.user.unitId,
+			}
+			getNoticeList(params1).then(res => {
+				notices.value = res.returnParams.noticelist.list;
+			})
+			break;
+		case 1:
+			notices.value = [];
+			break;
+		case 2:
+			notices.value = [];
+			break;
 	}
-	function clickFabButton() {
-		console.log('clickFabButton');
-		$tab.navigateTo('/pages/message/chat/index')
+}
+// 点击消息
+function handleToDetail({ message, type }) {
+	switch (type) {
+		case 0:
+			$tab.navigateTo('/pages/message/detail/index?type=' + type + '&noticeId=' + message.id)
+			break
+		case 1:
+			$tab.navigateTo('/pages/message/detail/index?type=' + type + '&messageId=' + message.messageid + '&universalId=' + message.universalid)
+			break
 	}
+}
+function clickFabButton() {
+	console.log('clickFabButton');
+	$tab.navigateTo('/pages/message/chat/index')
+}
 </script>
 
 <style lang="scss">
-	@import "@/static/font/ygoa/iconfont.css";
+@import "@/static/font/ygoa/iconfont.css";
 
-	.text {
-		text-align: center;
-		font-size: 26rpx;
-		margin-top: 10rpx;
-	}
-
-	.grid-body {
-		.ygoa-icon {
-			font-size: 40px;
-		}
+.text {
+	text-align: center;
+	font-size: 26rpx;
+	margin-top: 10rpx;
+}
 
-		.grid-item-box {
-			flex: 1;
-			/* #ifndef APP-NVUE */
-			display: flex;
-			/* #endif */
-			border-top: 1px solid #ccc;
-			background-color: #ffffff;
-			flex-direction: column;
-			align-items: center;
-			justify-content: center;
-			padding: 15px 0;
-		}
+.grid-body {
+	.ygoa-icon {
+		font-size: 40px;
 	}
 
-	.segmented_control_container {
-		// margin-top: 10px;
+	.grid-item-box {
+		flex: 1;
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		border-top: 1px solid #ccc;
+		background-color: #ffffff;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		padding: 15px 0;
 	}
+}
 
-	.message_container {
-		border-left: #7b7b7b .4rem solid;
+.segmented_control_container {
+	// margin-top: 10px;
+}
 
-		.message_top_container {
-			padding: 5px 5px 0;
+.message_container {
+	border-left: #7b7b7b .4rem solid;
 
-			.message_user {
-				color: #000000;
-			}
-		}
+	.message_top_container {
+		padding: 5px 5px 0;
 
-		.message_mid_container {
-			padding: 5px;
-			height: 1.1rem;
+		.message_user {
+			color: #000000;
+		}
+	}
 
-			.message_title {
-				font-size: 1.1rem;
-			}
+	.message_mid_container {
+		padding: 5px;
+		height: 1.1rem;
 
-			.message_time {
-				font-size: 0.8rem;
-			}
+		.message_title {
+			font-size: 1.1rem;
 		}
 
-		.message_bottom_container {
-			.message_content {}
+		.message_time {
+			font-size: 0.8rem;
 		}
 	}
 
-	.message_container_unread {
-		// 未读样式
-		border-left-color: #0f6cbd;
+	.message_bottom_container {
+		.message_content {}
+	}
+}
 
-		.message_user {
-			color: #000000;
-			font-weight: bold;
-		}
+.message_container_unread {
+	// 未读样式
+	border-left-color: #0f6cbd;
 
-		.message_title {
-			color: #0f6cbd;
+	.message_user {
+		color: #000000;
+		font-weight: bold;
+	}
 
-			.message_title_text {
-				font-weight: bold;
-			}
-		}
+	.message_title {
+		color: #0f6cbd;
 
+		.message_title_text {
+			font-weight: bold;
+		}
 	}
 
-	.hidden_over {
-		white-space: nowrap; // 不换行
-		overflow: hidden; // 超出内容隐藏
-		text-overflow: ellipsis; // 超出部分显示省略号
-		display: inline-block;
-		max-width: 100%;
-	}
+}
+
+.hidden_over {
+	white-space: nowrap; // 不换行
+	overflow: hidden; // 超出内容隐藏
+	text-overflow: ellipsis; // 超出部分显示省略号
+	display: inline-block;
+	max-width: 100%;
+}
 </style>

+ 23 - 17
pages/process/index.vue

@@ -26,7 +26,7 @@
 				activeColor="#409eff"></uni-segmented-control>
 		</view>
 		<view class="process_list">
-			<process-list :processes="processes"></process-list>
+			<process-list :current="current" :processes="processes"></process-list>
 		</view>
 		<view class="popup_container">
 			<uni-popup ref="searchItemPopup" type="bottom">
@@ -43,8 +43,13 @@
 <script setup lang="ts">
 	import processList from '@/components/ygoa/processList.vue'
 	import { onMounted, reactive, ref } from 'vue';
+	import { onPullDownRefresh } from '@dcloudio/uni-app'
 	import { useUserStore } from '@/store/user';
 	import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess } from '@/api/process';
+	onPullDownRefresh(() => {
+		onClickItem({ currentIndex: 0 })
+    uni.stopPullDownRefresh();
+	})
 	const userStore = useUserStore();
 	// 分段器选项
 	const items = reactive(['我的', '待办', '在办', '办结'])
@@ -54,7 +59,7 @@
 	const current = ref(-1)
 
 	// 搜索项
-	const candidates = ref(['全局', '请假日期', '天数'])
+	const candidates = ref(['全局', '类型', '创建时间'])
 	// 搜索栏选中项
 	const searchItem = ref('全局')
 	onMounted(() => {
@@ -102,12 +107,13 @@
 				});
 				break;
 			case 1: // 待办
+			  //TODO params参数相同 抽出来
 				params = {
-					"staffId": userStore.user.useId,
-					"page": 1,
-					"pageNum": 5,
-					"modelId": "",
-					"control": 1
+					staffId: userStore.user.useId,
+					page: 1,
+					pageNum: 5,
+					modelId: "",
+					control: 1
 				}
 				getUserProcess(params).then(res => {
 					if(res.returnParams==undefined){
@@ -119,11 +125,11 @@
 				break;
 			case 2: // 在办
 				params = {
-					"staffId": userStore.user.useId,
-					"page": 1,
-					"pageNum": 5,
-					"modelId": "",
-					"control": 1
+					staffId: userStore.user.useId,
+					page: 1,
+					pageNum: 5,
+					modelId: "",
+					control: 1
 				}
 				getUserProcessing(params).then(res => {
 					if(res.returnParams==undefined){
@@ -135,11 +141,11 @@
 				break;
 			case 3: // 办结
 				params = {
-					"staffId": userStore.user.useId,
-					"page": 1,
-					"pageNum": 5,
-					"modelId": "",
-					"control": 1
+					staffId: userStore.user.useId,
+					page: 1,
+					pageNum: 5,
+					modelId: "",
+					control: 1
 				}
 				getUserProcessed(params).then(res => {
 					if(res.returnParams==undefined){

+ 17 - 5
pages/work/edit/index.vue

@@ -57,24 +57,29 @@ let processInfo = reactive({
 	modelId: '',
 	tmodelId: '',
 	isMoreIns: '',
-	pathJudgeType: ''
+	pathJudgeType: '',
+	form: []
 })
+const userStore = useUserStore()
+const title = ref('')
 onLoad((options) => {
 	const { modelName, modelId, control } = options
 	processInfo.modelName = modelName
 	processInfo.modelId = modelId
 	processInfo.control = control
+	title.value = userStore.user.name + '的' + processInfo.modelName
 	// 设置导航栏标题
 	uni.setNavigationBarTitle({
-		title: processInfo.modelName
+		title: title.value
 	});
 })
+
 onMounted(() => {
 	initProcessInfo().then(() => {
 		initProcessForm()
 	})
 })
-const userStore = useUserStore()
+
 function initProcessInfo() {
 	return new Promise<void>((resolve, reject) => {
 		getProcessInfo(processInfo)
@@ -88,6 +93,7 @@ function initProcessInfo() {
 			})
 	})
 }
+
 const formElements = ref([])
 const startEleIndex = ref(0) // 开始时间
 const endEleIndex = ref(0) // 结束时间
@@ -113,7 +119,6 @@ const endTime = ref(0) // 结束时间
 const diffHours = ref(' ') // 时间差
 const timeFlag = ref(false) // 是否计算时间差
 const disableEndTime = ref(false) // 禁用 结束时间选择器
-
 function setTimeRange(e) {
 	if (timeFlag.value && '开始时间' == e.elementName) {
 		startTime.value = e.defaultValue // 设置 开始时间
@@ -146,7 +151,14 @@ function handleDelete(e) { // 移除文件
 }
 
 function submitProcess() { // 提交表单
-		console.log('submitProcess')
+		// const form = formElements.value.map(({tableField, defaultValue}) => {
+		// 	return { name: tableField, value: defaultValue }
+		// })
+		processInfo.form = formElements.value.map(({tableField, defaultValue}) => {
+			return { name: tableField, value: defaultValue }
+		})
+		console.log('submitProcess', processInfo)
+		console.log('fileList', fileList)
 	}
 </script>