简体   繁体   English

为什么在编辑发票时看不到我的发票项目?

[英]Why Can't I see My Invoice Items When I Edit My Invoice?

I'm using Laravel 5.7 & VueJs 2.5.* ...我正在使用Laravel 5.7VueJs 2.5.* ...

I'm using a single Bootstrap Model to create as well as edit my TicketInvoice & it's TicketInvocieItems , but when i hit Edit, Bootstrap Model opens & i see data fill with TicketInvoice but can't see data of TicketInvoiceItems .我正在使用单个 Bootstrap 模型来创建和编辑我的TicketInvoice和它的TicketInvocieItems ,但是当我点击编辑时,Bootstrap 模型打开并且我看到数据填充了TicketInvoice但看不到TicketInvoiceItems数据。 I don't know how to fill data of TicketInvoiceItems as well.我也不知道如何填写TicketInvoiceItems数据。

My ticketInvoiceItems input fields:我的ticketInvoiceItems输入字段:

<tbody>
  <tr v-for="(ticketInvoiceItem, key) in form.ticketInvoiceItems" :key="key">
    <!--Passenger Name-->
    <td>
      <input v-model="ticketInvoiceItem.passenger_name" size="40" type="text" name="passenger_name" class="table-control form-control" :class="{ 'is-invalid': form.errors.has('passenger_name') }">
      <has-error :form="form" field="passenger_name"></has-error>
    </td>
    <!--Ticket No.-->
    <td>
      <input v-model="ticketInvoiceItem.ticket_no" size="24" type="text" name="ticket_no" class="table-control form-control" :class="{ 'is-invalid': form.errors.has('ticket_no') }">
      <has-error :form="form" field="ticket_no"></has-error>
    </td>
  </tr>
  <!----------- ANY MANY OTHER FIELDS DOWN BELOW ----------->

My HTML edit Button:我的HTML编辑按钮:

<a href="#" @click="editModel(ticketInvoice)">
  <i class="fas fa-user-edit fa-lg text-orange"></i>
</a>

My VueJs editModel() code:我的VueJs editModel()代码:

<script>
  /*==============EDIT INVOICE CODE==============*/
  editModel(ticketInvoice) {
    this.editmode = true;
    this.form.reset();
    this.form.clear();
    $("#addNewTicketInvoice").modal("show");
    this.form.fill(ticketInvoice);
  },
  /*==============END EDIT INVOICE CODE==============*/
  </script>

My data() in VueJs我在VueJs data()

<script>
  export default {
    data() {
      return {
        editmode: true,
        ticketInvoices: {},
        vendors: null,
        form: new Form({
          id: "",
          vendor_id: "",
          ticket_invoice_no: "",
          ticket_invoice_date: "",
          ticket_invoice_fares_total: "",
          ticket_invoice_grand_total: "",

          ticketInvoiceItems: [{
            id: "",
            ticket_invoice_id: "",
            passenger_name: "",
            ticket_no: "",
            departure_date: "",
            fares: "",
            sub_total: 0
          }]
        })
      };
    },
    </script>

An Image For Better Understanding更好理解的图像在此处输入图片说明

In your editModel method add these lines :在您的editModel方法中添加以下editModel行:

   $("#addNewTicketInvoice").modal("show");
   this.form.fill(ticketInvoice);
   this.form.ticketInvoiceItems=ticketInvoice.ticket_invoice_items;

this.form.ticketInvoiceItems will be an object to loop through its values you should use this.form.ticketInvoiceItems将是一个对象,用于遍历您应该使用的值

   Object.values(this.form.ticketInvoiceItems).forEach(....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在视图中看不到我的 GrandTotal? - Why Can't I See My GrandTotal In My View? 如何在发票模板中显示我的发票数据 - How To Display My Invoice Data In Invoice Template 为什么我在 Chrome 控制台中看不到我的对象反应? - Why I can't see my objects in chrome console in react? 当我想查看更改时,如何在不重新启动nodejs的情况下编辑我的服务器文件? - How can I edit on my server files without restarting nodejs when i want to see the changes? 为什么我看不到下拉列表中保存在myphp数据库中的数据? - Why can't I see my data from my drop down list saved in my database on myphp? 为什么我在网页上看不到动态添加的铁页元素? - Why can't I see my dynamically added iron-pages element on my webpage? 为什么我无法在原始React Web应用程序的首页上看到测试文本? - Why can't I see my test text on the front page of my original React web app? 如果我的购物车打开HTML发票,是否应该考虑安全性问题? - Are there security issues I should take into consideration if my shopping cart opens up a HTML invoice? 为什么CodeceptJS不执行测试中的步骤? 为什么我看不到正在执行的测试? - Why isn't CodeceptJS executing the steps in my test? And why can I not see the test being executed? 为什么我不能将我的项目分配给对象的常量? - Why can I not assign my items to my object's constant?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM