<template>
	<view class="pdca-page">
		<uni-segmented-control
		  :current="current"
			:values="items"
			@clickItem="onClickItem"
			style-type="text"
			active-color="#3377FF" />
		<view class="content">
			<scroll-view class="scroll-y" scroll-y="true">
        <one-textarea
          v-if="current === 0"
          :defaultPlanValue="plan"
          :disabled="disabled"
         />
				 <do-and-check
					 v-if="current === 1"
           :disabled="disabled"
					/>
				<view v-if="current === 2">
						选项卡3的内容
				</view>
				<one-textarea
          v-if="current === 3"
          title="对策处置（Action）"
          label="对策处置"
          :defaultactionValue="'123'"
          :disabled="disabled"
         />
			</scroll-view>
			<view class="fixed-buttom-btn" v-if="!disabled">
				<view class="btn-text cancle">
					<text>暂存</text>
				</view>
				<view class="btn-text">
					<text>完成</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// 改善任务PDCA
	import uniSegmentedControl from "@/components/uni-segmented-control/uni-segmented-control.vue"
	import oneTextarea from './pdca-components/one-textarea.vue'
	import doAndCheck from './pdca-components/do-and-check.vue'

	export default {
    props: {
      // 是否禁用
      disabled: {
        type: Boolean,
        default: false
      },
      // 详情回显的数据
      values: {
        type: Object,
        default: () => {
          return {}
        }
      },
      // 按钮信息 (包过请求的key)
      btnInfo: {
        type: Object,
        default: () => {
          return {}
        }
      },
      // 任务详情
      missionDetails: {
        type: Object,
        default: () => {
          return {}
        }
      }
    },
		data() {
			return {
				items: ['改善计划(P)', '执行过程(D)', '改善确认(C)', '对策处置(A)'],
        current: 0,
        // plan 改善计划
        plan: ''
			}
		},
		created() {
			uni.setNavigationBarTitle({
				title: '改善计划'
      });
      if(this.disabled) {
        this.plan = this.values['plan'];
        console.log(9, this.values)
      }
		},
		methods: {
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex;
				}
			}
		},
		components: {
			uniSegmentedControl,
			oneTextarea,
			doAndCheck
		}
	}
</script>

<style lang="less">
	.pdca-page {
		height: 100%;

		.content {
      height: calc(100% - 141.5rpx);

			.scroll-y {
				height: 100%;
			}
		}
	}
</style>
