Просмотр исходного кода

feat(process、process/detail、message): 流程审批功能

wangpx 1 год назад
Родитель
Сommit
24bb07257a
4 измененных файлов с 685 добавлено и 379 удалено
  1. 68 8
      api/process.js
  2. 247 237
      pages/message/index.vue
  3. 325 101
      pages/process/detail/index.vue
  4. 45 33
      pages/process/index.vue

+ 68 - 8
api/process.js

@@ -1,7 +1,7 @@
 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',
@@ -70,31 +70,91 @@ export function getUserProcessing(params) {
 	})
 }
 
+//获取待办流程数
+export function getUnProcessNum(userId, startTime) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2013V0100PHONE010',
+			params: {
+				staffId: userId, // useId
+				startTime: startTime // 开始时间
+			}
+		}
+	})
+}
+
+export function getProcessFlowInfo(userId, { tinsId, control }) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2013V0100PHONE005',
+			params: {
+				staffId: userId, // useId
+				tinsid: tinsId, // process.tinsId
+				control
+			}
+		}
+	})
+}
+
 //获取流程详情
-export function getProcessInfo(userId, insId) {
+export function getProcessFormInfo(userId, insId) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
 			serviceId: 'bpm_2020V0100PHONE006',
 			params: {
-				userId: userId, // useId
-				insId: insId // process.insId
+				userId, // useId
+				insId // process.insId
+			}
+		}
+	})
+}
+export function getProcessFormInfoInFlow(useId, {tinsId, insId, control}) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2013V0100PHONE006',
+			params: {
+				staffId: useId, // useId
+				tinsid: tinsId,
+				insId,
+				control
 			}
 		}
 	})
 }
 
-//获取待办流程数
-export function getUnProcessNum(userId,startTime) {
+export function getProcessFlow(userId, { insId, control }) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
-			serviceId: 'bpm_2013V0100PHONE010',
+			serviceId: 'bpm_2013V0100PHONE007',
 			params: {
 				staffId: userId, // useId
-				startTime: startTime // 开始时间
+				insid: insId, // process.insId
+				control
+			}
+		}
+	})
+}
+// 提交 流程审批
+export function submitProcessFlow(flow, form, control) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2013V0100PHONE008',
+			params: {
+				flow,
+				form,
+				control
 			}
 		}
 	})

+ 247 - 237
pages/message/index.vue

@@ -3,18 +3,18 @@
 		<uni-nav-bar dark :border="false" :fixed="true" title="宇光同行">
 		</uni-nav-bar>
 		<uni-collapse>
-			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="false">
+			<uni-collapse-item title-border="show" :border="true" :show-animation="true" :open="true">
 				<template v-slot:title>
 					<uni-section title="待办" type="line" titleFontSize="1.3rem">
 						<template v-slot:right>
 							<uni-badge :text="unProcessNum" style="margin-left: -10px;"
-								v-if="unProcessNum>0"></uni-badge>
+								v-if="unProcessNum > 0"></uni-badge>
 						</template>
 					</uni-section>
 				</template>
 				<view class="process_container">
 					<view class="process_list">
-						<process-list :list="processes" @clickSegment="getProcessData"
+						<process-list ref="processListRef" :list="processes" @clickSegment="getProcessData"
 							@clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="0" :pSize="5"
 							:pageNo="1" contentHeight="69.5vh"></process-list>
 					</view>
@@ -28,7 +28,7 @@
 			title="公告"></message-list>
 
 		<!-- 消息列表 -->
-		<message-list ref="msgListRef" @readMsg="setMsgRead" :unReadNum="unReadNum" :list="messages"
+		<message-list ref="msgListRef" @readMsg="setAllMsgRead" :unReadNum="unReadNum" :list="messages"
 			@clickSegment="getMessageData" @clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage"
 			:defaultCurrent="1" :pSize="5" :pageNo="1" :anime="true" :open="true"
 			:segments="{ '全部': '', '未读': '0', '已读': '1' }" title="消息"></message-list>
@@ -43,261 +43,271 @@
 </template>
 
 <script setup lang="ts">
-	import { onBeforeMount, onMounted, onUpdated, ref } from 'vue';
-	import { onLoad } from '@dcloudio/uni-app'
-	import { getMessageList, getNoticeList, getUnReadMessageNum, setMsgIsRead } from '@/api/message.js';
-	import { getUserProcess, getUnProcessNum } from '@/api/process';
-	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 { showConfirm } from '@/utils/common';
-	const userStore = useUserStore()
+import { onMounted, onUpdated, ref } from 'vue';
+import { onLoad } from '@dcloudio/uni-app'
+import { getMessageList, getNoticeList, getUnReadMessageNum, setMsgIsRead } from '@/api/message.js';
+import { getUserProcess, getUnProcessNum } from '@/api/process';
+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'
+const userStore = useUserStore()
 
-	onLoad((options) => {
-		// 是否跳转打卡页
-		if (options.to == 'clockIn') toClockIn()
+const processListRef = ref(null)
+onMounted(() => {
+	uni.$on('ReloadProcessData', (res) => {
+		console.log('res: ',res);
+		processListRef.value.onClickItem()
 	})
-	onUpdated(()=>{
-		showTarBarBadge();
+})
+onLoad((options) => {
+	// 是否跳转打卡页
+	if (options.to == 'clockIn') toClockIn()
+})
+onUpdated(() => {
+	showTarBarBadge();
+})
+// onMounted(() => {
+// 	showTarBarBadge();
+// })
+// 跳转打卡页
+function toClockIn() {
+	// 确认是否跳转打卡页
+	$modal.confirm('当前未打卡,是否前往打卡').then(() => {
+		$tab.navigateTo('/pages/mine/clockIn/clockIn')
 	})
-	// onMounted(() => {
-	// 	showTarBarBadge();
-	// })
-	// 跳转打卡页
-	function toClockIn() {
-		// 确认是否跳转打卡页
-		$modal.confirm('当前未打卡,是否前往打卡').then(() => {
-			$tab.navigateTo('/pages/mine/clockIn/clockIn')
-		})
-	}
-
-	//子组件
-	const msgListRef = ref(null)
-	//设置消息已读
-	function setMsgRead() {
-		$modal.confirm('是否一键已读').then(res => {
-			if (res) {
-				const params = {
-					currentUser: userStore.user.useId,
-					isRead: "0",
-					pSize: unReadNum.value,
-					type: "",
-					p: 1,
-				}
-				getMessageList(params).then(({ returnParams }) => {
-					const unReadMsgIds = returnParams.ids === "" ? "" : returnParams.ids + ",";
-					setMsgIsRead(unReadMsgIds).then((res) => {
-						if (Number.isInteger(res)) {
-							switch (res) {
-								case -1:
-									$modal.msgError('操作失败')
-									break
-								case -2:
-								case 0:
-									$modal.msg('不存在未读消息')
-									break
-								default:
-									$modal.msgSuccess('操作成功')
-									//刷新页面
-									msgListRef.value.reload();// 调用子组件刷新数据
-									// showTarBarBadge();
-							}
-						} else {
-							// $modal.msgError('jssesionid失效')
-							showConfirm('jssesionid失效,您可以继续留在该页面,或者重新登录?').then(res => {
-								if (res.confirm) {
-									userStore.LogOut().then(res => {
-										uni.reLaunch({ url: '/pages/login' })
-									})
-								}
-							})
-
-						}
-					})
-				})
-			}
-		})
-
+}
 
+// 待办列表
+const processes = ref([])
+// 获取待办消息列表数据
+function getProcessData({ pSize, pageNo }, callback) {
+	const params = {
+		staffId: userStore.user.useId,
+		page: pageNo,
+		pageNum: pSize,
+		modelId: "",
+		control: 1
 	}
-
-	// 待办列表
-	const processes = ref([])
-	// 获取待办消息列表数据
-	function getProcessData({ pSize, pageNo }, callback) {
-		const params = {
-			staffId: userStore.user.useId,
-			page: pageNo,
-			pageNum: pSize,
-			modelId: "",
-			control: 1
+	getUserProcess(params).then(({ returnParams }) => {
+		if (returnParams == undefined) {
+			processes.value = []
+			return
 		}
-		getUserProcess(params).then(({ returnParams }) => {
-			if (returnParams == undefined) {
-				processes.value = []
-				return
-			}
-			processes.value = returnParams.list;
-			callback(returnParams.list, returnParams.total, pageNo)
-		});
+		processes.value = returnParams.list;
+		callback(returnParams.list, returnParams.total, pageNo)
+	});
+}
+// 分页获取待办消息列表数据
+function getProcessPage({ pSize, pageNo }, callback) {
+	const params = {
+		staffId: userStore.user.useId,
+		page: pageNo,
+		pageNum: pSize,
+		modelId: "",
+		control: 1
 	}
-	// 分页获取待办消息列表数据
-	function getProcessPage({ pSize, pageNo }, callback) {
-		const params = {
-			staffId: userStore.user.useId,
-			page: pageNo,
-			pageNum: pSize,
-			modelId: "",
-			control: 1
-		}
-		getUserProcess(params).then(({ returnParams }) => {
-			processes.value.push(...returnParams.list)
-			callback(returnParams.list, returnParams.total, pageNo)
-		});
+	getUserProcess(params).then(({ returnParams }) => {
+		processes.value.push(...returnParams.list)
+		callback(returnParams.list, returnParams.total, pageNo)
+	});
+}
+// 点击待办消息列表项
+function handleToProcessDetail({ insId, tinsId, insName, control }) {
+	$tab.navigateTo('/pages/process/detail/index?insId=' + insId + '&tinsId=' + tinsId + '&insName=' + insName + '&control=' + control)
+}
+
+// 公告列表
+const notices = ref([])
+// 获取公告列表数据
+function getNoticeData({ pSize, pageNo }, callback) {
+	const params = {
+		notice_title: "",
+		p: pageNo,
+		pSize,
+		userId: userStore.user.useId,
+		unitId: userStore.user.unitId,
 	}
-	// 点击待办消息列表项
-	function handleToProcessDetail({ insId, insName, control }) {
-		$tab.navigateTo('/pages/process/detail/index?insId=' + insId + '&insName=' + insName + '&control=' + control)
+	getNoticeList(params).then(({ returnParams }) => {
+		notices.value = returnParams.noticelist.list
+		// 通知子组件加载完成
+		callback(returnParams.noticelist.list, returnParams.total, pageNo)
+	})
+}
+// 分页获取公告数据
+function getNoticePage({ pSize, pageNo }, callback) {
+	const params = {
+		notice_title: "",
+		p: pageNo,
+		pSize,
+		userId: userStore.user.useId,
+		unitId: userStore.user.unitId,
 	}
+	getNoticeList(params).then(({ returnParams }) => {
+		// 更新数据
+		notices.value.push(...returnParams.noticelist.list)
+		// 通知子组件加载完成
+		callback(returnParams.noticelist.list, returnParams.total, pageNo)
+	})
+}
+// 点击公告列表项
+function handleToNoticeDetail(notice) {
+	$tab.navigateTo('/pages/message/detail/index?noticeId=' + notice.id)
+}
 
-	// 公告列表
-	const notices = ref([])
-	// 获取公告列表数据
-	function getNoticeData({ pSize, pageNo }, callback) {
-		const params = {
-			notice_title: "",
-			p: pageNo,
-			pSize,
-			userId: userStore.user.useId,
-			unitId: userStore.user.unitId,
-		}
-		getNoticeList(params).then(({ returnParams }) => {
-			notices.value = returnParams.noticelist.list
-			// 通知子组件加载完成
-			callback(returnParams.noticelist.list, returnParams.total, pageNo)
-		})
+// 消息列表
+const messages = ref([])
+// 获取消息列表数据
+function getMessageData({ pSize, pageNo, type, segmentValue }, callback) {
+	const params = {
+		currentUser: userStore.user.useId,
+		isRead: segmentValue,
+		pSize: pSize,
+		type: type,
+		p: pageNo,
 	}
-	// 分页获取公告数据
-	function getNoticePage({ pSize, pageNo }, callback) {
-		const params = {
-			notice_title: "",
-			p: pageNo,
-			pSize,
-			userId: userStore.user.useId,
-			unitId: userStore.user.unitId,
-		}
-		getNoticeList(params).then(({ returnParams }) => {
-			// 更新数据
-			notices.value.push(...returnParams.noticelist.list)
-			// 通知子组件加载完成
-			callback(returnParams.noticelist.list, returnParams.total, pageNo)
+	getMessageList(params).then(({ returnParams }) => {
+		returnParams.list.forEach(item => {
+			if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
+				item.title = '(流程提醒)' + item.title.slice(12)
+			}
+			// return item
 		})
+		messages.value = returnParams.list;
+		// 通知子组件加载完成
+		callback(returnParams.list, returnParams.total, pageNo)
+	})
+}
+// 分页获取消息数据
+function getMessagePage({ pSize, pageNo, type, segmentValue }, callback) {
+	const params = {
+		currentUser: userStore.user.useId,
+		isRead: segmentValue,
+		pSize: pSize,
+		type: type,
+		p: pageNo,
 	}
-	// 点击公告列表项
-	function handleToNoticeDetail(notice) {
-		$tab.navigateTo('/pages/message/detail/index?noticeId=' + notice.id)
-	}
-
-	// 消息列表
-	const messages = ref([])
-	// 获取消息列表数据
-	function getMessageData({ pSize, pageNo, type, segmentValue }, callback) {
-		const params = {
-			currentUser: userStore.user.useId,
-			isRead: segmentValue,
-			pSize: pSize,
-			type: type,
-			p: pageNo,
-		}
-		getMessageList(params).then(({ returnParams }) => {
-			returnParams.list.forEach(item => {
-				if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
-					item.title = '(流程提醒)' + item.title.slice(12)
-				}
-				// return item
-			})
-			messages.value = returnParams.list;
-			// 通知子组件加载完成
-			callback(returnParams.list, returnParams.total, pageNo)
+	getMessageList(params).then(({ returnParams }) => {
+		returnParams.list.forEach(item => {
+			if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
+				item.title = '(流程提醒)' + item.title.slice(12)
+			}
+			// return item
 		})
-	}
-	// 分页获取消息数据
-	function getMessagePage({ pSize, pageNo, type, segmentValue }, callback) {
-		const params = {
-			currentUser: userStore.user.useId,
-			isRead: segmentValue,
-			pSize: pSize,
-			type: type,
-			p: pageNo,
-		}
-		getMessageList(params).then(({ returnParams }) => {
-			returnParams.list.forEach(item => {
-				if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
-					item.title = '(流程提醒)' + item.title.slice(12)
-				}
-				// return item
+		// 更新数据
+		messages.value.push(...returnParams.list)
+		// 通知子组件加载完成
+		callback(returnParams.list, returnParams.total, pageNo)
+	})
+}
+// 点击消息列表项
+function handleToMessageDetail({ messageid, universalid }) {
+	setMsgIsRead(universalid + ',').then((res) => {
+		if (Number.isInteger(res)) {
+			msgListRef.value.reload();// 调用子组件刷新数据
+			$tab.navigateTo('/pages/message/detail/index?messageId=' + messageid + '&universalId=' + universalid)
+		} else {
+			$modal.confirm('登录状态失效,您可以继续留在该页面,或者重新登录?').then(res => {
+				userStore.LogOut().then(res => {
+					uni.reLaunch({ url: '/pages/login' })
+				})
 			})
-			// 更新数据
-			messages.value.push(...returnParams.list)
-			// 通知子组件加载完成
-			callback(returnParams.list, returnParams.total, pageNo)
-		})
-	}
-	// 点击消息列表项
-	function handleToMessageDetail({ messageid, universalid }) {
-		$tab.navigateTo('/pages/message/detail/index?messageId=' + messageid + '&universalId=' + universalid)
-	}
+		}
+	})
+}
 
-	// AI咨询按钮
-	function clickFabButton() {
-		console.log('clickFabButton');
-		$tab.navigateTo('/pages/message/chat/index')
-	}
-	//待办流程数
-	const unProcessNum = ref(0)
-	//未读消息数
-	const unReadNum = ref(0)
-	//待阅消息数+待办流程数(用于tarbar导航栏)
-	const unReadMsgNum = ref(0)
-	function showTarBarBadge() {
-		getUnProcessNum(userStore.user.useId, "").then(res => {
-			if ("failed" == res.returnMsg) {
-				$modal.showToast('待办流程数获取失败')
-				return
+// AI咨询按钮
+function clickFabButton() {
+	console.log('clickFabButton');
+	$tab.navigateTo('/pages/message/chat/index')
+}
+//待办流程数
+const unProcessNum = ref(0)
+//未读消息数
+const unReadNum = ref(0)
+//待阅消息数+待办流程数(用于tarbar导航栏)
+const unReadMsgNum = ref(0)
+function showTarBarBadge() {
+	getUnProcessNum(userStore.user.useId, "").then(res => {
+		if ("failed" == res.returnMsg) {
+			$modal.showToast('待办流程数获取失败')
+			return
+		} else {
+			unProcessNum.value = parseInt(res.returnParams.total, 10);
+		}
+		getUnReadMessageNum(userStore.user.useId).then(res => {
+			unReadNum.value = parseInt(res.returnParams, 10);
+			unReadMsgNum.value = unReadNum.value + unProcessNum.value;
+			if (unReadMsgNum.value == 0) {
+				uni.removeTabBarBadge({
+					index: 0
+				})
 			} else {
-				unProcessNum.value = parseInt(res.returnParams.total, 10);
+				uni.setTabBarBadge({
+					index: 0,
+					text: unReadMsgNum.value > 99 ? '99+' : String(unReadMsgNum.value)
+				})
 			}
-			getUnReadMessageNum(userStore.user.useId).then(res => {
-				unReadNum.value = parseInt(res.returnParams, 10);
-				unReadMsgNum.value = unReadNum.value + unProcessNum.value;
-				if (unReadMsgNum.value == 0) {
-					uni.removeTabBarBadge({
-						index: 0
-					})
-				} else {
-					uni.setTabBarBadge({
-						index: 0,
-						text: unReadMsgNum.value > 99 ? '99+' : String(unReadMsgNum.value)
-					})
-				}
-			})
 		})
-
-	}
+	})
+}
+//子组件
+const msgListRef = ref(null)
+// 设置所有消息已读
+function setAllMsgRead() {
+	$modal.confirm('是否全部已读').then(res => {
+		if (res) {
+			const params = {
+				currentUser: userStore.user.useId,
+				isRead: "0",
+				pSize: unReadNum.value,
+				type: "",
+				p: 1,
+			}
+			getMessageList(params).then(({ returnParams }) => {
+				const unReadMsgIds = returnParams.ids === "" ? "" : returnParams.ids + ",";
+				setMsgIsRead(unReadMsgIds).then((res) => {
+					if (Number.isInteger(res)) {
+						switch (res) {
+							case -1:
+								$modal.msgError('操作失败')
+								break
+							case -2:
+							case 0:
+								$modal.msg('不存在未读消息')
+								break
+							default:
+								$modal.msgSuccess('操作成功')
+								//刷新页面
+								msgListRef.value.reload();// 调用子组件刷新数据
+							// showTarBarBadge();
+						}
+					} else {
+						$modal.confirm('登录状态失效,您可以继续留在该页面,或者重新登录?').then(res => {
+							userStore.LogOut().then(res => {
+								uni.reLaunch({ url: '/pages/login' })
+							})
+						})
+				
+					}
+				})
+			})
+		}
+	})
+}
 </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;
-	}
+.text {
+	text-align: center;
+	font-size: 26rpx;
+	margin-top: 10rpx;
+}
 
-	::v-deep .uni-section-header__content {
-		max-width: 3rem;
-	}
+::v-deep .uni-section-header__content {
+	max-width: 3rem;
+}
 </style>

+ 325 - 101
pages/process/detail/index.vue

@@ -1,129 +1,353 @@
 <template>
-	<view>
-		<uni-card>
-			<uni-list>
-				<uni-list-item v-for="(elem, index) in formElements" :key="index">
-					<template v-slot:header>
-						<text class="element_name">{{ elem.elementName }}</text>
-					</template>
-					<template v-slot:footer>
-						<text class="element_value">{{ elem.defaultValue }}</text>
-					</template>
-				</uni-list-item>
-			</uni-list>
-		</uni-card>
+	<view class="process_detail_container">
+		<view class="main_container">
+			<uni-card>
+				<uni-section titleFontSize="1.3rem" title="申请内容" type="line"></uni-section>
+				<uni-list>
+					<uni-list-item v-for="(elem, index) in formElements" :key="index">
+						<template v-slot:header>
+							<text class="element_name">{{ elem.elementName }}</text>
+						</template>
+						<template v-slot:footer>
+							<text class="element_value">{{ elem.defaultValue }}</text>
+						</template>
+					</uni-list-item>
+				</uni-list>
+			</uni-card>
+		</view>
+		<view>
 		<!-- 重复表 -->
-		<uni-card v-if="repeatingFormNotEmpty">
-			<button @click="handlerepeatingForm" type="primary">查看重复表</button>
-		</uni-card >
-		<uni-popup v-if="repeatingFormNotEmpty" ref="repeatingFormPopup">
-			<uni-card margin="0px" spacing="0px" padding="0px">
-				<view class="repeating_table_container">
-					<uni-table :border="true" stripe>
-						<uni-tr>
-							<uni-th align="center" v-for="(item, index) in repeatingForm.elementItem" :key="index">
-							{{ item.elementName.slice(3, 5) }}
-							<!-- {{ item.elementName.slice(3) }} -->
-							</uni-th>
-						</uni-tr>
-						<uni-tr v-for="(item, index) in (repeatingForm.elements.length / repeatingForm.elementItem.length)" :key="index">
-							<uni-td align="center" v-for="col in repeatingForm.elementItem.length" :key="col">
-							<!-- (列数 - 1) * 总行数 + 当前行数 -->
-							{{repeatingForm.elements[(col-1)*(repeatingForm.elements.length / repeatingForm.elementItem.length) + index]!.defaultValue}}
-							</uni-td>
-						</uni-tr>
-					</uni-table>
-				</view>
+			<uni-card v-if="repeatingFormNotEmpty" spacing="0" padding="0">
+				<button @click="handlerepeatingForm" type="primary">查看重复表</button>
 			</uni-card>
-		</uni-popup>
+			<uni-popup v-if="repeatingFormNotEmpty" ref="repeatingFormPopup">
+				<uni-card margin="0px" spacing="0px" padding="0px">
+					<view class="repeating_table_container">
+						<uni-table :border="true" stripe>
+							<uni-tr>
+								<uni-th align="center" v-for="(item, index) in repeatingForm.elementItem" :key="index">
+									{{ item.elementName.slice(3, 5) }}
+								</uni-th>
+							</uni-tr>
+							<uni-tr
+								v-for="(item, index) in (repeatingForm.elements.length / repeatingForm.elementItem.length)"
+								:key="index">
+								<uni-td align="center" v-for="col in repeatingForm.elementItem.length" :key="col">
+									<!-- (列数 - 1) * 总行数 + 当前行数 -->
+									{{ repeatingForm.elements[(col - 1) * (repeatingForm.elements.length /
+										repeatingForm.elementItem.length) + index]!.defaultValue}}
+								</uni-td>
+							</uni-tr>
+						</uni-table>
+					</view>
+				</uni-card>
+			</uni-popup>
+		</view>
 		<!-- 附件 -->
 		<view v-for="(item, index) in fileList" :key="index">
-			<uni-card  v-if="item.files.length > 0">
-				<attachment-list :attachments="item.files" ></attachment-list>
+			<uni-card v-if="item.files.length != undefined && item.files.length > 0">
+				<uni-section titleFontSize="1.3rem" title="附件" type="line"></uni-section>
+				<attachment-list :attachments="item.files"></attachment-list>
+			</uni-card>
+		</view>
+		<view class="flow_step_container">
+			<uni-card>
+				<uni-section titleFontSize="1.3rem" title="流转过程" type="line"></uni-section>
+				<up-steps :current="stepActive" activeColor="#18bc37" inactiveColor="#2979ff" direction="column">
+					<view v-for="(step, index) in options">
+						<up-steps-item v-if="step.state == 3" :title="step.title" :desc="step.desc" :key="index" error>
+						</up-steps-item>
+						<up-steps-item v-else-if="index == stepActive" :title="step.title" :desc="step.desc" :key="index">
+							<template #icon>
+								<view class="active_step_circle">
+									<text class="active_step_text">{{ index + 1 }}</text>
+								</view>
+							</template>
+						</up-steps-item>
+						<up-steps-item v-else :title="step.title" :desc="step.desc" :key="index"></up-steps-item>
+					</view>
+				</up-steps>
+			</uni-card>
+		</view>
+		<view v-if="processInfo.tinsId">
+			<view class="remark_container">
+				<uni-card>
+					<uni-section titleFontSize="1.3rem" title="备注" type="line"></uni-section>
+					<view class="remark_content">
+						<uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入"></uni-easyinput>
+					</view>
+				</uni-card>
+			</view>
+		</view>
+		<view v-if="processInfo.tinsId" class="approve_button">
+			<uni-card spacing="0" padding="0">
+				<button :loading="!button_state" type="primary" @click="submitProcess('1')">通过</button>
+			</uni-card>
+		</view>
+	</view>
+	<view v-if="processInfo.tinsId">
+		<view class="reject_button">
+			<uni-card spacing="0" padding="0" :is-shadow="false" :border="false">
+				<uni-row>
+					<uni-col :span="11">
+						<button :loading="!button_state" type="warn" @click="submitProcess('0')">退回上一级</button>
+					</uni-col>
+					<uni-col :span="11" :offset="2">
+						<button :loading="!button_state" type="warn" @click="submitProcess('2')">退回发起人</button>
+					</uni-col>
+				</uni-row>
 			</uni-card>
 		</view>
 	</view>
+	<view style="height: 5px; margin-top: 10px;"></view>
 </template>
 
 <script setup lang="ts">
-	import { onMounted, reactive, ref } from 'vue'
-	import { onLoad } from '@dcloudio/uni-app'
-	import attachmentList from '@/components/ygoa/attachmentList.vue'
-	import { getProcessInfo } from '@/api/process.js'
-	import { useUserStore } from '@/store/user.js'
-	const userStore = useUserStore()
-	const processInfo = reactive({
-		insId: '',
-		insName: ''
-	})
-	onLoad(({insId, insName}) => {
-		// 获取传入的标题参数
-		const title = insName || '流程信息';
-		processInfo.insId = insId
-		processInfo.insName = insName
-		// 设置导航栏标题
-		uni.setNavigationBarTitle({
-			title: title
-		});
+import { onMounted, reactive, ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+import attachmentList from '@/components/ygoa/attachmentList.vue'
+import $tab from '@/plugins/tab.js'
+import $modal from '@/plugins/modal.js'
+import { getProcessFlowInfo, getProcessFormInfo, getProcessFormInfoInFlow, getProcessFlow, submitProcessFlow } from '@/api/process.js'
+import { useUserStore } from '@/store/user.js'
+const userStore = useUserStore()
+const processInfo = reactive({
+	insId: '',
+	insName: '',
+	control: 1,
+	tinsId: undefined
+})
+onLoad(({ insId, tinsId, insName, control }) => {
+	// 获取传入的标题参数
+	const title = insName || '流程信息';
+	processInfo.insId = insId
+	processInfo.insName = insName
+	processInfo.control = control
+	if (tinsId) {
+		processInfo['tinsId'] = tinsId
+	}
+	// 设置导航栏标题
+	uni.setNavigationBarTitle({
+		title: title
+	});
+})
+
+onMounted(() => {
+	initProcessInfo()
+	initProcessFlow()
+})
+
+const repeatingForm = ref({
+	elements: [],
+	elementItem: [],
+})
+const repeatingFormNotEmpty = ref(false)
+function repeatingFormHasValue() {
+	if (repeatingForm.value === undefined) return
+	if (repeatingForm.value.elementItem.length <= 0) return
+	repeatingForm.value.elements.forEach(({ defaultValue }) => {
+		if (defaultValue != "") {
+			repeatingFormNotEmpty.value = true
+			return new Promise((resolve, reject) => {
+				resolve(repeatingFormNotEmpty)
+			})
+		}
 	})
-	
-	onMounted(() => {
-		initProcessInfo()
+
+}
+const formElements = ref([])
+const formInfo = ref({
+	formElements: [],
+	formId: '',
+	formInsId: ''
+})
+const fileList = ref([])
+function initProcessInfo() {
+		if (processInfo.tinsId) {
+			getProcessFormInfoInFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
+				formElements.value = returnParams.formElements
+				formInfo.value = returnParams.formInfo[0]
+				repeatingForm.value = returnParams.repeatingForm
+				// fileList.value = returnParams.fileList
+				repeatingFormHasValue()
+			})
+		} else {
+			getProcessFormInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
+				formElements.value = returnParams.formElements
+				repeatingForm.value = returnParams.repeatingForm
+				fileList.value = returnParams.fileList
+				repeatingFormHasValue()
+			})
+		}
+}
+const options = ref([])
+const stepActive = ref(-1)
+const flowInfo = ref({})
+function initProcessFlow() {
+	getProcessFlow(userStore.user.useId, processInfo).then(({returnParams}) => {
+		options.value = returnParams.list.map((item, index) => {
+			const { tmodelName, name, createdate, finishdate, remark, state } = item
+			if (state == 1) {
+				stepActive.value = index
+			}
+			const title = tmodelName + (name==''?'':' ( ' + name  + ' )')
+			const desc = '创建时间: ' + createdate 
+			+ (finishdate==''?'\n':'\n办理时间: ' + finishdate)
+			+ (remark=='\n'?'':'\n环节意见: ' + remark)
+			return {
+				title,
+				desc,
+				state
+			}
+		})
+		if (stepActive.value === -1) stepActive.value = returnParams.list.length
+		// 获取未完成过程
+		if (processInfo.tinsId) {
+			getProcessFlowInfo(userStore.user.useId, processInfo).then(({returnParams}) => {
+				options.value.push({title: returnParams.nextTmodels[0].nextTmodelName})
+				flowInfo.value = returnParams.flow[0]
+				fileList.value = [
+					{files: returnParams.flow[0].files}
+				]
+			})
+		}
 	})
-	
-	const repeatingForm = ref({
-		elements: [],
-		elementItem: [],
+}
+
+const repeatingFormPopup = ref(null)
+function handlerepeatingForm() {
+	repeatingFormPopup.value.open()
+}
+
+const button_state = ref(true)
+const remark = ref('')
+function submitProcess(result) {
+	console.log('formElements: ',formElements);
+	formInfo.value.formElements = formElements.value.map(({tableField, defaultValue}) => {
+		return {
+			name: tableField,
+			value: defaultValue
+		}
 	})
-	const repeatingFormNotEmpty = ref(false)
-	function repeatingFormHasValue() {
-		if (repeatingForm.value === undefined) return
-		if (repeatingForm.value.elementItem.length <= 0) return
-		repeatingForm.value.elements.forEach(({defaultValue}) => {
-			if (defaultValue != "") {
-				repeatingFormNotEmpty.value = true
-				return new Promise((resolve, reject) => {
-					resolve(repeatingFormNotEmpty)
-				})
+	let flow = Object.assign({}, flowInfo.value)
+	flow['staffId'] = userStore.user.useId
+	flow['gxId'] = userStore.user.gxId
+	flow['groupId'] = flowInfo.value.groupid
+	flow['fileIds'] = ''
+	// result: 1通过 2退回发起人 0退回上一级
+	flow['result'] = result
+	flow['remark'] = remark.value
+	flow['nextTmodelId'] = 'undefined'
+	submitProcessFlow(flow, formInfo.value, processInfo.control).then(({returnMsg}) => {
+		if (returnMsg.includes('提交失败')) {
+			// 启用提交按钮
+			button_state.value = true
+			$modal.msgError(returnMsg)
+		} else {
+			$modal.msgSuccess(returnMsg)
+			// 通知列表刷新数据
+			uni.$emit('ReloadProcessData', '测试$emit');
+			setTimeout(()=> {
+				$tab.navigateBack();
+			}, 1000)
 			}
-		})
-		
-	}
-	const formElements = ref([])
-	const fileList = ref([])
-	function initProcessInfo() {
-		getProcessInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
-			formElements.value = returnParams.formElements
-			repeatingForm.value = returnParams.repeatingForm
-			fileList.value = returnParams.fileList
-			repeatingFormHasValue()
-		})
-	}
-	const repeatingFormPopup = ref(null)
-	function handlerepeatingForm() {
-		repeatingFormPopup.value.open()
-	}
+	})
+}
 </script>
 
 <style lang="scss">
 .element_name {
 	width: 10rem;
+	font-weight: 600;
 }
+
 .element_value {
 	width: 100%;
 }
-.repeating_table_container {
-	width: 98vw;
-	.uni-table-scroll {
-		max-height: 80vh;
-		.uni-table {
-			min-width: 100% !important;
-			.uni-table-th {
-				min-width: 50px;
-				background-color: #2979ff;
-				font-weight: bold;
-				color: #fcfcfc;
+
+.uni-section {
+	margin-left: -15px;
+	margin-bottom: 10px;
+}
+.process_detail_container {
+	position: relative;
+	.main_container {
+		min-height: 70vh;
+	}
+	.repeating_table_container {
+		width: 98vw;
+	
+		.uni-table-scroll {
+			max-height: 80vh;
+	
+			.uni-table {
+				min-width: 100% !important;
+	
+				.uni-table-th {
+					min-width: 50px;
+					background-color: #2979ff;
+					font-weight: bold;
+					color: #fcfcfc;
+				}
+			}
+		}
+	}
+	.flow_step_container {
+		.u-steps {
+			.u-steps-item {
+				padding-bottom: 11px;
+				.active_step_circle {
+					width: 20px;
+					height: 20px;
+					box-sizing: border-box;
+					flex-shrink: 0;
+					border-radius: 100px;
+					border-width: 1px;
+					border-color: #A78BFA;
+					background-color: #A78BFA;
+					border-style: solid;
+					display: flex;
+					flex-direction: row;
+					align-items: center;
+					justify-content: center;
+					transition: background-color .3s;
+					.active_step_text {
+						color: #fff;
+						font-size: 11px;
+						display: flex;
+						flex-direction: row;
+						align-items: center;
+						justify-content: center;
+						text-align: center;
+						line-height: 11px;
+					}
+				}
 			}
+			.u-steps-item view:last-of-type {
+				margin-top: 0 !important;
+				.u-text__value--content {
+					font-size: 16px !important;
+				}
+				.u-text__value--main {
+					font-size: 16px !important;
+				}
+			}
+		}
+	}
+	.remark_container {
+		.remark_content{
+			margin-bottom: 10px;
+		}
+	}
+	.approve_button {
+		position: sticky;
+		z-index: 999;
+		width: 100%;
+		bottom: 10px;
+	}
+	.reject_button  {
+		.uni-card {
+			background-color: transparent;
 		}
 	}
 }

+ 45 - 33
pages/process/index.vue

@@ -45,36 +45,43 @@
 
 <script setup lang="ts">
 import processList from '@/components/ygoa/processList.vue'
-import { reactive, ref,onMounted } from 'vue';
+import { onShow } from '@dcloudio/uni-app'
+import { reactive, ref, onMounted } from 'vue';
 import $tab from '@/plugins/tab.js'
-import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess,getUnProcessNum } from '@/api/process';
+import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess, getUnProcessNum } from '@/api/process';
 import { useUserStore } from '@/store/user';
 import { getUnReadMessageNum } from '@/api/message';
-
-onMounted(()=>{
-	showTarBarBadge();
+// onShow(() =>  {
+// 	console.log('isBack: ',someData.value);
+// })
+onMounted(() => {
+	showTarBarBadge()
+	uni.$on('ReloadProcessData', (res) => {
+		console.log('res: ',res);
+		processListRef.value.onClickItem()
+	})
 })
-function showTarBarBadge(){
-		let unReadMsgNum=0;
-		let unProcessNum=0;
-		getUnProcessNum(userStore.user.useId,"").then(res=>{
-			unProcessNum=parseInt(res.returnParams.total, 10);
-			getUnReadMessageNum(userStore.user.useId).then(res=>{
-				unReadMsgNum=parseInt(res.returnParams, 10)+unProcessNum;
-				if(unReadMsgNum==0){
-					uni.removeTabBarBadge({
-						index:0
-					})
-				}else{
-					uni.setTabBarBadge({
-					  index: 0,
-					  text: unReadMsgNum>99?'99+':String(unReadMsgNum)
-					})
-				}
-			})
+function showTarBarBadge() {
+	let unReadMsgNum = 0;
+	let unProcessNum = 0;
+	getUnProcessNum(userStore.user.useId, "").then(res => {
+		unProcessNum = parseInt(res.returnParams.total, 10);
+		getUnReadMessageNum(userStore.user.useId).then(res => {
+			unReadMsgNum = parseInt(res.returnParams, 10) + unProcessNum;
+			if (unReadMsgNum == 0) {
+				uni.removeTabBarBadge({
+					index: 0
+				})
+			} else {
+				uni.setTabBarBadge({
+					index: 0,
+					text: unReadMsgNum > 99 ? '99+' : String(unReadMsgNum)
+				})
+			}
 		})
-		
-	}
+	})
+
+}
 const userStore = useUserStore();
 // 分段器选项
 const items = reactive(['我的', '待办', '在办', '办结'])
@@ -99,28 +106,28 @@ 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) { 
+function search(e) {
 	// console.log('search', e)
 }
 // 取消搜索
-function searchCancel() { 
+function searchCancel() {
 	return
 }
 // 搜索栏失去焦点
-function searchOnBlur(e) { 
+function searchOnBlur(e) {
 	// console.log('searchOnBlur', e);
 }
 
@@ -165,8 +172,12 @@ function getProcessPage({ pageNo, pSize }, callback) {
 	})
 }
 // 跳转到流程详情页
-function handleToProcessDetail({ insId, insName }) {
-	$tab.navigateTo('/pages/process/detail/index?insId=' + insId + '&insName=' + insName)
+function handleToProcessDetail({ insId, tinsId, insName, control }) {
+	let url = '/pages/process/detail/index?insId=' + insId + '&insName=' + insName + '&control=' + control
+	if (tinsId) {
+		url = url + '&tinsId=' + tinsId
+	}
+	$tab.navigateTo(url)
 }
 </script>
 
@@ -186,6 +197,7 @@ function handleToProcessDetail({ insId, insName }) {
 		text-align: center;
 		font-size: 16px;
 		color: #333;
+
 		.button_text {
 			width: 64px;
 			margin-left: 4px;