<template>
  <div>
    <LHeader :text="text"></LHeader>
    <van-form
      @submit="onSubmit"
      :show-error="false"
      :scroll-to-error="true"
      validate-trigger="onSubmit"
    >
    <van-field
        v-model="delayTime"
        name="delayTime"
        label="延期时间"
        placeholder="请输入"
        :rules="[{ required: true, message: '延期时间不能为空' }]"
      />


      <van-field
        v-model="delayApply"
        readonly
        label="延期理由"
        name="delayApply"
        rows="1"
        autosize
        type="textarea"
      />

    <van-field name="isAgree" label="延期是否通过">
        <template #input>
          <van-radio-group
            v-model="isAgree"
            direction="horizontal"
            @change="selectResult"
          >
            <van-radio name="1">通过</van-radio>
            <van-radio name="0">退回</van-radio>
          </van-radio-group>
        </template>
      </van-field>

      <van-field
        v-model="opinion"
        label="理由或者意见"
        name="opinion"
        rows="3"
        type="textarea"
        placeholder="请输入"
        :rules="[{ required: true, message: '理由或者意见不能为空' }]"
      />


      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit"
          >保存</van-button
        >
      </div>
    </van-form>
    <div style="margin:10px 16px 0px;padding-bottom:16px">
      <van-button round block type="warning" @click.native="cancel"
        >取消</van-button
      >
    </div>
  </div>
</template>

<script>
import LHeader from "@/components/header.vue";
import { timestampToTime } from "@/utils/format";
export default {
  components: {
    LHeader
  },
  data() {
    return {
      text: "延期审批",
      taskId: "",
      delayTime: "", // 延迟时间
      showDelayTime: false,
      delayApply: "", // 延迟理由
      isAgree: 1, // 延期是否通过
      opinion: "", //理由或者意见

    };
  },
  created() {
    this.taskId = this.$route.params.taskId;
  },
  methods: {
    onSubmit(values) {
      console.log("submit", values);
    },

    selectResult(val) {
      this.isAgree = val;
    },

 
   
    cancel() {
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
</style>
