Explorar o código

完成OA审批

ZhaoJun hai 1 ano
pai
achega
15bdad0df5

+ 31 - 16
pages/audit/OA/detail.vue

@@ -6,7 +6,7 @@
 
 			<!-- 表单数据 -->
 			<template v-if="formList.length > 0">
-				<uni-section title="表单数据" type="line"></uni-section>
+				<uni-section title="表单数据" type="line" />
 				<uni-forms class="form" label-align="right" :labelWidth="100">
 					<uni-forms-item v-for="item in formList" :label="item.name" name="email">
 						<view class="content">{{item.value.join(",")}}</view>
@@ -15,25 +15,26 @@
 			</template>
 
 			<!-- 附件信息 -->
-			<template v-if="excelFileList.length > 0">
-				<uni-section title="附件信息" type="line"></uni-section>
-				<view class="attachment" v-for="item in excelFileList" :key="item.id">
+			<template v-if="attachments.length > 0">
+				<uni-section title="附件信息" type="line" />
+				<view class="attachment" v-for="item in attachments" :key="item.id">
 					<!-- {{item.name}} -->
 					<previewFile :src="item.url" :name="item.name" />
 				</view>
 			</template>
 
 			<!-- 审批信息 -->
-			<uni-section title="审批信息" type="line"></uni-section>
+			<uni-section title="审批信息" type="line" />
 			<uni-steps :options="auditList" :active="currentStep" direction="column" />
 
 			<!-- 清单详情 -->
-			<uni-section title="清单详情" type="line"></uni-section>
-			<view class="excel-detail" @click="toExcelDetail">查看详情</view>
+			<!-- 	<uni-section title="清单详情" type="line" />
+			<view class="excel-detail" @click="toExcelDetail">查看详情</view> -->
+
 			<!-- 审批按钮 -->
 			<view class="btns" v-if="isAuditor">
-				<button type="primary" @click="showAuditModal">通过</button>
-				<button type="warn" @click="showRejectModal">拒绝</button>
+				<button type="primary" @click="showAuditModal" style="width: 200rpx; height: 45px;">通过</button>
+				<button type="warn" @click="showRejectModal" style="width: 200rpx; height: 45px;">拒绝</button>
 			</view>
 		</view>
 
@@ -71,6 +72,7 @@
 			return {
 				id: "",
 				detail: {},
+				attachments:[],
 				auditList: [],
 				currentStep: 0,
 				isAuditor: true,
@@ -84,23 +86,37 @@
 			}
 			this.id = query.id
 			this.query = query
+			this.checkDeviceType()
 			this.init()
 		},
 		methods: {
+			checkDeviceType() {
+				const userAgent = navigator.userAgent.toLowerCase();
+				const mobileKeywords = ['android', 'iphone', 'ipad', 'ipod', 'mobile'];
+				this.isMobile = mobileKeywords.some(keyword => userAgent.includes(keyword));
+				return this.isMobile
+			},
+
 			async init() {
 				var currentUser = await gerCurrentUser();
 				if (!currentUser) {
 					return
 				}
 				uni.setStorageSync("user", currentUser);
+
+				// if (!this.isMobile) {
+				// 	// 如果是在电脑上打开,转到PC端的页面去
+				// 	window.location.href =
+				// 		`http://120.55.44.4:8896/#/bom/home/detail/${version.project_id}/${version.template_id}?version_id=${this.versionId}&JWT-TOKEN=${this.query['JWT-TOKEN']}`
+				// }
+
 				const detail = await getOAAuditDetail(this.id)
 				this.detail = detail
-
+				this.attachments = detail.Files
 				this.getAuditList(detail.OaAuditList, detail.AuditorInfo)
-
-
 			},
 
+
 			getAuditList(list, currentAuditor) {
 				// 填充审核人列表
 				if (list && list.length) {
@@ -172,18 +188,17 @@
 				if (!form) {
 					return []
 				}
-				console.log(form);
 				try {
 					const formDatas = JSON.parse(form)
-					console.log(formDatas);
 					if (formDatas && formDatas.length) {
-						return formDatas
+						return formDatas.filter(item=>item.type!=='DIYTable')
 					}
 					return []
 				} catch {
 					return []
 				}
-			}
+			},
+			
 		}
 	}
 </script>

+ 19 - 17
pages/audit/detail.vue

@@ -7,7 +7,7 @@
 			<!-- 表单数据 -->
 			<template v-if="formList.length > 0">
 				<uni-section title="表单数据" type="line"></uni-section>
-				<uni-forms class="form" label-align="right" :labelWidth="100" >
+				<uni-forms class="form" label-align="right" :labelWidth="100">
 					<uni-forms-item v-for="item in formList" :label="item.name" name="email">
 						<view class="content">{{item.value.join(",")}}</view>
 					</uni-forms-item>
@@ -73,7 +73,7 @@
 			return {
 				projectId: 580,
 				templateNodeId: 0,
-				versionId: 0,
+				id: 0,
 				version: {},
 				excelFileList: [],
 				auditMessage: '',
@@ -93,12 +93,13 @@
 		},
 		onLoad(options) {
 			this.templateNodeId = options.templateNodeId
-			this.versionId = options.versionId
 			this.projectId = Number(options.projectId)
+			this.id = options.excel_id
 			if (!uni.getStorageSync('token')) {
 				uni.setStorageSync("token", options['JWT-TOKEN']);
 			}
 			this.options = options
+			this.checkDeviceType()
 			this.init()
 		},
 		methods: {
@@ -118,12 +119,12 @@
 
 				var version = await queryVersionDetail({
 					userID: currentUser.ID,
-					versionID: this.versionId
+					excelID: this.id
 				})
-				if (!this.checkDeviceType()) {
+				if (!this.isMobile) {
 					// 如果是在电脑上打开,转到PC端的页面去
 					window.location.href =
-						`http://120.55.44.4:8896/#/bom/home/detail/${version.project_id}/${version.template_id}?version_id=${this.versionId}`
+						`http://120.55.44.4:8896/#/bom/home/detail/${version.project_id}/${version.template_id}?excel_id=${this.id}&JWT-TOKEN=${this.query['JWT-TOKEN']}`
 				}
 
 				if (version.flow_id) {
@@ -150,12 +151,12 @@
 					// console.log(this.excelFileList)
 				}
 			},
-			
+
 			// 显示通过审批弹窗
 			async showAuditModal() {
 				this.$refs.popup.open();
 			},
-			
+
 			// 通过审批
 			async auditConfirm() {
 				let flow = this.flow;
@@ -179,20 +180,20 @@
 				})
 				this.$refs.popup.close();
 			},
-			
+
 			// 显示拒绝审批弹窗
 			showRejectModal() {
 				this.$refs.rejectPopup.open()
 			},
-			
+
 			auditClose() {
 				this.$refs.popup.close();
 			},
-			
+
 			rejectClose() {
 				this.$refs.rejectPopup.close();
 			},
-			
+
 			async rejectConfirm(audit_comment) {
 				const flow = this.flow
 				const flowNode = flow.currentNode;
@@ -253,10 +254,10 @@
 					}
 				}
 			},
-			
+
 			toExcelDetail() {
 				uni.navigateTo({
-					url: `./excelDetail?templateNodeId=${this.templateNodeId}&versionId=${this.versionId}`
+					url: `./excelDetail?templateNodeId=${this.templateNodeId}&versionId=${this.version.version_id}`
 				})
 			}
 		},
@@ -268,12 +269,13 @@
 				try {
 					const formStrArray = JSON.parse(this.version.formStr);
 					const formComponents = []
-					if(formStrArray && formStrArray.length){
-						formStrArray.forEach(item=>{
+					if (formStrArray && formStrArray.length) {
+						formStrArray.forEach(item => {
 							formComponents.push(JSON.parse(item))
 						})
 					}
-					const formComponent = formComponents.filter(item=> item.template_node_id === this.version.template_node_id)
+					const formComponent = formComponents.filter(item => item.template_node_id === this.version.template_node_id)
+					console.log(formComponent);
 					return formComponent[0].formComponentValues || [];
 				} catch (e) {
 					return []

+ 1 - 7
pages/audit/list.vue

@@ -41,7 +41,6 @@
 				list: [],
 				classify: {},
 				project: {},
-				plateform: 'bom',
 				pagination: {
 					current: 1,
 					pageSize: 10,
@@ -49,10 +48,6 @@
 				}
 			}
 		},
-		onLoad(query) {
-			this.plateform = query.type
-
-		},
 		mounted() {
 			this.init()
 		},
@@ -79,7 +74,6 @@
 				})
 				this.project = project;
 				this.classify = classify;
-
 			},
 
 			async queryList() {
@@ -93,7 +87,7 @@
 
 			toDetail(item) {
 				uni.navigateTo({
-					url: `./detail?templateNodeId=${item.TemplateNodeInfo.Id}&versionId=${item.version_id}&projectId=${item.project_id}`
+					url: `./detail?templateNodeId=${item.TemplateNodeInfo.Id}&excel_id=${item.id}&projectId=${item.project_id}`
 				})
 			}
 		},

+ 5 - 5
pages/index/buttonConfig.js

@@ -2,35 +2,35 @@ export const buttons = [{
 		name: 'BOM审批',
 		show: true,
 		icon: 'list',
-		size: 40,
+		size: '50rpx',
 		url: '../audit/list',
 	},
 	{
 		name: 'OA审批',
 		show: true,
 		icon: 'calendar-filled',
-		size: 40,
+		size: "50rpx",
 		url: '../audit/OA/list'
 	},
 	{
 		name: '项目审核',
 		show: false,
 		icon: 'calendar-filled',
-		size: 40,
+		size: "50rpx",
 		url: '../audit/list'
 	},
 	{
 		name: '工时上报',
 		show: false,
 		icon: 'calendar-filled',
-		size: 40,
+		size: "50rpx",
 		url: '../audit/list'
 	},
 	{
 		name: '工时审批',
 		show: false,
 		icon: 'calendar-filled',
-		size: 40,
+		size: "50rpx",
 		url: '../audit/list'
 	},
 ]

+ 5 - 2
pages/index/index.vue

@@ -89,11 +89,14 @@
 
 	.button {
 		width: 100%;
-		margin: 5px;
-		height: 300rpx;
+		margin: 10px 5px;
+		height: 250rpx;
 		font-size: 32rpx;
 		background-color: #edf1f7;
 		box-shadow: 0px 0px 3px 3px rgba(0, 0, 0, 0.1) ;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
 	}
 
 	

+ 1 - 1
services/bom.js

@@ -40,6 +40,6 @@ export async function queryProjectList() {
 
 // 查询单个Version
 export async function queryVersionDetail(params) {
-	const res =  await request(`v1/purchase/bom/get-audit-detail/${params.userID}?version_id=${params.versionID}`, 'GET');
+	const res =  await request(`v1/purchase/bom/get-audit-detail/${params.userID}?excel_id=${params.excelID}`, 'GET');
 	return res.data
 }

+ 0 - 1
services/oa.js

@@ -12,5 +12,4 @@ export async function getOAAuditDetail(id) {
 
 export async function audit(data) {
 	return await request('v1/oa/audit/status', 'GET', data)
-
 }