<template>
	<view>
		<u-navbar title="办公OA">
			
		</u-navbar>
		<view class="mainBody">
			<view class="mainItem" v-for="(info,i) in  list" :key="i" v-if="info.show" >
				<view class="name">{{info.name}}</view>
				<view class="grid">
					<u-grid :col="3" :border="false">
						<u-grid-item   v-for="(item,index) in info.list" :key="index"   
							@click="gotoItem(info,item)" >
							<u-badge type="error" v-if="item.opkey" :count="mythis[item.opkey]"></u-badge>
							<view class="gridItem" :style="item.bgColor?item.bgColor:info.bgColor">
								<img :src="item.img?item.img:info.img" alt="">
								
							</view>
							<view class="grid-text">{{item.name}}</view>
						</u-grid-item>
					</u-grid>
				</view>
			</view>
		</view>
		<u-divider  bg-color="#F2F4F4"  >已经到底了</u-divider>
		
	</view>
</template>

<script>
	var img1 =require("@/assets/img/oawork/riFill-file-4-fill.svg")
	var img2 =require("@/assets/img/oawork/riFill-edit-box-fill.svg")
	var img3 =require("@/assets/img/oawork/if-stamp.svg")
	var img4 =require("@/assets/img/oawork/riFill-file-list-2-fill.svg")
	var img5 =require("@/assets/img/oawork/riFill-numbers-fill.svg")
	
	var bg1 =require("@/assets/img/oawork/bg1.png")
	var bg2 =require("@/assets/img/oawork/bg2.png")
	
	import * as API from '@/apis/pagejs/oa.js'
	export default {
		data() {
			return {
				
				mythis:{
					approveopkey:0,
				},
				list:[
					{
						name:"公文提报",
							show:1,
						img:img1,
						url:"/pages/oawork/business/list",
						bgColor:"background: linear-gradient(90deg, rgba(82,222,216,1) 0%,rgba(89,196,196,1) 50%,rgba(22,164,167,1) 100%);",
						list:[
							{
								name:"发文申请",
								type:"2",
							
							},
							{
								name:"合同审核表",
								type:"3",
							
							},
							{
								name:"收文处理专门笺",
								type:"6"
							}
						],
					},
					{
						name:"申请提交",
							show:1,
						img:img2,
						url:"/pages/oawork/business/list",
						bgColor:"background-color: rgba(0, 185, 98, 1);",
						
						list:[
							{
								name:"打印机维护",
								type:"1",
							
							},
							{
								name:"计算机维护",
								type:"4",
							
							},
							{
								name:"公司申请单",
								type:"5",
							
							},
							{
								name:"外出登记单",
								type:"7"
							},
							{
								name:"网络信息发布",
								type:"8"
							},
							{
								name:"用车申请",
								type:"9"
							},
							{
								name:"运输生产事项",
								type:"10"
							}
						],
					},
					{
						name:"代办审批",
							show:1,
						url:"/pages/oawork/approve/list",
						img:img3,
						bgColor:"background-color: rgba(22, 119, 255, 1);",
						
						list:[
							{
								name:"公文审批",
								type:"approve",
								opkey:"approveopkey",
									show:1
							}
							, {
								name:"查看抄送",
								type:"view",
								
									show:1
							},
							// {
							// 	name:"公文类型1",
							// 	type:"oa3"
							// }
						],
					},
					{
						name:"运输指标",
						img:img3,
						bgColor:"background-color: rgba(22, 119, 255, 1);",
						
						list:[
							{
								name:"数据明细",
								type:"oaoao1",
								url:"/pages/oawork/data1",
								img:img4,
								bgColor:"background: url("+bg2+");",
								
							},
							{
								name:"数据分析",
								type:"oaoao1",
								url:"/pages/oawork/data1",
								img:img5,
								//bgColor:"background: radial-gradient(1.1496160000000002% 1.089584% at -8.7% -3.6999999999999997%, rgba(163,221,255,1) 0%,rgba(144,116,255,1) 100%);",
								bgColor:"background: url("+bg1+");",
								
							}
						],
					}
				]
			}
		},
		onLoad(op){
			
			
			this.getList(0,"approveopkey");
			//this.getList(2,"viewopkey");
		},
		methods: {
			getList(status,key){
				
				//this.formData.formId=this.oatype
				
				
				API.approveList({
					pageIndex: 1,
					pageSize: 0,
					status:status
				}).then((res) => {
					
					uni.hideLoading();
				
				
					this.mythis[key]= res.data.recordsTotal;
				}).catch(error => {
					uni.showToast({
						title: error,
						icon: "none"
					})
				})
			},
			gotoItem(info,item){
				uni.navigateTo({
					url:(item.url?item.url:info.url)+"?oatype="+item.type+"&oaname="+item.name
				})
			}
		}
	}
</script>


<style  lang="scss" scoped >
	.mainBody{
		.mainItem{
			color: rgba(16, 16, 16, 1);
			font-size: 28rpx;
			line-height: 40rpx;
			border-radius: 8px;
			background-color: rgba(255, 255, 255, 1);
			margin: 32rpx;
			padding: 24rpx 32rpx;
			//display: flex;
			//justify-content: space-between;
			.name{
				font-size: 36rpx;
			}
			.grid{
				.gridItem{
					width: 80rpx;
					height: 80rpx;
					border-radius: 8px;
					display: flex;
					margin-bottom: 8rpx;
					justify-content: center;
					align-items: center;
					img{
						width: 48rpx;
						height: 48rpx;
					}
				}
			}
			.left{
				
			}
		}
	}
</style>

