<template>
  <div>
    <avue-form :option="option" @submit="submit" v-model="form" ref="form"></avue-form>
  </div>
</template>

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

  export default {
    name: "goodsuse-sure",
    data(){
      return {
        option: {
          submitText: "確認",
          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: "date",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入日期",
                trigger: "blur"
              }]
            },
            {
              label: "憑證/實物種類",
              prop: "type",
              type: "select",
              dicUrl: "/api/blade-system/dict/dictionary?code=voucher_type",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dicFormatter: (res) => {
                res.data.forEach(item => {item.disabled = item.isSealed == 1;})
                return res.data;
              },
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入憑證/實物種類",
                trigger: "blur"
              }]
            },
            {
              label: "使用數量",
              prop: "useNumber",
              type: "number",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入使用數量",
                trigger: "blur"
              }]
            },
            {
              label: "領入數量",
              prop: "receiptNumber",
              type: "number",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入領入數量",
                trigger: "blur"
              }]
            },
            {
              label: "註銷數量",
              prop: "writeOffNumber",
              type: "number",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入註銷數量",
                trigger: "blur"
              }]
            },
            {
              label: "開始編號",
              prop: "beginNo",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入開始編號",
                trigger: "blur"
              }]
            },
            {
              label: "結束編號",
              prop: "endNo",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入結束編號",
                trigger: "blur"
              }]
            },
            {
              label: "餘額",
              prop: "balance",
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入餘額",
                trigger: "blur"
              }]
            },
            {
              label: "備註",
              prop: "remark",
              disabled: true,
              rules: [{
                required: false,
                message: "請輸入備註",
                trigger: "blur"
              }]
            },
            {
              label: "填報人員工號",
              prop: "fillingNo",
              addDisplay: false,
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入填報人員工號",
                trigger: "blur"
              }]
            },
            {
              label: "填報人姓名",
              prop: "fillingName",
              addDisplay: false,
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入填報人姓名",
                trigger: "blur"
              }]
            },
            {
              label: "填報日期及時間",
              prop: "fillingDate",
              addDisplay: false,
              disabled: true,
              rules: [{
                required: true,
                message: "請輸入填報日期及時間",
                trigger: "blur"
              }]
            },

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

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

<style scoped>

</style>
