resolveIndicesForIncrementalSubmit.js 594 Bytes
/**
 * 与 index.vue getGoodsTypeGroupRules 全量提交路径一致:
 * 仅 touched 或 sessionAdded 的 Tab 进入 indicesForIncremental。
 *
 * @param {Array<object>} editableTabs
 * @returns {number[]}
 */
export function resolveIndicesForIncrementalSubmit(editableTabs) {
  const indices = []
  const tabs = editableTabs || []
  for (let i = 0; i < tabs.length; i++) {
    const tab = tabs[i]
    if (
      tab
      && String(tab.name) !== "add"
      && (tab.classificationUserTouched === true || tab.sessionAdded === true)
    ) {
      indices.push(i)
    }
  }
  return indices
}