Parcourir la source

fix(contacts): 用户unitId为0时使用groupid获取通讯录数据
fix(message,process): 上拉加载时,重复获取数据
style(process): 优化流程列表样式

wangpx il y a 1 an
Parent
commit
2d3fdfb2a5

+ 5 - 0
components/ygoa/messageList.vue

@@ -90,6 +90,11 @@ onMounted(() => {
 const paging = ref(null)
 // 加载完成 更新数据
 function complete(list, total, pageNo) {
+	// 第一页直接加载数据
+	if (pageNo === 1) {
+		paging.value.complete(list)
+		return
+	}
 	// 防止重复获取最后一次信息
 	if (props.pSize*pageNo < total) {
 		paging.value.complete(list)

+ 33 - 19
components/ygoa/processList.vue

@@ -5,17 +5,18 @@
 			<view @click="handleToDetail(process)" v-for="(process, index) in list" :key="index">
 				<uni-card :isFull="true" padding="10px 0">
 					<uni-row>
-						<uni-col :xs="4" :sm="2">
+						<uni-col :xs="3" :sm="2">
 							<view class="icon_container">
-								<text class="ygoa-icon" :class="iconDict[process.modelName]"></text>
+								<text style="
+	font-size: 2.5rem;" class="ygoa-icon" :class="iconDict[process.modelName]"></text>
 							</view>
 						</uni-col>
-						<uni-col :xs="20" :sm="22">
+						<uni-col :xs="21" :sm="22">
 
 							<uni-card padding="0" :isFull="true" :border="false" :is-shadow="false">
 								<template v-slot:title>
 									<uni-row>
-										<uni-col :xs="18" :sm="22" v-if="current !== 0">
+										<uni-col :xs="19" :sm="22" v-if="current !== 0">
 											<view class="process_title">
 												<text>{{ process.insName }}</text>
 											</view>
@@ -25,10 +26,12 @@
 												<text>{{ process.insName }}</text>
 											</view>
 										</uni-col>
-										<uni-col :xs="6" :sm="2" v-if="current !== 0">
-											<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 :xs="5" :sm="2" v-if="current !== 0">
+											<view class="process_status">
+												<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>
+											</view>
 										</uni-col>
 									</uni-row>
 								</template>
@@ -67,9 +70,8 @@ const iconDict = ref({
 })
 
 const props = defineProps({
-	contentHeight: {type: String, default: '85vh'},
-	processes: { type: Array, required: true },
-	current: { type: Number, default: 1 }, // 消息类型
+	contentHeight: { type: String, default: '85vh' },
+	current: { type: Number, default: 0 }, // 消息类型
 	list: { type: Array, required: true }, // 消息数据
 	pSize: { type: Number, default: 10 }, // 分页大小
 	pageNo: { type: Number, default: 1 }, // 默认页
@@ -83,8 +85,13 @@ const emits = defineEmits([
 const paging = ref(null)
 // 加载完成 更新数据
 function complete(list, total, pageNo) {
+	// 第一页直接加载数据
+	if (pageNo === 1) {
+		paging.value.complete(list)
+		return
+	}
 	// 防止重复获取最后一次信息
-	if (props.pSize*pageNo < total) {
+	if (props.pSize * pageNo < total) {
 		paging.value.complete(list)
 	} else {
 		paging.value.complete([])
@@ -133,19 +140,14 @@ function handleToDetail(process) { // 跳转流程详情页
 	emits('clickItem', process)
 }
 defineExpose({
-  onClickItem,
+	onClickItem,
 });
 </script>
 
 <style lang="scss">
 @import url("@/static/font/ygoa/iconfont.css");
 
-.ygoa-icon {
-	font-size: 3rem;
-}
-
 .content {
-	height: 85vh;
 	.icon_container {
 		margin: 50% 0;
 	}
@@ -161,7 +163,19 @@ defineExpose({
 		margin: 10px 0;
 		color: #333;
 	}
+	.process_status {
+		margin: 10px 0;
+		height: 1.5rem;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		text-align: center;
+		white-space: nowrap;
+		overflow: hidden;
+	}
 
-	.process_contant {}
+	.process_contant {
+		color: #777;
+	}
 }
 </style>

+ 4 - 1
pages/contacts/index.vue

@@ -50,7 +50,10 @@ import { useUserStore } from '@/store/user.js'
 const userStore = useUserStore()
 onMounted(() => {
 	// 获取 通讯录 索引列表
-	getContactAllUser(userStore.user.unitId).then(res => {
+	let unitId = userStore.user.unitId
+	if ( unitId === 0 ) unitId = userStore.user.groupid
+	// getContactAllUser(userStore.user.groupid).then(res => {
+	getContactAllUser(unitId).then(res => {
 		getContactList(res.returnParams)
 	})
 })

+ 6 - 6
pages/message/index.vue

@@ -9,7 +9,7 @@
 				</template>
 				<view class="process_container">
 					<view class="process_list">
-						<process-list :list="processes" @clickSegment="getProcessData" @clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="1" :pSize="5" :pageNo="1" contentHeight="67.8vh"></process-list>
+						<process-list :list="processes" @clickSegment="getProcessData" @clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="0" :pSize="5" :pageNo="1" contentHeight="67.8vh"></process-list>
 					</view>
 				</view>
 			</uni-collapse-item>
@@ -17,12 +17,12 @@
 
 		<!-- 公告列表 type=0为公告 -->
 		<message-list :list="notices" @clickSegment="getNoticeData" @clickItem="handleToNoticeDetail"
-			@scrollToBottom="getNoticePage" :pSize="10" :pageNo="1" :anime="true" :open="false"
+			@scrollToBottom="getNoticePage" :pSize="5" :pageNo="1" :anime="true" :open="false"
 			title="公告"></message-list>
 
 		<!-- 消息列表 type=1为消息 -->
 		<message-list :list="messages" @clickSegment="getMessageData" @clickItem="handleToMessageDetail"
-			@scrollToBottom="getMessagePage" :pSize="10" :pageNo="1" :anime="true" :open="false"
+			@scrollToBottom="getMessagePage" :pSize="5" :pageNo="1" :anime="true" :open="false"
 			:segments="{ '全部': '', '未读': '0', '已读': '1' }" 
 			title="消息"></message-list>
 			
@@ -60,7 +60,7 @@ function toClockIn() {
 }
 
 // 待办列表
-let processes = ref([])
+const processes = ref([])
 // 获取待办消息列表数据
 function getProcessData({ pSize, pageNo }, callback) {
 	const params = {
@@ -99,7 +99,7 @@ function handleToProcessDetail({ insId, insName }) {
 }
 
 // 公告列表
-let notices = ref([])
+const notices = ref([])
 // 获取公告列表数据
 function getNoticeData({ pSize, pageNo }, callback) {
 	const params = {
@@ -137,7 +137,7 @@ function handleToNoticeDetail(notice) {
 }
 
 // 消息列表
-let messages = ref([])
+const messages = ref([])
 // 获取消息列表数据
 function getMessageData({ pSize, pageNo, type, segmentValue }, callback) {
 	const params = {

+ 40 - 29
pages/process/index.vue

@@ -3,8 +3,9 @@
 		<view class="search_container">
 			<uni-row>
 				<uni-col :xs="6" :sm="4">
-					<view class="popup_button_container">
-						<button @click="openPopup" class="button">{{ searchItem }}</button>
+					<view @click="openPopup" class="popup_button_container">
+						<text class="ygoa-icon icon-filter"></text>
+						<text class="button_text">{{ searchItem }}</text>
 					</view>
 				</uni-col>
 				<uni-col :xs="18" :sm="20">
@@ -53,11 +54,16 @@ const userStore = useUserStore();
 const items = reactive(['我的', '待办', '在办', '办结'])
 // 分段器选项
 const current = ref(0)
+// 子组件
 const processListRef = ref(null)
+
+// 待办列表
+const processes = ref([])
 // 分段器点击事件 调用子组件刷新数据
 function clickSegmentItem({ currentIndex }) {
-	current.value = currentIndex
-	processListRef.value.onClickItem()
+	processes.value = [] // 清空列表数据
+	current.value = currentIndex // 更新分段器状态
+	processListRef.value.onClickItem() // 调用子组件刷新数据
 }
 
 // 搜索项
@@ -66,29 +72,33 @@ const candidates = ref(['全局', '类型', '创建时间'])
 const searchItem = ref('全局')
 // 搜索项弹出层
 const searchItemPopup = ref(null)
-function openPopup() { // 打开搜索项弹出层
+// 打开搜索项弹出层
+function openPopup() { 
 	searchItemPopup.value.open()
 }
-function closePopup() { // 关闭搜索项弹出层
+// 关闭搜索项弹出层
+function closePopup() { 
 	searchItemPopup.value.close()
 }
-function clickSearchItem(item) { // 选中搜索项
+// 选中搜索项
+function clickSearchItem(item) { 
 	searchItem.value = item
 	closePopup()
 }
-function search(e) { // 搜索
-	console.log('search', e)
+// 搜索
+function search(e) { 
+	// console.log('search', e)
 }
-function searchCancel() { // 取消搜索
+// 取消搜索
+function searchCancel() { 
 	return
 }
-function searchOnBlur(e) { // 搜索栏失去焦点
-	console.log('searchOnBlur', e);
+// 搜索栏失去焦点
+function searchOnBlur(e) { 
+	// console.log('searchOnBlur', e);
 }
 
-
-// 待办列表
-const processes = ref([])
+// 获取待办列表数据
 function getProcessData({ pageNo, pSize }, callback) {
 	const params = {
 		staffId: userStore.user.useId,
@@ -108,6 +118,7 @@ function getProcessData({ pageNo, pSize }, callback) {
 		callback(returnParams.list, returnParams.total, pageNo)
 	})
 }
+// 分页获取待办列表数据
 function getProcessPage({ pageNo, pSize }, callback) {
 	const params = {
 		staffId: userStore.user.useId,
@@ -127,31 +138,31 @@ function getProcessPage({ pageNo, pSize }, callback) {
 		callback(returnParams.list, returnParams.total, pageNo)
 	})
 }
-
+// 跳转到流程详情页
 function handleToProcessDetail({ insId, insName }) {
 	$tab.navigateTo('/pages/process/detail/index?insId=' + insId + '&insName=' + insName)
 }
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
 @import url("@/static/font/ygoa/iconfont.css");
 
-.ygoa-icon {
-	font-size: 3rem;
-}
-
 .search_container {
 	.popup_button_container {
+		display: flex;
+		justify-content: center;
+		margin-left: 5px;
+		height: 36px;
+		line-height: 36px;
 		width: 100%;
 		padding-top: 10px;
-
-		.button {
-			font-size: 14px;
-			font-weight: bold;
-			color: #ffffff;
-			background-color: #1aad19;
-			height: 36px;
-			width: 100%;
+		background-color: #f5f5f5;
+		text-align: center;
+		font-size: 16px;
+		color: #333;
+		.button_text {
+			width: 64px;
+			margin-left: 4px;
 		}
 	}
 

+ 7 - 3
static/font/ygoa/iconfont.css

@@ -2,9 +2,9 @@
   font-family: "ygoa-icon"; /* Project id 4740271 */
   /* Color fonts */
   src: 
-       url('iconfont.woff2?t=1732330180971') format('woff2'),
-       url('iconfont.woff?t=1732330180971') format('woff'),
-       url('iconfont.ttf?t=1732330180971') format('truetype');
+       url('iconfont.woff2?t=1732590493983') format('woff2'),
+       url('iconfont.woff?t=1732590493983') format('woff'),
+       url('iconfont.ttf?t=1732590493983') format('truetype');
 }
 
 .ygoa-icon {
@@ -15,6 +15,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-filter:before {
+  content: "\e646";
+}
+
 .icon-goOut:before {
   content: "\e608";
 }

BIN
static/font/ygoa/iconfont.ttf


BIN
static/font/ygoa/iconfont.woff


BIN
static/font/ygoa/iconfont.woff2