Browse Source

feat(work): 工作台宫格列表数据渲染

wangpx 1 year ago
parent
commit
7bd781ca9e
5 changed files with 107 additions and 29 deletions
  1. 48 0
      api/work.js
  2. 3 1
      config.js
  3. 1 1
      manifest.json
  4. 4 3
      pages/login.vue
  5. 51 24
      pages/work/index.vue

+ 48 - 0
api/work.js

@@ -0,0 +1,48 @@
+import request from '@/utils/request.js'
+
+const preUrl = '/clientServices.do?iscrypt=1'
+
+// 获取流程 宫格 列表
+export function getFlowList(staffId, unitId) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_20150319001GetFlowList',
+			'params': {
+        "staffId": staffId,
+        "unitid": unitId
+			}
+		}
+	})
+}
+
+// 获取流程信息
+export function getFlowInfo(staffId, unitId) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_20150319001GetFlowList',
+			'params': {
+        "staffId": staffId,
+        "unitid": unitId
+			}
+		}
+	})
+}
+
+// 获取流程 表单
+export function getFlowForm(staffId, unitId) {
+	return request({
+		url: preUrl,
+    method: 'post',
+		data: {
+			'serviceId': 'bpm_20150319001GetFlowList',
+			'params': {
+        "staffId": staffId,
+        "unitid": unitId
+			}
+		}
+	})
+}

+ 3 - 1
config.js

@@ -1,3 +1,5 @@
 export default {
-	baseUrl: 'http://localhost:8081/oa'
+	// baseUrl: 'https://api.ygtxfj.com/oa'
+	baseUrl: 'http://118.195.146.34:20076/ynet',
+	logoSrc: 'https://50006360.s21i.huaweicloudsite.cn/4/ABUIABAEGAAg-I3cuQYo6IXe9AQw9AM4Rg.png',
 }

+ 1 - 1
manifest.json

@@ -49,7 +49,7 @@
     "quickapp" : {},
     /* 快应用特有相关 */
     "mp-weixin" : {
-        "appid" : "wx6cf4eb9ed2a3cd6a",
+        "appid" : "wxde4bf149a4c88707",
         "setting" : {
             "urlCheck" : false,
             "minified" : false

+ 4 - 3
pages/login.vue

@@ -1,10 +1,10 @@
 <template>
 	<view class="normal-login-container">
 		<view class="logo-content align-center justify-center flex">
-			<image style="width: 200rpx;height: 200rpx;"
-				src="https://50006360.s21i.huaweicloudsite.cn/4/ABUIABAEGAAg6PTOtwYohbu8vAIw8AM4gAI.png" mode="widthFix">
+			<image style="width: 100%;"
+				:src="config.logoSrc" mode="widthFix">
 			</image>
-			<text class="title">OA移动端登录</text>
+			<!-- <text class="title">OA移动端登录</text> -->
 		</view>
 		<view class="login-form-content">
 			<view class="input-item flex align-center">
@@ -23,6 +23,7 @@
 </template>
 
 <script setup lang="ts">
+	import config from '@/config.js'
 	import { ref } from 'vue'
 	import { useUserStore } from '@/store/user.js'
 	import $modal from '@/plugins/modal.js'

+ 51 - 24
pages/work/index.vue

@@ -1,16 +1,16 @@
 <template>
 	<view class="work-container">
 		<!-- 宫格组件 -->
-		<uni-section title="日常办公" type="line"></uni-section>
+		<uni-section :title="flowList.ftypeList[0].typeName" type="line"></uni-section>
 		<view class="grid-body">
 			<uni-grid :column="4" :showBorder="false" @change="changeProcessGrid">
-				<uni-grid-item :index="1">
+				<uni-grid-item v-for="(item, index) in flowList.fList" :index="index">
 					<view class="grid-item-box">
 						<text class="ygoa-icon icon-outsourcing"></text>
-						<text class="text">外协结算</text>
+						<text class="text">{{ item.modelName }}</text>
 					</view>
 				</uni-grid-item>
-				<uni-grid-item :index="2">
+				<!-- <uni-grid-item :index="2">
 					<view class="grid-item-box">
 						<text class="ygoa-icon icon-apply-car"></text>
 						<text class="text">用车申请</text>
@@ -57,14 +57,19 @@
 						<text class="ygoa-icon icon-apply-sign-contract"></text>
 						<text class="text">合同会签</text>
 					</view>
-				</uni-grid-item>
-				<uni-grid-item :index="10">
+				</uni-grid-item> -->
+			</uni-grid>
+		</view>
+		<uni-section title="考勤管理" type="line"></uni-section>
+		<view class="grid-body">
+			<uni-grid :column="4" :showBorder="false" @change="changeAttendanceGrid">
+				<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="11">
+				<uni-grid-item :index="2">
 					<view class="grid-item-box">
 						<text class="ygoa-icon icon-location"></text>
 						<text class="text">打卡</text>
@@ -122,15 +127,49 @@
 
 <script setup lang="ts">
 	import cuiCalculator from "@/components/cui-calculator/cui-calculator.vue"
-	import { ref } from "vue"
-	// import $modal from "@/plugins/modal.js"
+	import { onMounted, ref } from "vue"
 	import $tab from "@/plugins/tab.js"
 	import { getUserInfo } from '@/utils/auth'
 	import { useUserStore } from '@/store/user.js'
+	import { getFlowList } from '@/api/work.js'
+	
+	const userStore = useUserStore()
+	
+	onMounted(() => {
+		initFlowList()
+	})
+	
+	const flowList = ref({
+		fList: [],
+		ftypeList: [
+			{
+				typeName: '日常办公'
+			}
+		],
+	})
+	
+	function initFlowList() {
+		const staffId = userStore.user.useId
+		const unitId = userStore.user.unitId
+		getFlowList(staffId, unitId).then(res => {
+			flowList.value = res.returnParams // 设置flowList
+			console.log('getFlowList', flowList.value);
+		})
+	}
 	function changeProcessGrid(e) { // 点击流程宫格
 		console.log('changeProcessGrid', e);
+		const flow = flowList.value.fList[e.detail.index]
+		console.log('flow', flow);
 		// 跳转流程申请页面
-		$tab.navigateTo('/pages/work/edit/index?title=' + '')
+		// $tab.navigateTo('/pages/work/edit/index?title=' + '')
+	}
+	function changeAttendanceGrid(e) {
+		if (1 == e.detail.index) { // 考勤
+
+		}
+		if (2 == e.detail.index) { // 打卡
+
+		}
 	}
 	function changeDiaryGrid(e) {
 		if (1 == e.detail.index) {
@@ -148,41 +187,29 @@
 	function changeToolsGrid(e) { // 点击工具宫格
 		switch (e.detail.index) {
 			case 1:
-				openCalculatorPopup()
+				openCalculatorPopup() // 打开计算器弹出层
 				break
 			case 2:
-				openClearCachePopup()
+				openClearCachePopup() // 打开清除缓存弹出层
 				break
 			default:
 		}
-		console.log('changeToolsGrid', e);
-		// $tab.navigateTo('/pages/work/edit/index?title=' + '')
-		// $modal.showToast('模块建设中~')
 	}
 	// 计算器
 	const calculatorPopup = ref(null)
 	function openCalculatorPopup() { // 打开计算器弹出层
 		calculatorPopup.value.open()
 	}
-	function closeCalculatorPopup() { // 关闭计算器弹出层
-		calculatorPopup.value.close()
-	}
 	// 清除缓存
 	const clearCacheDialog = ref(null)
 	function openClearCachePopup() { // 打开清除缓存弹出层
 		clearCacheDialog.value.open()
 	}
-	function closeClearCachePopup() { // 关闭清除缓存弹出层
-		clearCacheDialog.value.close()
-	}
 	// const userStore = useUserStore()
 	function clearCache() {
 		const userInfo = getUserInfo()
 		uni.clearStorageSync();
-		// console.log('userStore.user', userStore.user);
-		// console.log('userInfo', userInfo);
 		uni.setStorageSync('userInfo', userInfo)
-		// console.log('userInfo', userStore.user);
 		// 提示用户缓存清理成功
 		uni.showToast({
 			title: '缓存清理成功',