|
|
/**
|
|
|
* 创建供应商
|
|
|
* 品类关联尺码列表
|
|
|
*/
|
|
|
'use strict';
|
|
|
var $ = require('jquery'),
|
|
|
common = require('../common/common');
|
|
|
|
|
|
|
|
|
var sortmenu = require('../common/sortmenu');
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 表格
|
|
|
*/
|
|
|
var g = new common.grid({
|
|
|
el: "#basicTable",
|
|
|
parms: function () {
|
...
|
...
|
@@ -26,23 +24,28 @@ var g = new common.grid({ |
|
|
{display: "排序", name: "orderBy"},
|
|
|
{
|
|
|
display: "操作", name: 'id', render: function (item) {
|
|
|
|
|
|
var htmlArr=[];
|
|
|
// 子类目不能删除父类目所创建的属性
|
|
|
if (window.sortid == item.sortId)
|
|
|
return '<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>';
|
|
|
if (window.sortid == item.sortId){
|
|
|
htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>')
|
|
|
}
|
|
|
htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-primary btn-xs editBtn">修改</a>')
|
|
|
return htmlArr.join("");
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 初始化排序目录
|
|
|
*/
|
|
|
sortmenu.init(function () {
|
|
|
g.init('/erpproduct/sortsize/ajax/index');
|
|
|
});
|
|
|
|
|
|
|
|
|
var _model = JSON.parse($("#model").val());
|
|
|
|
|
|
/**
|
|
|
* 添加
|
|
|
*/
|
|
|
$(document).on("click", "#btn-add", function () {
|
|
|
var _title = $(this).text();
|
|
|
common.dialog.confirm(_title, common.util.__template($("#template").html(), {
|
...
|
...
|
@@ -82,7 +85,9 @@ $(document).on("click", "#btn-add", function () { |
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
*/
|
|
|
$(document).on("click", ".delbtn", function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
common.dialog.confirm("温馨提示", "你确定要删除吗?", function () {
|
...
|
...
|
@@ -94,3 +99,68 @@ $(document).on("click", ".delbtn", function () { |
|
|
});
|
|
|
});
|
|
|
});
|
|
|
/**
|
|
|
* 验证
|
|
|
*/
|
|
|
var edit = new common.edit2("#baseform");
|
|
|
/**
|
|
|
* 通用
|
|
|
* @type {{module: null, toast: Bll.toast}}
|
|
|
*/
|
|
|
var Bll = {
|
|
|
module: null,
|
|
|
//弹框
|
|
|
toast: function (module) {
|
|
|
Bll.module = module;
|
|
|
var d = new common.dialog({
|
|
|
title: "修改",
|
|
|
content: common.util.__template2($("#template2").html(), Bll.module),
|
|
|
width: '30%',
|
|
|
button: [
|
|
|
{
|
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
if (edit.validate()) {
|
|
|
common.util.__ajax({
|
|
|
url: "/product/updateSortSize",
|
|
|
data: Bll.module
|
|
|
}, function (res) {
|
|
|
if (res.code == '200') {
|
|
|
g.reload();
|
|
|
d.close();
|
|
|
}
|
|
|
else {
|
|
|
common.util.__tip(res.message, "warning");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
},
|
|
|
{
|
|
|
"value": "取消",
|
|
|
"css": "btn-info"
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
edit.init();
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
* 监听输入框变化
|
|
|
*/
|
|
|
$(document).on("change", ".observe", function () {
|
|
|
var $this = $(this);
|
|
|
var name = $this.data("field");
|
|
|
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) {
|
|
|
obj[name1] = $this.val();
|
|
|
});
|
|
|
});
|
|
|
/**
|
|
|
* 修改
|
|
|
*/
|
|
|
$(document).on("click", ".editBtn", function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
Bll.toast(item);
|
|
|
}); |
...
|
...
|
|