|
|
@ -136,6 +136,9 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-table"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<th:block th:include="include :: footer" /> |
|
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
@ -143,7 +146,8 @@ |
|
|
|
<script th:src="@{/js/activiti.js}"></script> |
|
|
|
<script th:src="@{/ajax/libs/vue/vue.js}"></script> |
|
|
|
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script> |
|
|
|
<script type="text/javascript"> |
|
|
|
<script th:inline="javascript"> |
|
|
|
|
|
|
|
new Vue({ |
|
|
|
el: '#app', |
|
|
|
data: function() { |
|
|
@ -247,7 +251,163 @@ |
|
|
|
var prefix = ctx + "erp/bom"; |
|
|
|
$("#form-edit").validate({focusCleanup: true}); |
|
|
|
var materialType = $("#materialType").val(); |
|
|
|
$("#selectMaterialType").val(materialType); |
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
var levelDatas = [[${@dict.getType('bomLevel')}]]; |
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; |
|
|
|
var useStatusDatas = [[${@dict.getType('useStatus')}]]; |
|
|
|
|
|
|
|
$(function() { |
|
|
|
var options = { |
|
|
|
id: "bootstrap-table", |
|
|
|
url: prefix + "/oneLevelList", |
|
|
|
method: 'post', |
|
|
|
sidePagination: "server", |
|
|
|
contentType: "application/x-www-form-urlencoded", |
|
|
|
queryParams: { |
|
|
|
parentId: $("input[name='id']").val() |
|
|
|
}, |
|
|
|
columns: [{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'level', |
|
|
|
title: '层级', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectDictLabel(levelDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomNo', |
|
|
|
title: 'bom号', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'photoUrl', |
|
|
|
title: '图片', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.imageView(value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNo', |
|
|
|
title: '料号', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialName', |
|
|
|
title: '物料名称', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
title: '物料类型', |
|
|
|
// formatter: function(value, row, index) { |
|
|
|
// return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
// } |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'describe', |
|
|
|
title: '描述', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'brand', |
|
|
|
title: '品牌', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'unit', |
|
|
|
title: '单位', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'useNum', |
|
|
|
title: '用量', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
} else { |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
title: '损耗率', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return "%"; |
|
|
|
} |
|
|
|
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 |
|
|
|
const match = value.match(regex); // 使用match方法查找所有匹配 |
|
|
|
if (match) { |
|
|
|
return value; |
|
|
|
} else { |
|
|
|
return value + "%"; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'processMethod', |
|
|
|
title: '半成品类型', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'parentId', |
|
|
|
title: '父级id', |
|
|
|
visible: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'sortNo', |
|
|
|
title: '排序', |
|
|
|
visible: false |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
$.table.init(options); |
|
|
|
}); |
|
|
|
|
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
var materialType = $('#selectMaterialType').select2('val'); |
|
|
|