<template>
	<view class="zd_container">
		<nav-bar :inner2="true" @goIn="goIn" title="作业明细"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">设备</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input filter_input_disabled" disabled v-model="val1">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">单据类型</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input filter_input_disabled" disabled v-model="['维修单', '保养单', '点检单', '润滑单'][Number(val2) - 1]">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">单据号</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input filter_input_disabled" disabled v-model="val3">
					</view>
				</view>
			</view>
			<view class="zd_wrapper grid-wraper">
				<view class="slide_new">
					<table>
						<thead>
							<tr>
								<th>是否完成</th>
								<th>项目编码</th>
								<th>项目名称</th>
								<th v-show="val2 !== '1'">项目等级</th>
								<th v-show="val2 !== '1'">项目内容</th>
								<th>要求</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="(e, i) in dataList" :key="i">
								<td>{{['否', '是'][Number(e.isfinish)]}}</td>
								<td>{{e.item_code}}</td>
								<td>{{e.item_name}}</td>
								<td v-show="val2 !== '1'">{{['日常', '一级', '二级'][Number(e.item_level) - 1]}}</td>
								<td v-show="val2 !== '1'">{{e.contents}}</td>
								<td>{{e.requirement}}</td>
							</tr>
						</tbody>
					</table>
				</view>
			</view>
		</view>
		<view class="submit-bar">
			<button class="submit-button" @tap="toCancle">返回</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import SearchBox from '@/components/SearchBox.vue'
	import {deviceManageGetDtl} from '@/utils/getData2.js'
	export default {
		components: {
			NavBar,
			SearchBox
		},
		data() {
			return {
				val1: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.device_code : '',
				val2: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.job_type : '',
				val3: this.$store.getters.publicObj !== '' ? this.$store.getters.publicObj.job_code : '',
				dataList: []
			};
		},
		created () {
			this._deviceManageGetDtl()
		},
		methods: {
			/** grid查询 */
			async _deviceManageGetDtl () {
				let res = await deviceManageGetDtl(this.val1, this.val2, this.val3)
				this.dataList = [...res.data]
			},
			toCancle () {
			  this.goIn()
			},
			goIn () {
				this.$store.dispatch('setPublicObj', '')
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="stylus">
</style>
