<template>
	<view class="word_oeders">
		<view class="word_item">为了维护单位内部治安秩序，切实做好治安保卫工作，经检查你单位存在下列治安隐患:</view>
        
		<view  v-for="(item,index) in dataList" :key="index">
			<uni-card v-if="dataList.length !== 0">				
			 <view style="color: red;">{{item.problemDesc}}</view>
			</uni-card>
			
		</view>
		<view v-if="dataList.length == 0" >
			<uni-card>
				<view style="color: red;">无治安隐患</view>
			</uni-card>
		</view>
		<view class="word_item">请将防范整改情况填入回单于{{dataList[0]&&dataList[0].timestamp?dataList[0].timestamp:time}}前送我单位。
		</view>
		<view class="time">{{time}}</view>



	</view>
</template>

<script>
	import {
		getwordOrder
	} from '@/api/login';
	import {
		mapGetters
	} from 'vuex';
	import {
		timeSecurity
	} from '@/utils/index.js';
	export default {
		name: "work_order",
		data() {
			return {
				time: timeSecurity(),
				dataList: []
			};
		},
		onLoad() {
			this.wordOrderList()
		},
		onShow() {

			// this.wordOrderList()
		},
		computed: {
			// 拿取vuex数据
			...mapGetters({
				userInfo: 'users/getLoginInfo',
			})
		},
		methods: {
			wordOrderList() {
				getwordOrder({
					station: this.userInfo.station,
					brigade: '长沙芙蓉区'
				}).then((res) => {

					this.dataList = res.data
					try {
						uni.setStorageSync('Security', res.data)
					} catch (e) {
						console.log(e);
						//错误
					}
					console.log(res);
				}).catch((err) => {
					console.log(err);
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.word_oeders {
		padding: 12rpx;

		.word_item {
			text-indent: 24px;
			font-size: 18px;
			letter-spacing: 6rpx;
			margin-bottom: 20rpx
		}

		.box {
			text-indent:1em;
			border-bottom: 1px solid black;
			color: red;
			word-spacing: 10px;
			line-height: 20px;
			margin-bottom: 20rpx // color: pink;
		}

		.time {
			text-align: right;
			margin-top: 40rpx;
		}
	}
</style>