...
|
...
|
@@ -71,6 +71,15 @@ GOLABDATA.on("LYaddInfo", function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
function inputDisabled(callback) {
|
|
|
if ($('.contentpanel').data('type') == 'info') {
|
|
|
$('.contentpanel').find('input').prop('disabled', true);
|
|
|
$('.contentpanel').find('select').prop('disabled', true);
|
|
|
$('.contentpanel').find('.btn').addClass('disabled');
|
|
|
callback && callback();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/goods/product/queryAttributesByConf',
|
...
|
...
|
@@ -151,12 +160,9 @@ $.ajax({ |
|
|
|
|
|
e.init();
|
|
|
|
|
|
if ($('.contentpanel').data('type') == 'info') {
|
|
|
$('.contentpanel').find('input').prop('disabled', true);
|
|
|
$('.contentpanel').find('select').prop('disabled', true);
|
|
|
$('.contentpanel').find('.btn').addClass('disabled');
|
|
|
inputDisabled(function() {
|
|
|
$('#addinfo-wrap').find('input').not(":checked").parents('label').hide();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -241,48 +247,44 @@ $('#editProductName').on('click', function() { |
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
var common_columns = [{
|
|
|
display: "名称",
|
|
|
width: '10%',
|
|
|
name: "attributeName",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
var arr = [];
|
|
|
arr.push(item.attributeName);
|
|
|
if (item.required) {
|
|
|
arr.push("<span class='red'>*</span>");
|
|
|
}
|
|
|
return arr.join('');
|
|
|
}
|
|
|
}]
|
|
|
/*陈超*/
|
|
|
|
|
|
var ag = new common.grid({
|
|
|
el: "#attributeTable",
|
|
|
columns: [{
|
|
|
display: "名称",
|
|
|
name: "attributeName",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
var arr = [];
|
|
|
arr.push(item.attributeName);
|
|
|
if (item.required) {
|
|
|
arr.push("<span class='red'>*</span>");
|
|
|
}
|
|
|
return arr.join('');
|
|
|
}
|
|
|
}, {
|
|
|
hash: false,
|
|
|
columns: common_columns.concat([{
|
|
|
display: "属性",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
|
|
|
// return {name:elem}
|
|
|
// });
|
|
|
|
|
|
var attrs = NETSALEDATA.productStandardRelationBoList;
|
|
|
if (attrs) {
|
|
|
for (var i in attrs) {
|
|
|
if (attrs[i].standardId == item.attributeId) {
|
|
|
item.val = attrs[i].standardVal;
|
|
|
item.val = attrs[i].parameterMakeId;
|
|
|
item.__val = attrs[i].parameterMakeId;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// item.attributeValues={name:};
|
|
|
item.__name = "attributeTable";
|
|
|
return common.util.__template2($("#template33").html(), item);
|
|
|
}
|
|
|
}, {
|
|
|
display: "备注",
|
|
|
name: "remark"
|
|
|
}],
|
|
|
}]),
|
|
|
complete: function() {
|
|
|
ag.__edit.init();
|
|
|
}
|
...
|
...
|
@@ -297,6 +299,9 @@ common.util.__ajax({ |
|
|
}
|
|
|
}, function(res) {
|
|
|
ag.init(res.data);
|
|
|
inputDisabled(function() {
|
|
|
$('#attributeTable').find('input').not(":checked").parents('label').hide();
|
|
|
});
|
|
|
}, true);
|
|
|
|
|
|
|
...
|
...
|
@@ -305,43 +310,25 @@ common.util.__ajax({ |
|
|
console.log("attributeProValuesBosOne", NETSALEDATA.attributeProValuesBosOne);
|
|
|
var ag2 = new common.grid({
|
|
|
el: "#goodsParamWrap",
|
|
|
columns: [{
|
|
|
display: "名称",
|
|
|
name: "attributeName",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
var arr = [];
|
|
|
arr.push(item.attributeName);
|
|
|
if (item.required) {
|
|
|
arr.push("<span class='red'>*</span>");
|
|
|
}
|
|
|
return arr.join('');
|
|
|
}
|
|
|
}, {
|
|
|
hash: false,
|
|
|
columns: common_columns.concat([{
|
|
|
display: "属性",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
item.id = item.parameterMakeId;
|
|
|
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
|
|
|
// return {name:elem}
|
|
|
// });
|
|
|
var attrs = NETSALEDATA.attributeProValuesBosOne;
|
|
|
if (attrs) {
|
|
|
for (var i in attrs) {
|
|
|
if (attrs[i].attributeId == item.attributeId) {
|
|
|
item.val = attrs[i].standardVal;
|
|
|
item.val = attrs[i].attributeValueId;
|
|
|
item.__val = attrs[i].attributeValueId.replace(/,/g, '|');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// item.attributeValues={name:};
|
|
|
item.__name = "goodsParamWrap";
|
|
|
return common.util.__template2($("#template33").html(), item);
|
|
|
}
|
|
|
}, {
|
|
|
display: "备注",
|
|
|
name: "remark"
|
|
|
}],
|
|
|
}]),
|
|
|
complete: function() {
|
|
|
ag2.__edit.init();
|
|
|
}
|
...
|
...
|
@@ -358,21 +345,70 @@ common.util.__ajax({ |
|
|
}, function(res) {
|
|
|
console.log("res.data", res.data);
|
|
|
ag2.init(res.data);
|
|
|
inputDisabled(function() {
|
|
|
$('#goodsParamWrap').find('input').not(":checked").parents('label').hide();
|
|
|
});
|
|
|
}, true);
|
|
|
|
|
|
// console.log(basicInfo);
|
|
|
|
|
|
var ag3 = new common.grid({
|
|
|
el: "#goodsParamWrap2",
|
|
|
hash: false,
|
|
|
columns: common_columns.concat([{
|
|
|
display: "属性",
|
|
|
render: function(item) {
|
|
|
item.required = item.isMust == "Y" ? "required" : "";
|
|
|
item.id = item.parameterMakeId;
|
|
|
var attrs = NETSALEDATA.specialAttrBo;
|
|
|
if (attrs && attrs.materialList) {
|
|
|
var _arr = [];
|
|
|
for (var i in attrs.materialList) {
|
|
|
_arr.push(attrs.materialList[i].id);
|
|
|
}
|
|
|
item.__val = _arr.join('|');
|
|
|
}
|
|
|
|
|
|
item.__name = "goodsParamWrap2";
|
|
|
return common.util.__template2($("#template33").html(), item);
|
|
|
}
|
|
|
}]),
|
|
|
complete: function() {
|
|
|
ag3.__edit.init();
|
|
|
}
|
|
|
});
|
|
|
ag3.__edit = new common.edit("#goodsParamWrap2");
|
|
|
common.util.__ajax({
|
|
|
url: '/base/goods/queryMaterialList',
|
|
|
data: {
|
|
|
categoryId: basicInfo.maxSortId
|
|
|
}
|
|
|
}, function(res) {
|
|
|
console.log("接口queryMaterialList", res.data);
|
|
|
ag3.init([res.data]);
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
$(document).on("change", "#goodsParamWrap .attr_input", function() {
|
|
|
var item = ag2.rows[$(this).data("index")];
|
|
|
item.val = $(this).val();
|
|
|
});
|
|
|
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
|
|
|
var item = ag2.rows[$(this).data("index")];
|
|
|
item.val = $("#attr_" + $(this).data("index")).val().replace(/\|/g, ',');
|
|
|
})
|
|
|
|
|
|
$(document).on("change", "#attributeTable .attr_input", function() {
|
|
|
var item = ag.rows[$(this).data("index")];
|
|
|
item.val = $(this).val();
|
|
|
});
|
|
|
|
|
|
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
|
|
|
var item = ag2.rows[$(this).data("index")];
|
|
|
item.val = $("#goodsParamWrap_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
|
|
|
})
|
|
|
|
|
|
$(document).on("change", "#goodsParamWrap2 .attr_checkobx_class", function() {
|
|
|
var item = ag3.rows[$(this).data("index")];
|
|
|
item.val = $("#goodsParamWrap2_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
|
|
|
})
|
|
|
|
|
|
|
|
|
/*保存*/
|
|
|
GOLABDATA.on("TYgoodsParams", function() {
|
...
|
...
|
@@ -381,24 +417,24 @@ GOLABDATA.on("TYgoodsParams", function() { |
|
|
return ag.__edit.errMessage;
|
|
|
}
|
|
|
if (!ag2.__edit.validate(true)) {
|
|
|
return ag.__edit.errMessage;
|
|
|
return ag2.__edit.errMessage;
|
|
|
}
|
|
|
if (!ag3.__edit.validate(true)) {
|
|
|
return ag3.__edit.errMessage;
|
|
|
}
|
|
|
|
|
|
var productStandardRelationStr = [];
|
|
|
if (ag.rows.length > 0) {
|
|
|
for (var i in ag.rows) {
|
|
|
if (ag.rows[i].val) {
|
|
|
var arr = ag.rows[i].val.split('|');
|
|
|
var idNameList = ag.rows[i].idNameList;
|
|
|
for (var x in idNameList) {
|
|
|
for (var y in arr) {
|
|
|
if (arr[y] == idNameList[x].id) {
|
|
|
productStandardRelationStr.push({
|
|
|
standardId: ag.rows[i].attributeId,
|
|
|
standardVal: idNameList[x].text,
|
|
|
parameterMakeId: idNameList[x].id
|
|
|
});
|
|
|
}
|
|
|
if (ag.rows[i].val == idNameList[x].id) {
|
|
|
productStandardRelationStr.push({
|
|
|
standardId: ag.rows[i].attributeId,
|
|
|
standardVal: idNameList[x].text,
|
|
|
parameterMakeId: idNameList[x].id
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -421,8 +457,14 @@ GOLABDATA.on("TYgoodsParams", function() { |
|
|
}
|
|
|
}
|
|
|
data.attributeProValuesOne = JSON.stringify(goodsParamArr);
|
|
|
|
|
|
data.productMaterial = "";
|
|
|
if (ag3.rows.length > 0) {
|
|
|
data.productMaterial = ag3.rows[0].val;
|
|
|
}
|
|
|
|
|
|
data.productSkn = $('#productSkn').val();
|
|
|
console.log(data);
|
|
|
console.log("data", data);
|
|
|
return data;
|
|
|
|
|
|
});
|
...
|
...
|
|