Commodity attributes and specifications are selected for different specifications to add different inventory prices and other information on the background management page how to use js to reflect the Cartesian product how to achieve?

The id of

data format [[222333444], [111]] mainly wants to realize the style and specific data adjustment of html
clipboard.png


clipboard.png

.
<table class="table table-border table-bordered radius">
          <thead class="text-c">
            <tr>
              <th width="10%"></th>
              <th width="10%"></th>
              <th><span class="c-red">*</span>()</th>
              <th><span class="c-red">*</span>()</th>
              <th><span class="c-red">*</span>()</th>
              <th><span class="c-red">*</span></th>
              <th></th>
              <th></th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td></td>
              <td></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
              <td><input type="text" name="sp_name" value="" class="input-text"></td>
            </tr>
          </tbody>
        </table>

thank you!

May.30,2022

function descartes(arrIndex, aresult, data){
      if (arrIndex >= data.length) {
          result.push(aresult);
          return ;
      }
      var aArr = data[arrIndex];
      for (var i = 0; i < aArr.length; PPi) {
          var theResult = aresult.slice(0, aresult.length);
          theResult.push(aArr[i]);
          descartes(arrIndex + 1, theResult, data);
      }
  }
function goods_stock_set(result,spec){
    if (spec.length > 0) {
      var header_html = '<th><span class="c-red">*</span>()</th>'+
        '<th><span class="c-red">*</span>()</th>'+
        '<th><span class="c-red">*</span>()</th>'+
        '<th><span class="c-red">*</span></th>'+
        '<th></th>'+
        '<th></th>';
      var header_html_var = '';
      for (var i = 0; i < spec.length; iPP) {
        header_html_var += '<th width="10%">'+spec[i][0]+'</th>';
      }
      header_html_var += header_html;
      $('.more-spec-set thead tr').html(header_html_var);

      var tbody_html = '';
      for (var i = 0; i < result.length; iPP) {
        var tbody_html_ = '<tr>';
        for (var j = 0; j < result[i].length; jPP) {
          var value_name = $("label[for='checkbox-"+result[i][j]+"']").html();
          tbody_html_ += '<td>'+value_name+'</td>';
        }
        tbody_html_ += '<td><input type="text" name="sp_name" value="" class="input-text"></td>'+
              '<td><input type="text" name="sp_name" value="" class="input-text"></td>'+
              '<td><input type="text" name="sp_name" value="" class="input-text"></td>'+
              '<td><input type="text" name="sp_name" value="" class="input-text"></td>'+
              '<td><input type="text" name="sp_name" value="" class="input-text"></td>'+
              '<td><input type="text" name="sp_name" value="" class="input-text"></td></tr>';
        tbody_html += tbody_html_;
      }
      $('.more-spec-set tbody').html(tbody_html);

      $('.more-spec-set').show();
    }
  }
Menu