|
|
@ -72,8 +72,12 @@ |
|
|
|
title: '物料类型', |
|
|
|
field: 'materialType', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
var data = [{ index: index, type: value }]; |
|
|
|
return $("#materialType").tmpl(data).html(); |
|
|
|
var $template = $("#materialType").tmpl({ index: index, type: value }); |
|
|
|
var $select = $template.find('select'); |
|
|
|
$select.change(function() { |
|
|
|
// 这里可以做一些额外的操作,例如验证等 |
|
|
|
}).trigger('change'); // 触发 change 事件以设置初始值 |
|
|
|
return $select.prop('outerHTML'); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
@ -152,6 +156,19 @@ |
|
|
|
$.modal.alertWarning("请填写完整信息"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 获取当前行的下拉列表元素 |
|
|
|
var materialTypeSelect = $('#materialType-' + i); |
|
|
|
|
|
|
|
// 获取选中的值 |
|
|
|
var selectedMaterialType = materialTypeSelect.val(); |
|
|
|
|
|
|
|
if (!selectedMaterialType) { |
|
|
|
$.modal.alertWarning("请选择物料类型"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 更新表单数据 |
|
|
|
addChildMaterialTable[i].materialType = selectedMaterialType; |
|
|
|
} |
|
|
|
|
|
|
|
//将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
@ -210,13 +227,18 @@ |
|
|
|
|
|
|
|
<!-- 物料类型下拉框模板--> |
|
|
|
<script id="materialType" type="text/x-jquery-tmpl"> |
|
|
|
<div> |
|
|
|
<select name='salesEstimateDetailMaterialList[${index}].materialType' class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" required> |
|
|
|
<optgroup th:each="child: ${childList}" th:label="${child.name}"> |
|
|
|
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option> |
|
|
|
</optgroup> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<select data-id='salesEstimateDetailMaterialList[${index}].materialType' |
|
|
|
name='salesEstimateDetailMaterialList[${index}].materialType' |
|
|
|
class="form-control" |
|
|
|
th:with="childList=${@category.getChildByCode('materialType')}" |
|
|
|
required |
|
|
|
id="materialType-${index}"> |
|
|
|
<optgroup th:each="child: ${childList}" th:label="${child.name}"> |
|
|
|
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option> |
|
|
|
</optgroup> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|