<template>
    <view class="mx3" style="padding-bottom: 100rpx">
        <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
        <view
            class="p3 bg-color-white"
            style="margin-top: -50rpx; border-radius: 20rpx"
        >
            <u-form :model="form" ref="uForm" :label-width="180">
                <!--        <u-form-item label="计划id">
          <u-input disabled v-model="form.planId" />
        </u-form-item>
        <u-form-item label="设备id">
          <u-input disabled v-model="form.sbId" />
        </u-form-item>
        <u-form-item label="部件id">
          <u-input disabled v-model="form.partId" />
        </u-form-item>
        <u-form-item label="标准id">
          <u-input disabled v-model="form.standardId" />
        </u-form-item>
        <u-form-item label="负责人id">
          <u-input disabled v-model="form.checkUserId" />
        </u-form-item>

        <u-form-item label="计划单号">
          <u-input disabled v-model="form.planNo" />
        </u-form-item>-->
                <!--        <u-form-item label="任务名称">
          <u-input disabled v-model="form.name" />
        </u-form-item>
        <u-form-item label="计划名称">
          <u-input disabled v-model="form.planName" />
        </u-form-item>
        <u-form-item label="负责人">
          <u-input disabled v-model="form.checkUserName" />
        </u-form-item>
        <u-form-item label="设备名称">
          <u-input disabled v-model="form.sbName" />
        </u-form-item>
        <u-form-item label="部件名称">
          <u-input disabled v-model="form.partName" />
        </u-form-item>

        <u-form-item label="任务开始时间">
          <u-input disabled v-model="form.startTime" />
        </u-form-item>
        <u-form-item label="任务结束时间">
          <u-input disabled v-model="form.endTime" />
        </u-form-item>
        <u-form-item label="实际开始时间">
          <u-input disabled v-model="form.actualStartTime" />
        </u-form-item>
        <u-form-item label="实际结束时间">
          <u-input disabled v-model="form.actualEndTime" />
        </u-form-item>
        <u-form-item label="任务状态">
          <u-input disabled v-model="statusMap[form.status]" />
        </u-form-item>-->

                <!--        <u-form-item label="创建人名称">
          <u-input disabled v-model="form.createdUserName" />
        </u-form-item>
        <u-form-item label="创建时间">
          <u-input disabled v-model="form.createdTime" />
        </u-form-item>-->
                <u-form-item label="检查结果">
                    <u-input type="textarea" :height="50" v-model="form.feedback" />
                </u-form-item>
<!--                <u-form-item label="备注">
                    <u-input
                        placeholder="暂无"
                        type="textarea"
                        disabled
                        :height="50"
                        v-model="form.remark"
                    />
                </u-form-item>-->
            </u-form>

            <view class="p-fixed d-flex j-around a-center footer">
                <view
                    class="main-color-bg text-color-white common"
                    @tap="submit"
                >提交</view
                >
            </view>
        </view>
    </view>
</template>

<script>
import DictCache from '@/utils/dict.js';
export default {
    data() {
        return {
            form: {
                planId: '',
                sbId: '',
                partId: '',
                standardId: '',
                checkUserId: '',
                planNo: '',
                name: '',
                planName: '',
                checkUserName: '',
                sbName: '',
                partName: '',
                startTime: '',
                endTime: '',
                actualStartTime: '',
                actualEndTime: '',
                status: '',
                createdUserName: '',
                createdTime: '',
                remark: '',
                feedback: ''
            },
            test: null,
            detailId: '',
            searchType: null,
            filter: 0
        };
    },
    onLoad(options) {
        this.detailId = options.detailId;
        this.searchType = options.searchType;
        this.filter = options.filter;
        this.initData();
        this.statusMap = this.$DictCache.getLabelByValueMapByType(
            this.$DictCache.TYPE.CHECK_JOB_STATUS
        );
    },
    methods: {
        // 提交
        submit() {
            this.$Http.finishJob(this.form).then((res) => {
                uni.showToast({
                    title: res.message
                });
                uni.navigateTo({
                    url: '/pages/maintain-detail/maintain-detail?detailId=' + this.detailId + '&filter=' + this.filter + '&searchType=' + this.searchType
                });
            });
        },
        initData() {
            this.$Http
                .fetchCheckJob({
                    id: this.detailId
                })
                .then((res) => {
                    this.form = res.data;
                });
        }
    }
};
</script>

<style lang="less">
page {
  background-color: #f4f4f4;
}

.footer {
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  z-index: 10000;
  border-top: 1rpx solid #f4f4f4;
  height: 100rpx;

  .common {
    padding: 15rpx 200rpx;
    border-radius: 30rpx;
    background-color: #0082ff;
    color: #fff;
  }
}
</style>
