<template>
	<view class="container">
		<view class="fs-bg__primary fs-pt160 fs-pb120 fs-pl30 fs-color__white">
			{{config.weather}} / {{config.city}} {{config.temperature}}°C
		</view>
		<view class="fs-pl30 fs-pr30 fs-mt-60">
			<view class="fs-py36 fs-px30 fs-bg__white fs-radius__sm">
				<tui-list-cell unlined padding="0" :size="30" color="#000" :hover="false">日常管理</tui-list-cell>
				<view class="fs-flex fs-mt30 fs-size__h4">
					<view v-if="inspectionRoles.includes(userInfo.postId)" class="fs-flex__column fs-items__center item" @click="href('/pages/work/daily/inspection/list')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome7.png"></image>
						<text>巡查计划</text>
					</view>
					<view v-if="maintainRoles.includes(userInfo.postId)" class="fs-flex__column fs-items__center item" @click="href('/pages/work/daily/maintain/list')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome26.png"></image>
						<text>养护计划</text>
					</view>
					<view class="fs-flex__column fs-items__center item"  v-if="inspectionRoles.includes(userInfo.postId)" @click="href('/pages/work/daily/reporting')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome10.png"></image>
						<text>问题上报</text>
					</view>
					<view class="fs-flex__column fs-items__center item" @click="href('/pages/work/daily/history')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome6.png"></image>
						<text>历史记录</text>
					</view>
				</view>
			</view>
			<view class="fs-mt30 fs-py36 fs-px30 fs-bg__white fs-radius__sm">
				<tui-list-cell unlined padding="0" :size="30" color="#000" :hover="false">问题管理</tui-list-cell>
				<view class="fs-flex fs-mt30 fs-size__h4">
					<view v-if="manageRoles.includes(userInfo.postId)" class="fs-flex__column fs-items__center item" @click="href('/pages/work/case/manage')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome18.png"></image>
						<text>问题管理</text>
					</view>
					<view v-else class="fs-flex__column fs-items__center item" @click="href('/pages/work/case/maintain')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome18.png"></image>
						<text>问题管理</text>
					</view>
					<view v-if="manageRoles.includes(userInfo.postId)" class="fs-flex__column fs-items__center item" @click="href('/pages/work/case/distribution')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome4.png"></image>
						<text>任务分配</text>
					</view>
				</view>
			</view>
			<view class="fs-mt30 fs-py36 fs-px30 fs-bg__white fs-radius__sm">
				<tui-list-cell unlined padding="0" :size="30" color="#000" :hover="false">数据管理</tui-list-cell>
				<view class="fs-flex fs-mt30 fs-size__h4">
					<view class="fs-flex__column fs-items__center item" @click="href('/pages/work/data/base')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome1.png"></image>
						<text>基础数据</text>
					</view>
					<view class="fs-flex__column fs-items__center item" @click="href('/pages/work/data/worker')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome34.png"></image>
						<text>人员轨迹</text>
					</view>
					<view class="fs-flex__column fs-items__center item" @click="href('/pages/work/data/personnel')">
						<image class="fs-mb10 icon" src="/static/images/work/itmeHome9.png"></image>
						<text>人员管理</text>
					</view>
          <view class="fs-flex__column fs-items__center item" @click="href('/subPackages/treePage/treeFiles')">
            <image class="fs-mb10 icon" src="/static/images/work/itmeHometree.png"></image>
            <text>行道树档案</text>
          </view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { apiSetUserGps } from '@/api/work'
export default {
	data() {
		return {
			inspectionRoles: [9],
			maintainRoles: [10],
			manageRoles: [5,6,7,11,12]
		}
	},
	onLoad() {
		// 获取实时位置
		// uni.startLocationUpdate({
		// 	type: 'gcj02',
		// 	success: () => {
		// 		uni.onLocationChange(res => {
		// 			apiSetUserGps({data:{type:1, lat:res.latitude, lon:res.longitude}})
		// 		})
		// 	}
		// })
	},
	methods: {
		// 页面跳转
		href(url) {
			uni.$tui.href(url)
		}
	}
}
</script>

<style lang="scss" scoped>
.item {
	width: 25%;
}
.icon {
	width: 60rpx;
	height: 60rpx;
}
</style>
