Merge branch 'yohobuy_portak_dev_v4.8_20160620' of http://git.yoho.cn/fe/yohobuy…
…-portal-fe2 into yohobuy_portak_dev_v4.8_20160620
Showing
7 changed files
with
199 additions
and
187 deletions
1 | -module.exports=function(app) { | ||
2 | - /**/ | ||
3 | - app.get("/erpproduct/sortsize/index","baserule.CateSize","porattr_queryProductSortListByConf",function(pros){ | ||
4 | - this.$extend={ | ||
5 | - moduleName:'商品基础规则', | ||
6 | - pageName:'品类关联尺码列表', | ||
7 | - data:pros.data | ||
8 | - } | ||
9 | - }) | 1 | +module.exports = function (app) { |
2 | + /**/ | ||
3 | + app.get("/erpproduct/sortsize/index", "baserule.CateSize", "porattr_queryProductSortListByConf", function (pros) { | ||
4 | + this.$extend = { | ||
5 | + moduleName: '商品基础规则', | ||
6 | + pageName: '品类关联尺码列表', | ||
7 | + data: pros.data | ||
8 | + } | ||
9 | + }); | ||
10 | 10 | ||
11 | - app.post("/erpproduct/sortsize/ajax/index","catesize_querySizeListBySortId"); | ||
12 | - /*添加尺码接口【验证通过】*/ | ||
13 | - app.post("/erpproduct/sortsize/ajax/add","catesize_addSortSize"); | ||
14 | - /*删除单个品类尺码接口【待验证】*/ | ||
15 | - app.post("/erpproduct/sortsize/ajax/delete","catesize_deleteSortSize"); | ||
16 | - /*修改品类尺码排序接口*/ | ||
17 | - app.post("/product/updateSortSize","catesize_updateSortSize"); | 11 | + app.post("/erpproduct/sortsize/ajax/index", "catesize_querySizeListBySortId"); |
12 | + /*添加尺码接口【验证通过】*/ | ||
13 | + app.post("/erpproduct/sortsize/ajax/add", "catesize_addSortSize"); | ||
14 | + /*删除单个品类尺码接口【待验证】*/ | ||
15 | + app.post("/erpproduct/sortsize/ajax/delete", "catesize_deleteSortSize"); | ||
16 | + /*修改品类尺码排序接口*/ | ||
17 | + app.post("/product/updateSortSize", "catesize_updateSortSize"); | ||
18 | 18 | ||
19 | - //************************品类尺码属性管理***************************** | 19 | + /*尺码模糊查询【验证通过】*/ |
20 | + app.post("/erpproduct/sortsize/ajax/automatic", "catesize_querySizeByNameForSelect"); | ||
20 | 21 | ||
21 | - app.get("/erpproduct/sortattribute/index","baserule.CateSizeAttr","porattr_queryProductSortListByConf",function(pros){ | ||
22 | - this.$extend={ | ||
23 | - moduleName:'商品基础规则', | ||
24 | - pageName:'品类尺码属性', | ||
25 | - data:pros.data | ||
26 | - } | ||
27 | - }); | ||
28 | - /*获取品类关联尺码属性列表【验证通过】*/ | ||
29 | - app.post("/erpproduct/sortattribute/ajax/index","catesize_queryList"); | ||
30 | - /*添加品类关联尺码属性接口【待验证】*/ | ||
31 | - app.post("/erpproduct/sortattribute/ajax/add","catesize_add"); | ||
32 | - /*删除品类关联尺码属性接口【待验证】*/ | ||
33 | - app.post("/erpproduct/sortattribute/ajax/delete","catesize_delete"); | ||
34 | - /*修改品类关联尺码属性接口【待验证】*/ | ||
35 | - app.post("/sortAttribute/updateOrderBy","catesize_updateOrderBy"); | ||
36 | -} | ||
22 | + //************************品类尺码属性管理***************************** | ||
23 | + | ||
24 | + app.get("/erpproduct/sortattribute/index", "baserule.CateSizeAttr", "porattr_queryProductSortListByConf", function (pros) { | ||
25 | + this.$extend = { | ||
26 | + moduleName: '商品基础规则', | ||
27 | + pageName: '品类尺码属性', | ||
28 | + data: pros.data | ||
29 | + } | ||
30 | + }); | ||
31 | + /*获取品类关联尺码属性列表【验证通过】*/ | ||
32 | + app.post("/erpproduct/sortattribute/ajax/index", "catesize_queryList"); | ||
33 | + /*添加品类关联尺码属性接口【待验证】*/ | ||
34 | + app.post("/erpproduct/sortattribute/ajax/add", "catesize_add"); | ||
35 | + /*删除品类关联尺码属性接口【待验证】*/ | ||
36 | + app.post("/erpproduct/sortattribute/ajax/delete", "catesize_delete"); | ||
37 | + /*修改品类关联尺码属性接口【待验证】*/ | ||
38 | + app.post("/sortAttribute/updateOrderBy", "catesize_updateOrderBy"); | ||
39 | + | ||
40 | + /*修改品类关联尺码属性接口【待验证】*/ | ||
41 | + app.post("/erpproduct/sortattribute/ajax/automatic", "catesize_querySizeAttributesByName"); | ||
42 | +}; |
1 | -module.exports={ | ||
2 | - namespace:"catesize", | ||
3 | - apis:{ | ||
4 | - querySizeListBySortId:{ | ||
5 | - title:'querySizeListBySortId', | ||
6 | - url: '/product/querySizeListBySortId', | ||
7 | - params: [ | ||
8 | - {name: "sortId", type: "number"} | ||
9 | - ] | 1 | +module.exports = { |
2 | + namespace: "catesize", | ||
3 | + apis: { | ||
4 | + querySizeListBySortId: { | ||
5 | + title: 'querySizeListBySortId', | ||
6 | + url: '/product/querySizeListBySortId', | ||
7 | + params: [ | ||
8 | + {name: "sortId", type: "number"} | ||
9 | + ] | ||
10 | }, | 10 | }, |
11 | - addSortSize:{ | ||
12 | - title:'添加尺码接口【验证通过】', | ||
13 | - url: '/product/addSortSize', | ||
14 | - params: [ | ||
15 | - {name: "sortId", type: "number"}, | ||
16 | - {name: "sizeId", type: "number"}, | ||
17 | - {name: "orderBy", type: "number"} | ||
18 | - ] | 11 | + addSortSize: { |
12 | + title: '添加尺码接口【验证通过】', | ||
13 | + url: '/product/addSortSize', | ||
14 | + params: [ | ||
15 | + {name: "sortId", type: "number"}, | ||
16 | + {name: "sizeId", type: "number"}, | ||
17 | + {name: "orderBy", type: "number"} | ||
18 | + ] | ||
19 | }, | 19 | }, |
20 | - deleteSortSize:{ | ||
21 | - title:'删除单个品类尺码接口【待验证】', | ||
22 | - url: '/product/deleteSortSize', | ||
23 | - params: [ | ||
24 | - {name: "sortId", type: "number"}, | ||
25 | - {name: "sizeId", type: "number"} | ||
26 | - ] | 20 | + deleteSortSize: { |
21 | + title: '删除单个品类尺码接口【待验证】', | ||
22 | + url: '/product/deleteSortSize', | ||
23 | + params: [ | ||
24 | + {name: "sortId", type: "number"}, | ||
25 | + {name: "sizeId", type: "number"} | ||
26 | + ] | ||
27 | }, | 27 | }, |
28 | - updateSortSize:{ | ||
29 | - title:'修改品类尺码排序接口', | ||
30 | - url: '/product/updateSortSize', | ||
31 | - params: [ | ||
32 | - {name: "sortId", type: "number"}, | ||
33 | - {name: "sizeId", type: "number"}, | ||
34 | - {name: "orderBy", type: "number"} | ||
35 | - ] | 28 | + updateSortSize: { |
29 | + title: '修改品类尺码排序接口', | ||
30 | + url: '/product/updateSortSize', | ||
31 | + params: [ | ||
32 | + {name: "sortId", type: "number"}, | ||
33 | + {name: "sizeId", type: "number"}, | ||
34 | + {name: "orderBy", type: "number"} | ||
35 | + ] | ||
36 | + }, | ||
37 | + querySizeByNameForSelect: { | ||
38 | + title: '尺码模糊查询【验证通过】', | ||
39 | + url: '/product/querySizeByNameForSelect', | ||
40 | + params: [ | ||
41 | + {name: "idName", type: "String"}, | ||
42 | + {name: "sortId", type: "Number"} | ||
43 | + ] | ||
36 | }, | 44 | }, |
37 | /**********************品类尺码属性管理*****************************/ | 45 | /**********************品类尺码属性管理*****************************/ |
38 | - queryList:{ | ||
39 | - title:'获取品类关联尺码属性列表【验证通过】', | ||
40 | - url: '/sortAttribute/queryList', | ||
41 | - params: [ | ||
42 | - {name: "page", type: "number"}, | ||
43 | - {name: "size", type: "number"}, | ||
44 | - {name: "sortId", type: "number"} | ||
45 | - ] | 46 | + queryList: { |
47 | + title: '获取品类关联尺码属性列表【验证通过】', | ||
48 | + url: '/sortAttribute/queryList', | ||
49 | + params: [ | ||
50 | + {name: "page", type: "number"}, | ||
51 | + {name: "size", type: "number"}, | ||
52 | + {name: "sortId", type: "number"} | ||
53 | + ] | ||
54 | + }, | ||
55 | + add: { | ||
56 | + title: '添加品类关联尺码属性接口【待验证】', | ||
57 | + url: '/sortAttribute/add', | ||
58 | + params: [ | ||
59 | + {name: "sortId", type: "number"}, | ||
60 | + {name: "attributeId", type: "number"}, | ||
61 | + {name: "orderBy", type: "number"} | ||
62 | + ] | ||
46 | }, | 63 | }, |
47 | - add:{ | ||
48 | - title:'添加品类关联尺码属性接口【待验证】', | ||
49 | - url: '/sortAttribute/add', | ||
50 | - params: [ | ||
51 | - {name: "sortId", type: "number"}, | ||
52 | - {name: "attributeId", type: "number"}, | ||
53 | - {name: "orderBy", type: "number"} | ||
54 | - ] | 64 | + delete: { |
65 | + title: '删除品类关联尺码属性接口【待验证】', | ||
66 | + url: '/sortAttribute/delete', | ||
67 | + params: [ | ||
68 | + {name: "sortId", type: "number"}, | ||
69 | + {name: "attributeId", type: "number"} | ||
70 | + ] | ||
55 | }, | 71 | }, |
56 | - delete:{ | ||
57 | - title:'删除品类关联尺码属性接口【待验证】', | ||
58 | - url: '/sortAttribute/delete', | ||
59 | - params: [ | ||
60 | - {name: "sortId", type: "number"}, | ||
61 | - {name: "attributeId", type: "number"} | ||
62 | - ] | 72 | + updateOrderBy: { |
73 | + title: '修改品类关联尺码属性接口【待验证】', | ||
74 | + url: '/sortAttribute/updateOrderBy', | ||
75 | + params: [ | ||
76 | + {name: "sortId", type: "number"}, | ||
77 | + {name: "attributeId", type: "number"}, | ||
78 | + {name: "orderBy", type: "number"} | ||
79 | + ] | ||
63 | }, | 80 | }, |
64 | - updateOrderBy:{ | ||
65 | - title:'修改品类关联尺码属性接口【待验证】', | ||
66 | - url: '/sortAttribute/updateOrderBy', | ||
67 | - params: [ | ||
68 | - {name: "sortId", type: "number"}, | ||
69 | - {name: "attributeId", type: "number"}, | ||
70 | - {name: "orderBy", type: "number"} | ||
71 | - ] | 81 | + querySizeAttributesByName: { |
82 | + title: '尺码属性搜素', | ||
83 | + url: '/product/querySizeAttributesByName', | ||
84 | + params: [ | ||
85 | + {name: "idName", type: "String"}, | ||
86 | + {name: "sortId", type: "Number"} | ||
87 | + ] | ||
72 | } | 88 | } |
73 | } | 89 | } |
74 | -} | ||
90 | +}; |
@@ -44,7 +44,6 @@ | @@ -44,7 +44,6 @@ | ||
44 | <input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" readonly/> | 44 | <input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" readonly/> |
45 | </div> | 45 | </div> |
46 | </div> | 46 | </div> |
47 | - [[if name=="尺码"]] | ||
48 | <div class="form-group"> | 47 | <div class="form-group"> |
49 | <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> | 48 | <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> |
50 | [[if __state=='update']] | 49 | [[if __state=='update']] |
@@ -57,21 +56,6 @@ | @@ -57,21 +56,6 @@ | ||
57 | </div> | 56 | </div> |
58 | [[/if]] | 57 | [[/if]] |
59 | </div> | 58 | </div> |
60 | - [[/if]] | ||
61 | - [[if name=="尺码属性"]] | ||
62 | - <div class="form-group"> | ||
63 | - <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> | ||
64 | - [[if __state=='update']] | ||
65 | - <div class="col-sm-6"> | ||
66 | - <input type="text" value="[[attributeName]]" class="form-control" readonly/> | ||
67 | - </div> | ||
68 | - [[else]] | ||
69 | - <div class="col-sm-6" id="attri-content"> | ||
70 | - | ||
71 | - </div> | ||
72 | - [[/if]] | ||
73 | - </div> | ||
74 | - [[/if]] | ||
75 | <div class="form-group"> | 59 | <div class="form-group"> |
76 | <label class="col-sm-2 control-label">排序<i class="red">*</i></label> | 60 | <label class="col-sm-2 control-label">排序<i class="red">*</i></label> |
77 | 61 | ||
@@ -91,13 +75,4 @@ | @@ -91,13 +75,4 @@ | ||
91 | [[/each]] | 75 | [[/each]] |
92 | </select> | 76 | </select> |
93 | </script> | 77 | </script> |
94 | -<script type="text/template" id="search-attri"> | ||
95 | - <select id="choose-attri" title="" class="select2-offscreen form-control" required placehoder="尺码属性"> | ||
96 | - <option value="">选择尺码属性</option> | ||
97 | - [[each data as item index]] | ||
98 | - <option value="[[item.id]]">[[item.text]]</option> | ||
99 | - [[/each]] | ||
100 | - </select> | ||
101 | -</script> | ||
102 | - | ||
103 | <%include '../../common/views/__ui/footer'%> | 78 | <%include '../../common/views/__ui/footer'%> |
@@ -7,14 +7,15 @@ | @@ -7,14 +7,15 @@ | ||
7 | <div class="panel-body"> | 7 | <div class="panel-body"> |
8 | <div class="pannel-scroll"> | 8 | <div class="pannel-scroll"> |
9 | <ul class="list-group"> | 9 | <ul class="list-group"> |
10 | - <%if data%> | ||
11 | - <%each data as item%> | ||
12 | - <li class="list-group-item level<%item.sortLevel%> <%if item.child%>hidden<%/if%>" data-parent="<%item.parentId%>" data-val="<%item.id%>" data-status="close"> | 10 | + <%if data%> |
11 | + <%each data as item%> | ||
12 | + <li class="list-group-item level<%item.sortLevel%> <%if item.child%>hidden<%/if%>" | ||
13 | + data-parent="<%item.parentId%>" data-val="<%item.id%>" data-status="close"> | ||
13 | <span class="icon expand-icon glyphicon glyphicon-plus"></span> | 14 | <span class="icon expand-icon glyphicon glyphicon-plus"></span> |
14 | <%item.sortName%> | 15 | <%item.sortName%> |
15 | </li> | 16 | </li> |
16 | - <%/each%> | ||
17 | - <%/if%> | 17 | + <%/each%> |
18 | + <%/if%> | ||
18 | </ul> | 19 | </ul> |
19 | </div> | 20 | </div> |
20 | </div> | 21 | </div> |
@@ -28,7 +29,7 @@ | @@ -28,7 +29,7 @@ | ||
28 | </button> | 29 | </button> |
29 | </div> | 30 | </div> |
30 | </div> | 31 | </div> |
31 | - <div id="basicTable" class="table-responsive"> | 32 | + <div id="basicTable" class="table-responsive"> |
32 | </div> | 33 | </div> |
33 | </div> | 34 | </div> |
34 | </div> | 35 | </div> |
@@ -41,24 +42,10 @@ | @@ -41,24 +42,10 @@ | ||
41 | <label class="col-sm-2 control-label">当前分类<i class="red">*</i></label> | 42 | <label class="col-sm-2 control-label">当前分类<i class="red">*</i></label> |
42 | 43 | ||
43 | <div class="col-sm-6"> | 44 | <div class="col-sm-6"> |
44 | - <input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" readonly/> | 45 | + <input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" |
46 | + readonly/> | ||
45 | </div> | 47 | </div> |
46 | </div> | 48 | </div> |
47 | - [[if name=="尺码"]] | ||
48 | - <div class="form-group"> | ||
49 | - <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> | ||
50 | - [[if __state=='update']] | ||
51 | - <div class="col-sm-6"> | ||
52 | - <input type="text" value="[[sizeName]]" class="form-control observe" data-field="sizeName" readonly/> | ||
53 | - </div> | ||
54 | - [[else]] | ||
55 | - <div class="col-sm-6" id="sort-content"> | ||
56 | - | ||
57 | - </div> | ||
58 | - [[/if]] | ||
59 | - </div> | ||
60 | - [[/if]] | ||
61 | - [[if name=="尺码属性"]] | ||
62 | <div class="form-group"> | 49 | <div class="form-group"> |
63 | <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> | 50 | <label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label> |
64 | [[if __state=='update']] | 51 | [[if __state=='update']] |
@@ -71,7 +58,6 @@ | @@ -71,7 +58,6 @@ | ||
71 | </div> | 58 | </div> |
72 | [[/if]] | 59 | [[/if]] |
73 | </div> | 60 | </div> |
74 | - [[/if]] | ||
75 | <div class="form-group"> | 61 | <div class="form-group"> |
76 | <label class="col-sm-2 control-label">排序<i class="red">*</i></label> | 62 | <label class="col-sm-2 control-label">排序<i class="red">*</i></label> |
77 | 63 | ||
@@ -83,14 +69,6 @@ | @@ -83,14 +69,6 @@ | ||
83 | 69 | ||
84 | </div> | 70 | </div> |
85 | </script> | 71 | </script> |
86 | -<script type="text/template" id="search-sort"> | ||
87 | - <select id="choose-sort" title="" class="select2-offscreen form-control" required placehoder="尺码"> | ||
88 | - <option value="">选择尺码</option> | ||
89 | - [[each data as item index]] | ||
90 | - <option value="[[item.id]]">[[item.text]]</option> | ||
91 | - [[/each]] | ||
92 | - </select> | ||
93 | -</script> | ||
94 | <script type="text/template" id="search-attri"> | 72 | <script type="text/template" id="search-attri"> |
95 | <select id="choose-attri" title="" class="select2-offscreen form-control" required placehoder="尺码属性"> | 73 | <select id="choose-attri" title="" class="select2-offscreen form-control" required placehoder="尺码属性"> |
96 | <option value="">选择尺码属性</option> | 74 | <option value="">选择尺码属性</option> |
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | </div> | 61 | </div> |
62 | <div class="row show-grid"> | 62 | <div class="row show-grid"> |
63 | <div id="baseTable"></div> | 63 | <div id="baseTable"></div> |
64 | - <input type="hidden" id="shopRelationList" value="<%data.shopRelationList%>" /> | 64 | + <input type="hidden" id="shopRelationList" value='<%data.shopRelationList%>' /> |
65 | </div> | 65 | </div> |
66 | <div style="text-align: center"> | 66 | <div style="text-align: center"> |
67 | <%if btn%> | 67 | <%if btn%> |
@@ -62,7 +62,7 @@ var Bll = { | @@ -62,7 +62,7 @@ var Bll = { | ||
62 | "sortId": window.sortid ? window.sortid : "" | 62 | "sortId": window.sortid ? window.sortid : "" |
63 | } | 63 | } |
64 | }, function (res) { | 64 | }, function (res) { |
65 | - Bll.orderBys=[]; | 65 | + Bll.orderBys = []; |
66 | if (res.data && res.data.list) { | 66 | if (res.data && res.data.list) { |
67 | var list = res.data.list; | 67 | var list = res.data.list; |
68 | list.forEach(function (x) { | 68 | list.forEach(function (x) { |
@@ -100,16 +100,16 @@ var Bll = { | @@ -100,16 +100,16 @@ var Bll = { | ||
100 | { | 100 | { |
101 | value: "保存", | 101 | value: "保存", |
102 | callback: function () { | 102 | callback: function () { |
103 | - var flag=true; | ||
104 | - if(Bll.orderBys.length>0){ | ||
105 | - for(var i=0;i<Bll.orderBys.length;i++){ | ||
106 | - if(Bll.orderBys[i]==Bll.module.orderBy){ | ||
107 | - flag=false; | 103 | + var flag = true; |
104 | + if (Bll.orderBys.length > 0) { | ||
105 | + for (var i = 0; i < Bll.orderBys.length; i++) { | ||
106 | + if (Bll.orderBys[i] == Bll.module.orderBy) { | ||
107 | + flag = false; | ||
108 | common.util.__tip("排序值不可重复", "warning"); | 108 | common.util.__tip("排序值不可重复", "warning"); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | - if (edit.validate()&&flag) { | 112 | + if (edit.validate() && flag) { |
113 | common.util.__ajax({ | 113 | common.util.__ajax({ |
114 | url: url, | 114 | url: url, |
115 | data: Bll.module | 115 | data: Bll.module |
@@ -164,6 +164,7 @@ $(document).on("click", ".editBtn", function () { | @@ -164,6 +164,7 @@ $(document).on("click", ".editBtn", function () { | ||
164 | var item = g.rows[$(this).data("index")]; | 164 | var item = g.rows[$(this).data("index")]; |
165 | item = $.extend(true, {}, item); | 165 | item = $.extend(true, {}, item); |
166 | item.__state = "update"; | 166 | item.__state = "update"; |
167 | + item.name = "尺码"; | ||
167 | Bll.toast("修改", item, "/product/updateSortSize"); | 168 | Bll.toast("修改", item, "/product/updateSortSize"); |
168 | }); | 169 | }); |
169 | 170 |
1 | -/** | ||
2 | - * 创建供应商 | ||
3 | - */ | 1 | + |
4 | 'use strict'; | 2 | 'use strict'; |
5 | var $ = require('jquery'), | 3 | var $ = require('jquery'), |
6 | common = require('../../common/common'); | 4 | common = require('../../common/common'); |
7 | var sortmenu = require('../../common/sortmenu'); | 5 | var sortmenu = require('../../common/sortmenu'); |
8 | 6 | ||
7 | +sortmenu.init(function () { | ||
8 | + g.init('/erpproduct/sortattribute/ajax/index'); | ||
9 | +}); | ||
10 | + | ||
9 | var g = new common.grid({ | 11 | var g = new common.grid({ |
10 | el: "#basicTable", | 12 | el: "#basicTable", |
11 | parms: function () { | 13 | parms: function () { |
12 | return { | 14 | return { |
13 | - sortId: window.sortid ? window.sortid : "", | 15 | + sortId: window.sortid ? window.sortid : "" |
14 | }; | 16 | }; |
15 | }, | 17 | }, |
16 | columns: [ | 18 | columns: [ |
@@ -21,18 +23,19 @@ var g = new common.grid({ | @@ -21,18 +23,19 @@ var g = new common.grid({ | ||
21 | {display: "尺码属性名", name: "attributeName"}, | 23 | {display: "尺码属性名", name: "attributeName"}, |
22 | {display: "排序", name: "orderBy"}, | 24 | {display: "排序", name: "orderBy"}, |
23 | { | 25 | { |
24 | - display: "操作", name: 'id', render: function (item) { | ||
25 | - | ||
26 | - if (window.sortid == item.sortId) | ||
27 | - return '<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>'; | 26 | + display: "操作", render: function (item) { |
27 | + var htmlArr = []; | ||
28 | + // 子类目不能删除父类目所创建的属性 | ||
29 | + if (window.sortid == item.sortId) { | ||
30 | + htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>') | ||
31 | + htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-primary btn-xs editBtn">修改</a>') | ||
32 | + } | ||
33 | + return htmlArr.join(""); | ||
28 | } | 34 | } |
29 | } | 35 | } |
30 | ] | 36 | ] |
31 | }); | 37 | }); |
32 | 38 | ||
33 | -sortmenu.init(function () { | ||
34 | - g.init('/erpproduct/sortattribute/ajax/index'); | ||
35 | -}); | ||
36 | 39 | ||
37 | /** | 40 | /** |
38 | * 验证 | 41 | * 验证 |
@@ -46,6 +49,25 @@ var edit = new common.edit2(".modal-body"); | @@ -46,6 +49,25 @@ var edit = new common.edit2(".modal-body"); | ||
46 | var Bll = { | 49 | var Bll = { |
47 | module: null, | 50 | module: null, |
48 | attri: [], | 51 | attri: [], |
52 | + orderBys: [], | ||
53 | + getOrderBy: function () { | ||
54 | + common.util.__ajax({ | ||
55 | + url: '/erpproduct/sortattribute/ajax/index', | ||
56 | + data: { | ||
57 | + "sortId": window.sortid ? window.sortid : "" | ||
58 | + } | ||
59 | + }, function (res) { | ||
60 | + Bll.orderBys = []; | ||
61 | + if (res.data && res.data.list) { | ||
62 | + var list = res.data.list; | ||
63 | + list.forEach(function (x) { | ||
64 | + if (x.orderBy != 0) { | ||
65 | + Bll.orderBys.push(x.orderBy); | ||
66 | + } | ||
67 | + }) | ||
68 | + } | ||
69 | + }, true); | ||
70 | + }, | ||
49 | dropDown: function () { | 71 | dropDown: function () { |
50 | common.util.__ajax({ | 72 | common.util.__ajax({ |
51 | url: '/erpproduct/sortattribute/ajax/automatic', | 73 | url: '/erpproduct/sortattribute/ajax/automatic', |
@@ -60,31 +82,35 @@ var Bll = { | @@ -60,31 +82,35 @@ var Bll = { | ||
60 | }, | 82 | }, |
61 | //弹框 | 83 | //弹框 |
62 | toast: function (hint, module, url) { | 84 | toast: function (hint, module, url) { |
63 | - if (module.__state == 'add') { | 85 | + Bll.module = module; |
86 | + Bll.getOrderBy(); | ||
87 | + if (Bll.module.__state == 'add') { | ||
64 | Bll.dropDown(); | 88 | Bll.dropDown(); |
65 | } | 89 | } |
66 | - Bll.module = module; | ||
67 | var d = new common.dialog({ | 90 | var d = new common.dialog({ |
68 | - title: hint + "尺码", | 91 | + title: hint + "尺码属性", |
69 | content: common.util.__template2($("#template").html(), Bll.module), | 92 | content: common.util.__template2($("#template").html(), Bll.module), |
70 | width: '30%', | 93 | width: '30%', |
71 | button: [ | 94 | button: [ |
72 | { | 95 | { |
73 | value: "保存", | 96 | value: "保存", |
74 | callback: function () { | 97 | callback: function () { |
75 | - console.log("保存数据", Bll.module); | ||
76 | - if (edit.validate()) { | 98 | + var flag = true; |
99 | + if (Bll.orderBys.length > 0) { | ||
100 | + for (var i = 0; i < Bll.orderBys.length; i++) { | ||
101 | + if (Bll.orderBys[i] == Bll.module.orderBy) { | ||
102 | + flag = false; | ||
103 | + common.util.__tip("排序值不可重复", "warning"); | ||
104 | + } | ||
105 | + } | ||
106 | + } | ||
107 | + if (edit.validate() && flag) { | ||
77 | common.util.__ajax({ | 108 | common.util.__ajax({ |
78 | url: url, | 109 | url: url, |
79 | data: Bll.module | 110 | data: Bll.module |
80 | - }, function (res) { | ||
81 | - if (res.code == '200') { | ||
82 | - g.reload(); | ||
83 | - d.close(); | ||
84 | - } | ||
85 | - else { | ||
86 | - common.util.__tip(res.message, "warning"); | ||
87 | - } | 111 | + }, function () { |
112 | + g.reload(); | ||
113 | + d.close(); | ||
88 | }); | 114 | }); |
89 | } | 115 | } |
90 | return false; | 116 | return false; |
@@ -116,14 +142,24 @@ $(document).on("change", ".observe", function () { | @@ -116,14 +142,24 @@ $(document).on("change", ".observe", function () { | ||
116 | $(document).on("click", "#btn-add", function () { | 142 | $(document).on("click", "#btn-add", function () { |
117 | var item = { | 143 | var item = { |
118 | __state: "add", | 144 | __state: "add", |
119 | - name:"尺码属性", | 145 | + name: "尺码属性", |
120 | sortName: window.sortname, | 146 | sortName: window.sortname, |
121 | sortId: window.sortid, | 147 | sortId: window.sortid, |
122 | attributeName: "", | 148 | attributeName: "", |
123 | attributeId: "", | 149 | attributeId: "", |
124 | orderBy: 0 | 150 | orderBy: 0 |
125 | }; | 151 | }; |
126 | - Bll.toast("新增", item, '/erpproduct/sortsize/ajax/add'); | 152 | + Bll.toast("新增", item, '/erpproduct/sortattribute/ajax/add'); |
153 | +}); | ||
154 | +/** | ||
155 | + * 修改 | ||
156 | + */ | ||
157 | +$(document).on("click", ".editBtn", function () { | ||
158 | + var item = g.rows[$(this).data("index")]; | ||
159 | + item = $.extend(true, {}, item); | ||
160 | + item.__state = "update"; | ||
161 | + item.name = "尺码属性"; | ||
162 | + Bll.toast("修改", item, "/sortAttribute/updateOrderBy"); | ||
127 | }); | 163 | }); |
128 | /** | 164 | /** |
129 | * 删除 | 165 | * 删除 |
-
Please register or login to post a comment