Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码生成的两个缺陷 #6935

Closed
zhouyu629 opened this issue Jul 21, 2024 · 1 comment
Closed

代码生成的两个缺陷 #6935

zhouyu629 opened this issue Jul 21, 2024 · 1 comment

Comments

@zhouyu629
Copy link

版本号:

3.7

问题描述:

因带子表oneline表单不是很灵活,就生成代码改了下试试:
// 1. js加强生成不了
2. 子表数据从后台提取后赋值不对,默认直接取的list,应该用list的records属性
xxxxTable.dataSource = [...xxxxDataList.records];
3. 默认值填值(如从后台取订单号)未实现。

'''
/**
* 默认填充订单编号
*/
async function fillOrderNum() {
const orderNumData = await queryShopOrderNum();
formData.orderCode = orderNumData;
}

  /**
   * @param event 当订单明细行的实际拿货价和数量变化时计算当前行总价,以及总订单的总价和总数量
   */
  function rowValueChange(event) {
    if (event.columnIndex == 4 || event.columnIndex == 5) {
      // 4和5列为实际价和数量,相乘得到该行的总价
      let row = event.row;
      if (row.factPrice != '' && row.orderNum != '') {
        row.totalPrice = row.factPrice * row.orderNum;
        reCaculateTotalPriceAndTotalAmount();
      }
    }
  }

  /**
   * 当删除一行记录时,应该更新订单总金额和数量
   */
  function removedDet() {
    reCaculateTotalPriceAndTotalAmount();
  }

  /**
   * 重新计算整个订单的总数量和总价
   */
  function reCaculateTotalPriceAndTotalAmount() {
    // 循环计算订单的总价和总数量
    let detTable = bcOrderDetTableRef.value.getXTable().getTableData();
    let totalPrice = 0,
      totalAmount = 0;
    for (let detRow of detTable.tableData) {
      totalPrice += detRow.totalPrice;
      totalAmount += detRow.orderNum;
    }
    formData.totalPrice = totalPrice;
    formData.totalAmount = totalAmount;
  }

'''

错误截图:

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
@zhangdaiscott
Copy link
Member

暂时收录到 #1312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants