提交 efc3bccf 编写于 作者: Skyeye云's avatar Skyeye云

代码修改

上级 4fa5b982
......@@ -59,9 +59,32 @@ layui.config({
}
});
// 添加
$("body").on("click", "#addBean", function() {
_openNewWindows({
url: systemCommonUtil.getUrl('FP2023092900001', null),
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "erpBomAdd",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadTable();
}});
});
// 详情
function details(data) {
_openNewWindows({
url: "../../tpl/erpBom/erpBomDetail.html",
title: systemLanguage["com.skyeye.detailsPageTitle"][languageType],
pageId: "erpBomDetails",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
}});
}
// 编辑
function edit(data) {
rowId = data.id;
_openNewWindows({
url: "../../tpl/erpBom/erpBomEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
......@@ -85,31 +108,6 @@ layui.config({
});
}
// 添加
$("body").on("click", "#addBean", function() {
_openNewWindows({
url: "../../tpl/erpBom/erpBomAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "erpBomAdd",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadTable();
}});
});
// 详情
function details(data) {
rowId = data.id;
_openNewWindows({
url: "../../tpl/erpBom/erpBomDetail.html",
title: systemLanguage["com.skyeye.detailsPageTitle"][languageType],
pageId: "erpBomDetails",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
}});
}
form.render();
$("body").on("click", "#reloadTable", function() {
loadTable();
......
......@@ -49,7 +49,7 @@ layui.config({
//加载bom方案列表
function loadBomList(normsId){
AjaxPostUtil.request({url: flowableBasePath + "erpbom007", params: {normsId: normsId}, type: 'json', callback: function (json) {
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryBomListByNormsId", params: {normsId: normsId}, type: 'json', method: 'GET', callback: function (json) {
$("#bomList").html(getDataUseHandlebars(selTemplate, json));
form.render("select");
//加载bom方案下的子件列表
......
......@@ -100,7 +100,7 @@ layui.config({
//加载bom方案列表
function loadBomList(normsId){
AjaxPostUtil.request({url: flowableBasePath + "erpbom007", params: {normsId: normsId}, type: 'json', callback: function (json) {
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryBomListByNormsId", params: {normsId: normsId}, type: 'json', method: 'GET', callback: function (json) {
$("#bomList").html(getDataUseHandlebars(selTemplate, json));
form.render("select");
//加载bom方案下的子件列表
......
var rowId = "";
layui.config({
base: basePath,
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
......@@ -12,10 +11,11 @@ layui.config({
form = layui.form,
table = layui.table,
tableCheckBoxUtil = layui.tableCheckBoxUtil;
var selTemplate = getFileContent('tpl/template/select-option.tpl');
// 组件使用
// 选择的多商品列表
materialMationList = parent.materialMationList;
// 设置提示信息
var s = "商品选择规则:1.多选;如没有查到要选择的商品,请检查商品信息是否满足当前规则。";
$("#showInfo").html(s);
......@@ -31,12 +31,12 @@ layui.config({
function initTable(){
var ids = [];
$.each(materialMationList, function(i, item) {
ids.push(item.materialId);
ids.push(item.id);
});
tableCheckBoxUtil.init({
gridId: 'messageTable',
filterId: 'messageTable',
fieldName: 'materialId',
fieldName: 'id',
ids: ids
});
......@@ -66,21 +66,14 @@ layui.config({
}},
{ field: 'unit', title: '产品规格类型', align: 'center', width: 100, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("materialUnit", 'id', d.unit, 'name');
}},
{ field: 'procedureMationList', title: '工序', align: 'left', width: 100, templet: function (d) {
var str = ""
$.each(d.procedureMationList, function(i, item) {
str += '<span class="layui-badge layui-bg-gray">' + item.number + '</span>' + item.procedureName + '<br>';
});
return str;
}}
}}
]],
done: function (json, curr, count) {
matchingLanguage();
// 设置选中
tableCheckBoxUtil.checkedDefault({
gridId: 'messageTable',
fieldName: 'materialId'
fieldName: 'id'
});
initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入商品名称,型号", function () {
......@@ -88,17 +81,17 @@ layui.config({
});
}
});
form.render();
}
var $step = $("#step");
$step.step({
index: 0,
time: 500,
title: ["选择商品", "选择规格"]
});
// 下一步
$("body").on("click", "#nextTab", function() {
var selectedData = tableCheckBoxUtil.getValueList({
......@@ -115,89 +108,47 @@ layui.config({
$("#tBody").html(getDataUseHandlebars($("#tableBody").html(), {rows: materialMationList}));
// 设置商品来源选中
$.each(materialMationList, function(i, item) {
$("#type" + item.materialId).val(item.typeId);
$("#type" + item.id).val(item.typeId);
});
form.render();
});
// 保存
$("body").on("click", "#saveChoose", function() {
var rows = $("#tBody tr");
var proList = new Array();
$.each(rows, function(i, item) {
var _object = $(item);
var materialId = _object.attr("rowid");
var materialId = $(item).attr("rowid");
proList.push({
materialId: materialId,
materialName: $("#name" + materialId).html(),
materialModel: $("#model" + materialId).html(),
bomId: $("#bom" + materialId).val(),
normsId: $("#norms" + materialId).val(),
unitName: $("#norms" + materialId).find("option:selected").text(),
procedureMationList: getProcedureMationList(materialId),
pId: '0',
needNum: '1',
unitPrice: getNormsPrice(materialId, $("#norms" + materialId).val()),
wastagePrice: '0.00',
type: $("#type" + materialId).val(),
remark: '',
open: 'true',
isParent: 1
normsId: $("#norms" + materialId).val()
});
});
var params = {
proList: JSON.stringify(proList)
};
AjaxPostUtil.request({url: flowableBasePath + "material015", params: params, type: 'json', callback: function(json) {
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "material015", params: params, type: 'json', method: 'POST', callback: function(json) {
parent.materialMationList = [].concat(json.rows);
parent.layer.close(index);
parent.refreshCode = '0';
}});
});
/**
* 获取商品工序
*/
function getProcedureMationList(materialId) {
var proIndex = -1;
$.each(materialMationList, function (i, item) {
if (materialId == item.materialId) {
proIndex = i;
return false;
}
});
if (proIndex >= 0) {
return materialMationList[proIndex].procedureMationList;
} else {
return new Array();
}
}
/**
* 获取指定规格的采购价/成本价
*/
function getNormsPrice(materialId, normsId){
//项目索引
var proIndex = -1;
//规格索引
var normsIndex = -1;
$.each(materialMationList, function(i, item) {
if(materialId == item.materialId){
proIndex = i;
$.each(item.unitList, function(j, bean){
normsIndex = j;
return false;
});
return false;
}
});
if(proIndex >= 0 && normsIndex >= 0){
return materialMationList[proIndex].unitList[normsIndex].estimatePurchasePrice;
form.on('select(unitListChoose)', function (data) {
var materialId = data.elem.id.replace("norms", "");
var value = data.value;
if (isNull(value)) {
$("#modelId").html("");
} else {
return new Array();
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryBomListByNormsId", params: {normsId: value}, type: 'json', method: 'GET', callback: function (json) {
$("#bom" + materialId).html(getDataUseHandlebars(selTemplate, json));
form.render("select");
}});
}
}
});
// 上一步
$("body").on("click", "#prevTab", function() {
$step.prevStep();
......@@ -209,11 +160,11 @@ layui.config({
$("body").on("click", "#reloadTable", function() {
loadTable();
});
function loadTable() {
table.reloadData("messageTable", {where: getTableParams()});
}
function refreshTable(){
table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()});
}
......@@ -221,6 +172,6 @@ layui.config({
function getTableParams() {
return $.extend(true, {categoryId: categoryId}, initTableSearchUtil.getSearchValue("messageTable"));
}
exports('materialChooseToProduce', {});
});
\ No newline at end of file
......@@ -44,16 +44,14 @@
<div id="secondTab" style="display: none;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<table class="layui-table" style="margin: 0px 10px;">
<table class="layui-table" style="margin: 0px 10px; width: calc(100% - 20px);">
<thead>
<tr>
<th style="width: 100px">商品名称</th>
<th>型号</th>
<th>所属类型</th>
<th>商品来源</th>
<th>规格选择</th>
<th>商品来源<i class="red">*</i></th>
<th>规格选择<i class="red">*</i></th>
<th>BOM方案选择</th>
<th>工序</th>
</tr>
</thead>
<tbody id="tBody">
......@@ -71,36 +69,27 @@
<script type="text/html" id="tableBody">
{{#each rows}}
<tr rowid="{{materialId}}">
<td id="name{{materialId}}">{{materialName}}</td>
<td id="model{{materialId}}">{{materialModel}}</td>
<td>{{categoryName}}</td>
<tr rowid="{{id}}">
<td id="name{{id}}">{{name}}</td>
<td id="model{{id}}">{{model}}</td>
<td>
<select lay-filter="typeId" lay-search="" id="type{{materialId}}" disabled>
<select lay-filter="typeId" lay-search="" id="type{{id}}" disabled>
<option value="1">自产</option>
<option value="2">外购</option>
</select>
</td>
<td>
<select lay-filter="unitListChoose" lay-search="" id="norms{{materialId}}">
{{#each unitList}}
<select lay-filter="unitListChoose" lay-filter="unitListChoose" win-verify="required" lay-search="" id="norms{{id}}">
<option value="">请选择</option>
{{#each materialNorms}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select>
</td>
<td>
<select lay-filter="bomListChoose" lay-search="" id="bom{{materialId}}">
<option value="">全部</option>
{{#each bomList}}
<option value="{{id}}">{{name}}</option>
{{/each}}
<select lay-filter="bomListChoose" lay-search="" id="bom{{id}}">
</select>
</td>
<td>
{{#each procedureMationList}}
<span class="layui-badge layui-bg-gray">{{number}}</span>{{procedureName}}<br>
{{/each}}
</td>
</tr>
{{/each}}
</script>
......
......@@ -40,7 +40,7 @@
.ztree div.diy {
height: 100%;
width: 20%;
width: 17%;
line-height: 30px;
border-top: 1px dotted #ccc;
border-left: 1px solid #eeeeee;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册