<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>-->
    </avue-form>
  </div>
</template>

<script>
  import {returnsApprove} from "@/api/bank/returns";;

  export default {
    name: "returns-approve",
    data(){
      return {
        loading: false,
        option: {
          mockBtn: false,
          submitText: '提交',
          printBtn: false,
          emptyBtn: false,
          column: [
            {
              label: "業務類型",
              prop: "isPublic",
              type: "select",
              dataType: "string",
              disabled: true,
              dicUrl: `/api/blade-system/dict/dictionary?code=business_type`,
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dicFormatter: (res) => {
                res.data.forEach(item => {item.disabled = item.isSealed == 1;})
                return res.data;
              },
              rules: [{
                required: true,
                message: "請輸入業務類型",
                trigger: "blur"
              }]
            },
            {
              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: "serialNo",
              hide: true,
              display: false,
              rules: [{
                required: true,
                message: "請輸入序號",
                trigger: "blur"
              }]
            },
            {
              label: "支行",
              prop: "subBank",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入支行",
                trigger: "blur"
              }]
            },
            {
              label: "客戶名稱",
              prop: "customerName",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入客戶名稱",
                trigger: "blur"
              }]
            },
            {
              label: "狀態",
              prop: "status",
              type: "select",
              disabled: true,
              dataType: "string",
              dicUrl: `/api/blade-system/dict/dictionary?code=returns_status`,
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dicFormatter: (res) => {
                res.data.forEach(item => {item.disabled = item.isSealed == 1;})
                return res.data;
              },
              rules: [{
                required: true,
                message: "請輸入狀態",
                trigger: "blur"
              }]
            },
            {
              label: "退件原因",
              prop: "reason",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入退件原因",
                trigger: "blur"
              }]
            },
            {
              label: "備註",
              prop: "remark",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入備註",
                trigger: "blur"
              }]
            },
            {
              label: "條碼",
              prop: "barCode",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入條碼",
                trigger: "blur"
              }]
            },
            {
              label: "處理日期",
              prop: "handlingDate",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入處理日期",
                trigger: "blur"
              }]
            },
            {
              label: "接辦行經辦",
              prop: "handlingBank",
              rules: [{
                required: true,
                message: "請輸入接辦行經辦",
                trigger: "blur"
              }]
            },
            {
              label: "接辦行覆核",
              prop: "handlingBankReview",
              rules: [{
                required: false,
                message: "請輸入接辦行覆核",
                trigger: "blur"
              }]
            },

            {
              label: "經辦",
              prop: "handler",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入經辦",
                trigger: "blur"
              }]
            },
            {
              label: "跟進情況",
              prop: "handlingStatus",
              type: "select",
              dataType: "string",
              dicUrl: `/api/blade-system/dict/dictionary?code=processing_status`,
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dicFormatter: (res) => {
                res.data.forEach(item => {item.disabled = item.isSealed == 1;})
                return res.data;
              },
              change: ({value}) => {
                this.findObject(this.option.column, 'bankRemark').rules[0].required = value == '2'
              },
              rules: [{
                required: true,
                message: "請輸入跟進情況",
                trigger: "blur"
              }]
            },
            {
              label: "支行備註",
              prop: "bankRemark",
              rules: [{
                required: false,
                message: "請輸入支行備註",
                trigger: "blur"
              }]
            },
            {
              label: "支行確認人員工號",
              prop: "bankConfirmNo",
              display: false,
              rules: [{
                required: true,
                message: "請輸入支行確認人員工號",
                trigger: "blur"
              }]
            },
            {
              label: "支行確認人姓名",
              prop: "bankConfirmName",
              display: false,
              rules: [{
                required: true,
                message: "請輸入支行確認人姓名",
                trigger: "blur"
              }]
            },
            {
              label: "確認日期",
              prop: "bankConfirmTime",
              type: "datetime",
              format: "yyyy-MM-dd HH:mm:ss",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              display: false,
              rules: [{
                required: true,
                message: "請輸入確認日期",
                trigger: "blur"
              }]
            },

          ]
        }
      }
    },
    props: {
      form: {
        type: Object
      },

    },
    mounted() {

    },
    methods: {
      submit(row, done){
        returnsApprove(row).then(() => {
          this.$emit("close")
          done();
        });
      },
    }
  }
</script>

<style scoped>

</style>
