<template>
  <div>
    <Row style="marginTop:10px">
      <Col :span="24">
        <Card>
          <div>
            <Form :model="viewForm" ref="viewForm" :rules="rules" :label-width="120" inline>
              <Row>
                <Col :span="12">
                  <Form-item prop="batchNum" label="批次号">{{viewForm.batchNum}}</Form-item>
                </Col>
                <Col :span="12">
                  <Form-item prop="ctldate" label="控制日期">{{viewForm.ctldate|}}</Form-item>
                </Col>
              </Row>
              <Row>
                <Col :span="12">
                  <Form-item prop="senddate" label="发送日期">{{viewForm.senddate}}</Form-item>
                </Col>
                <Col :span="12">
                  <Form-item prop="receivableNum" label="收款单号">{{viewForm.receivableNum}}</Form-item>
                </Col>
              </Row>
              <Row>
                <Col :span="12">
                  <Form-item prop="fmsModule" label="核算模块">{{viewForm.fmsModule}}</Form-item>
                </Col>
                <Col :span="12">
                  <Form-item prop="serviceId" label="ESB服务号">{{viewForm.serviceId}}</Form-item>
                </Col>
              </Row>
              <Row>
                <Col :span="12">
                  <Form-item prop="impStatus" label="导入状态">{{viewForm.impStatus}}</Form-item>
                </Col>
                <Col :span="12">
                  <Form-item prop="returnMsg" label="返回信息">{{viewForm.returnMsg}}</Form-item>
                </Col>
              </Row>
              <Row>
                <Col :span="12">
                  <Form-item prop="createdTime" label="首次导入时间">{{viewForm.createdTime}}</Form-item>
                </Col>
                <Col :span="12">
                  <Form-item prop="updatedTime" label="最后导入时间">{{viewForm.updatedTime}}</Form-item>
                </Col>
              </Row>
            </Form>
          </div>
        </Card>
      </Col>
    </Row>
  </div>
</template>

<script>
import miment from "miment";
import util from "@/tools/util.js";
import Server from "./server.js";
const server = new Server();
export default {
  name: "reimportViewPage",
  components: {},
  props: {
    lineNum: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      server: server,
      viewForm: {
        batchNum: "", //批次号
        ctldate: "", //控制日期
        receivableNum: "", //收款单号
        impStatus: "", //导入状态
        returnMsg: "", //返回信息
        fmsModule: "", //核算模块
        serviceId: "", //ESB服务号
        createdTime: "", //首次导入时间
        updatedTime: "" //最后导入时间
      }
    };
  },
  created() {
    this.$emit("SetTitle", "凭证导入详细信息");

    //加载导入失败详情
    this.server.findDetail(this.lineNum).then(response => {
      if (response.statusCode === "-1") {
        this.$Message.error(response.msg);
        return;
      } else {
        if (!response.data.id) {
          this.$Message.error("【" + this.lineNum + "】单据未找到导入记录！");
          return;
        } else {
          this.viewForm = response.data;
          this.viewForm.ctldate = new Date(this.viewForm.ctldate).Format("yyyy-MM-dd");
          this.viewForm.createdTime = new Date(this.viewForm.createdTime).Format("yyyy-MM-dd hh:mm:ss");
          this.viewForm.updatedTime = new Date(this.viewForm.updatedTime).Format("yyyy-MM-dd hh:mm:ss");
          this.viewForm.impStatus = this.viewForm.impStatus == "E" ? "导入失败" : "导入成功";
          this.viewForm.fmsModule = this.viewForm.impStatus == "GL" ? "总账" : "应收账款";
        }
      }
    });
    //当前页 “关闭”按钮配置
    this.$emit("SetPageActions", [
      {
        text: "关闭",
        theme: "primary",
        handle: () => {
          this.$emit("Close");
        }
      }
    ]);
    this.$emit("SetPageSize", 800);
  },
  beforeMount: function() {},
  mounted: function() {},
  beforeDestroy: function() {},
  destroyed: function() {},
  methods: {},
  watch: {},
  directives: {}
};
</script>
