danjup.vue 7.89 KB
<template>
  <div class="eibs-tab">
    <c-col :span="24">

      <c-table style="text-align: center" highlight-current-row @row-click="handleInvrepRowClick" :row-class-name="tableInvrepRowClassName" :list="model.recpan.danlst" :paginationShow="true" :border="true" :total="model.recpan.danlst.length">
        <el-table-column label="进口企业名称" prop="clinam" width="auto">
        </el-table-column>
        <el-table-column label="发票号" prop="ineref" width="auto">
        </el-table-column>
        <el-table-column label="发票金额" prop="ineamt" width="auto">
        </el-table-column>
        <el-table-column label="报关单编号" prop="cusref" width="auto">
        </el-table-column>
        <el-table-column label="关单币种" prop="cur" width="auto">
        </el-table-column>
        <el-table-column label="报关单占用金额" prop="cusamt" width="auto">
        </el-table-column>
        <el-table-column label="使用情况" prop="usesta" width="auto">
        </el-table-column>
        <el-table-column label="核验情况" prop="chksta" width="auto">
        </el-table-column>
        <el-table-column label="核验结果" prop="chkret" width="auto">
        </el-table-column>

        <el-table-column label="" prop="det" width="150px" fixed="right">
          <template slot-scope="scope" slot="header">
            <c-button circle style="padding: 4px" class="el-icon-plus" size="mini" @click="handleEdit()">
            </c-button>
            <c-button style="padding: 4px" circle class="el-icon-minus" size="mini" @click="removeRowDanlst(scope)">
            </c-button>
          </template>
          <template slot-scope="scoped">
            <c-button style="margin-left: 0" size="small" type="primary" icon="el-icon-info" @click="handleEdit(scoped.row)"></c-button>
          </template>
        </el-table-column>
      </c-table>

    </c-col>

    <el-dialog title="单据信息详情" :visible.sync="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" destroy-on-close width="75%" center>
      <el-form :model="dialog" label-width="100px">
        <c-col :span="12" style="padding-right: 20px;">
          <c-col :span="24">
            <el-form-item label="进口企业名称" label-width="150px" prop="clinam">
              <c-input v-model="dialog.clinam" style="width: 100%"></c-input>
            </el-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="发票号" label-width="150px" prop="ineref">
              <c-input v-model="dialog.ineref" style="width: 100%"></c-input>
            </el-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="发票金额" label-width="150px" prop="ineamt">
              <c-input-currency v-model="dialog.ineamt" style="width: 100%"></c-input-currency>
            </el-form-item>
          </c-col>
        </c-col>
        <c-col :span="12" style="padding-right: 20px;">
          <c-col :span="24">
            <el-form-item label="报关单编号" label-width="150px" prop="cusref">
              <c-input v-model="dialog.cusref" style="width: 100%"></c-input>
            </el-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="关单币种" label-width="150px" prop="cur">
              <c-select disabled v-model="dialog.cur" dbCode="curtxt" style="width: 100%">
              </c-select>
            </el-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="报关单占用金额" label-width="150px" prop="cusamt">
              <c-input-currency v-model="dialog.cusamt" style="width: 100%"></c-input-currency>
            </el-form-item>
          </c-col>
        </c-col>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <c-button type="primary" @click="saveDialog">确 定</c-button>
        <c-button @click="dialogVisible = false">取 消</c-button>
      </span>
    </el-dialog>

    <c-col :span="24" style="margin-top: 50px;">
      <c-col :span="12" style="padding-right: 20px">
        <c-col :span="24" style="display: flex;align-item: center;justify-content: flex-start;">
          <div style="width: 100%;">
            <el-form-item label="发票数量" prop="recgrp.rec.inenum">
              <c-input disabled v-model="model.recgrp.rec.inenum" placeholder="请输入发票数量"></c-input>
            </el-form-item>
          </div>
          <div style="margin-left: 10px;">
            <span style="height:32px;line-height:32px"></span>
          </div>
        </c-col>

        <c-col :span="24" style="display: flex;align-item: center;justify-content: flex-start;">
          <div style="width: 100%;">
            <el-form-item label="报关单数量" prop="recgrp.rec.cusnum">
              <c-input disabled v-model="model.recgrp.rec.cusnum" placeholder="请输入报关单数量"></c-input>
            </el-form-item>
          </div>
          <div style="margin-left: 10px;">
            <span style="height:32px;line-height:32px"></span>
          </div>
        </c-col>

      </c-col>

      <c-col :span="12" style="padding-left: 20px">
        <c-col :span="24">
          <c-form-item label="发票总金额" prop="recpan.totamt">
            <c-input-currency disabled v-model="model.recpan.totamt" placeholder="请输入发票总金额"></c-input-currency>
          </c-form-item>
        </c-col>

        <c-col :span="24">
          <c-form-item label="报关单总金额" prop="recpan.bgdamt">
            <c-input-currency disabled v-model="model.recpan.bgdamt" placeholder="请输入报关单总金额"></c-input-currency>
          </c-form-item>
        </c-col>

      </c-col>
    </c-col>

  </div>
</template>
<script>
import event from "../event";
import Default from "../model/default";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event, Default],
  data() {
    return {
      danlstIndex: -1,
      dialogVisible: false,
      tableData: [],
      pagination: {
        pageNum: 1,
        pageSize: 10,
        total: 0
      },

      dialog: {
        clinam: "",
        cur: "",
        cusamt: "",
        cusref: "",
        ineamt: "",
        ineref: ""
      },

      newdialog: {
        clinam: "",
        cur: "",
        cusamt: "",
        cusref: "",
        ineamt: "",
        ineref: ""
      }
    };
  },
  methods: {
    handleEdit(row) {
      this.dialogVisible = true;
      this.opeTyp = "ADD";
      this.dialog = {
        clinam: "",
        cur: this.model.recgrp.rec.rcvtotcur,
        cusamt: "",
        cusref: "",
        ineamt: "",
        ineref: ""
      };
      if (row) {
        this.opeTyp = "EDIT";
        Object.assign(this.dialog, row);
      }
    },

    addRowDanlst() {
      let newRow = { ...this.newdialog };
      let start = 0;
      if (this.model.recpan.danlst) {
        start = this.model.recpan.danlst.length;
      }
      this.model.recpan.danlst.splice(start, 0, newRow);

      this.danlstIndex = this.model.recpan.danlst.length - 1;
    },

    removeRowDanlst() {
      console.log("选中的他行下标", this.danlstIndex);
      if (this.danlstIndex === -1) {
        this.$notify.error({
          title: "错误",
          message: "请选择一条数据删除!"
        });
        return;
      }
      this.model.recpan.danlst.splice(this.danlstIndex, 1);
      this.danlstIndex = -1;
      this.refreshLnelstAndCuslst();
    },
    tableInvrepRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    handleInvrepRowClick(row) {
      this.danlstIndex = row.index;
    },

    saveDialog() {
      if (this.opeTyp == "ADD") {
        this.addRowDanlst();
      }
      this.opeTyp = "";
      this.dialogVisible = false;
      this.model.recpan.danlst.splice(this.danlstIndex, 1, this.dialog);
      this.refreshLnelstAndCuslst();
    },

    mounted() {},
    computed: {},
    watch: {},
    created: function() {}
  }
};
</script>
<style scoped>
</style>