Browse Source

feat(App、message): 登录未打卡跳转打卡页面
feat(work): 考勤、打卡按钮页面跳转
fix(request): 错误返回时提示信息参数名错误

wangpx 1 year ago
parent
commit
985a631deb
11 changed files with 535 additions and 532 deletions
  1. 56 42
      App.vue
  2. 7 7
      api/login.js
  3. 21 17
      api/mine.js
  4. 1 1
      api/work.js
  5. 125 126
      pages/contacts/group/index.vue
  6. 60 61
      pages/contacts/index.vue
  7. 6 0
      pages/message/index.vue
  8. 0 1
      pages/mine/checkIn/checkIn.vue
  9. 102 103
      pages/work/edit/index.vue
  10. 148 166
      pages/work/index.vue
  11. 9 8
      utils/request.js

+ 56 - 42
App.vue

@@ -1,31 +1,46 @@
 <script>
-  import { getUserInfo } from '@/utils/auth'
-	import $tab from '@/plugins/tab.js'
-	export default {
-		onLaunch: function() {
-			console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
-      this.initApp()
-			console.log('App Launch')
+import { getUserInfo } from '@/utils/auth'
+import { CheckAttendance } from '@/api/mine.js'
+import $tab from '@/plugins/tab.js'
+export default {
+	onLaunch: function () {
+		console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
+		this.initApp()
+		console.log('App Launch')
+	},
+	onShow: function () {
+		console.log('App Show')
+	},
+	onHide: function () {
+		console.log('App Hide')
+	},
+	methods: {
+		// 初始化应用
+		initApp() {
+			// 初始化应用配置
+			// this.initConfig()
+			// 检查用户登录状态
+			this.checkLogin()
 		},
-		onShow: function() {
-			console.log('App Show')
-		},
-		onHide: function() {
-			console.log('App Hide')
-		},
-		methods: {
-			  // 初始化应用
-			  initApp() {
-			    // 初始化应用配置
-			    // this.initConfig()
-			    // 检查用户登录状态
-			    this.checkLogin()
-			  },
-      checkLogin() {
-        if (!getUserInfo()) {
-          $tab.reLaunch('/pages/login')
+		checkLogin() {
+			const user = getUserInfo()
+			if (!getUserInfo()) {
+				$tab.reLaunch('/pages/login')
         } else {
-          $tab.reLaunch('/pages/message/index')
+					const now = new Date()
+					const params = {
+						universalid: user.useId,
+						rizi: (now.getFullYear()) + '-' + (now.getMonth() + 1) + '-' + (now.getDate())
+					}
+					CheckAttendance(params).then(({ returnParams }) => { // 获取当天考勤信息
+						if (returnParams.list.length) { 
+							// 已签到 跳转消息页面
+							$tab.reLaunch('/pages/message/index')
+						} else { 
+							// 未签到 跳转考勤页面
+							$tab.reLaunch('/pages/message/index?to=clockIn')
+						}
+					})
 				}
       }
 		}
@@ -33,24 +48,23 @@
 </script>
 
 <style lang="scss">
-	/*每个页面公共css */
-	@import '@/uni_modules/uni-scss/index.scss';
-	/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
-	@import '@/common/uni.css';
-	/* #ifndef APP-NVUE */
-	@import '@/static/font/customicons.css';
-	/* uParse富文本框渲染 样式 */
-	@import url("/components/gaoyia-parse/parse.css");
+/*每个页面公共css */
+@import '@/uni_modules/uni-scss/index.scss';
+/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
+@import '@/common/uni.css';
+/* #ifndef APP-NVUE */
+@import '@/static/font/customicons.css';
+/* uParse富文本框渲染 样式 */
+@import url("/components/gaoyia-parse/parse.css");
 
-	// 设置整个项目的背景色
-	page {
-		background-color: #f5f5f5;
-	}
+// 设置整个项目的背景色
+page {
+	background-color: #f5f5f5;
+}
 
-	/* #endif */
-	.example-info {
-		font-size: 14px;
-		color: #333;
-		padding: 10px;
+/* #endif */
+.example-info {
+	font-size: 14px;
+	color: #333;	padding: 10px;
 	}
 </style>

+ 7 - 7
api/login.js

@@ -8,10 +8,10 @@ export function login(username, password) {
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'eu_2013V01login',
-			'params': {
-				"userName": username,
-				"password": password
+			serviceId: 'eu_2013V01login',
+			params: {
+				userName: username,
+				password: password
 			}
 		}
 	})
@@ -22,9 +22,9 @@ export function getInfo(useId) {
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'eu_2013V01loadMe',
-			'params': {
-				"staffId": useId
+			serviceId: 'eu_2013V01loadMe',
+			params: {
+				staffId: useId
 			}
 		}
 	})

+ 21 - 17
api/mine.js

@@ -7,49 +7,53 @@ export function getUserInfo(useId) {
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'eu_2013V01loadMe',
-			'params': {
-				"staffId": useId
+			serviceId: 'eu_2013V01loadMe',
+			params: {
+				staffId: useId
 			}
 		}
 	})
 }
 
 //检查今日考勤状况
-export function CheckAttendance(params) {
+export function CheckAttendance({ universalid, rizi }) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'hr_2018V01CheckAttendance',
-			'params': params
+			serviceId: 'hr_2018V01CheckAttendance',
+			params: {
+				universalid,
+				rizi
+			}
 		}
 	})
 }
 
 //获取我的考勤数据统计
-export function getMyTotalCount(params) {
+export function getMyTotalCount({ staffId, start_date, end_date }) {
 	return request({
 		url: preUrl,
 		method: 'post',
 		data: {
-			'serviceId': 'hr_2015V01getMyTotalCount',
-			'params': params
+			serviceId: 'hr_2015V01getMyTotalCount',
+			params: {
+				staffId,
+				start_date,
+				end_date
+			}
 		}
 	})
 }
 
-
-
-
 //考勤打卡
 export function createAttendance(params) {
 	return request({
 		url: preUrl,
-		method:'post',
+		method: 'post',
 		data: {
-			'serviceId': 'hr_2018V01CreateAttendance',
-			'params': params
+			serviceId: 'hr_2018V01CreateAttendance',
+			params: params
 		}
 	})
 }
@@ -58,7 +62,7 @@ export function createAttendance(params) {
 export function TranAddress(locationStr) {
 	return request({
 		baseUrl: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + locationStr + '&key=' + config.mapKey +
-				'&get_poi=1',
-		method:'GET'
+			'&get_poi=1',
+		method: 'GET'
 	})
 }

+ 1 - 1
api/work.js

@@ -18,7 +18,7 @@ export function getProcessList(staffId, unitId) {
 }
 
 // 获取流程信息
-export function getProcessInfo({modelId, control}) {
+export function getProcessInfo({ modelId, control }) {
 	return request({
 		url: preUrl,
 		method: 'post',

+ 125 - 126
pages/contacts/group/index.vue

@@ -7,10 +7,11 @@
 					<view class="chat_list">
 						<uni-list :border="true">
 							<uni-list-chat :to="`../../mine/personal_message/personal_message?id=${id}&name=${name}`"
-								v-for="({ id, name, phone, avatar}, index) in item" @click="clickChat" :title="name" :avatar="avatar"
-								:note="phone" time="研发部" :clickable="true" :avatar-circle="true" :key="index">
-								</uni-list-chat>
-		
+								v-for="({ id, name, phone, avatar }, index) in item" @click="clickChat" :title="name"
+								:avatar="avatar" :note="phone" time="研发部" :clickable="true" :avatar-circle="true"
+								:key="index">
+							</uni-list-chat>
+
 						</uni-list>
 					</view>
 				</uv-index-item>
@@ -20,128 +21,126 @@
 </template>
 
 <script setup lang="ts">
-	import { onMounted, reactive, ref } from 'vue'
-	import headImg from "/static/images/mine/headImg.jpg";
-	const indexList = ref([])
-	const itemArr = ref([])
-	onMounted(() => {
-		const dept = '研发部'
-		uni.setNavigationBarTitle({
-			title: dept
-		});
-		indexList.value = ["A", "B", "C", "F", "G"]
-		itemArr.value = [
-			[
-				{
-					id: 1,
-					name: '张三',
-					phone: '13579543684',
-					avatar: headImg
-				},
-				{
-					id: 2,
-					name: '李四',
-					phone: '13987654321',
-					avatar: headImg
-				},
-				{
-					id: 3,
-					name: '王五',
-					phone: '13812345678',
-					avatar: headImg
-				},
-			],
-			[
-				{
-					id: 4,
-					name: '赵六',
-					phone: '13765432109',
-					avatar: headImg
-				},
-				{
-					id: 5,
-					name: '孙七',
-					phone: '13698765432',
-					avatar: headImg
-				},
-				{
-					id: 6,
-					name: '周八',
-					phone: '13524689753',
-					avatar: headImg
-				}
-			],
-			[
-				{
-					id: 7,
-					name: '吴九',
-					phone: '13456789012',
-					avatar: headImg
-				},
-				{
-					id: 8,
-					name: '郑十',
-					phone: '13367890123',
-					avatar: headImg
-				},
-				{
-					id: 9,
-					name: '钱十一',
-					phone: '13278901234',
-					avatar: headImg
-				}
-			],
-			
-			[
-				{
-					id: 16,
-					name: '郑十八',
-					phone: '13876543210',
-					avatar: headImg
-				},
-				{
-					id: 17,
-					name: '吴十九',
-					phone: '13712345678',
-					avatar: headImg
-				},
-				{
-					id: 18,
-					name: '周二十',
-					phone: '13534567890',
-					avatar: headImg
-				}
-			],
-			[
-				{
-					id: 19,
-					name: '二十一',
-					phone: '13445678901',
-					avatar: headImg
-				},
-				{
-					id: 20,
-					name: '二十二',
-					phone: '13356789012',
-					avatar: headImg
-				},
-				{
-					id: 21,
-					name: '二十三',
-					phone: '13267890123',
-					avatar: headImg
-				}
-			]
+import { onMounted, ref } from 'vue'
+import headImg from "/static/images/mine/headImg.jpg";
+const indexList = ref([])
+const itemArr = ref([])
+onMounted(() => {
+	const dept = '研发部'
+	uni.setNavigationBarTitle({
+		title: dept
+	});
+	indexList.value = ["A", "B", "C", "F", "G"]
+	itemArr.value = [
+		[
+			{
+				id: 1,
+				name: '张三',
+				phone: '13579543684',
+				avatar: headImg
+			},
+			{
+				id: 2,
+				name: '李四',
+				phone: '13987654321',
+				avatar: headImg
+			},
+			{
+				id: 3,
+				name: '王五',
+				phone: '13812345678',
+				avatar: headImg
+			},
+		],
+		[
+			{
+				id: 4,
+				name: '赵六',
+				phone: '13765432109',
+				avatar: headImg
+			},
+			{
+				id: 5,
+				name: '孙七',
+				phone: '13698765432',
+				avatar: headImg
+			},
+			{
+				id: 6,
+				name: '周八',
+				phone: '13524689753',
+				avatar: headImg
+			}
+		],
+		[
+			{
+				id: 7,
+				name: '吴九',
+				phone: '13456789012',
+				avatar: headImg
+			},
+			{
+				id: 8,
+				name: '郑十',
+				phone: '13367890123',
+				avatar: headImg
+			},
+			{
+				id: 9,
+				name: '钱十一',
+				phone: '13278901234',
+				avatar: headImg
+			}
+		],
+
+		[
+			{
+				id: 16,
+				name: '郑十八',
+				phone: '13876543210',
+				avatar: headImg
+			},
+			{
+				id: 17,
+				name: '吴十九',
+				phone: '13712345678',
+				avatar: headImg
+			},
+			{
+				id: 18,
+				name: '周二十',
+				phone: '13534567890',
+				avatar: headImg
+			}
+		],
+		[
+			{
+				id: 19,
+				name: '二十一',
+				phone: '13445678901',
+				avatar: headImg
+			},
+			{
+				id: 20,
+				name: '二十二',
+				phone: '13356789012',
+				avatar: headImg
+			},
+			{
+				id: 21,
+				name: '二十三',
+				phone: '13267890123',
+				avatar: headImg
+			}
 		]
-	})
-	function clickTop() {
-		console.log('clickTop');
-	}
-	function clickChat(e) {
-		console.log('clickChat', e);
-	}
+	]
+})
+// function clickTop() {
+// 	console.log('clickTop');
+// }
+// function clickChat(e) {
+// 	console.log('clickChat', e);
+// }
 </script>
 
-<style lang="scss">
-
-</style>
+<style lang="scss"></style>

+ 60 - 61
pages/contacts/index.vue

@@ -17,17 +17,18 @@
 									</uni-row>
 								</view>
 							</template>
-						</uni-list-item>
-					</uni-list>
-				</view>
-			</template> -->
+</uni-list-item>
+</uni-list>
+</view>
+</template> -->
 			<template v-for="(items, index) in itemArr" :key="index">
 				<uv-index-item>
 					<uv-index-anchor :text="indexList[index]" size="16"></uv-index-anchor>
 					<view class="chat_list">
 						<uni-list :border="true">
 							<uni-list-chat v-for="(item, index) in items" @click="clickChat(item)" :title="item.name"
-								:avatar="item.avatar || headImg" :note="item.desktop_phone" :clickable="true" :avatar-circle="true" :key="index">
+								:avatar="item.avatar || headImg" :note="item.desktop_phone" :clickable="true"
+								:avatar-circle="true" :key="index">
 								<view class="chat-custom-right">
 									<text class="chat-custom-text" v-text="item.dept"></text>
 								</view>
@@ -41,73 +42,71 @@
 </template>
 
 <script setup lang="ts">
-	import { onMounted, ref } from 'vue'
-	import headImg from "@/static/images/mine/headImg.jpg";
-	import $tab from '@/plugins/tab.js'
-	import { getContactAllUser } from '@/api/contacts.js'
-	import { useUserStore } from '@/store/user.js'
-	const userStore = useUserStore()
-	onMounted(() => {
-		// 获取 通讯录 索引列表
-		getContactAllUser(userStore.user.unitId).then(res => {
-			getContactList(res.returnParams)
-		})
+import { onMounted, ref } from 'vue'
+import headImg from "@/static/images/mine/headImg.jpg";
+import $tab from '@/plugins/tab.js'
+import { getContactAllUser } from '@/api/contacts.js'
+import { useUserStore } from '@/store/user.js'
+const userStore = useUserStore()
+onMounted(() => {
+	// 获取 通讯录 索引列表
+	getContactAllUser(userStore.user.unitId).then(res => {
+		getContactList(res.returnParams)
 	})
-	// 索引列表
-	const indexList = ref([])
-	const itemArr = ref([])
-	function getContactList(data) {
-		// console.log('data', data);
-		
-		for(let key in data) {
-			// hasOwnProperty 排除 __proto__等数据
-			if (data.hasOwnProperty(key)) {
-				// 过滤 userState 为 0 的 user
-				data[key] = data[key].filter(user => user.userState !== '0')
-			} else {
-				continue
-			}
-			// 删除 过滤后 数据为0的 索引 
-			if (data[key].length === 0) delete data[key]
+})
+// 索引列表
+const indexList = ref([])
+const itemArr = ref([])
+function getContactList(data) {
+
+	for (let key in data) {
+		// hasOwnProperty 排除 __proto__等数据
+		if (data.hasOwnProperty(key)) {
+			// 过滤 userState 为 0 的 user
+			data[key] = data[key].filter(user => user.userState !== '0')
+		} else {
+			continue
 		}
-		// 获取索引
-		indexList.value = Object.keys(data)
-		// 获取索引数据
-		itemArr.value = Object.values(data)
-	}
-	function clickTop() {
-		console.log('clickTop');
-	}
-	// 点击通讯录列表
-	function clickChat(e) {
-		$tab.navigateTo('/pages/mine/personal_message/personal_message?useId=' + e.useId)
+		// 删除 过滤后 数据为0的 索引 
+		if (data[key].length === 0) delete data[key]
 	}
+	// 获取索引
+	indexList.value = Object.keys(data)
+	// 获取索引数据
+	itemArr.value = Object.values(data)
+}
+// function clickTop() {
+// 	console.log('clickTop');
+// }
+// 点击通讯录列表
+function clickChat(e) {
+	$tab.navigateTo('/pages/mine/personal_message/personal_message?useId=' + e.useId)
+}
 </script>
 
 <style lang="scss">
-	.contact_container {
-		.top {
-			.top_slot_container {
-				height: 100%;
-				width: 100%;
+.contact_container {
+	.top {
+		.top_slot_container {
+			height: 100%;
+			width: 100%;
 
-				::v-deep .uni-icons {
-					background-color: #468bf0;
-					border-radius: 50%;
-				}
+			::v-deep .uni-icons {
+				background-color: #468bf0;
+				border-radius: 50%;
+			}
 
-				.top_text {
-					font-size: 24px;
-				}
+			.top_text {
+				font-size: 24px;
 			}
 		}
+	}
 
-		.chat_list {
-			.chat-custom-right {
-				.chat-custom-text {
-					margin-right: 10px;
-				}
+	.chat_list {
+		.chat-custom-right {
+			.chat-custom-text {
+				margin-right: 10px;
 			}
-		}
+		}}
 	}
 </style>

+ 6 - 0
pages/message/index.vue

@@ -98,9 +98,15 @@
 
 <script setup lang="ts">
 	import { onMounted, reactive, ref } from 'vue';
+	import { onLoad } from '@dcloudio/uni-app'
 	import $tab from '@/plugins/tab.js';
 	import processList from '@/components/ygoa/processList.vue'
 	import { useUserStore } from '@/store/user.js'
+	onLoad((options) => {
+		if (options.to == 'clockIn') {
+			$tab.navigateTo('/pages/mine/clockIn/clockIn')
+		}
+	})
 	onMounted(() => {
 		onClickItem({ currentIndex: 0 })
 	})

+ 0 - 1
pages/mine/checkIn/checkIn.vue

@@ -291,7 +291,6 @@ function fetchWeekAttData() {
 			start_date: thisMondayDate.value,
 			end_date: todayData.day
 		}
-		// console.log('params', params);
 		getMyTotalCount(params).then(res => {
 			const myWeekAttData = res.returnParams;
 			const mockData = {

+ 102 - 103
pages/work/edit/index.vue

@@ -3,10 +3,10 @@
 		<uni-card margin="10px" spacing="0">
 			<uni-forms label-position="left" :label-width="110" :border="true">
 				<uni-forms-item v-for="(item, index) in formElements" :label="item.elementName" :key="index">
-					<uni-easyinput v-if="'多少小时'==item.elementName" :disabled="true" placeholder="请输入内容"
+					<uni-easyinput v-if="'多少小时' == item.elementName" :disabled="true" placeholder="请输入内容"
 						:value="diffHours"></uni-easyinput>
 					<!-- 输入框 -->
-					<uni-easyinput v-else-if="'0'==item.type" :disabled="'0'==item.canEdit" placeholder="请输入内容"
+					<uni-easyinput v-else-if="'0' == item.type" :disabled="'0' == item.canEdit" placeholder="请输入内容"
 						:value="item.defaultValue"></uni-easyinput>
 					<!-- 下拉框 -->
 					<!-- <uni-data-select v-else-if="'2'==item.type" :disabled="'0'==item.canEdit" placeholder="请选择内容" :value="item.defaultValue || 0" :localdata="item.typeDetail.enum"></uni-data-select> -->
@@ -14,15 +14,15 @@
 					<!-- <uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0">底部弹出 Popup 自定义圆角</uni-popup> -->
 					<!-- 开始时间选择器 -->
 					<uni-datetime-picker :end="endTime" @change="setTimeRange(item)"
-						v-else-if="timeFlag&&'9'==item.type&&'开始时间'==item.elementName" v-model="item.defaultValue"
+						v-else-if="timeFlag && '9' == item.type && '开始时间' == item.elementName" v-model="item.defaultValue"
 						:clear-icon="false" type="datetime" />
 					<!-- 结束时间选择器 -->
 					<uni-datetime-picker :start="startTime" @change="setTimeRange(item)" :disabled="disableEndTime"
-						:placeholder="disableEndTime?'请先选择开始时间':'选择日期时间'"
-						v-else-if="timeFlag&&'9'==item.type&&'结束时间'==item.elementName" v-model="item.defaultValue"
+						:placeholder="disableEndTime ? '请先确认开始时间' : '确认结束时间'"
+						v-else-if="timeFlag && '9' == item.type && '结束时间' == item.elementName" v-model="item.defaultValue"
 						:clear-icon="false" type="datetime" />
 					<!-- 其他时间选择器 -->
-					<uni-datetime-picker v-else-if="'9'==item.type" v-model="item.defaultValue" type="datetime" />
+					<uni-datetime-picker v-else-if="'9' == item.type" v-model="item.defaultValue" type="datetime" />
 				</uni-forms-item>
 			</uni-forms>
 		</uni-card>
@@ -35,7 +35,8 @@
 			<uni-list-item>
 				<template v-slot:body>
 					<uni-file-picker v-model="fileList" :autoUpload="false" mode="list" limit="5" file-mediatype="all"
-						title="选择文件" @select="handleSelect" @progress="handleProgress" @delete="handleDelete"></uni-file-picker>
+						title="选择文件" @select="handleSelect" @progress="handleProgress"
+						@delete="handleDelete"></uni-file-picker>
 				</template>
 			</uni-list-item>
 			<button type="default" style="background-color: #007aff;color: #ffffff;" @click="submitProcess">提交</button>
@@ -44,111 +45,109 @@
 </template>
 
 <script setup lang="ts">
-	import { onMounted, reactive, ref } from 'vue'
-	import { onLoad } from '@dcloudio/uni-app'
-	import { useUserStore } from '@/store/user.js'
-	import { getProcessInfo, getProcessForm } from '@/api/work.js'
-	
-	let processInfo = reactive({
-		modelName: '流程申请',
-		control: '',
-		formId: '',
-		modelId: '',
-		tmodelId: '',
-		isMoreIns: '',
-		pathJudgeType: ''
+import { onMounted, reactive, ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+import { useUserStore } from '@/store/user.js'
+import { getProcessInfo, getProcessForm } from '@/api/work.js'
+
+let processInfo = reactive({
+	modelName: '流程申请',
+	control: '',
+	formId: '',
+	modelId: '',
+	tmodelId: '',
+	isMoreIns: '',
+	pathJudgeType: ''
+})
+onLoad((options) => {
+	const { modelName, modelId, control } = options
+	processInfo.modelName = modelName
+	processInfo.modelId = modelId
+	processInfo.control = control
+	// 设置导航栏标题
+	uni.setNavigationBarTitle({
+		title: processInfo.modelName
+	});
+})
+onMounted(() => {
+	initProcessInfo().then(() => {
+		initProcessForm()
 	})
-	onLoad((options) => {
-		const { modelName, modelId, control } = options
-		processInfo.modelName = modelName
-		processInfo.modelId = modelId
-		processInfo.control = control
-		// 设置导航栏标题
-		uni.setNavigationBarTitle({
-			title: processInfo.modelName
-		});
+})
+const userStore = useUserStore()
+function initProcessInfo() {
+	return new Promise<void>((resolve, reject) => {
+		getProcessInfo(processInfo)
+			.then(({ returnParams }) => {
+				const { formId, tmodelId, isMoreIns, pathJudgeType } = returnParams.flow[0]
+				processInfo.formId = formId
+				processInfo.tmodelId = tmodelId
+				processInfo.isMoreIns = isMoreIns
+				processInfo.pathJudgeType = pathJudgeType
+				resolve()
+			})
 	})
-	onMounted(() => {
-		initProcessInfo().then(() => {
-			initProcessForm()
-		})
+}
+const formElements = ref([])
+const startEleIndex = ref(0) // 开始时间
+const endEleIndex = ref(0) // 结束时间
+function initProcessForm() {
+	getProcessForm(userStore.user, processInfo).then(({ returnParams }) => {
+		formElements.value = returnParams.formElements
+
+		startEleIndex.value = formElements.value.findIndex((item) => '开始时间' == item.elementName)
+		endEleIndex.value = formElements.value.findIndex((item) => '结束时间' == item.elementName)
+		// console.log('startEle', startEleIndex.value);
+		// console.log('endEle', endEleIndex.value);
+		if (startEleIndex.value != -1 && endEleIndex.value != -1) { // 判断是否需要计算时间差
+			// console.log('if (startEleIndex && endEleIndex)');
+			timeFlag.value = true
+			disableEndTime.value = true // 计算时间差时默认禁用结束时间选择器
+			formElements.value[startEleIndex.value].defaultValue = new Date()
+		}
 	})
-	const userStore = useUserStore()
-	function initProcessInfo(){
-		return new Promise<void>((resolve, reject) => {
-				getProcessInfo(processInfo)
-				.then(({returnParams}) => {
-					const { formId, tmodelId, isMoreIns, pathJudgeType} = returnParams.flow[0]
-					processInfo.formId = formId
-					processInfo.tmodelId = tmodelId
-					processInfo.isMoreIns = isMoreIns
-					processInfo.pathJudgeType = pathJudgeType
-					resolve()
-				})
-		})
+}
+
+const startTime = ref(0) // 开始时间
+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 // 设置 开始时间
+		disableEndTime.value = false // 解除 结束时间选择器 禁用
 	}
-	const formElements = ref([])
-	const startEleIndex = ref(0) // 开始时间
-	const endEleIndex = ref(0) // 结束时间
-	function initProcessForm() {
-		getProcessForm(userStore.user, processInfo).then(({returnParams}) => {
-			formElements.value = returnParams.formElements
-		
-			startEleIndex.value = formElements.value.findIndex((item) => '开始时间' == item.elementName)
-			endEleIndex.value = formElements.value.findIndex((item) => '结束时间' == item.elementName)
-			console.log('startEle', startEleIndex.value);
-			console.log('endEle', endEleIndex.value);
-			if (startEleIndex.value != -1 && endEleIndex.value != -1) { // 判断是否需要计算时间差
-			console.log('if (startEleIndex && endEleIndex)');
-				timeFlag.value = true
-				disableEndTime.value = true // 计算时间差时默认禁用结束时间选择器
-				formElements.value[startEleIndex.value].defaultValue = new Date()
-			}
-		})
+	if (timeFlag.value && '结束时间' == e.elementName) {
+		endTime.value = e.defaultValue // 设置 结束时间
 	}
-	
-	const startTime = ref(0) // 开始时间
-	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 // 设置 开始时间
-			disableEndTime.value = false // 解除 结束时间选择器 禁用
-		}
-		if (timeFlag.value && '结束时间' == e.elementName) {
-			endTime.value = e.defaultValue // 设置 结束时间
-		}
-		if (timeFlag.value && startTime.value && endTime.value) {
-			const start = new Date(startTime.value).getTime() // 获取  开始时间 时间戳
-			const end = new Date(endTime.value).getTime() // 获取  结束时间 时间戳
-			const diffSec = Math.abs(end - start) // 获取 时间戳 差值
-			diffHours.value = (diffSec / 1000 / 60 / 60).toFixed(2) // 计算 时间差值 并格式化 为只有2位小数
-		}
+	if (timeFlag.value && startTime.value && endTime.value) {
+		const start = new Date(startTime.value).getTime() // 获取  开始时间 时间戳
+		const end = new Date(endTime.value).getTime() // 获取  结束时间 时间戳
+		const diffSec = Math.abs(end - start) // 获取 时间戳 差值
+		diffHours.value = (diffSec / 1000 / 60 / 60).toFixed(2) // 计算 时间差值 并格式化 为只有2位小数
 	}
+}
 
-	let fileList = reactive([]) // 文件列表
-	function handleSelect(e) { // 新增文件
-		console.log('handleSelect', e)
-		for (const file of e.tempFiles) {
-			fileList.push(file)
-		}
-	}
-	function handleProgress(e) { // 文件上传
-		console.log('handleProgress', e)
+let fileList = ref([]) // 文件列表
+function handleSelect(e) { // 新增文件
+	console.log('handleSelect', e)
+	for (const file of e.tempFiles) {
+		fileList.value.push(file)
 	}
-	function handleDelete(e) { // 移除文件
-		console.log('handleDelete', e)
-		fileList.splice(fileList.indexOf(e.tempFiles), 1)
-	}
-	
-	function submitProcess() { // 提交表单
+}
+function handleProgress(e) { // 文件上传
+	console.log('handleProgress', e)
+}
+function handleDelete(e) { // 移除文件
+	console.log('handleDelete', e)
+	fileList.value.splice(fileList.value.indexOf(e.tempFiles), 1)
+}
+
+function submitProcess() { // 提交表单
 		console.log('submitProcess')
 	}
 </script>
 
-<style lang="scss">
-
-</style>
+<style lang="scss"></style>

+ 148 - 166
pages/work/index.vue

@@ -7,63 +7,46 @@
 				<uni-grid :column="4" :showBorder="false" @change="changeProcessGrid">
 					<uni-grid-item v-for="(item, index) in processList.fList" :index="index">
 						<view class="grid-item-box">
-							<text class="ygoa-icon" :class="item.modelPicture == 'default.png'?'icon-outsourcing':item.modelPicture"></text>
+							<text class="ygoa-icon"
+								:class="item.modelPicture == 'default.png' ? 'icon-outsourcing' : item.modelPicture"></text>
 							<text class="text">{{ item.modelName }}</text>
 						</view>
 					</uni-grid-item>
 					<!-- <uni-grid-item :index="1">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-outsourcing"></text>
 							<text class="text">外协结算申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="2">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-car"></text>
 							<text class="text">用车申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="3">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-business"></text>
 							<text class="text">出差申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="4">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-out"></text>
 							<text class="text">外出申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="5">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-expense"></text>
 							<text class="text">费用报销</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="6">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-overtime"></text>
 							<text class="text">加班申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="7">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-leave"></text>
 							<text class="text">请假申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="8">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-purchase"></text>
 							<text class="text">采购申请</text>
-						</view>
 					</uni-grid-item>
 					<uni-grid-item :index="9">
-						<view class="grid-item-box">
 							<text class="ygoa-icon icon-apply-sign-contract"></text>
 							<text class="text">合同会签</text>
-						</view>
 					</uni-grid-item> -->
 				</uni-grid>
 			</view>
@@ -134,177 +117,176 @@
 </template>
 
 <script setup lang="ts">
-	import cuiCalculator from "@/components/cui-calculator/cui-calculator.vue"
-	import { onMounted, ref } from "vue"
-	import $tab from "@/plugins/tab.js"
-	import { getUserInfo } from '@/utils/auth'
-	import { useUserStore } from '@/store/user.js'
-	import { getProcessList } from '@/api/work.js'
-	
-	const userStore = useUserStore()
-	
-	onMounted(() => {
-		initProcessList()
-	})
-	
-	const processList = ref({
-		fList: [],
-		ftypeList: [
-			{
-				typeName: ''
-			}
-		],
-	})
-	
-	function initProcessList() {
-		const staffId = userStore.user.useId
-		const unitId = userStore.user.unitId
-		getProcessList(staffId, unitId).then(res => {
-			processList.value = res.returnParams // 设置processList
-			// console.log('getProcessList', processList.value);
-		})
-	}
-	function changeProcessGrid(e) { // 点击流程宫格
-		console.log('changeProcessGrid', e);
-		const { modelName, modelId, control} = processList.value.fList[e.detail.index]
-		// 跳转流程申请页面
-		$tab.navigateTo('/pages/work/edit/index?modelName=' + modelName + '&modelId=' + modelId +'&control=' + control)
-	}
-	function changeAttendanceGrid(e) {
-		if (1 == e.detail.index) { // 考勤
+import cuiCalculator from "@/components/cui-calculator/cui-calculator.vue"
+import { onMounted, ref } from "vue"
+import $tab from "@/plugins/tab.js"
+import { getUserInfo } from '@/utils/auth'
+import { useUserStore } from '@/store/user.js'
+import { getProcessList } from '@/api/work.js'
 
-		}
-		if (2 == e.detail.index) { // 打卡
+const userStore = useUserStore()
 
+onMounted(() => {
+	initProcessList()
+})
+
+const processList = ref({
+	fList: [],
+	ftypeList: [
+		{
+			typeName: ''
 		}
+	],
+})
+
+function initProcessList() {
+	const staffId = userStore.user.useId
+	const unitId = userStore.user.unitId
+	getProcessList(staffId, unitId).then(res => {
+		processList.value = res.returnParams // 设置processList
+	})
+}
+function changeProcessGrid(e) { // 点击流程宫格
+	console.log('changeProcessGrid', e);
+	const { modelName, modelId, control } = processList.value.fList[e.detail.index]
+	// 跳转流程申请页面
+	$tab.navigateTo('/pages/work/edit/index?modelName=' + modelName + '&modelId=' + modelId + '&control=' + control)
+}
+function changeAttendanceGrid(e) {
+	if (1 == e.detail.index) { // 考勤
+		$tab.navigateTo('/pages/mine/checkIn/checkIn')
 	}
-	function changeDiaryGrid(e) {
-		if (1 == e.detail.index) {
-			wx.navigateToMiniProgram({
-				appId: 'wxd45c635d754dbf59',
-				path: `pages/detail/detail?url=https://docs.qq.com/sheet/DZndGYU5aWVBpR1Nm`
-			})
-			return
-		}
-		if (2 == e.detail.index) {
-			$tab.navigateTo('/pages/work/diary/index')
-			return
-		}
-	}
-	function changeToolsGrid(e) { // 点击工具宫格
-		switch (e.detail.index) {
-			case 1:
-				openCalculatorPopup() // 打开计算器弹出层
-				break
-			case 2:
-				openClearCachePopup() // 打开清除缓存弹出层
-				break
-			default:
-		}
+	if (2 == e.detail.index) { // 打卡
+		$tab.navigateTo('/pages/mine/clockIn/clockIn')
 	}
-	// 计算器
-	const calculatorPopup = ref(null)
-	function openCalculatorPopup() { // 打开计算器弹出层
-		calculatorPopup.value.open()
+}
+function changeDiaryGrid(e) {
+	if (1 == e.detail.index) {
+		wx.navigateToMiniProgram({
+			appId: 'wxd45c635d754dbf59',
+			path: `pages/detail/detail?url=https://docs.qq.com/sheet/DZndGYU5aWVBpR1Nm`
+		})
+		return
 	}
-	// 清除缓存
-	const clearCacheDialog = ref(null)
-	function openClearCachePopup() { // 打开清除缓存弹出层
-		clearCacheDialog.value.open()
+	if (2 == e.detail.index) {
+		$tab.navigateTo('/pages/work/diary/index')
+		return
 	}
-	// const userStore = useUserStore()
-	function clearCache() {
-		const userInfo = getUserInfo()
-		uni.clearStorageSync();
-		uni.setStorageSync('userInfo', userInfo)
-		// 提示用户缓存清理成功
-		uni.showToast({
-			title: '缓存清理成功',
-			icon: 'success',
-			duration: 2000
-		});
+}
+function changeToolsGrid(e) { // 点击工具宫格
+	switch (e.detail.index) {
+		case 1:
+			openCalculatorPopup() // 打开计算器弹出层
+			break
+		case 2:
+			openClearCachePopup() // 打开清除缓存弹出层
+			break
+		default:
 	}
+}
+// 计算器
+const calculatorPopup = ref(null)
+function openCalculatorPopup() { // 打开计算器弹出层
+	calculatorPopup.value.open()
+}
+// 清除缓存
+const clearCacheDialog = ref(null)
+function openClearCachePopup() { // 打开清除缓存弹出层
+	clearCacheDialog.value.open()
+}
+// const userStore = useUserStore()
+function clearCache() {
+	const userInfo = getUserInfo()
+	uni.clearStorageSync();
+	uni.setStorageSync('userInfo', userInfo)
+	// 提示用户缓存清理成功
+	uni.showToast({
+		title: '缓存清理成功',
+		icon: 'success',
+		duration: 2000
+	});
+}
 </script>
 
 <style lang="scss">
-	@import "@/static/font/ygoa/iconfont.css";
+@import "@/static/font/ygoa/iconfont.css";
 
-	.ygoa-icon {
-		font-size: 80rpx;
-		// color: #468bf0;
-	}
+.ygoa-icon {
+	font-size: 80rpx;
+	// color: #468bf0;
+}
 
-	/* #ifndef APP-NVUE */
-	page {
-		display: flex;
-		flex-direction: column;
-		box-sizing: border-box;
-		background-color: #fff;
-		min-height: 100%;
-		height: auto;
-	}
+/* #ifndef APP-NVUE */
+page {
+	display: flex;
+	flex-direction: column;
+	box-sizing: border-box;
+	background-color: #fff;
+	min-height: 100%;
+	height: auto;
+}
 
-	view {
-		font-size: 14px;
-		line-height: inherit;
-	}
+view {
+	font-size: 14px;
+	line-height: inherit;
+}
 
-	/* #endif */
+/* #endif */
 
-	.text {
-		text-align: center;
-		font-size: 26rpx;
-		margin-top: 10rpx;
-	}
+.text {
+	text-align: center;
+	font-size: 26rpx;
+	margin-top: 10rpx;
+}
 
-	.grid-item-box {
-		flex: 1;
-		/* #ifndef APP-NVUE */
-		display: flex;
-		/* #endif */
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-		padding: 15px 0;
-	}
+.grid-item-box {
+	flex: 1;
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: column;
+	align-items: center;
+	justify-content: center;
+	padding: 15px 0;
+}
 
-	.uni-margin-wrap {
-		width: 690rpx;
-		width: 100%;
-		;
-	}
+.uni-margin-wrap {
+	width: 690rpx;
+	width: 100%;
+	;
+}
 
-	.swiper {
-		height: 300rpx;
-	}
+.swiper {
+	height: 300rpx;
+}
 
-	.swiper-box {
-		height: 150px;
-	}
+.swiper-box {
+	height: 150px;
+}
 
-	.swiper-item {
+.swiper-item {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: column;
+	justify-content: center;
+	align-items: center;
+	color: #fff;
+	height: 300rpx;
+	line-height: 300rpx;
+}
+
+@media screen and (min-width: 500px) {
+	.uni-swiper-dot-box {
+		width: 400px;
 		/* #ifndef APP-NVUE */
-		display: flex;
+		margin: 0 auto;
 		/* #endif */
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-		color: #fff;
-		height: 300rpx;
-		line-height: 300rpx;
+		margin-top: 8px;
 	}
 
-	@media screen and (min-width: 500px) {
-		.uni-swiper-dot-box {
-			width: 400px;
-			/* #ifndef APP-NVUE */
-			margin: 0 auto;
-			/* #endif */
-			margin-top: 8px;
-		}
-
-		.image {
-			width: 100%;
-		}
+	.image {
+		width: 100%;
 	}
+}
 </style>

+ 9 - 8
utils/request.js

@@ -60,15 +60,16 @@ const request = config => {
         resolve(data)
       })
       .catch(error => {
-        let { message } = error
-        if (message === 'Network Error') {
-          message = '后端接口连接异常'
-        } else if (message.includes('timeout')) {
-          message = '系统接口请求超时'
-        } else if (message.includes('Request failed with status code')) {
-          message = '系统接口' + message.substr(message.length - 3) + '异常'
+				console.log('request.error', error);
+        let { errMsg } = error
+        if (errMsg === 'Network Error') {
+          errMsg = '后端接口连接异常'
+        } else if (errMsg.includes('timeout')) {
+          errMsg = '系统接口请求超时'
+        } else if (errMsg.includes('Request failed with status code')) {
+          errMsg = '系统接口' + errMsg.substr(errMsg.length - 3) + '异常'
         }
-        toast(message)
+        toast(errMsg)
         reject(error)
       })
   })