Authored by 姜敏

尺码测量数据加载时无需测量列不可编辑

... ... @@ -45,6 +45,7 @@ var list = function (data) {
columns: headList
});
g1.init(data.sizeRelationsList);
rendNoMeasureIds(data);
};
/**
*编辑尺码弹窗
... ... @@ -151,6 +152,7 @@ var toast = function (url, item, noHead, gridList) {
columns: headList
});
g.init(item.sizeRelationsList);
rendNoMeasureIds(item);
$("#noMeasureIds").val(item.noMeasureIds ? item.noMeasureIds.join("|") : "");
e.init();
};
... ... @@ -174,6 +176,25 @@ var check = function () {
}
});
};
/**
* 打开界面时,“无需测量”列不可编辑
* @param data
*/
var rendNoMeasureIds=function (data) {
var noMeasureIds=data.noMeasureIds||[];
// console.log(noMeasureIds);
$("input[name='noMeasureIds']").each(function () {
var val=$(this).val();
var _index = $(this).data("index");
var tbody = $(this).parents('table').children('tbody');
// console.log(val,_index,noMeasureIds.indexOf(val));
if(noMeasureIds.indexOf(val)>-1){
tbody.children('tr').each(function () {
$(this).find('td').eq(_index + 2).children().attr("readonly", true);
});
}
});
};
module.exports = {
list: list,
... ...
... ... @@ -3,7 +3,6 @@ var $ = require('jquery'),
util = require('../../../../common/util');
if (window.NETSALEDATA) {
{ //搜索关键词
var searchKeys = "";
if (window.NETSALEDATA.productExtBo) {
... ... @@ -34,7 +33,6 @@ if (window.NETSALEDATA) {
$("#searchKeys").on('change', function () {
searchKeys = $("#searchKeys").val();
});
$(document).on('click', '.add', function () {
var item = g.rows[$(this).data("index")];
var value = $("#searchKeys").val();
... ... @@ -67,7 +65,6 @@ if (window.NETSALEDATA) {
});
}
{ //尺寸信息
var productSkn = window.NETSALEDATA.baseProductInfo.baseProduct.productSkn;
var dataList;
... ... @@ -81,47 +78,7 @@ if (window.NETSALEDATA) {
if (res.data.list && res.data.list.length > 0) {
var e = new common.edit("#add-list");
dataList = res.data.list[0];
//拼接分类字符串
var a = dataList.productType.replace(/<br>/g, "/");
dataList.productType = a.substring(0, a.length - 1);
var headList = [];
var j = 0;//创造一个变量以供赋值
if (dataList.sizeRelationsList.length > 0) {
headList.push({display: "尺码", name: "sizeName"});//尺码
headList.push({
display: "参考尺码(" + dataList.genderName + ")",
name: "referenceName",
render: function (item1) {//参考尺码列
var refName = item1.referenceName ? item1.referenceName : "";//非空判断
var a = refName.split(/[|/]/g);
var refName1 = a[0] || "", refName2 = a[1] || "";
//console.log("refName1",refName1);
//console.log("refName2",refName2);
return '<div class="form-group"><div class="col-sm-5"><input class=" form-control refInfo refInfo1" data-index="' + item1.__index + '"' + 'value="' + refName1 + '"/></div>' + '<div class="col-sm-1">' + '/</div>' + '<div class="col-sm-5"><input class=" form-control refInfo refInfo2" data-index="' + item1.__index + '"' + 'value="' + refName2 + '"/></div></div>';
}
});
for (var i = 0; i < dataList.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
var sizeAttributes = dataList.sizeRelationsList[0].prdSizeAttributeBoList[i];//参考尺码数组里的数据
var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" data-index="' + i + '" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>';
headList.push({
display: sizeAttributes.sizeAttributeName + "<br>" + chkbox,
name: "sizeValue",
render: function (item1) {
var prdList = item1.prdSizeAttributeBoList;
if (j >= prdList.length) j = 0;//防止越界
var sizeVal = prdList[j].sizeValue ? prdList[j].sizeValue : "";
return '<div class="form-group"><input class="form-control sizeInfo ' + prdList[j++].sizeAttributeId
+ '" data-index="' + item1.__index + '"' + 'value="' + sizeVal + '"/><div>';
}
});
}
}
var grid = new common.grid({
el: "#content-list",
hash: false,
columns: headList
});
grid.init(dataList.sizeRelationsList);
common.sizeInfo.list(dataList);
$("#noMeasureIds").val(dataList.noMeasureIds ? dataList.noMeasureIds.join("|") : "");
e.init();
$(document).on('click', '#add-saveBtn', function () {
... ... @@ -150,14 +107,12 @@ if (window.NETSALEDATA) {
referenceName: ref1.val() + '/' + ref2.val()
});
}
//console.log(productSizeReferList);
var data = {
productSkn: dataList.productSkn,
noMeasureIds: noMeasureIds,
sizeInfoList: JSON.stringify(sizeInfoList),
productSizeReferList: JSON.stringify(productSizeReferList)
};
common.util.__ajax({
url: "/meterManage/productSize/saveProdSizeInfo",
data: data
... ... @@ -166,7 +121,7 @@ if (window.NETSALEDATA) {
return false;
});
}
},true);
}, true);
}
}
{ //搜索优先级
... ... @@ -174,7 +129,6 @@ if (window.NETSALEDATA) {
if (window.NETSALEDATA.searchSortList) {
searchSortList = window.NETSALEDATA.searchSortList;
}
for (var i = 0; i < searchSortList.length; i++) {
if (searchSortList[i].modelId == 1)
$("#sort0").val(searchSortList[i].intValue);
... ... @@ -193,7 +147,6 @@ if (window.NETSALEDATA) {
intValue: parseInt($("#sort" + i).val())
};
}
for (var i = 0; i < 3; i++) {
for (var j = 0; j < searchSortList.length; j++) {
if (searchSortList[j].modelId == item[i].modelId) {
... ... @@ -202,9 +155,7 @@ if (window.NETSALEDATA) {
}
}
}
searchSortList = item;
$('#sort-save').on('click', function () {
common.util.__ajax({
url: '/netSale/saveSearchSort',
... ... @@ -248,17 +199,4 @@ if (window.NETSALEDATA) {
}
//当点击“无需测量”,该列输入框不可编辑
$(document).on("change", "input[name='noMeasureIds']", function () {
var _index = $(this).data("index");
var tbody = $(this).parents('table').children('tbody');
if ($(this).is(':checked')) {
tbody.children('tr').each(function () {
$(this).find('td').eq(_index + 2).children().attr("readonly", true);
});
}
else {
tbody.children('tr').each(function () {
$(this).find('td').eq(_index + 2).children().attr("readonly", false);
});
}
});
\ No newline at end of file
common.sizeInfo.check();
\ No newline at end of file
... ...