<!-- 日常盘点 -->
<template>
	<view class="amms-page">
		<cu-custom>
			<block v-slot:content>{{ title }}</block>
		</cu-custom>
		<!-- <q-tab style="padding-bottom: .64rem;" :tab-list="tabList" :tabCur.sync="tabCur" @change="tapTabSelect"></q-tab> -->
		<view class="con main-font-color">
			<!-- 新增 -->
			<block v-if="tabCur == 0"><tjgz @tjgzChange="tjgzChange"></tjgz></block>
			<!-- 查询 -->
			<block v-else-if="tabCur == 1">
				<jl-info 
				@pdetailsfunction = "pdetailsfunction"
				@pdetailszi = "pdetailszi"
				@passfunction = "meetfunction"></jl-info>
			</block>
			<!-- 详情 -->
			<block v-else-if="tabCur == 2">
				<details-list @detailsChange="detailsChange" :pdetails_arr="pdetails_arr"></details-list>
			</block>
		</view>
		<!-- 等待界面 -->
		<q-loading mask="true" click="true" ref="loading"></q-loading>
	</view>
</template>

<script>
import tjgz from './components/tjgz.vue';
import jlInfo from './components/jlInfo.vue';
import detailsList from './components/details.vue';
export default {
	components: {
		jlInfo,
		tjgz,
		detailsList
	},
	props: {
	},
	data() {
		return {
			title: 'NFF存档内容查询',
			tabCur: 1,
			tabList: ['新增', '查询', '详情'],
			pdetails_arr: {},
		};
	},
	watch: {
		tabCur(newVal, oldVal){
			if(newVal == 0){
				this.title = 'NFF存档内容新增'
			}else if(newVal == 1){
				this.title = 'NFF存档内容查询'
			}else{
				this.title = 'NFF'
			}
		}
	},
	computed: {},
	methods: {
		// 切换tab页
		tapTabSelect(_index) {
			this.tabCur = _index;
		},
		meetfunction(val){
			this.tabCur = val
		},
		pdetailszi(val){
			this.tabCur = val
		},
		tjgzChange(val){
			this.tabCur = val
		},
		detailsChange(val){
			this.tabCur = val
		},
		pdetailsfunction(row){
			this.pdetails_arr = this.formatData(row)
		},
		// 数据结构处理
		formatData(obj){
			let ZNFFJW1 = [];
			let ZNFFJW2 = [];
			let ZNFFJW3 = [];
			let ZNFFJW4 = [];
			let ZNFFJW5 = [];
			let ZNFFJW6 = [];

			obj.fileList.map(item => {
				if(item.dmtyp1 == 'ZNFFJW1'){
					ZNFFJW1.push(item);
					obj['ZNFFJW1'] = ZNFFJW1;
				}
				if(item.dmtyp1 == 'ZNFFJW2'){
					ZNFFJW2.push(item);
					obj['ZNFFJW2'] = ZNFFJW2;
				}
				if(item.dmtyp1 == 'ZNFFJW3'){
					ZNFFJW3.push(item);
					obj['ZNFFJW3'] = ZNFFJW3;
				}
				if(item.dmtyp1 == 'ZNFFJW4'){
					ZNFFJW4.push(item);
					obj['ZNFFJW4'] = ZNFFJW4;
				}
				if(item.dmtyp1 == 'ZNFFJW5'){
					ZNFFJW5.push(item);
					obj['ZNFFJW5'] = ZNFFJW5;
				}
				if(item.dmtyp1 == 'ZNFFJW6'){
					ZNFFJW6.push(item);
					obj['ZNFFJW6'] = ZNFFJW6;
				}
			})
			return obj;
		},
		contains(arr, val){
			return arr.some(item => item === val)
		},
	},
	onShow() {
		// 监听回调
		let vm = this;
	},
	onLoad() {},
	onReady() {}
};
</script>

<style lang="less" scoped>
.con {
	// margin-top: 90rpx;

	.steps-view-item {
		.line {
			width: 100%;
			border-top: 1rpx solid #ddd;
			margin-left: 64rpx;
		}
	}
}
</style>
