Quellcode durchsuchen

feat(process):流程页数据获取

HMY vor 1 Jahr
Ursprung
Commit
98bd2e14d5
3 geänderte Dateien mit 151 neuen und 49 gelöschten Zeilen
  1. 48 0
      api/process.js
  2. 55 1
      components/ygoa/processList.vue
  3. 48 48
      pages/process/index.vue

+ 48 - 0
api/process.js

@@ -0,0 +1,48 @@
+import request from '@/utils/request.js'
+const preUrl = '/clientServices.do?iscrypt=1'
+//获取用户所有流程
+export function getUserAllProcess(params) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_2013V0100PHONE009',
+			'params': params
+		}
+	})
+}
+
+//获取用户办结流程
+export function getUserProcessed(params) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_2013V0100PHONE003',
+			'params': params
+		}
+	})
+}
+//获取用户待办流程
+export function getUserProcess(params) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_2013V0010PHONE001',
+			'params': params
+		}
+	})
+}
+
+//获取用户在办流程
+export function getUserProcessing(params) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_2013V0100PHONE002',
+			'params': params
+		}
+	})
+}

+ 55 - 1
components/ygoa/processList.vue

@@ -3,7 +3,7 @@
 		<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">
+					<!-- <uni-col :xs="4" :sm="2">
 						<view class="icon_container">
 							<text class="ygoa-icon" :class="process.type"></text>
 						</view>
@@ -36,6 +36,41 @@
 									<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>
+						</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.insName }}</text>
+										</view>
+									</uni-col>
+									<uni-col :xs="6" :sm="2">
+										<uni-tag :text="process.control == 0?'审批中':'已办结'"
+											:type="process.control == 0?'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-row>
+								<uni-row>
+									<uni-col :xs="8" :sm="7">创建时间:</uni-col>
+									<uni-col :xs="15" :sm="16">{{ process.createdate }}</uni-col>
+								</uni-row>
 							</view>
 						</uni-card>
 					</uni-col>
@@ -47,8 +82,27 @@
 
 <script setup lang="ts">
 	import $tab from '@/plugins/tab.js'
+	import { onMounted, ref } from 'vue';
+	
+
+	onMounted(() => {
+		startProcessCheck();
+	})
+	const intervalId = ref(null); // 定时器ID
+	
 	// TODO: 根据接口返回的数据动态生成process表单
 	const props = defineProps(['processes'])
+	function startProcessCheck() {
+		intervalId.value = setInterval(() => {
+			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)
 	}

+ 48 - 48
pages/process/index.vue

@@ -31,8 +31,8 @@
 		<view class="popup_container">
 			<uni-popup ref="searchItemPopup" type="bottom">
 				<uni-list>
-					<uni-list-item @click="clickSearchItem(item)" v-for="(item, index) in candidates" :key="index" clickable
-						:title="item">
+					<uni-list-item @click="clickSearchItem(item)" v-for="(item, index) in candidates" :key="index"
+						clickable :title="item">
 					</uni-list-item>
 				</uni-list>
 			</uni-popup>
@@ -43,10 +43,13 @@
 <script setup lang="ts">
 	import processList from '@/components/ygoa/processList.vue'
 	import { onMounted, reactive, ref } from 'vue';
+	import { useUserStore } from '@/store/user';
+	import { getUserProcess, getUserProcessed, getUserProcessing, getUserAllProcess } from '@/api/process';
+	const userStore = useUserStore();
 	// 分段器选项
 	const items = reactive(['我的', '待办', '在办', '办结'])
 	// 待办列表
-	let processes = reactive([])
+	const processes = ref([])
 	// 分段器选项
 	const current = ref(-1)
 
@@ -78,59 +81,56 @@
 	function searchOnBlur(e) { // 搜索栏失去焦点
 		console.log('searchOnBlur', e);
 	}
+
+	const params = ref({});
 	function onClickItem({ currentIndex }) { // 点击分段器选项
 		current.value = currentIndex
 		switch (currentIndex) {
 			case 0: // 我的
+				params.value = {
+					"staffId": userStore.user.useId,
+					"page": 1,
+					"pageNum": 5
+				}
+				getUserAllProcess(params).then(res => {
+					processes.value = res.returnParams.list;
+				});
+				break;
 			case 1: // 待办
+				params.value = {
+					"staffId": userStore.user.useId,
+					"page": 1,
+					"pageNum": 5,
+					"modelId": "",
+					"control": 1
+				}
+				getUserProcess(params).then(res => {
+					processes.value = res.returnParams.list;
+				});
+				break;
 			case 2: // 在办
-				processes = [
-					{
-						id: 1,
-						title: '账户1 的请假申请',
-						user: '账户1',
-						createTime: '2024/10/10',
-						startTime: '2024/10/10',
-						endTime: '2024/10/12',
-						totalTime: '2',
-						description: '请假说明请假说明请假说明请假说明请假说明',
-						type: 'icon-apply-leave',
-						step: 0
-					},
-					{
-						id: 1,
-						title: '账户2 的请假申请',
-						user: '账户2',
-						createTime: '2024/10/10',
-						startTime: '2024/10/10',
-						endTime: '2024/10/12',
-						totalTime: '2',
-						description: '请假说明请假说明',
-						type: 'icon-apply-leave',
-						step: 0
-					},
-					{
-						id: 2,
-						title: '账户2 的加班申请',
-						user: '账户2',
-						createTime: '2024/10/10',
-						startTime: '2024/10/10 17/30/00',
-						endTime: '2024/10/10 18/30/00',
-						totalTime: '1',
-						description: '加班说明加班说明',
-						type: 'icon-apply-overtime',
-						step: 0
-					}
-				]
+				params.value = {
+					"staffId": userStore.user.useId,
+					"page": 1,
+					"pageNum": 5,
+					"modelId": "",
+					"control": 1
+				}
+				getUserProcessing(params).then(res => {
+					processes.value = res.returnParams.list;
+				});
 				break;
-			// case 1:
-			// 	processes = []
-			// 	break;
-			// case 2:
-			// 	processes = []
-			// 	break;
 			case 3: // 办结
-				processes = []
+				params.value = {
+					"staffId": userStore.user.useId,
+					"page": 1,
+					"pageNum": 5,
+					"modelId": "",
+					"control": 1
+				}
+				getUserProcessed(params).then(res => {
+					processes.value = res.returnParams.list;
+				});
 				break;
 		}
 	}