<template>
  <div>
    <avue-form :option="option"
               @submit="submit"
               v-model="form"
               ref="form">
      <!--<template slot-scope="scope" slot="menuForm">
        <el-button @click="tip">自定義按鈕</el-button>
      </template>-->
      <template slot="isTurnIn">
        <!--        <el-checkbox v-model="row.isTurnIn" @change="turnInChange"></el-checkbox>-->
        <el-tag size="small " type="success" plain v-if="form.isTurnIn">上繳至上級單位</el-tag>
        <el-tag size="small " type="danger" plain v-if="!form.isTurnIn">非上繳</el-tag>
      </template>
    </avue-form>
  </div>
</template>

<script>
  import {sure} from "@/api/bank/sealhandover";;

  export default {
    name: "sealhandover-sure",
    data(){
      return {
        loading: false,
        option: {
          mockBtn: false,
          submitText: '確認',
          printBtn: false,
          emptyBtn: false,
          column: [
            {
              label: "銀行號",
              prop: "bankNo",
              span: 24,
              hide: true,
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入銀行號",
                trigger: "blur"
              }]
            },
            {
              label: "機構號",
              prop: "orgNo",
              hide: true,
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入機構號",
                trigger: "blur"
              }]
            },
            {
              label: "機構名稱",
              prop: "orgName",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入機構號",
                trigger: "blur"
              }]
            },
            {
              label: "印章類型",
              prop: "sealType",
              type: "select",
              disabled: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=seal_type",
              props:{
                label: "dictValue",
                value: "dictKey",
              },
            },
            {
              label: "印章編號",
              prop: "sealNo",
              disabled: true,
            },
            {
              label: "交出人",
              prop: "handoverPersonName",
              // formslot: true,
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入交出人姓名",
                trigger: "change"
              }]
            },
            {
              label: "交出人員工號",
              prop: "handoverPersonNo",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入交出人員工號",
                trigger: "blur"
              }]
            },
            {
              label: "交接日期",
              prop: "handoverDate",
              type: "datetime",
              format: "yyyy-MM-dd HH:mm",
              valueFormat: "yyyy-MM-dd HH:mm",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入交接日期",
                trigger: "blur"
              }]
            },
            {
              label: "是否上繳",
              prop: "isTurnIn",
              slot: true,
              rules: [{
                required: false,
                message: "請勾選是否上繳",
                trigger: "blur"
              }]
            },
            {
              label: "接收人",
              prop: "receiverName",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入接收人姓名",
                trigger: "change"
              }]
            },
            {
              label: "接收人員工號",
              prop: "receiverNo",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入接收人員工號",
                trigger: "blur"
              }]
            },
            {
              label: "備註",
              prop: "remark",
              disabled: false,
              rules: [{
                required: false,
                message: "請輸入備註",
                trigger: "blur"
              }]
            },
            {
              label: "填報時間",
              prop: "fillingDate",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入填報時間",
                trigger: "blur"
              }]
            },
            {
              label: "填報人",
              prop: "fillingPerson",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入填報人",
                trigger: "blur"
              }]
            },
          ]
        }
      }
    },
    props: {
      form: {
        type: Object
      },

    },
    mounted() {

    },
    methods: {
      submit(row, done){
        row.isTurnIn = !row.isTurnIn ? 0 : 1;
        sure(row).then(() => {
          this.$message.success("操作成功！");
          this.$emit("close")
          done();
        });
      },
    }
  }
</script>

<style scoped>

</style>
